Category : C Source Code
Archive   : CSRC2.ZIP
Filename : CTYPE.H

 
Output of file : CTYPE.H contained in archive : CSRC2.ZIP

/*
* ctype.h - character type definitions include file
*/

#ifdef DOCUMENTATION

title ctype Character test macros and global definitions
index Character test macros and global definitions

Synopsis

#include

Description

This module defines a set of character test and manipulation
macros (or, on Decus C, functions) that allow classification
and modification of Ascii characters. If the C compiler supports
macros with arguments, the following are defined:

isupper(c) /* Upper case alphabetic */
islower(c) /* Lower case alphabetic */
isalpha(c) /* Alphabetic in any case */
isdigit(c) /* Decimal digit */
isalnum(c) /* Alphabetic or digit */
isxdigit(c) /* Hexadecimal digit */
isspace(c) /* Space or tab */
ispunct(c) /* Punctuation */
isgraph(c) /* Visible character */
isprint(c) /* Printable character */
iscntrl(c) /* Control character */
isascii(c) /* 7-bit Ascii character */
_toupper(c) /* Lower case convert to Upper */
_tolower(c) /* Upper case convert to Lower */
toascii(c) /* Remove eighth (parity) bit */

Note that _toupper() and _tolower() must not be used with
arguments that have side effects, such as

_toupper(*ptr++);

Use the functions toupper() and tolower() instead.

Bugs

#endif

/*
* )EDITLEVEL=01
* Edit history
* 0.0 10-Mar-82 JB/MM Extracted from vax library
*/

#define _U 0001 /* Uppercase alpha */
#define _L 0002 /* Lowercase alpha */
#define _UL 0003 /* _U | _L Alpha in any case */
#define _D 0004 /* Digit */
#define _ULD 0007 /* _U | _L | _D Alphanumeric */
#define _S 0010 /* Whitespace */
#define _P 0020 /* Punctuation */
#define _PULD 0027 /* _P | _U | _L | _D Textual character */
#define _C 0040 /* Control character */
#define _X 0100 /* Hexadecimal Alpha (A-F) */
#define _B 0200 /* Space ' ' only */

#ifdef vax11c
globalvalue c$v_ctypedefs;
#endif

extern char _ctype_ [];

#ifdef nomacarg
/*
* Decus C does not support macros with arguments.
*/
#define _toupper toupper
#define _tolower tolower
#else
/*
* Define macros for the character tests.
*/
#define isupper(c) (_ctype_[(c)&0177]&_U)
#define islower(c) (_ctype_[(c)&0177]&_L)
#define isalpha(c) (_ctype_[(c)&0177]&_UL)
#define isdigit(c) (_ctype_[(c)&0177]&_D)
#define isalnum(c) (_ctype_[(c)&0177]&_ULD)
#define isxdigit(c) (_ctype_[(c)&0177]&_X)
#define isspace(c) (_ctype_[(c)&0177]&_S)
#define ispunct(c) (_ctype_[(c)&0177]&_P)
#define isgraph(c) (_ctype_[(c)&0177]&_PULD)
#define isprint(c) (_ctype_[(c)&0177]&(_PULD|_B))
#define iscntrl(c) (_ctype_[(c)&0177]&_C)
#define isascii(c) ((unsigned)(c)<=0177)
#define _toupper(c) ((c)>='a'&&(c)<='z'?(c)&0137:(c))
#define _tolower(c) ((c)>='A'&&(c)<='Z'?(c)|040:(c))
#define toascii(c) ((c)&0177)
#endif



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

  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/