/* 
 * VMisc.h - Include file for miscellaneous functions.
 * 
 * Author:	L. Van Warren
 * Date:	Nov 1995
 * Copyright (c) 1995 L. Van Warren  All Rights Reserved
 */

#ifdef MAIN
#define EXTERN
#else
#define EXTERN extern
#endif

EXTERN	int		 gDebug;
EXTERN	int		 gEcho;

#define PRINT_HERALD(x)	PRINTF("Reading configuration file %s:\n", (x))

/* Input File Parsing. */
#define IS_SAME_NAME(x, y)	(strcmp((x), (y))==0)

#define SAME_TOKEN(x,y)		(strcmp((x),(y))==0)

#define COMMENT_LINE	(lineBuf[0]=='%')
#define  DEFINE_LINE	(lineBuf[0]=='#')
#define   BLANK_LINE	(lineBuf[0]=='\n')

#define PRINT_NLIN		PRINTF("\n")
#define PRINT_TAB		PRINTF("\t")
#define PRINT_INT(x)	PRINTF(" %d", (x))
#define PRINT_1FLT(x)	PRINTF("%11.4f ", (x))
#define PRINT_FLT(x)	PRINTF(" %11.4f", (x))
#define PRINT_STR(x)	PRINTF(" %s", (x))

#define DEBUG(x)		if(gDebug)fprintf(stderr,x)
#define DEBUG1(x,y)		if(gDebug)fprintf(stderr,x,y)
#define DEBUG2(x,y,z)	if(gDebug)fprintf(stderr,x,y,z)

#define   PRINTF        if(gDebug)printf
#define  FPRINTF        if(gDebug)fprintf
#define  VPRINTF        if(gEcho)printf
#define  LPRINTF        if(gLog)fprintf
#define VFPRINTF        if(gEcho)fprintf

#define TAB(file)     fprintf(file,"\t");
#define NEWLINE(file) fprintf(file,"\n");

extern void entab(FILE*, int);

extern void error(char *);

#define NIL	    0

#define LEFT	0
#define RIGHT	1

#define NOT(x)    (!(x))
#define AND(x,y)   ((x)&&(y))
#define  OR(x,y)   ((x)||(y))

typedef struct
{
	char c[33];
} String32;

extern String32  asnString32(char*);
extern String32  genString32(void);
extern int      hashString32(String32, int);
extern int    isSameString32(String32, String32);

void    fprintString32(FILE*, String32) ;
String32 fscanString32(FILE*) ;
void    fwriteString32(FILE*, String32) ;
String32 freadString32(FILE*) ;

void      clearLineBuf(char*, int);
int        isLineBlank(char*, int);
int       isWhiteSpace(char*, int);

