/* Collection of code snippets by Arne Vajhøj */
/* (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) */
/* global variables for NICE-utility */

#define nice_vers "NICE version 2.5"  /* version string */

#define TRUE 1
#define FALSE 0

#if vms
#define OK 1
#define ABORT 44
#else
#define OK 0
#define ABORT 1
#endif

/*  memory managament  */
void *nice_malloc(int nb);
void *nice_realloc(void *mp,int nb);
void nice_free(void *mp);

#define nicelist "NICE.LIS"  /* name of list-file */
#define nicedoc "NICE.DOC"   /* name of doc-file  */

#define max_name 64  /* max length of names */

enum style {UPPCAS,LOWCAS,MIXCAS};  /* case style */

EXTERN int indfact;             /* indention factor           */
EXTERN enum style idstyle;      /* case style for identifiers */
EXTERN enum style keywrdstyle;  /* case style for keywords    */
EXTERN int beginbreak;          /* linebreak before begin     */
EXTERN int commstyle;           /* comment style              */
EXTERN int forcecomm;           /* force comments             */
EXTERN int endind;              /* end indent                 */
EXTERN int definition;          /* list routine definitions   */
EXTERN int calling;             /* list routine calling       */
EXTERN int translate;           /* translate PASCAL dialect   */
EXTERN int document;            /* document program           */
EXTERN int assignspace;         /* assign with space around   */

#define def_indfact 3           /* default indention factor           */
#define def_idstyle LOWCAS      /* default case style for identifiers */
#define def_keywrdstyle LOWCAS  /* default case style for keywords    */
#define def_beginbreak FALSE    /* default linebreak before begin     */
#define def_commstyle 2         /* default comment style              */
#define def_forcecomm FALSE     /* default force comments             */
#define def_endind FALSE        /* default end indent                 */
#define def_definition FALSE    /* default list routine definitions   */
#define def_calling FALSE       /* default list routine calling       */
#define def_translate FALSE     /* default translate PASCAL dialect   */
#define def_document FALSE      /* default document program           */
#define def_assignspace TRUE    /* default assign with space around   */

#define MISSCOMM " MISSING COMMENT "  /* default text for missing comments */

EXTERN int ind;        /* indention-level counted in factors */
EXTERN int ind2;       /* additional indention in characters */
EXTERN int dind;       /* documentation indentation          */
EXTERN int skipnewl;   /* true if skip next new-line         */
EXTERN int notfirst;   /* true if not first line             */
EXTERN int fin;        /* true if last END encountered       */
EXTERN int blocked;    /* true if last statement was a block */
EXTERN int misssemi;   /* potential missing semicolon        */
EXTERN char asgstr[5]; /* assignment string                  */
EXTERN int ininterf;   /* in interface part                  */
EXTERN int misspseudo; /* missing pseudoforeign              */

EXTERN FILE *lfp;  /* list-file   */
EXTERN FILE *dfp;  /* doc-file    */

EXTERN char *comm;  /* pointer to comment buffer        */
EXTERN char *buf;   /* pointer to start of input-buffer */

EXTERN int top;          /* stack-pointer */
EXTERN char **entryname; /* entry-names   */

/*  various routines  */
void newl();
void cvtupp(char *s1,char *s2);
void cvtlow(char *s1,char *s2);
void kwrdcvt(char *s);
void idcvt(char *s);
void gen(char *item);
void outcomm(int chalin1,int chalin2,int force);
void transerr(char *item);
int yyparse();
int yylex();
int yyerror();
