1*1454Sroot /* 2*1454Sroot * @(#)error.h 1.1 (Berkeley) 10/16/80 3*1454Sroot */ 4*1454Sroot typedef int boolean; 5*1454Sroot 6*1454Sroot #define TRUE 1 7*1454Sroot #define FALSE 0 8*1454Sroot /* 9*1454Sroot * Descriptors for the various languages we know about. 10*1454Sroot * If you touch these, also touch lang_table 11*1454Sroot */ 12*1454Sroot #define INUNKNOWN 0 13*1454Sroot #define INCPP 1 14*1454Sroot #define INCC 2 15*1454Sroot #define INAS 3 16*1454Sroot #define INLD 4 17*1454Sroot #define INLINT 5 18*1454Sroot #define INF77 6 19*1454Sroot #define INPI 7 20*1454Sroot #define INPC 8 21*1454Sroot #define INFRANZ 9 22*1454Sroot #define INLISP 10 23*1454Sroot #define INVAXIMA 11 24*1454Sroot #define INRATFOR 12 25*1454Sroot #define INLEX 13 26*1454Sroot #define INYACC 14 27*1454Sroot #define INAPL 15 28*1454Sroot #define INMAKE 16 29*1454Sroot #define INRI 17 30*1454Sroot 31*1454Sroot extern int language; 32*1454Sroot /* 33*1454Sroot * We analyze each line in the error message file, and 34*1454Sroot * attempt to categorize it by type, as well as language. 35*1454Sroot * Here are the type descriptors. 36*1454Sroot */ 37*1454Sroot typedef int Errorclass; 38*1454Sroot 39*1454Sroot #define C_FIRST 0 /* first error category */ 40*1454Sroot #define C_UNKNOWN 0 /* must be zero */ 41*1454Sroot #define C_IGNORE 1 /* ignore the message; used for pi */ 42*1454Sroot #define C_SYNC 2 /* synchronization errors */ 43*1454Sroot #define C_DISCARD 3 /* touches dangerous files, so discard */ 44*1454Sroot #define C_NONSPEC 4 /* not specific to any file */ 45*1454Sroot #define C_THISFILE 5 /* specific to this file, but at no line */ 46*1454Sroot #define C_NULLED 6 /* refers to special func; so null */ 47*1454Sroot #define C_TRUE 7 /* fits into true error format */ 48*1454Sroot #define C_DUPL 8 /* sub class only; duplicated error message */ 49*1454Sroot #define C_LAST 9 /* last error category */ 50*1454Sroot 51*1454Sroot #define SORTABLE(x) (!(NOTSORTABLE(x))) 52*1454Sroot #define NOTSORTABLE(x) (x <= C_NONSPEC) 53*1454Sroot /* 54*1454Sroot * Resources to count and print out the error categories 55*1454Sroot */ 56*1454Sroot extern char *class_table[]; 57*1454Sroot extern int class_count[]; 58*1454Sroot 59*1454Sroot #define nunknown class_count[C_UNKNOWN] 60*1454Sroot #define nignore class_count[C_IGNORE] 61*1454Sroot #define nsyncerrors class_count[C_SYNC] 62*1454Sroot #define ndiscard class_count[C_DISCARD] 63*1454Sroot #define nnonspec class_count[C_NONSPEC] 64*1454Sroot #define nthisfile class_count[C_THISFILE] 65*1454Sroot #define nnulled class_count[C_NULLED] 66*1454Sroot #define ntrue class_count[C_TRUE] 67*1454Sroot #define ndupl class_count[C_DUPL] 68*1454Sroot 69*1454Sroot /* places to put the error complaints */ 70*1454Sroot 71*1454Sroot #define TOTHEFILE 1 /* touch the file */ 72*1454Sroot #define TOSTDOUT 2 /* just print them out (ho-hum) */ 73*1454Sroot 74*1454Sroot FILE *errorfile; /* where error file comes from */ 75*1454Sroot FILE *queryfile; /* where the query responses from the user come from*/ 76*1454Sroot 77*1454Sroot extern char *currentfilename; 78*1454Sroot extern char *processname; 79*1454Sroot extern char *scriptname; 80*1454Sroot 81*1454Sroot extern boolean query; 82*1454Sroot /* 83*1454Sroot * Describes attributes about a language 84*1454Sroot */ 85*1454Sroot struct lang_desc{ 86*1454Sroot char *lang_name; 87*1454Sroot char *lang_incomment; /* one of the following defines */ 88*1454Sroot char *lang_outcomment; /* one of the following defines */ 89*1454Sroot }; 90*1454Sroot extern struct lang_desc lang_table[]; 91*1454Sroot 92*1454Sroot #define CINCOMMENT "/*###" 93*1454Sroot #define COUTCOMMENT "%%%*/\n" 94*1454Sroot #define FINCOMMENT "C###" 95*1454Sroot #define FOUTCOMMENT "%%%\n" 96*1454Sroot #define NEWLINE "%%%\n" 97*1454Sroot #define PIINCOMMENT "(*###" 98*1454Sroot #define PIOUTCOMMENT "%%%*)\n" 99*1454Sroot #define LISPINCOMMENT ";###" 100*1454Sroot #define ASINCOMMENT "####" 101*1454Sroot #define RIINCOMMENT CINCOMMENT 102*1454Sroot #define RIOUTCOMMENT COUTCOMMENT 103*1454Sroot /* 104*1454Sroot * Defines and resources for determing if a given line 105*1454Sroot * is to be discarded because it refers to a file not to 106*1454Sroot * be touched, or if the function reference is to a 107*1454Sroot * function the user doesn't want recorded. 108*1454Sroot */ 109*1454Sroot #define IG_FILE1 "llib-lc" 110*1454Sroot #define IG_FILE2 "llib-port" 111*1454Sroot #define IG_FILE3 "/usr/lib/llib-lc" 112*1454Sroot #define IG_FILE4 "/usr/lib/llib-port" 113*1454Sroot 114*1454Sroot #define ERRORNAME "/.errorrc" 115*1454Sroot int nignored; 116*1454Sroot char **names_ignored; 117*1454Sroot /* 118*1454Sroot * Structure definition for a full error 119*1454Sroot */ 120*1454Sroot struct error_desc{ 121*1454Sroot struct error_desc *error_next; /*linked together*/ 122*1454Sroot int error_lgtext; /* how many on the right hand side*/ 123*1454Sroot char **error_text; /* the right hand side proper*/ 124*1454Sroot Errorclass error_e_class; /* error category of this error*/ 125*1454Sroot Errorclass error_s_class; /* sub descriptor of error_e_class*/ 126*1454Sroot int error_language; /* the language for this error*/ 127*1454Sroot int error_position; /* oridinal position */ 128*1454Sroot int error_line; /* discovered line number*/ 129*1454Sroot int error_no; /* sequence number on input */ 130*1454Sroot }; 131*1454Sroot /* 132*1454Sroot * Resources for the true errors 133*1454Sroot */ 134*1454Sroot extern int nerrors; 135*1454Sroot extern struct error_desc *er_head; 136*1454Sroot extern struct error_desc **errors; 137*1454Sroot /* 138*1454Sroot * Resources for each of the files mentioned 139*1454Sroot */ 140*1454Sroot extern int nfiles; 141*1454Sroot extern struct error_desc ***files; /* array of pointers into errors*/ 142*1454Sroot boolean *touchedfiles; /* which files we touched */ 143*1454Sroot /* 144*1454Sroot * The langauge the compilation is in, as intuited from 145*1454Sroot * the flavor of error messages analyzed. 146*1454Sroot */ 147*1454Sroot extern int langauge; 148*1454Sroot extern char *currentfilename; 149*1454Sroot /* 150*1454Sroot * Functional forwards 151*1454Sroot */ 152*1454Sroot char *Calloc(); 153*1454Sroot char *strsave(); 154*1454Sroot char *clobberfirst(); 155*1454Sroot char lastchar(); 156*1454Sroot char firstchar(); 157*1454Sroot char next_lastchar(); 158*1454Sroot char **wordvsplice(); 159*1454Sroot int wordvcmp(); 160*1454Sroot boolean persperdexplode(); 161