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