[BACK]Return to error.h CVS log [TXT][DIR] Up to [local] / src / usr.bin / error

Annotation of src/usr.bin/error/error.h, Revision 1.1

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