1*21640Sdist /* 2*21640Sdist * Copyright (c) 1980 Regents of the University of California. 3*21640Sdist * All rights reserved. The Berkeley software License Agreement 4*21640Sdist * specifies the terms and conditions for redistribution. 5*21640Sdist * 6*21640Sdist * @(#)error.h 5.1 (Berkeley) 05/31/85 7*21640Sdist */ 814545Ssam 91454Sroot typedef int boolean; 105596Srrh #define reg register 111454Sroot 121454Sroot #define TRUE 1 131454Sroot #define FALSE 0 145596Srrh 155596Srrh #define true 1 165596Srrh #define false 0 171454Sroot /* 181454Sroot * Descriptors for the various languages we know about. 191454Sroot * If you touch these, also touch lang_table 201454Sroot */ 211454Sroot #define INUNKNOWN 0 221454Sroot #define INCPP 1 231454Sroot #define INCC 2 241454Sroot #define INAS 3 251454Sroot #define INLD 4 261454Sroot #define INLINT 5 271454Sroot #define INF77 6 281454Sroot #define INPI 7 291454Sroot #define INPC 8 301454Sroot #define INFRANZ 9 311454Sroot #define INLISP 10 321454Sroot #define INVAXIMA 11 331454Sroot #define INRATFOR 12 341454Sroot #define INLEX 13 351454Sroot #define INYACC 14 361454Sroot #define INAPL 15 371454Sroot #define INMAKE 16 381454Sroot #define INRI 17 3913106Srrh #define INTROFF 18 4017499Srrh #define INMOD2 19 411454Sroot 421454Sroot extern int language; 431454Sroot /* 441454Sroot * We analyze each line in the error message file, and 451454Sroot * attempt to categorize it by type, as well as language. 461454Sroot * Here are the type descriptors. 471454Sroot */ 481454Sroot typedef int Errorclass; 491454Sroot 505596Srrh #define C_FIRST 0 /* first error category */ 511454Sroot #define C_UNKNOWN 0 /* must be zero */ 521454Sroot #define C_IGNORE 1 /* ignore the message; used for pi */ 531454Sroot #define C_SYNC 2 /* synchronization errors */ 541454Sroot #define C_DISCARD 3 /* touches dangerous files, so discard */ 551454Sroot #define C_NONSPEC 4 /* not specific to any file */ 561454Sroot #define C_THISFILE 5 /* specific to this file, but at no line */ 571454Sroot #define C_NULLED 6 /* refers to special func; so null */ 581454Sroot #define C_TRUE 7 /* fits into true error format */ 591454Sroot #define C_DUPL 8 /* sub class only; duplicated error message */ 605596Srrh #define C_LAST 9 /* last error category */ 611454Sroot 621454Sroot #define SORTABLE(x) (!(NOTSORTABLE(x))) 631454Sroot #define NOTSORTABLE(x) (x <= C_NONSPEC) 641454Sroot /* 651454Sroot * Resources to count and print out the error categories 661454Sroot */ 671454Sroot extern char *class_table[]; 681454Sroot extern int class_count[]; 691454Sroot 701454Sroot #define nunknown class_count[C_UNKNOWN] 711454Sroot #define nignore class_count[C_IGNORE] 725596Srrh #define nsyncerrors class_count[C_SYNC] 731454Sroot #define ndiscard class_count[C_DISCARD] 741454Sroot #define nnonspec class_count[C_NONSPEC] 751454Sroot #define nthisfile class_count[C_THISFILE] 765596Srrh #define nnulled class_count[C_NULLED] 775596Srrh #define ntrue class_count[C_TRUE] 781454Sroot #define ndupl class_count[C_DUPL] 791454Sroot 801454Sroot /* places to put the error complaints */ 811454Sroot 825596Srrh #define TOTHEFILE 1 /* touch the file */ 831454Sroot #define TOSTDOUT 2 /* just print them out (ho-hum) */ 841454Sroot 851454Sroot FILE *errorfile; /* where error file comes from */ 861454Sroot FILE *queryfile; /* where the query responses from the user come from*/ 871454Sroot 881454Sroot extern char *currentfilename; 891454Sroot extern char *processname; 901454Sroot extern char *scriptname; 911454Sroot 921454Sroot extern boolean query; 935596Srrh extern boolean terse; 945596Srrh int inquire(); /* inquire for yes/no */ 955596Srrh /* 965596Srrh * codes for inquire() to return 975596Srrh */ 985596Srrh #define Q_NO 1 /* 'N' */ 995596Srrh #define Q_no 2 /* 'n' */ 1005596Srrh #define Q_YES 3 /* 'Y' */ 1015596Srrh #define Q_yes 4 /* 'y' */ 1025596Srrh 1035596Srrh int probethisfile(); 1041454Sroot /* 1055596Srrh * codes for probethisfile to return 1065596Srrh */ 1075596Srrh #define F_NOTEXIST 1 1085596Srrh #define F_NOTREAD 2 1095596Srrh #define F_NOTWRITE 3 1105596Srrh #define F_TOUCHIT 4 1115596Srrh 1125596Srrh /* 1131454Sroot * Describes attributes about a language 1141454Sroot */ 1151454Sroot struct lang_desc{ 1161454Sroot char *lang_name; 1171454Sroot char *lang_incomment; /* one of the following defines */ 1181454Sroot char *lang_outcomment; /* one of the following defines */ 1191454Sroot }; 1201454Sroot extern struct lang_desc lang_table[]; 1211454Sroot 1221454Sroot #define CINCOMMENT "/*###" 1231454Sroot #define COUTCOMMENT "%%%*/\n" 1241454Sroot #define FINCOMMENT "C###" 1251454Sroot #define FOUTCOMMENT "%%%\n" 1261454Sroot #define NEWLINE "%%%\n" 1271454Sroot #define PIINCOMMENT "(*###" 1281454Sroot #define PIOUTCOMMENT "%%%*)\n" 1291454Sroot #define LISPINCOMMENT ";###" 1301454Sroot #define ASINCOMMENT "####" 1315596Srrh #define RIINCOMMENT CINCOMMENT 1321454Sroot #define RIOUTCOMMENT COUTCOMMENT 13313106Srrh #define TROFFINCOMMENT ".\\\"###" 13413106Srrh #define TROFFOUTCOMMENT NEWLINE 13517499Srrh #define MOD2INCOMMENT "(*###" 13617499Srrh #define MOD2OUTCOMMENT "%%%*)\n" 1371454Sroot /* 1381454Sroot * Defines and resources for determing if a given line 1391454Sroot * is to be discarded because it refers to a file not to 1401454Sroot * be touched, or if the function reference is to a 1411454Sroot * function the user doesn't want recorded. 1421454Sroot */ 1435596Srrh #define IG_FILE1 "llib-lc" 1445596Srrh #define IG_FILE2 "llib-port" 1451454Sroot #define IG_FILE3 "/usr/lib/llib-lc" 1461454Sroot #define IG_FILE4 "/usr/lib/llib-port" 1471454Sroot 1485596Srrh #define ERRORNAME "/.errorrc" 1491454Sroot int nignored; 1501454Sroot char **names_ignored; 1511454Sroot /* 1521454Sroot * Structure definition for a full error 1531454Sroot */ 1545596Srrh typedef struct edesc Edesc; 1555596Srrh typedef Edesc *Eptr; 1565596Srrh 1575596Srrh struct edesc{ 1585596Srrh Eptr error_next; /*linked together*/ 1591454Sroot int error_lgtext; /* how many on the right hand side*/ 1601454Sroot char **error_text; /* the right hand side proper*/ 1611454Sroot Errorclass error_e_class; /* error category of this error*/ 1621454Sroot Errorclass error_s_class; /* sub descriptor of error_e_class*/ 1631454Sroot int error_language; /* the language for this error*/ 1641454Sroot int error_position; /* oridinal position */ 1651454Sroot int error_line; /* discovered line number*/ 1661454Sroot int error_no; /* sequence number on input */ 1671454Sroot }; 1681454Sroot /* 1691454Sroot * Resources for the true errors 1701454Sroot */ 1711454Sroot extern int nerrors; 1725596Srrh extern Eptr er_head; 1735596Srrh extern Eptr *errors; 1741454Sroot /* 1751454Sroot * Resources for each of the files mentioned 1761454Sroot */ 1771454Sroot extern int nfiles; 1785596Srrh extern Eptr **files; /* array of pointers into errors*/ 1795596Srrh boolean *touchedfiles; /* which files we touched */ 1801454Sroot /* 1811454Sroot * The langauge the compilation is in, as intuited from 1821454Sroot * the flavor of error messages analyzed. 1831454Sroot */ 1841454Sroot extern int langauge; 1851454Sroot extern char *currentfilename; 1861454Sroot /* 1871454Sroot * Functional forwards 1881454Sroot */ 1891454Sroot char *Calloc(); 1901454Sroot char *strsave(); 1911454Sroot char *clobberfirst(); 1921454Sroot char lastchar(); 1931454Sroot char firstchar(); 1941454Sroot char next_lastchar(); 1951454Sroot char **wordvsplice(); 1961454Sroot int wordvcmp(); 1971454Sroot boolean persperdexplode(); 1985596Srrh /* 1995596Srrh * Printing hacks 2005596Srrh */ 2015596Srrh char *plural(), *verbform(); 202