Category : C Source Code
Archive   : CSRC2.ZIP
Filename : CSWITH.C

 
Output of file : CSWITH.C contained in archive : CSRC2.ZIP
/*
* c s w i t h . c
*/

/*)LIBRARY
*/

#ifdef DOCUMENTATION

title cswith Add an Element To a Cset
index Add an element to a cset

synopsis

#ifdef vms
#include "c:cset.h"
#else
#include
#endif

CSET *
cswith(cs,c)
CSET *cs;
int c;

description

The element c, which is generally a character, is added to the cset
cs. This call modifies the actual cset cs, whatever the value of
csunique.

cs itself is returned.

Note: c is not validated; c < 0 or c >= cssize may cause cswith()
to set an arbitrary bit in memory. However, csmask is used to control
unwanted sign extension; see cset().

bugs

author

Jerry Leichter

#endif

/*
)EDITLEVEL=00
* Edit history
* 0.0 16-Jul-82 JSL Invention
*/

#ifdef vms
#include "c:cset.h"
#else
#include
#endif

CSET *
cswith(cs,c)
register CSET *cs;
int c;
{
if ((int)cs & 1) /* Complemented cset */
return(cscomp(csless(cscomp(cs),c)));
/* Use DeMorgan's law */
cs->table[c & csmask] |= cs->mask; /* Add it in */
return(cs);
}


  3 Responses to “Category : C Source Code
Archive   : CSRC2.ZIP
Filename : CSWITH.C

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/