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

Annotation of src/usr.bin/error/input.c, Revision 1.2

1.2     ! deraadt     1: /*     $OpenBSD: input.c,v 1.4 1995/09/10 15:55:13 christos Exp $      */
1.1       deraadt     2: /*     $NetBSD: input.c,v 1.4 1995/09/10 15:55:13 christos Exp $       */
                      3:
                      4: /*
                      5:  * Copyright (c) 1980, 1993
                      6:  *     The Regents of the University of California.  All rights reserved.
                      7:  *
                      8:  * Redistribution and use in source and binary forms, with or without
                      9:  * modification, are permitted provided that the following conditions
                     10:  * are met:
                     11:  * 1. Redistributions of source code must retain the above copyright
                     12:  *    notice, this list of conditions and the following disclaimer.
                     13:  * 2. Redistributions in binary form must reproduce the above copyright
                     14:  *    notice, this list of conditions and the following disclaimer in the
                     15:  *    documentation and/or other materials provided with the distribution.
                     16:  * 3. All advertising materials mentioning features or use of this software
                     17:  *    must display the following acknowledgement:
                     18:  *     This product includes software developed by the University of
                     19:  *     California, Berkeley and its contributors.
                     20:  * 4. Neither the name of the University nor the names of its contributors
                     21:  *    may be used to endorse or promote products derived from this software
                     22:  *    without specific prior written permission.
                     23:  *
                     24:  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
                     25:  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
                     26:  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
                     27:  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
                     28:  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
                     29:  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
                     30:  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
                     31:  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
                     32:  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
                     33:  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
                     34:  * SUCH DAMAGE.
                     35:  */
                     36:
                     37: #ifndef lint
                     38: #if 0
                     39: static char sccsid[] = "@(#)input.c    8.1 (Berkeley) 6/6/93";
                     40: #endif
1.2     ! deraadt    41: static char rcsid[] = "$OpenBSD: input.c,v 1.4 1995/09/10 15:55:13 christos Exp $";
1.1       deraadt    42: #endif /* not lint */
                     43:
                     44: #include <stdio.h>
                     45: #include <ctype.h>
                     46: #include <stdlib.h>
                     47: #include <string.h>
                     48: #include "error.h"
                     49:
                     50: int    wordc;          /* how long the current error message is */
                     51: char   **wordv;        /* the actual error message */
                     52:
                     53: int    nerrors;
                     54: int    language;
                     55:
                     56: Errorclass     onelong();
                     57: Errorclass     cpp();
                     58: Errorclass     pccccom();      /* Portable C Compiler C Compiler */
                     59: Errorclass     richieccom();   /* Richie Compiler for 11 */
                     60: Errorclass     lint0();
                     61: Errorclass     lint1();
                     62: Errorclass     lint2();
                     63: Errorclass     lint3();
                     64: Errorclass     make();
                     65: Errorclass     f77();
                     66: Errorclass     pi();
                     67: Errorclass     ri();
                     68: Errorclass     troff();
                     69: Errorclass     mod2();
                     70: /*
                     71:  *     Eat all of the lines in the input file, attempting to categorize
                     72:  *     them by their various flavors
                     73:  */
                     74: eaterrors(r_errorc, r_errorv)
                     75:        int     *r_errorc;
                     76:        Eptr    **r_errorv;
                     77: {
                     78:        extern  boolean piflag;
                     79:        Errorclass      errorclass = C_SYNC;
                     80:        char *line;
                     81:        char *inbuffer;
                     82:        size_t inbuflen;
                     83:
                     84:     for (;;){
                     85:        if ((inbuffer = fgetln(errorfile, &inbuflen)) == NULL)
                     86:                break;
                     87:        line = Calloc(inbuflen + 1, sizeof(char));
                     88:        memcpy(line, inbuffer, inbuflen);
                     89:        line[inbuflen] = '\0';
                     90:        wordvbuild(line, &wordc, &wordv);
                     91:        /*
                     92:         *      for convience, convert wordv to be 1 based, instead
                     93:         *      of 0 based.
                     94:         */
                     95:        wordv -= 1;
                     96:        if ( wordc > 0 &&
                     97:           ((( errorclass = onelong() ) != C_UNKNOWN)
                     98:           || (( errorclass = cpp() ) != C_UNKNOWN)
                     99:           || (( errorclass = pccccom() ) != C_UNKNOWN)
                    100:           || (( errorclass = richieccom() ) != C_UNKNOWN)
                    101:           || (( errorclass = lint0() ) != C_UNKNOWN)
                    102:           || (( errorclass = lint1() ) != C_UNKNOWN)
                    103:           || (( errorclass = lint2() ) != C_UNKNOWN)
                    104:           || (( errorclass = lint3() ) != C_UNKNOWN)
                    105:           || (( errorclass = make() ) != C_UNKNOWN)
                    106:           || (( errorclass = f77() ) != C_UNKNOWN)
                    107:           || ((errorclass = pi() ) != C_UNKNOWN)
                    108:           || (( errorclass = ri() )!= C_UNKNOWN)
                    109:           || (( errorclass = mod2() )!= C_UNKNOWN)
                    110:           || (( errorclass = troff() )!= C_UNKNOWN))
                    111:        ) ;
                    112:        else
                    113:                errorclass = catchall();
                    114:        if (wordc)
                    115:                erroradd(wordc, wordv+1, errorclass, C_UNKNOWN);
                    116:     }
                    117: #ifdef FULLDEBUG
                    118:     printf("%d errorentrys\n", nerrors);
                    119: #endif
                    120:     arrayify(r_errorc, r_errorv, er_head);
                    121: }
                    122:
                    123: /*
                    124:  *     create a new error entry, given a zero based array and count
                    125:  */
                    126: erroradd(errorlength, errorv, errorclass, errorsubclass)
                    127:        int             errorlength;
                    128:        char            **errorv;
                    129:        Errorclass      errorclass;
                    130:        Errorclass      errorsubclass;
                    131: {
                    132:        reg     Eptr    newerror;
                    133:        reg     char    *cp;
                    134:
                    135:        if (errorclass == C_TRUE){
                    136:                /* check canonicalization of the second argument*/
                    137:                for(cp = errorv[1]; *cp && isdigit(*cp); cp++)
                    138:                        continue;
                    139:                errorclass = (*cp == '\0') ? C_TRUE : C_NONSPEC;
                    140: #ifdef FULLDEBUG
                    141:                if (errorclass != C_TRUE)
                    142:                        printf("The 2nd word, \"%s\" is not a number.\n",
                    143:                                errorv[1]);
                    144: #endif
                    145:        }
                    146:        if (errorlength > 0){
                    147:                newerror = (Eptr)Calloc(1, sizeof(Edesc));
                    148:                newerror->error_language = language; /* language is global */
                    149:                newerror->error_text = errorv;
                    150:                newerror->error_lgtext = errorlength;
                    151:                if (errorclass == C_TRUE)
                    152:                        newerror->error_line = atoi(errorv[1]);
                    153:                newerror->error_e_class = errorclass;
                    154:                newerror->error_s_class = errorsubclass;
                    155:                switch(newerror->error_e_class = discardit(newerror)){
                    156:                        case C_SYNC:            nsyncerrors++; break;
                    157:                        case C_DISCARD:         ndiscard++; break;
                    158:                        case C_NULLED:          nnulled++; break;
                    159:                        case C_NONSPEC:         nnonspec++; break;
                    160:                        case C_THISFILE:        nthisfile++; break;
                    161:                        case C_TRUE:            ntrue++; break;
                    162:                        case C_UNKNOWN:         nunknown++; break;
                    163:                        case C_IGNORE:          nignore++; break;
                    164:                }
                    165:                newerror->error_next = er_head;
                    166:                er_head = newerror;
                    167:                newerror->error_no = nerrors++;
                    168:        }       /* length > 0 */
                    169: }
                    170:
                    171: Errorclass onelong()
                    172: {
                    173:        char    **nwordv;
                    174:        if ( (wordc == 1) && (language != INLD) ){
                    175:                /*
                    176:                 *      We have either:
                    177:                 *      a)      file name from cc
                    178:                 *      b)      Assembler telling world that it is complaining
                    179:                 *      c)      Noise from make ("Stop.")
                    180:                 *      c)      Random noise
                    181:                 */
                    182:                wordc = 0;
                    183:                if (strcmp(wordv[1], "Stop.") == 0){
                    184:                        language = INMAKE; return(C_SYNC);
                    185:                }
                    186:                if (strcmp(wordv[1], "Assembler:") == 0){
                    187:                        /* assembler always alerts us to what happened*/
                    188:                        language = INAS; return(C_SYNC);
                    189:                } else
                    190:                if (strcmp(wordv[1], "Undefined:") == 0){
                    191:                        /* loader complains about unknown symbols*/
                    192:                        language = INLD; return(C_SYNC);
                    193:                }
                    194:                if (lastchar(wordv[1]) == ':'){
                    195:                        /* cc tells us what file we are in */
                    196:                        currentfilename = wordv[1];
                    197:                        (void)substitute(currentfilename, ':', '\0');
                    198:                        language = INCC; return(C_SYNC);
                    199:                }
                    200:        } else
                    201:        if ( (wordc == 1) && (language == INLD) ){
                    202:                nwordv = (char **)Calloc(4, sizeof(char *));
                    203:                nwordv[0] = "ld:";
                    204:                nwordv[1] = wordv[1];
                    205:                nwordv[2] = "is";
                    206:                nwordv[3] = "undefined.";
                    207:                wordc = 4;
                    208:                wordv = nwordv - 1;
                    209:                return(C_NONSPEC);
                    210:        } else
                    211:        if (wordc == 1){
                    212:                return(C_SYNC);
                    213:        }
                    214:        return(C_UNKNOWN);
                    215: }      /* end of one long */
                    216:
                    217: Errorclass     cpp()
                    218: {
                    219:        /*
                    220:         *      Now attempt a cpp error message match
                    221:         *      Examples:
                    222:         *              ./morse.h: 23: undefined control
                    223:         *              morsesend.c: 229: MAGNIBBL: argument mismatch
                    224:         *              morsesend.c: 237: MAGNIBBL: argument mismatch
                    225:         *              test1.c: 6: undefined control
                    226:         */
                    227:        if (   (language != INLD)               /* loader errors have almost same fmt*/
                    228:            && (lastchar(wordv[1]) == ':')
                    229:            && (isdigit(firstchar(wordv[2])))
                    230:            && (lastchar(wordv[2]) == ':') ){
                    231:                language = INCPP;
                    232:                clob_last(wordv[1], '\0');
                    233:                clob_last(wordv[2], '\0');
                    234:                return(C_TRUE);
                    235:        }
                    236:        return(C_UNKNOWN);
                    237: }      /*end of cpp*/
                    238:
                    239: Errorclass pccccom()
                    240: {
                    241:        /*
                    242:         *      Now attempt a ccom error message match:
                    243:         *      Examples:
                    244:         *        "morsesend.c", line 237: operands of & have incompatible types
                    245:         *        "test.c", line 7: warning: old-fashioned initialization: use =
                    246:         *        "subdir.d/foo2.h", line 1: illegal initialization
                    247:         */
                    248:        if (   (firstchar(wordv[1]) == '"')
                    249:            && (lastchar(wordv[1]) == ',')
                    250:            && (next_lastchar(wordv[1]) == '"')
                    251:            && (strcmp(wordv[2],"line") == 0)
                    252:            && (isdigit(firstchar(wordv[3])))
                    253:            && (lastchar(wordv[3]) == ':') ){
                    254:                clob_last(wordv[1], '\0');      /* drop last , */
                    255:                clob_last(wordv[1], '\0');      /* drop last " */
                    256:                wordv[1]++;                     /* drop first " */
                    257:                clob_last(wordv[3], '\0');      /* drop : on line number */
                    258:                wordv[2] = wordv[1];    /* overwrite "line" */
                    259:                wordv++;                /*compensate*/
                    260:                wordc--;
                    261:                currentfilename = wordv[1];
                    262:                language = INCC;
                    263:                return(C_TRUE);
                    264:        }
                    265:        return(C_UNKNOWN);
                    266: }      /* end of ccom */
                    267: /*
                    268:  *     Do the error message from the Richie C Compiler for the PDP11,
                    269:  *     which has this source:
                    270:  *
                    271:  *     if (filename[0])
                    272:  *             fprintf(stderr, "%s:", filename);
                    273:  *     fprintf(stderr, "%d: ", line);
                    274:  *
                    275:  */
                    276: Errorclass richieccom()
                    277: {
                    278:        reg     char    *cp;
                    279:        reg     char    **nwordv;
                    280:                char    *file;
                    281:
                    282:        if (lastchar(wordv[1]) == ':'){
                    283:                cp = wordv[1] + strlen(wordv[1]) - 1;
                    284:                while (isdigit(*--cp))
                    285:                        continue;
                    286:                if (*cp == ':'){
                    287:                        clob_last(wordv[1], '\0');      /* last : */
                    288:                        *cp = '\0';                     /* first : */
                    289:                        file = wordv[1];
                    290:                        nwordv = wordvsplice(1, wordc, wordv+1);
                    291:                        nwordv[0] = file;
                    292:                        nwordv[1] = cp + 1;
                    293:                        wordc += 1;
                    294:                        wordv = nwordv - 1;
                    295:                        language = INCC;
                    296:                        currentfilename = wordv[1];
                    297:                        return(C_TRUE);
                    298:                }
                    299:        }
                    300:        return(C_UNKNOWN);
                    301: }
                    302:
                    303: Errorclass lint0()
                    304: {
                    305:        reg     char    **nwordv;
                    306:                char    *line, *file;
                    307:        /*
                    308:         *      Attempt a match for the new lint style normal compiler
                    309:         *      error messages, of the form
                    310:         *
                    311:         *      printf("%s(%d): %s\n", filename, linenumber, message);
                    312:         */
                    313:        if (wordc >= 2){
                    314:                if (   (lastchar(wordv[1]) == ':')
                    315:                    && (next_lastchar(wordv[1]) == ')')
                    316:                ) {
                    317:                        clob_last(wordv[1], '\0'); /* colon */
                    318:                        if (persperdexplode(wordv[1], &line, &file)){
                    319:                                nwordv = wordvsplice(1, wordc, wordv+1);
                    320:                                nwordv[0] = file;       /* file name */
                    321:                                nwordv[1] = line;       /* line number */
                    322:                                wordc += 1;
                    323:                                wordv = nwordv - 1;
                    324:                                language = INLINT;
                    325:                                return(C_TRUE);
                    326:                        }
                    327:                        wordv[1][strlen(wordv[1])] = ':';
                    328:                }
                    329:        }
                    330:        return (C_UNKNOWN);
                    331: }
                    332:
                    333: Errorclass lint1()
                    334: {
                    335:        char    *line1, *line2;
                    336:        char    *file1, *file2;
                    337:        char    **nwordv1, **nwordv2;
                    338:
                    339:        /*
                    340:         *      Now, attempt a match for the various errors that lint
                    341:         *      can complain about.
                    342:         *
                    343:         *      Look first for type 1 lint errors
                    344:         */
                    345:        if (wordc > 1 && strcmp(wordv[wordc-1], "::") == 0){
                    346:         /*
                    347:          * %.7s, arg. %d used inconsistently %s(%d) :: %s(%d)
                    348:          * %.7s value used inconsistently %s(%d) :: %s(%d)
                    349:          * %.7s multiply declared %s(%d) :: %s(%d)
                    350:          * %.7s value declared inconsistently %s(%d) :: %s(%d)
                    351:          * %.7s function value type must be declared before use %s(%d) :: %s(%d)
                    352:          */
                    353:                language = INLINT;
                    354:                if (wordc > 2
                    355:                     && (persperdexplode(wordv[wordc], &line2, &file2))
                    356:                     && (persperdexplode(wordv[wordc-2], &line1, &file1)) ){
                    357:                        nwordv1 = wordvsplice(2, wordc, wordv+1);
                    358:                        nwordv2 = wordvsplice(2, wordc, wordv+1);
                    359:                        nwordv1[0] = file1; nwordv1[1] = line1;
                    360:                        erroradd(wordc+2, nwordv1, C_TRUE, C_DUPL); /* takes 0 based*/
                    361:                        nwordv2[0] = file2; nwordv2[1] = line2;
                    362:                        wordc = wordc + 2;
                    363:                        wordv = nwordv2 - 1;    /* 1 based */
                    364:                        return(C_TRUE);
                    365:                }
                    366:        }
                    367:        return(C_UNKNOWN);
                    368: } /* end of lint 1*/
                    369:
                    370: Errorclass lint2()
                    371: {
                    372:        char    *file;
                    373:        char    *line;
                    374:        char    **nwordv;
                    375:        /*
                    376:         *      Look for type 2 lint errors
                    377:         *
                    378:         *      %.7s used( %s(%d) ), but not defined
                    379:         *      %.7s defined( %s(%d) ), but never used
                    380:         *      %.7s declared( %s(%d) ), but never used or defined
                    381:         *
                    382:         *      bufp defined( "./metric.h"(10) ), but never used
                    383:         */
                    384:        if (   (lastchar(wordv[2]) == '(' /* ')' */ )
                    385:            && (strcmp(wordv[4], "),") == 0) ){
                    386:                language = INLINT;
                    387:                if (persperdexplode(wordv[3], &line, &file)){
                    388:                        nwordv = wordvsplice(2, wordc, wordv+1);
                    389:                        nwordv[0] = file; nwordv[1] = line;
                    390:                        wordc = wordc + 2;
                    391:                        wordv = nwordv - 1;     /* 1 based */
                    392:                        return(C_TRUE);
                    393:                }
                    394:        }
                    395:        return(C_UNKNOWN);
                    396: } /* end of lint 2*/
                    397:
                    398: char   *Lint31[4] = {"returns", "value", "which", "is"};
                    399: char   *Lint32[6] = {"value", "is", "used,", "but", "none", "returned"};
                    400: Errorclass lint3()
                    401: {
                    402:        if (   (wordvcmp(wordv+2, 4, Lint31) == 0)
                    403:            || (wordvcmp(wordv+2, 6, Lint32) == 0) ){
                    404:                language = INLINT;
                    405:                return(C_NONSPEC);
                    406:        }
                    407:        return(C_UNKNOWN);
                    408: }
                    409:
                    410: /*
                    411:  *     Special word vectors for use by F77 recognition
                    412:  */
                    413: char   *F77_fatal[3] = {"Compiler", "error", "line"};
                    414: char   *F77_error[3] = {"Error", "on", "line"};
                    415: char   *F77_warning[3] = {"Warning", "on", "line"};
                    416: char    *F77_no_ass[3] = {"Error.","No","assembly."};
                    417: f77()
                    418: {
                    419:        char    **nwordv;
                    420:        /*
                    421:         *      look for f77 errors:
                    422:         *      Error messages from /usr/src/cmd/f77/error.c, with
                    423:         *      these printf formats:
                    424:         *
                    425:         *              Compiler error line %d of %s: %s
                    426:         *              Error on line %d of %s: %s
                    427:         *              Warning on line %d of %s: %s
                    428:         *              Error.  No assembly.
                    429:         */
                    430:        if (wordc == 3 && wordvcmp(wordv+1, 3, F77_no_ass) == 0) {
                    431:                wordc = 0;
                    432:                return(C_SYNC);
                    433:        }
                    434:        if (wordc < 6)
                    435:                return(C_UNKNOWN);
                    436:        if (    (lastchar(wordv[6]) == ':')
                    437:            &&(
                    438:               (wordvcmp(wordv+1, 3, F77_fatal) == 0)
                    439:            || (wordvcmp(wordv+1, 3, F77_error) == 0)
                    440:            || (wordvcmp(wordv+1, 3, F77_warning) == 0) )
                    441:        ){
                    442:                language = INF77;
                    443:                nwordv = wordvsplice(2, wordc, wordv+1);
                    444:                nwordv[0] = wordv[6];
                    445:                clob_last(nwordv[0],'\0');
                    446:                nwordv[1] = wordv[4];
                    447:                wordc += 2;
                    448:                wordv = nwordv - 1;     /* 1 based */
                    449:                return(C_TRUE);
                    450:        }
                    451:        return(C_UNKNOWN);
                    452: } /* end of f77 */
                    453:
                    454: char   *Make_Croak[3] = {"***", "Error", "code"};
                    455: char   *Make_NotRemade[5] = {"not", "remade", "because", "of", "errors"};
                    456: Errorclass make()
                    457: {
                    458:        if (wordvcmp(wordv+1, 3, Make_Croak) == 0){
                    459:                language = INMAKE;
                    460:                return(C_SYNC);
                    461:        }
                    462:        if  (wordvcmp(wordv+2, 5, Make_NotRemade) == 0){
                    463:                language = INMAKE;
                    464:                return(C_SYNC);
                    465:        }
                    466:        return(C_UNKNOWN);
                    467: }
                    468: Errorclass ri()
                    469: {
                    470: /*
                    471:  *     Match an error message produced by ri; here is the
                    472:  *     procedure yanked from the distributed version of ri
                    473:  *     April 24, 1980.
                    474:  *
                    475:  *     serror(str, x1, x2, x3)
                    476:  *             char str[];
                    477:  *             char *x1, *x2, *x3;
                    478:  *     {
                    479:  *             extern int yylineno;
                    480:  *
                    481:  *             putc('"', stdout);
                    482:  *             fputs(srcfile, stdout);
                    483:  *             putc('"', stdout);
                    484:  *             fprintf(stdout, " %d: ", yylineno);
                    485:  *             fprintf(stdout, str, x1, x2, x3);
                    486:  *             fprintf(stdout, "\n");
                    487:  *             synerrs++;
                    488:  *     }
                    489:  */
                    490:        if (  (firstchar(wordv[1]) == '"')
                    491:            &&(lastchar(wordv[1]) == '"')
                    492:            &&(lastchar(wordv[2]) == ':')
                    493:            &&(isdigit(firstchar(wordv[2]))) ){
                    494:                clob_last(wordv[1], '\0');      /* drop the last " */
                    495:                wordv[1]++;     /* skip over the first " */
                    496:                clob_last(wordv[2], '\0');
                    497:                language = INRI;
                    498:                return(C_TRUE);
                    499:        }
                    500:        return(C_UNKNOWN);
                    501: }
                    502:
                    503: Errorclass catchall()
                    504: {
                    505:        /*
                    506:         *      Catches random things.
                    507:         */
                    508:        language = INUNKNOWN;
                    509:        return(C_NONSPEC);
                    510: } /* end of catch all*/
                    511:
                    512: Errorclass troff()
                    513: {
                    514:        /*
                    515:         *      troff source error message, from eqn, bib, tbl...
                    516:         *      Just like pcc ccom, except uses `'
                    517:         */
                    518:        if (   (firstchar(wordv[1]) == '`')
                    519:            && (lastchar(wordv[1]) == ',')
                    520:            && (next_lastchar(wordv[1]) == '\'')
                    521:            && (strcmp(wordv[2],"line") == 0)
                    522:            && (isdigit(firstchar(wordv[3])))
                    523:            && (lastchar(wordv[3]) == ':') ){
                    524:                clob_last(wordv[1], '\0');      /* drop last , */
                    525:                clob_last(wordv[1], '\0');      /* drop last " */
                    526:                wordv[1]++;                     /* drop first " */
                    527:                clob_last(wordv[3], '\0');      /* drop : on line number */
                    528:                wordv[2] = wordv[1];    /* overwrite "line" */
                    529:                wordv++;                /*compensate*/
                    530:                currentfilename = wordv[1];
                    531:                language = INTROFF;
                    532:                return(C_TRUE);
                    533:        }
                    534:        return(C_UNKNOWN);
                    535: }
                    536: Errorclass mod2()
                    537: {
                    538:        /*
                    539:         *      for decwrl modula2 compiler (powell)
                    540:         */
                    541:        if (   (  (strcmp(wordv[1], "!!!") == 0)        /* early version */
                    542:                ||(strcmp(wordv[1], "File") == 0))      /* later version */
                    543:            && (lastchar(wordv[2]) == ',')      /* file name */
                    544:            && (strcmp(wordv[3], "line") == 0)
                    545:            && (isdigit(firstchar(wordv[4])))   /* line number */
                    546:            && (lastchar(wordv[4]) == ':')      /* line number */
                    547:        ){
                    548:                clob_last(wordv[2], '\0');      /* drop last , on file name */
                    549:                clob_last(wordv[4], '\0');      /* drop last : on line number */
                    550:                wordv[3] = wordv[2];            /* file name on top of "line" */
                    551:                wordv += 2;
                    552:                wordc -= 2;
                    553:                currentfilename = wordv[1];
                    554:                language = INMOD2;
                    555:                return(C_TRUE);
                    556:        }
                    557:        return(C_UNKNOWN);
                    558: }