Home | History | Annotate | Line # | Download | only in error
error.h revision 1.5
      1  1.5  wsanchez /*	$NetBSD: error.h,v 1.5 1998/10/08 01:29:27 wsanchez 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 extern	int	language;
     71  1.1       cgd /*
     72  1.1       cgd  *	We analyze each line in the error message file, and
     73  1.1       cgd  *	attempt to categorize it by type, as well as language.
     74  1.1       cgd  *	Here are the type descriptors.
     75  1.1       cgd  */
     76  1.1       cgd typedef	int	Errorclass;
     77  1.1       cgd 
     78  1.1       cgd #define	C_FIRST	0		/* first error category */
     79  1.1       cgd #define	C_UNKNOWN	0	/* must be zero */
     80  1.1       cgd #define	C_IGNORE	1	/* ignore the message; used for pi */
     81  1.1       cgd #define	C_SYNC		2	/* synchronization errors */
     82  1.1       cgd #define	C_DISCARD	3	/* touches dangerous files, so discard */
     83  1.1       cgd #define	C_NONSPEC	4	/* not specific to any file */
     84  1.1       cgd #define	C_THISFILE	5	/* specific to this file, but at no line */
     85  1.1       cgd #define	C_NULLED	6	/* refers to special func; so null */
     86  1.1       cgd #define	C_TRUE		7	/* fits into true error format */
     87  1.1       cgd #define	C_DUPL		8	/* sub class only; duplicated error message */
     88  1.1       cgd #define	C_LAST	9		/* last error category */
     89  1.1       cgd 
     90  1.1       cgd #define	SORTABLE(x)	(!(NOTSORTABLE(x)))
     91  1.1       cgd #define	NOTSORTABLE(x)	(x <= C_NONSPEC)
     92  1.1       cgd /*
     93  1.1       cgd  *	Resources to count and print out the error categories
     94  1.1       cgd  */
     95  1.1       cgd extern	char		*class_table[];
     96  1.1       cgd extern	int		class_count[];
     97  1.1       cgd 
     98  1.1       cgd #define	nunknown	class_count[C_UNKNOWN]
     99  1.1       cgd #define	nignore		class_count[C_IGNORE]
    100  1.1       cgd #define	nsyncerrors	class_count[C_SYNC]
    101  1.1       cgd #define	ndiscard	class_count[C_DISCARD]
    102  1.1       cgd #define	nnonspec	class_count[C_NONSPEC]
    103  1.1       cgd #define	nthisfile	class_count[C_THISFILE]
    104  1.1       cgd #define	nnulled		class_count[C_NULLED]
    105  1.1       cgd #define	ntrue		class_count[C_TRUE]
    106  1.1       cgd #define	ndupl		class_count[C_DUPL]
    107  1.1       cgd 
    108  1.1       cgd /* places to put the error complaints */
    109  1.1       cgd 
    110  1.1       cgd #define	TOTHEFILE	1	/* touch the file */
    111  1.1       cgd #define	TOSTDOUT	2	/* just print them out (ho-hum) */
    112  1.1       cgd 
    113  1.5  wsanchez extern FILE	*errorfile;	/* where error file comes from */
    114  1.5  wsanchez extern FILE	*queryfile;	/* where the query responses from the user come from*/
    115  1.1       cgd 
    116  1.1       cgd extern	char	*currentfilename;
    117  1.1       cgd extern	char	*processname;
    118  1.1       cgd extern	char	*scriptname;
    119  1.1       cgd 
    120  1.1       cgd extern	boolean	query;
    121  1.1       cgd extern	boolean	terse;
    122  1.4     lukem int	inquire __P((char *, ...));	/* inquire for yes/no */
    123  1.1       cgd /*
    124  1.1       cgd  *	codes for inquire() to return
    125  1.1       cgd  */
    126  1.1       cgd #define	Q_NO	1			/* 'N' */
    127  1.1       cgd #define	Q_no	2			/* 'n' */
    128  1.1       cgd #define	Q_YES	3			/* 'Y' */
    129  1.1       cgd #define	Q_yes	4			/* 'y' */
    130  1.1       cgd 
    131  1.4     lukem int	probethisfile __P((char *));
    132  1.1       cgd /*
    133  1.1       cgd  *	codes for probethisfile to return
    134  1.1       cgd  */
    135  1.1       cgd #define	F_NOTEXIST	1
    136  1.1       cgd #define	F_NOTREAD	2
    137  1.1       cgd #define	F_NOTWRITE	3
    138  1.1       cgd #define	F_TOUCHIT	4
    139  1.1       cgd 
    140  1.1       cgd /*
    141  1.1       cgd  *	Describes attributes about a language
    142  1.1       cgd  */
    143  1.1       cgd struct lang_desc{
    144  1.1       cgd 	char	*lang_name;
    145  1.1       cgd 	char	*lang_incomment;	/* one of the following defines */
    146  1.1       cgd 	char	*lang_outcomment;	/* one of the following defines */
    147  1.1       cgd };
    148  1.1       cgd extern struct lang_desc lang_table[];
    149  1.1       cgd 
    150  1.1       cgd #define	CINCOMMENT	"/*###"
    151  1.1       cgd #define	COUTCOMMENT	"%%%*/\n"
    152  1.1       cgd #define	FINCOMMENT	"C###"
    153  1.1       cgd #define	FOUTCOMMENT	"%%%\n"
    154  1.1       cgd #define	NEWLINE		"%%%\n"
    155  1.1       cgd #define	PIINCOMMENT	"(*###"
    156  1.1       cgd #define	PIOUTCOMMENT	"%%%*)\n"
    157  1.1       cgd #define	LISPINCOMMENT	";###"
    158  1.1       cgd #define	ASINCOMMENT	"####"
    159  1.1       cgd #define	RIINCOMMENT	CINCOMMENT
    160  1.1       cgd #define	RIOUTCOMMENT	COUTCOMMENT
    161  1.1       cgd #define	TROFFINCOMMENT	".\\\"###"
    162  1.1       cgd #define	TROFFOUTCOMMENT	NEWLINE
    163  1.1       cgd #define	MOD2INCOMMENT	"(*###"
    164  1.1       cgd #define	MOD2OUTCOMMENT	"%%%*)\n"
    165  1.1       cgd /*
    166  1.1       cgd  *	Defines and resources for determing if a given line
    167  1.1       cgd  *	is to be discarded because it refers to a file not to
    168  1.1       cgd  *	be touched, or if the function reference is to a
    169  1.1       cgd  *	function the user doesn't want recorded.
    170  1.1       cgd  */
    171  1.1       cgd 
    172  1.1       cgd #define	ERRORNAME	"/.errorrc"
    173  1.5  wsanchez extern int	nignored;
    174  1.5  wsanchez extern char	**names_ignored;
    175  1.1       cgd /*
    176  1.1       cgd  *	Structure definition for a full error
    177  1.1       cgd  */
    178  1.1       cgd typedef struct edesc	Edesc;
    179  1.1       cgd typedef	Edesc	*Eptr;
    180  1.1       cgd 
    181  1.1       cgd struct edesc{
    182  1.1       cgd 	Eptr	error_next;		/*linked together*/
    183  1.1       cgd 	int	error_lgtext;		/* how many on the right hand side*/
    184  1.1       cgd 	char	**error_text;		/* the right hand side proper*/
    185  1.1       cgd 	Errorclass	error_e_class;	/* error category of this error*/
    186  1.1       cgd 	Errorclass	error_s_class;	/* sub descriptor of error_e_class*/
    187  1.1       cgd 	int	error_language;		/* the language for this error*/
    188  1.1       cgd 	int	error_position;		/* oridinal position */
    189  1.1       cgd 	int	error_line;		/* discovered line number*/
    190  1.1       cgd 	int	error_no;		/* sequence number on input */
    191  1.1       cgd };
    192  1.1       cgd /*
    193  1.1       cgd  *	Resources for the true errors
    194  1.1       cgd  */
    195  1.1       cgd extern	int	nerrors;
    196  1.1       cgd extern	Eptr	er_head;
    197  1.1       cgd extern	Eptr	*errors;
    198  1.1       cgd /*
    199  1.1       cgd  *	Resources for each of the files mentioned
    200  1.1       cgd  */
    201  1.1       cgd extern	int	nfiles;
    202  1.1       cgd extern	Eptr	**files;	/* array of pointers into errors*/
    203  1.5  wsanchez extern  boolean	*touchedfiles;			/* which files we touched */
    204  1.4     lukem 
    205  1.1       cgd /*
    206  1.5  wsanchez  *	The language the compilation is in, as intuited from
    207  1.1       cgd  *	the flavor of error messages analyzed.
    208  1.1       cgd  */
    209  1.5  wsanchez extern	int	language;
    210  1.1       cgd extern	char	*currentfilename;
    211  1.4     lukem 
    212  1.1       cgd /*
    213  1.1       cgd  *	Functional forwards
    214  1.1       cgd  */
    215  1.4     lukem void	arrayify __P((int *, Eptr **, Eptr));
    216  1.4     lukem char   *Calloc __P((int, int));
    217  1.4     lukem void	clob_last __P((char *,  char));
    218  1.4     lukem int	countfiles  __P((Eptr *));
    219  1.4     lukem Errorclass discardit __P((Eptr));
    220  1.4     lukem void	diverterrors __P((char *, int, Eptr **, int, boolean,  int));
    221  1.4     lukem void	eaterrors __P((int *, Eptr **));
    222  1.4     lukem boolean	edit __P((char *));
    223  1.4     lukem void	erroradd __P((int, char **, Errorclass, Errorclass));
    224  1.4     lukem void	errorprint __P((FILE *, Eptr, boolean));
    225  1.4     lukem void	execvarg __P((int, int *, char ***));
    226  1.4     lukem void	filenames __P((int, Eptr **));
    227  1.4     lukem void	findfiles __P((int, Eptr *, int *, Eptr ***));
    228  1.4     lukem char	firstchar __P((char *));
    229  1.4     lukem void	getignored __P((char *));
    230  1.4     lukem void	hackfile __P((char *, Eptr **, int, int));
    231  1.4     lukem void	insert __P((int));
    232  1.4     lukem char	lastchar __P((char *));
    233  1.4     lukem int	mustoverwrite __P((FILE *, FILE *));
    234  1.4     lukem int	mustwrite __P((char *, int, FILE *));
    235  1.4     lukem char	next_lastchar __P((char *));
    236  1.4     lukem int	nopertain __P((Eptr **));
    237  1.4     lukem int	oktotouch __P((char *));
    238  1.4     lukem void	onintr __P((int));
    239  1.4     lukem boolean	persperdexplode __P((char *, char **, char **));
    240  1.4     lukem int	position __P((char *, char));
    241  1.4     lukem boolean	preview __P((char *,  int, Eptr **, int));
    242  1.4     lukem void	printerrors __P((boolean, int, Eptr []));
    243  1.4     lukem char   *plural __P((int));
    244  1.4     lukem boolean	qpersperdexplode __P((char *, char **, char **));
    245  1.4     lukem int	settotouch __P((char *));
    246  1.4     lukem char   *strsave __P((char *));
    247  1.4     lukem char   *substitute __P((char *, char, char));
    248  1.4     lukem void	text __P((Eptr, boolean));
    249  1.4     lukem boolean	touchfiles __P((int, Eptr **, int *, char ***));
    250  1.4     lukem char   *verbform __P((int));
    251  1.4     lukem void	wordvbuild __P((char *, int*, char ***));
    252  1.4     lukem int	wordvcmp __P((char **, int, char **));
    253  1.4     lukem void	wordvprint __P((FILE *, int, char **));
    254  1.4     lukem char  **wordvsplice __P((int, int, char **));
    255  1.4     lukem boolean	writetouched __P((int));
    256