Home | History | Annotate | Line # | Download | only in error
error.h revision 1.3
      1  1.3  jtc /*	$NetBSD: error.h,v 1.3 1995/09/02 06:15:25 jtc 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 #define	reg	register
     40  1.1  cgd 
     41  1.1  cgd #define	TRUE	1
     42  1.1  cgd #define	FALSE	0
     43  1.1  cgd 
     44  1.1  cgd #define	true	1
     45  1.1  cgd #define	false	0
     46  1.1  cgd /*
     47  1.1  cgd  *	Descriptors for the various languages we know about.
     48  1.1  cgd  *	If you touch these, also touch lang_table
     49  1.1  cgd  */
     50  1.1  cgd #define	INUNKNOWN	0
     51  1.1  cgd #define	INCPP	1
     52  1.1  cgd #define	INCC	2
     53  1.1  cgd #define	INAS	3
     54  1.1  cgd #define	INLD	4
     55  1.1  cgd #define	INLINT	5
     56  1.1  cgd #define	INF77	6
     57  1.1  cgd #define	INPI	7
     58  1.1  cgd #define	INPC	8
     59  1.1  cgd #define	INFRANZ	9
     60  1.1  cgd #define	INLISP	10
     61  1.1  cgd #define	INVAXIMA	11
     62  1.1  cgd #define	INRATFOR	12
     63  1.1  cgd #define	INLEX	13
     64  1.1  cgd #define	INYACC	14
     65  1.1  cgd #define	INAPL	15
     66  1.1  cgd #define	INMAKE	16
     67  1.1  cgd #define	INRI	17
     68  1.1  cgd #define	INTROFF	18
     69  1.1  cgd #define	INMOD2	19
     70  1.1  cgd 
     71  1.1  cgd extern	int	language;
     72  1.1  cgd /*
     73  1.1  cgd  *	We analyze each line in the error message file, and
     74  1.1  cgd  *	attempt to categorize it by type, as well as language.
     75  1.1  cgd  *	Here are the type descriptors.
     76  1.1  cgd  */
     77  1.1  cgd typedef	int	Errorclass;
     78  1.1  cgd 
     79  1.1  cgd #define	C_FIRST	0		/* first error category */
     80  1.1  cgd #define	C_UNKNOWN	0	/* must be zero */
     81  1.1  cgd #define	C_IGNORE	1	/* ignore the message; used for pi */
     82  1.1  cgd #define	C_SYNC		2	/* synchronization errors */
     83  1.1  cgd #define	C_DISCARD	3	/* touches dangerous files, so discard */
     84  1.1  cgd #define	C_NONSPEC	4	/* not specific to any file */
     85  1.1  cgd #define	C_THISFILE	5	/* specific to this file, but at no line */
     86  1.1  cgd #define	C_NULLED	6	/* refers to special func; so null */
     87  1.1  cgd #define	C_TRUE		7	/* fits into true error format */
     88  1.1  cgd #define	C_DUPL		8	/* sub class only; duplicated error message */
     89  1.1  cgd #define	C_LAST	9		/* last error category */
     90  1.1  cgd 
     91  1.1  cgd #define	SORTABLE(x)	(!(NOTSORTABLE(x)))
     92  1.1  cgd #define	NOTSORTABLE(x)	(x <= C_NONSPEC)
     93  1.1  cgd /*
     94  1.1  cgd  *	Resources to count and print out the error categories
     95  1.1  cgd  */
     96  1.1  cgd extern	char		*class_table[];
     97  1.1  cgd extern	int		class_count[];
     98  1.1  cgd 
     99  1.1  cgd #define	nunknown	class_count[C_UNKNOWN]
    100  1.1  cgd #define	nignore		class_count[C_IGNORE]
    101  1.1  cgd #define	nsyncerrors	class_count[C_SYNC]
    102  1.1  cgd #define	ndiscard	class_count[C_DISCARD]
    103  1.1  cgd #define	nnonspec	class_count[C_NONSPEC]
    104  1.1  cgd #define	nthisfile	class_count[C_THISFILE]
    105  1.1  cgd #define	nnulled		class_count[C_NULLED]
    106  1.1  cgd #define	ntrue		class_count[C_TRUE]
    107  1.1  cgd #define	ndupl		class_count[C_DUPL]
    108  1.1  cgd 
    109  1.1  cgd /* places to put the error complaints */
    110  1.1  cgd 
    111  1.1  cgd #define	TOTHEFILE	1	/* touch the file */
    112  1.1  cgd #define	TOSTDOUT	2	/* just print them out (ho-hum) */
    113  1.1  cgd 
    114  1.1  cgd FILE	*errorfile;	/* where error file comes from */
    115  1.1  cgd FILE	*queryfile;	/* where the query responses from the user come from*/
    116  1.1  cgd 
    117  1.1  cgd extern	char	*currentfilename;
    118  1.1  cgd extern	char	*processname;
    119  1.1  cgd extern	char	*scriptname;
    120  1.1  cgd 
    121  1.1  cgd extern	boolean	query;
    122  1.1  cgd extern	boolean	terse;
    123  1.1  cgd int	inquire();			/* inquire for yes/no */
    124  1.1  cgd /*
    125  1.1  cgd  *	codes for inquire() to return
    126  1.1  cgd  */
    127  1.1  cgd #define	Q_NO	1			/* 'N' */
    128  1.1  cgd #define	Q_no	2			/* 'n' */
    129  1.1  cgd #define	Q_YES	3			/* 'Y' */
    130  1.1  cgd #define	Q_yes	4			/* 'y' */
    131  1.1  cgd 
    132  1.1  cgd int	probethisfile();
    133  1.1  cgd /*
    134  1.1  cgd  *	codes for probethisfile to return
    135  1.1  cgd  */
    136  1.1  cgd #define	F_NOTEXIST	1
    137  1.1  cgd #define	F_NOTREAD	2
    138  1.1  cgd #define	F_NOTWRITE	3
    139  1.1  cgd #define	F_TOUCHIT	4
    140  1.1  cgd 
    141  1.1  cgd /*
    142  1.1  cgd  *	Describes attributes about a language
    143  1.1  cgd  */
    144  1.1  cgd struct lang_desc{
    145  1.1  cgd 	char	*lang_name;
    146  1.1  cgd 	char	*lang_incomment;	/* one of the following defines */
    147  1.1  cgd 	char	*lang_outcomment;	/* one of the following defines */
    148  1.1  cgd };
    149  1.1  cgd extern struct lang_desc lang_table[];
    150  1.1  cgd 
    151  1.1  cgd #define	CINCOMMENT	"/*###"
    152  1.1  cgd #define	COUTCOMMENT	"%%%*/\n"
    153  1.1  cgd #define	FINCOMMENT	"C###"
    154  1.1  cgd #define	FOUTCOMMENT	"%%%\n"
    155  1.1  cgd #define	NEWLINE		"%%%\n"
    156  1.1  cgd #define	PIINCOMMENT	"(*###"
    157  1.1  cgd #define	PIOUTCOMMENT	"%%%*)\n"
    158  1.1  cgd #define	LISPINCOMMENT	";###"
    159  1.1  cgd #define	ASINCOMMENT	"####"
    160  1.1  cgd #define	RIINCOMMENT	CINCOMMENT
    161  1.1  cgd #define	RIOUTCOMMENT	COUTCOMMENT
    162  1.1  cgd #define	TROFFINCOMMENT	".\\\"###"
    163  1.1  cgd #define	TROFFOUTCOMMENT	NEWLINE
    164  1.1  cgd #define	MOD2INCOMMENT	"(*###"
    165  1.1  cgd #define	MOD2OUTCOMMENT	"%%%*)\n"
    166  1.1  cgd /*
    167  1.1  cgd  *	Defines and resources for determing if a given line
    168  1.1  cgd  *	is to be discarded because it refers to a file not to
    169  1.1  cgd  *	be touched, or if the function reference is to a
    170  1.1  cgd  *	function the user doesn't want recorded.
    171  1.1  cgd  */
    172  1.1  cgd 
    173  1.1  cgd #define	ERRORNAME	"/.errorrc"
    174  1.1  cgd int	nignored;
    175  1.1  cgd char	**names_ignored;
    176  1.1  cgd /*
    177  1.1  cgd  *	Structure definition for a full error
    178  1.1  cgd  */
    179  1.1  cgd typedef struct edesc	Edesc;
    180  1.1  cgd typedef	Edesc	*Eptr;
    181  1.1  cgd 
    182  1.1  cgd struct edesc{
    183  1.1  cgd 	Eptr	error_next;		/*linked together*/
    184  1.1  cgd 	int	error_lgtext;		/* how many on the right hand side*/
    185  1.1  cgd 	char	**error_text;		/* the right hand side proper*/
    186  1.1  cgd 	Errorclass	error_e_class;	/* error category of this error*/
    187  1.1  cgd 	Errorclass	error_s_class;	/* sub descriptor of error_e_class*/
    188  1.1  cgd 	int	error_language;		/* the language for this error*/
    189  1.1  cgd 	int	error_position;		/* oridinal position */
    190  1.1  cgd 	int	error_line;		/* discovered line number*/
    191  1.1  cgd 	int	error_no;		/* sequence number on input */
    192  1.1  cgd };
    193  1.1  cgd /*
    194  1.1  cgd  *	Resources for the true errors
    195  1.1  cgd  */
    196  1.1  cgd extern	int	nerrors;
    197  1.1  cgd extern	Eptr	er_head;
    198  1.1  cgd extern	Eptr	*errors;
    199  1.1  cgd /*
    200  1.1  cgd  *	Resources for each of the files mentioned
    201  1.1  cgd  */
    202  1.1  cgd extern	int	nfiles;
    203  1.1  cgd extern	Eptr	**files;	/* array of pointers into errors*/
    204  1.1  cgd boolean	*touchedfiles;			/* which files we touched */
    205  1.1  cgd /*
    206  1.1  cgd  *	The langauge the compilation is in, as intuited from
    207  1.1  cgd  *	the flavor of error messages analyzed.
    208  1.1  cgd  */
    209  1.1  cgd extern	int	langauge;
    210  1.1  cgd extern	char	*currentfilename;
    211  1.1  cgd /*
    212  1.1  cgd  *	Functional forwards
    213  1.1  cgd  */
    214  1.1  cgd char	*Calloc();
    215  1.1  cgd char	*strsave();
    216  1.1  cgd char	*clobberfirst();
    217  1.1  cgd char	lastchar();
    218  1.1  cgd char	firstchar();
    219  1.1  cgd char	next_lastchar();
    220  1.1  cgd char	**wordvsplice();
    221  1.1  cgd int	wordvcmp();
    222  1.1  cgd boolean	persperdexplode();
    223  1.1  cgd /*
    224  1.1  cgd  *	Printing hacks
    225  1.1  cgd  */
    226  1.1  cgd char	*plural(), *verbform();
    227