/*
$Header: /home/smilie/bbs/lib/bbsgen/RCS/bbsgen.h,v 1.9 1992/08/31 11:32:50 smilie Exp $
$Log: bbsgen.h,v $
 * Revision 1.9  1992/08/31  11:32:50  smilie
 * *** empty log message ***
 *
 * Revision 1.8  1992/08/31  11:32:03  smilie
 * *** empty log message ***
 *
 * Revision 1.7  1992/08/17  10:41:22  root
 * added something for logentry
 *
 * Revision 1.6  1992/06/14  15:02:10  smilie
 * added makecrc32
 *
 * Revision 1.5  1992/06/05  05:23:26  smilie
 * fixed small incompatibility with ulong
 *
 * Revision 1.4  1992/06/02  20:42:44  anthony
 * added makecrc
 *
 * Revision 1.3  1992/06/02  20:40:40  anthony
 * added the CRC Table macros
 *
 * Revision 1.2  1992/06/02  20:19:48  anthony
 * added compression stuff
 *
 * Revision 1.1  1992/05/19  14:37:23  root
 * Initial revision
 *
*/

#ifndef _BBSGEN_H
#define _BBSGEN_H

#ifndef TRUE
#define TRUE          1
#define FALSE         0
#endif

extern unsigned short crctab[256];

#define FLAG_Copied   0x80
#define FLAG_Compress 0x40

typedef signed char sbyte;
typedef signed short sword;
typedef unsigned char ubyte;
typedef unsigned short uword;
typedef unsigned char bool;

extern char *add_underscore(char *);
extern char *fgetstr(char *, int, FILE *);
extern int logentry(char *, char *, ...);
extern char *remove_underscore(char *);
extern char *strupr(char *);
extern uword Compression(ubyte *, ubyte *, uword);
extern uword Decompression(ubyte *, ubyte *, uword);
extern unsigned int makecrc(unsigned char *p, int size);
extern unsigned long makecrc32(unsigned char *p, int size);

#define updcrc(cp, crc) ( crctab[((crc >> 8) & 255)] ^ (crc << 8) ^ cp)
#ifdef NFGM
long
UPDC32(b, c)
long c;
{
return (cr3tab[((int)c ^ b) & 0xff] ^ ((c >> 8) & 0x00FFFFFF));
}

#else

#define UPDC32(b, c) (cr3tab[((int)c ^ b) & 0xff] ^ ((c >> 8) & 0x00FFFFFF))
#endif

#endif
