Home | History | Annotate | Line # | Download | only in error
error.h revision 1.7
      1  1.7       wiz /*	$NetBSD: error.h,v 1.7 2002/05/26 22:41:20 wiz Exp $	*/
      2  1.3       jtc 
      3  1.1       cgd /*
      4  1.3       jtc  * Copyright (c) 1980, 1993
      5  1.3       jtc  *	The Regents of the University of California.  All rights reserved.
      6  1.1       cgd  *
      7  1.1       cgd  * Redistribution and use in source and binary forms, with or without
      8  1.1       cgd  * modification, are permitted provided that the following conditions
      9  1.1       cgd  * are met:
     10  1.1       cgd  * 1. Redistributions of source code must retain the above copyright
     11  1.1       cgd  *    notice, this list of conditions and the following disclaimer.
     12  1.1       cgd  * 2. Redistributions in binary form must reproduce the above copyright
     13  1.1       cgd  *    notice, this list of conditions and the following disclaimer in the
     14  1.1       cgd  *    documentation and/or other materials provided with the distribution.
     15  1.1       cgd  * 3. All advertising materials mentioning features or use of this software
     16  1.1       cgd  *    must display the following acknowledgement:
     17  1.1       cgd  *	This product includes software developed by the University of
     18  1.1       cgd  *	California, Berkeley and its contributors.
     19  1.1       cgd  * 4. Neither the name of the University nor the names of its contributors
     20  1.1       cgd  *    may be used to endorse or promote products derived from this software
     21  1.1       cgd  *    without specific prior written permission.
     22  1.1       cgd  *
     23  1.1       cgd  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     24  1.1       cgd  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     25  1.1       cgd  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     26  1.1       cgd  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     27  1.1       cgd  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     28  1.1       cgd  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     29  1.1       cgd  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     30  1.1       cgd  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     31  1.1       cgd  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     32  1.1       cgd  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     33  1.1       cgd  * SUCH DAMAGE.
     34  1.1       cgd  *
     35  1.3       jtc  *	@(#)error.h	8.1 (Berkeley) 6/6/93
     36  1.1       cgd  */
     37  1.1       cgd 
     38  1.1       cgd typedef	int	boolean;
     39  1.1       cgd 
     40  1.1       cgd #define	TRUE	1
     41  1.1       cgd #define	FALSE	0
     42  1.1       cgd 
     43  1.1       cgd #define	true	1
     44  1.1       cgd #define	false	0
     45  1.1       cgd /*
     46  1.1       cgd  *	Descriptors for the various languages we know about.
     47  1.1       cgd  *	If you touch these, also touch lang_table
     48  1.1       cgd  */
     49  1.1       cgd #define	INUNKNOWN	0
     50  1.1       cgd #define	INCPP	1
     51  1.1       cgd #define	INCC	2
     52  1.1       cgd #define	INAS	3
     53  1.1       cgd #define	INLD	4
     54  1.1       cgd #define	INLINT	5
     55  1.1       cgd #define	INF77	6
     56  1.1       cgd #define	INPI	7
     57  1.1       cgd #define	INPC	8
     58  1.1       cgd #define	INFRANZ	9
     59  1.1       cgd #define	INLISP	10
     60  1.1       cgd #define	INVAXIMA	11
     61  1.1       cgd #define	INRATFOR	12
     62  1.1       cgd #define	INLEX	13
     63  1.1       cgd #define	INYACC	14
     64  1.1       cgd #define	INAPL	15
     65  1.1       cgd #define	INMAKE	16
     66  1.1       cgd #define	INRI	17
     67  1.1       cgd #define	INTROFF	18
     68  1.1       cgd #define	INMOD2	19
     69  1.1       cgd 
     70  1.1       cgd /*
     71  1.1       cgd  *	We analyze each line in the error message file, and
     72  1.1       cgd  *	attempt to categorize it by type, as well as language.
     73  1.1       cgd  *	Here are the type descriptors.
     74  1.1       cgd  */
     75  1.1       cgd typedef	int	Errorclass;
     76  1.1       cgd 
     77  1.1       cgd #define	C_FIRST	0		/* first error category */
     78  1.1       cgd #define	C_UNKNOWN	0	/* must be zero */
     79  1.1       cgd #define	C_IGNORE	1	/* ignore the message; used for pi */
     80  1.1       cgd #define	C_SYNC		2	/* synchronization errors */
     81  1.1       cgd #define	C_DISCARD	3	/* touches dangerous files, so discard */
     82  1.1       cgd #define	C_NONSPEC	4	/* not specific to any file */
     83  1.1       cgd #define	C_THISFILE	5	/* specific to this file, but at no line */
     84  1.1       cgd #define	C_NULLED	6	/* refers to special func; so null */
     85  1.1       cgd #define	C_TRUE		7	/* fits into true error format */
     86  1.1       cgd #define	C_DUPL		8	/* sub class only; duplicated error message */
     87  1.1       cgd #define	C_LAST	9		/* last error category */
     88  1.1       cgd 
     89  1.1       cgd #define	SORTABLE(x)	(!(NOTSORTABLE(x)))
     90  1.1       cgd #define	NOTSORTABLE(x)	(x <= C_NONSPEC)
     91  1.1       cgd /*
     92  1.1       cgd  *	Resources to count and print out the error categories
     93  1.1       cgd  */
     94  1.1       cgd extern	char		*class_table[];
     95  1.1       cgd extern	int		class_count[];
     96  1.1       cgd 
     97  1.1       cgd #define	nunknown	class_count[C_UNKNOWN]
     98  1.1       cgd #define	nignore		class_count[C_IGNORE]
     99  1.1       cgd #define	nsyncerrors	class_count[C_SYNC]
    100  1.1       cgd #define	ndiscard	class_count[C_DISCARD]
    101  1.1       cgd #define	nnonspec	class_count[C_NONSPEC]
    102  1.1       cgd #define	nthisfile	class_count[C_THISFILE]
    103  1.1       cgd #define	nnulled		class_count[C_NULLED]
    104  1.1       cgd #define	ntrue		class_count[C_TRUE]
    105  1.1       cgd #define	ndupl		class_count[C_DUPL]
    106  1.1       cgd 
    107  1.1       cgd /* places to put the error complaints */
    108  1.1       cgd 
    109  1.1       cgd #define	TOTHEFILE	1	/* touch the file */
    110  1.1       cgd #define	TOSTDOUT	2	/* just print them out (ho-hum) */
    111  1.1       cgd 
    112  1.5  wsanchez extern FILE	*errorfile;	/* where error file comes from */
    113  1.5  wsanchez extern FILE	*queryfile;	/* where the query responses from the user come from*/
    114  1.1       cgd 
    115  1.1       cgd extern	char	*processname;
    116  1.1       cgd extern	char	*scriptname;
    117  1.1       cgd 
    118  1.1       cgd extern	boolean	query;
    119  1.1       cgd extern	boolean	terse;
    120  1.7       wiz int	inquire(char *, ...);	/* inquire for yes/no */
    121  1.1       cgd /*
    122  1.1       cgd  *	codes for inquire() to return
    123  1.1       cgd  */
    124  1.1       cgd #define	Q_NO	1			/* 'N' */
    125  1.1       cgd #define	Q_no	2			/* 'n' */
    126  1.1       cgd #define	Q_YES	3			/* 'Y' */
    127  1.1       cgd #define	Q_yes	4			/* 'y' */
    128  1.1       cgd 
    129  1.7       wiz int	probethisfile(char *);
    130  1.1       cgd /*
    131  1.1       cgd  *	codes for probethisfile to return
    132  1.1       cgd  */
    133  1.1       cgd #define	F_NOTEXIST	1
    134  1.1       cgd #define	F_NOTREAD	2
    135  1.1       cgd #define	F_NOTWRITE	3
    136  1.1       cgd #define	F_TOUCHIT	4
    137  1.1       cgd 
    138  1.1       cgd /*
    139  1.1       cgd  *	Describes attributes about a language
    140  1.1       cgd  */
    141  1.1       cgd struct lang_desc{
    142  1.1       cgd 	char	*lang_name;
    143  1.1       cgd 	char	*lang_incomment;	/* one of the following defines */
    144  1.1       cgd 	char	*lang_outcomment;	/* one of the following defines */
    145  1.1       cgd };
    146  1.1       cgd extern struct lang_desc lang_table[];
    147  1.1       cgd 
    148  1.1       cgd #define	CINCOMMENT	"/*###"
    149  1.1       cgd #define	COUTCOMMENT	"%%%*/\n"
    150  1.1       cgd #define	FINCOMMENT	"C###"
    151  1.1       cgd #define	FOUTCOMMENT	"%%%\n"
    152  1.1       cgd #define	NEWLINE		"%%%\n"
    153  1.1       cgd #define	PIINCOMMENT	"(*###"
    154  1.1       cgd #define	PIOUTCOMMENT	"%%%*)\n"
    155  1.1       cgd #define	LISPINCOMMENT	";###"
    156  1.1       cgd #define	ASINCOMMENT	"####"
    157  1.1       cgd #define	RIINCOMMENT	CINCOMMENT
    158  1.1       cgd #define	RIOUTCOMMENT	COUTCOMMENT
    159  1.1       cgd #define	TROFFINCOMMENT	".\\\"###"
    160  1.1       cgd #define	TROFFOUTCOMMENT	NEWLINE
    161  1.1       cgd #define	MOD2INCOMMENT	"(*###"
    162  1.1       cgd #define	MOD2OUTCOMMENT	"%%%*)\n"
    163  1.1       cgd /*
    164  1.1       cgd  *	Defines and resources for determing if a given line
    165  1.1       cgd  *	is to be discarded because it refers to a file not to
    166  1.1       cgd  *	be touched, or if the function reference is to a
    167  1.1       cgd  *	function the user doesn't want recorded.
    168  1.1       cgd  */
    169  1.1       cgd 
    170  1.1       cgd #define	ERRORNAME	"/.errorrc"
    171  1.5  wsanchez extern int	nignored;
    172  1.5  wsanchez extern char	**names_ignored;
    173  1.1       cgd /*
    174  1.1       cgd  *	Structure definition for a full error
    175  1.1       cgd  */
    176  1.1       cgd typedef struct edesc	Edesc;
    177  1.1       cgd typedef	Edesc	*Eptr;
    178  1.1       cgd 
    179  1.1       cgd struct edesc{
    180  1.1       cgd 	Eptr	error_next;		/*linked together*/
    181  1.1       cgd 	int	error_lgtext;		/* how many on the right hand side*/
    182  1.1       cgd 	char	**error_text;		/* the right hand side proper*/
    183  1.1       cgd 	Errorclass	error_e_class;	/* error category of this error*/
    184  1.1       cgd 	Errorclass	error_s_class;	/* sub descriptor of error_e_class*/
    185  1.1       cgd 	int	error_language;		/* the language for this error*/
    186  1.1       cgd 	int	error_position;		/* oridinal position */
    187  1.1       cgd 	int	error_line;		/* discovered line number*/
    188  1.1       cgd 	int	error_no;		/* sequence number on input */
    189  1.1       cgd };
    190  1.1       cgd /*
    191  1.1       cgd  *	Resources for the true errors
    192  1.1       cgd  */
    193  1.1       cgd extern	int	nerrors;
    194  1.1       cgd extern	Eptr	er_head;
    195  1.1       cgd extern	Eptr	*errors;
    196  1.1       cgd /*
    197  1.1       cgd  *	Resources for each of the files mentioned
    198  1.1       cgd  */
    199  1.1       cgd extern	int	nfiles;
    200  1.1       cgd extern	Eptr	**files;	/* array of pointers into errors*/
    201  1.5  wsanchez extern  boolean	*touchedfiles;			/* which files we touched */
    202  1.4     lukem 
    203  1.1       cgd /*
    204  1.5  wsanchez  *	The language the compilation is in, as intuited from
    205  1.1       cgd  *	the flavor of error messages analyzed.
    206  1.1       cgd  */
    207  1.5  wsanchez extern	int	language;
    208  1.1       cgd extern	char	*currentfilename;
    209  1.4     lukem 
    210  1.1       cgd /*
    211  1.1       cgd  *	Functional forwards
    212  1.1       cgd  */
    213  1.7       wiz void	arrayify(int *, Eptr **, Eptr);
    214  1.7       wiz char   *Calloc(int, int);
    215  1.7       wiz void	clob_last(char *,  char);
    216  1.7       wiz int	countfiles(Eptr *);
    217  1.7       wiz Errorclass discardit(Eptr);
    218  1.7       wiz void	diverterrors(char *, int, Eptr **, int, boolean,  int);
    219  1.7       wiz void	eaterrors(int *, Eptr **);
    220  1.7       wiz boolean	edit(char *);
    221  1.7       wiz void	erroradd(int, char **, Errorclass, Errorclass);
    222  1.7       wiz void	errorprint(FILE *, Eptr, boolean);
    223  1.7       wiz void	execvarg(int, int *, char ***);
    224  1.7       wiz void	filenames(int, Eptr **);
    225  1.7       wiz void	findfiles(int, Eptr *, int *, Eptr ***);
    226  1.7       wiz char	firstchar(char *);
    227  1.7       wiz void	getignored(char *);
    228  1.7       wiz void	hackfile(char *, Eptr **, int, int);
    229  1.7       wiz void	insert(int);
    230  1.7       wiz char	lastchar(char *);
    231  1.7       wiz int	mustoverwrite(FILE *, FILE *);
    232  1.7       wiz int	mustwrite(char *, int, FILE *);
    233  1.7       wiz char	next_lastchar(char *);
    234  1.7       wiz int	nopertain(Eptr **);
    235  1.7       wiz int	oktotouch(char *);
    236  1.7       wiz void	onintr(int);
    237  1.7       wiz boolean	persperdexplode(char *, char **, char **);
    238  1.7       wiz int	position(char *, char);
    239  1.7       wiz boolean	preview(char *,  int, Eptr **, int);
    240  1.7       wiz void	printerrors(boolean, int, Eptr []);
    241  1.7       wiz char   *plural(int);
    242  1.7       wiz boolean	qpersperdexplode(char *, char **, char **);
    243  1.7       wiz int	settotouch(char *);
    244  1.7       wiz char   *strsave(char *);
    245  1.7       wiz char   *substitute(char *, char, char);
    246  1.7       wiz void	text(Eptr, boolean);
    247  1.7       wiz boolean	touchfiles(int, Eptr **, int *, char ***);
    248  1.7       wiz char   *verbform(int);
    249  1.7       wiz void	wordvbuild(char *, int*, char ***);
    250  1.7       wiz int	wordvcmp(char **, int, char **);
    251  1.7       wiz void	wordvprint(FILE *, int, char **);
    252  1.7       wiz char  **wordvsplice(int, int, char **);
    253  1.7       wiz boolean	writetouched(int);
    254