Big-5 Fundamental Functions (Big5.h)

/* Define a new type that holds Big-5 characters and is compatible
   with ASCII.  We need an unsigned integer with two bytes. */

/* On UNIX workstations: */
typedef short Big5;

/* On PC:
typedef int Big5; */

/* Constants about the Big-5 encodeing system. */

#define BL0     64		/* 0x40, low start of Big-5 second byte */
#define BL1     126		/* 0x7E, low end of Big-5 second byte */
#define BH0     161		/* 0xA1, high start of Big-5 second byte */
#define BH1     254		/* 0xFE, high end of Big-5 second byte */

/* Fundamental Functions */

#define isfirst(c) ((BH0 <= c) && (c <= BH1))
#define issecond(c) (((BL0 <= c) && (c <= BL1)) || ((BH0 <= c) && (c <= BH1)))

Big5 fgetc5(FILE*);
#define getchar5()  fgetc5(stdin)
int fputc5(Big5, FILE*);
#define putchar5(c) fputc(c, stdout)

Created: Nov 17, 1996
Last Revised: Nov 20, 1996
© Copyright 1996 Wei-Chang Shann

shann@math.ncu.edu.tw