Annotation of researchv9/cmd/sun/c2/error.c, revision 1.1

1.1     ! root        1: #ifndef lint
        !             2: static char sccsid[] = "@(#)error.c 1.1 86/02/03 Copyr 1985 Sun Micro";
        !             3: #endif
        !             4: 
        !             5: /*
        !             6:  * Copyright (c) 1985 by Sun Microsystems, Inc.
        !             7:  */
        !             8: 
        !             9: 
        !            10: #include "as.h"
        !            11: 
        !            12: /*
        !            13:  *  routines to write error messages and warnings.
        !            14:  */
        !            15: 
        !            16: 
        !            17: char *e_messages[] = {
        !            18: /* E_NOERROR    */     "<unused>",
        !            19: /* E_BADCHAR    */     "Invalid character",
        !            20: /* E_MULTSYM    */     "Multiply defined symbol",
        !            21: /* E_NOSPACE    */     "Symbol storage exceeded",
        !            22: /* E_OFFSET     */     "Offset too large",
        !            23: /* E_SYMLEN     */     "Symbol too long",
        !            24: /* E_SYMDEF     */     "Undefined symbol",
        !            25: /* E_CONSTANT   */     "Invalid constant",
        !            26: /* E_TERM       */     "Invalid term",
        !            27: /* E_OPERATOR   */     "Invalid operator",
        !            28: /* E_RELOCATE   */     "Non-relocatable expression",
        !            29: /* E_TYPE       */     "Wrong type for instruction",
        !            30: /* E_OPERAND    */     "Invalid operand",
        !            31: /* E_SYMBOL     */     "Invalid symbol",
        !            32: /* E_EQUALS     */     "Invalid assignment",
        !            33: /* E_NLABELS    */     "Too many labels",
        !            34: /* E_OPCODE     */     "Invalid op-code",
        !            35: /* E_STRING     */     "Invalid string",
        !            36: /* E_PHASE      */     "Unacceptable relocatable expression",
        !            37: /* E_NUMOPS     */     "Wrong number of operands",
        !            38: /* E_LINELONG   */     "Line too long",
        !            39: /* E_REG        */     "Invalid register expression",
        !            40: /* E_IADDR      */     "Invalid machine address",
        !            41: /* E_PAREN      */     "Missing close-paren `)'",
        !            42: /* E_ODDADDR     */    "Odd address",
        !            43: /* E_UNDEFINED_L */    "Undefined L-symbol",
        !            44: /* E_REGLIST    */     "Invalid register list",
        !            45:                0
        !            46: } ;
        !            47: 
        !            48: int errors = 0;                /* Number of errors in this pass */
        !            49: extern char * asm_name; /* from init.c                  */
        !            50: 
        !            51: /* Sys_Error is called when a System Error occurs, that is, something is wrong
        !            52:    with the assembler itself.  Explanation is a string suitable for a printf
        !            53:    control string which explains the error, and Number is the value of the
        !            54:    offending parameter.  This routine will not return.
        !            55: */
        !            56: /*VARARGS 1*/
        !            57: sys_error(Explanation,Number)
        !            58: char *Explanation;
        !            59: {
        !            60:        fflush(stdout);
        !            61:        fprintf(stderr, "%s: Optimizer Error-- ", asm_name);
        !            62:        fprintf(stderr, Explanation,Number);
        !            63:        exit(-1);
        !            64: }
        !            65: 
        !            66: /* This is called whenever the assembler recognizes an error in the current
        !            67: statement. It registers the error, so that an error code will be listed with
        !            68: the statement, and a description of the error will be printed at the end of
        !            69: the listing */
        !            70: 
        !            71: prog_error(code)
        !            72: err_code code;
        !            73: {
        !            74:        errors++;                       /* increment error count */
        !            75:        fprintf(stderr,"%s: error (%d): %s\n",asm_name, 
        !            76:                line_no,e_messages[(int)code]);
        !            77: }
        !            78: 
        !            79: /* Prog_Warning registers a warning on a statement. A warning is like an error,
        !            80:        in that something is probably amiss, but the assembler will still try 
        !            81:        to generate the .o file. 
        !            82: */
        !            83: 
        !            84: prog_warning(code)
        !            85: err_code code;
        !            86: {
        !            87: 
        !            88: #if AS
        !            89:        if (pass != 2) return;
        !            90: #endif
        !            91:        fprintf(stderr,"%s: warning (%d): %s\n",asm_name, 
        !            92:                line_no,e_messages[(int)code]);
        !            93: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.