121640Sdist /* 221640Sdist * Copyright (c) 1980 Regents of the University of California. 3*34664Sbostic * All rights reserved. 421640Sdist * 5*34664Sbostic * Redistribution and use in source and binary forms are permitted 6*34664Sbostic * provided that this notice is preserved and that due credit is given 7*34664Sbostic * to the University of California at Berkeley. The name of the University 8*34664Sbostic * may not be used to endorse or promote products derived from this 9*34664Sbostic * software without specific prior written permission. This software 10*34664Sbostic * is provided ``as is'' without express or implied warranty. 11*34664Sbostic * 12*34664Sbostic * @(#)error.h 5.2 (Berkeley) 06/06/88 1321640Sdist */ 1414545Ssam 151454Sroot typedef int boolean; 165596Srrh #define reg register 171454Sroot 181454Sroot #define TRUE 1 191454Sroot #define FALSE 0 205596Srrh 215596Srrh #define true 1 225596Srrh #define false 0 231454Sroot /* 241454Sroot * Descriptors for the various languages we know about. 251454Sroot * If you touch these, also touch lang_table 261454Sroot */ 271454Sroot #define INUNKNOWN 0 281454Sroot #define INCPP 1 291454Sroot #define INCC 2 301454Sroot #define INAS 3 311454Sroot #define INLD 4 321454Sroot #define INLINT 5 331454Sroot #define INF77 6 341454Sroot #define INPI 7 351454Sroot #define INPC 8 361454Sroot #define INFRANZ 9 371454Sroot #define INLISP 10 381454Sroot #define INVAXIMA 11 391454Sroot #define INRATFOR 12 401454Sroot #define INLEX 13 411454Sroot #define INYACC 14 421454Sroot #define INAPL 15 431454Sroot #define INMAKE 16 441454Sroot #define INRI 17 4513106Srrh #define INTROFF 18 4617499Srrh #define INMOD2 19 471454Sroot 481454Sroot extern int language; 491454Sroot /* 501454Sroot * We analyze each line in the error message file, and 511454Sroot * attempt to categorize it by type, as well as language. 521454Sroot * Here are the type descriptors. 531454Sroot */ 541454Sroot typedef int Errorclass; 551454Sroot 565596Srrh #define C_FIRST 0 /* first error category */ 571454Sroot #define C_UNKNOWN 0 /* must be zero */ 581454Sroot #define C_IGNORE 1 /* ignore the message; used for pi */ 591454Sroot #define C_SYNC 2 /* synchronization errors */ 601454Sroot #define C_DISCARD 3 /* touches dangerous files, so discard */ 611454Sroot #define C_NONSPEC 4 /* not specific to any file */ 621454Sroot #define C_THISFILE 5 /* specific to this file, but at no line */ 631454Sroot #define C_NULLED 6 /* refers to special func; so null */ 641454Sroot #define C_TRUE 7 /* fits into true error format */ 651454Sroot #define C_DUPL 8 /* sub class only; duplicated error message */ 665596Srrh #define C_LAST 9 /* last error category */ 671454Sroot 681454Sroot #define SORTABLE(x) (!(NOTSORTABLE(x))) 691454Sroot #define NOTSORTABLE(x) (x <= C_NONSPEC) 701454Sroot /* 711454Sroot * Resources to count and print out the error categories 721454Sroot */ 731454Sroot extern char *class_table[]; 741454Sroot extern int class_count[]; 751454Sroot 761454Sroot #define nunknown class_count[C_UNKNOWN] 771454Sroot #define nignore class_count[C_IGNORE] 785596Srrh #define nsyncerrors class_count[C_SYNC] 791454Sroot #define ndiscard class_count[C_DISCARD] 801454Sroot #define nnonspec class_count[C_NONSPEC] 811454Sroot #define nthisfile class_count[C_THISFILE] 825596Srrh #define nnulled class_count[C_NULLED] 835596Srrh #define ntrue class_count[C_TRUE] 841454Sroot #define ndupl class_count[C_DUPL] 851454Sroot 861454Sroot /* places to put the error complaints */ 871454Sroot 885596Srrh #define TOTHEFILE 1 /* touch the file */ 891454Sroot #define TOSTDOUT 2 /* just print them out (ho-hum) */ 901454Sroot 911454Sroot FILE *errorfile; /* where error file comes from */ 921454Sroot FILE *queryfile; /* where the query responses from the user come from*/ 931454Sroot 941454Sroot extern char *currentfilename; 951454Sroot extern char *processname; 961454Sroot extern char *scriptname; 971454Sroot 981454Sroot extern boolean query; 995596Srrh extern boolean terse; 1005596Srrh int inquire(); /* inquire for yes/no */ 1015596Srrh /* 1025596Srrh * codes for inquire() to return 1035596Srrh */ 1045596Srrh #define Q_NO 1 /* 'N' */ 1055596Srrh #define Q_no 2 /* 'n' */ 1065596Srrh #define Q_YES 3 /* 'Y' */ 1075596Srrh #define Q_yes 4 /* 'y' */ 1085596Srrh 1095596Srrh int probethisfile(); 1101454Sroot /* 1115596Srrh * codes for probethisfile to return 1125596Srrh */ 1135596Srrh #define F_NOTEXIST 1 1145596Srrh #define F_NOTREAD 2 1155596Srrh #define F_NOTWRITE 3 1165596Srrh #define F_TOUCHIT 4 1175596Srrh 1185596Srrh /* 1191454Sroot * Describes attributes about a language 1201454Sroot */ 1211454Sroot struct lang_desc{ 1221454Sroot char *lang_name; 1231454Sroot char *lang_incomment; /* one of the following defines */ 1241454Sroot char *lang_outcomment; /* one of the following defines */ 1251454Sroot }; 1261454Sroot extern struct lang_desc lang_table[]; 1271454Sroot 1281454Sroot #define CINCOMMENT "/*###" 1291454Sroot #define COUTCOMMENT "%%%*/\n" 1301454Sroot #define FINCOMMENT "C###" 1311454Sroot #define FOUTCOMMENT "%%%\n" 1321454Sroot #define NEWLINE "%%%\n" 1331454Sroot #define PIINCOMMENT "(*###" 1341454Sroot #define PIOUTCOMMENT "%%%*)\n" 1351454Sroot #define LISPINCOMMENT ";###" 1361454Sroot #define ASINCOMMENT "####" 1375596Srrh #define RIINCOMMENT CINCOMMENT 1381454Sroot #define RIOUTCOMMENT COUTCOMMENT 13913106Srrh #define TROFFINCOMMENT ".\\\"###" 14013106Srrh #define TROFFOUTCOMMENT NEWLINE 14117499Srrh #define MOD2INCOMMENT "(*###" 14217499Srrh #define MOD2OUTCOMMENT "%%%*)\n" 1431454Sroot /* 1441454Sroot * Defines and resources for determing if a given line 1451454Sroot * is to be discarded because it refers to a file not to 1461454Sroot * be touched, or if the function reference is to a 1471454Sroot * function the user doesn't want recorded. 1481454Sroot */ 1495596Srrh #define IG_FILE1 "llib-lc" 1505596Srrh #define IG_FILE2 "llib-port" 1511454Sroot #define IG_FILE3 "/usr/lib/llib-lc" 1521454Sroot #define IG_FILE4 "/usr/lib/llib-port" 1531454Sroot 1545596Srrh #define ERRORNAME "/.errorrc" 1551454Sroot int nignored; 1561454Sroot char **names_ignored; 1571454Sroot /* 1581454Sroot * Structure definition for a full error 1591454Sroot */ 1605596Srrh typedef struct edesc Edesc; 1615596Srrh typedef Edesc *Eptr; 1625596Srrh 1635596Srrh struct edesc{ 1645596Srrh Eptr error_next; /*linked together*/ 1651454Sroot int error_lgtext; /* how many on the right hand side*/ 1661454Sroot char **error_text; /* the right hand side proper*/ 1671454Sroot Errorclass error_e_class; /* error category of this error*/ 1681454Sroot Errorclass error_s_class; /* sub descriptor of error_e_class*/ 1691454Sroot int error_language; /* the language for this error*/ 1701454Sroot int error_position; /* oridinal position */ 1711454Sroot int error_line; /* discovered line number*/ 1721454Sroot int error_no; /* sequence number on input */ 1731454Sroot }; 1741454Sroot /* 1751454Sroot * Resources for the true errors 1761454Sroot */ 1771454Sroot extern int nerrors; 1785596Srrh extern Eptr er_head; 1795596Srrh extern Eptr *errors; 1801454Sroot /* 1811454Sroot * Resources for each of the files mentioned 1821454Sroot */ 1831454Sroot extern int nfiles; 1845596Srrh extern Eptr **files; /* array of pointers into errors*/ 1855596Srrh boolean *touchedfiles; /* which files we touched */ 1861454Sroot /* 1871454Sroot * The langauge the compilation is in, as intuited from 1881454Sroot * the flavor of error messages analyzed. 1891454Sroot */ 1901454Sroot extern int langauge; 1911454Sroot extern char *currentfilename; 1921454Sroot /* 1931454Sroot * Functional forwards 1941454Sroot */ 1951454Sroot char *Calloc(); 1961454Sroot char *strsave(); 1971454Sroot char *clobberfirst(); 1981454Sroot char lastchar(); 1991454Sroot char firstchar(); 2001454Sroot char next_lastchar(); 2011454Sroot char **wordvsplice(); 2021454Sroot int wordvcmp(); 2031454Sroot boolean persperdexplode(); 2045596Srrh /* 2055596Srrh * Printing hacks 2065596Srrh */ 2075596Srrh char *plural(), *verbform(); 208