Changeset 35 for trunk/src/kmk/parse.c


Ignore:
Timestamp:
Mar 18, 2003, 4:58:49 AM (22 years ago)
Author:
bird
Message:

emx is kind of working again...

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kmk/parse.c

    r30 r35  
    252252static void ParseUnreadc __P((int));
    253253static void ParseHasCommands __P((ClientData));
    254 static void ParseDoInclude __P((char *));
     254static void ParseDoInclude __P((char *, char));
    255255static void ParseDoError __P((char *));
    256256#ifdef SYSVINCLUDE
     
    540540         * If we have noted the existence of a .MAIN, it means we need
    541541         * to add the sources of said target to the list of things
    542          * to create. The string 'src' is likely to be free, so we
     542         * to create. The string 'src' is likely to be efree, so we
    543543         * must make a new copy of it. Note that this will only be
    544544         * invoked if the user didn't specify a target on the command
     
    765765
    766766                if (freeIt) {
    767                     free(result);
     767                    efree(result);
    768768                }
    769769                cp += length-1;
     
    14541454
    14551455        Var_Set(line, cp, ctxt);
    1456         free(cp);
     1456        efree(cp);
    14571457    } else if (type == VAR_SHELL) {
    14581458        Boolean freeCmd = FALSE; /* TRUE if the command needs to be freed, i.e.
     
    14721472        res = Cmd_Exec(cp, &err);
    14731473        Var_Set(line, res, ctxt);
    1474         free(res);
     1474        efree(res);
    14751475
    14761476        if (err)
     
    14781478
    14791479        if (freeCmd)
    1480             free(cp);
     1480            efree(cp);
    14811481    } else {
    14821482        /*
     
    16051605 */
    16061606static void
    1607 ParseDoInclude (file)
     1607ParseDoInclude (file, chPre)
    16081608    char          *file;        /* file specification */
     1609    char           chPre;       /* Preprocessor char */
    16091610{
    16101611    char          *fullname;    /* full pathname of file */
     
    16211622    }
    16221623
     1624    #ifndef NMAKE
    16231625    if ((*file != '"') && (*file != '<')) {
    16241626        Parse_Error (PARSE_FATAL,
    1625             ".include filename must be delimited by '\"' or '<'");
     1627            "%cinclude filename must be delimited by '\"' or '<'", chPre);
    16261628        return;
    16271629    }
     1630    #endif
    16281631
    16291632    /*
     
    16371640    } else {
    16381641        isSystem = FALSE;
     1642        #ifdef NMAKE
     1643        if (*file == '"')
     1644            endc = '"';
     1645        else
     1646        {
     1647            endc = '\0';
     1648            file--;
     1649        }
     1650        #else
    16391651        endc = '"';
     1652        #endif
    16401653    }
    16411654
     
    16471660    }
    16481661
     1662    #ifdef NMAKE
     1663    if (endc && *cp != endc) {
     1664    #else
    16491665    if (*cp != endc) {
     1666    #endif
    16501667        Parse_Error (PARSE_FATAL,
    16511668                     "Unclosed %cinclude filename. '%c' expected",
    1652                      '.', endc);
     1669                     chPre, endc);
    16531670        return;
    16541671    }
     
    16921709                fullname = Dir_FindFile(newName, dirSearchPath);
    16931710            }
    1694             free (newName);
     1711            efree (newName);
    16951712            *prefEnd = '/';
    16961713        } else {
    16971714            fullname = (char *)NULL;
    16981715        }
    1699         free (Fname);
     1716        efree (Fname);
    17001717    } else {
    17011718        fullname = (char *)NULL;
     
    17251742    if (fullname == (char *) NULL) {
    17261743        *cp = endc;
    1727         Parse_Error (PARSE_FATAL, "Could not find %s", file);
     1744        Parse_Error (PARSE_FATAL, "Could not find '%s'", file);
    17281745        return;
    17291746    }
    17301747
    1731     free(file);
     1748    efree(file);
    17321749
    17331750    /*
     
    18821899            fullname = Dir_FindFile(newName, dirSearchPath);
    18831900        }
    1884         free (newName);
     1901        efree (newName);
    18851902        *prefEnd = '/';
    18861903    } else {
     
    19771994
    19781995    ifile = (IFile *) Lst_DeQueue (includes);
    1979     free ((Address) fname);
     1996    efree ((Address) fname);
    19801997    fname = ifile->fname;
    19811998    lineno = ifile->lineno;
     
    19832000        (void) fclose (curFILE);
    19842001    if (curPTR) {
    1985         free((Address) curPTR->str);
    1986         free((Address) curPTR);
     2002        efree((Address) curPTR->str);
     2003        efree((Address) curPTR);
    19872004    }
    19882005    curFILE = ifile->F;
    19892006    curPTR = ifile->p;
    1990     free ((Address)ifile);
     2007    efree ((Address)ifile);
    19912008    return (CONTINUE);
    19922009}
     
    20832100        Buf_AddByte(buf, (Byte)'\0');
    20842101        line = (char *)Buf_GetAll(buf, &lineLength);
     2102    #ifdef NMAKE
     2103    } while (skip == 1 && line[0] != '.' && line[0] != '!');
     2104    #else
    20852105    } while (skip == 1 && line[0] != '.');
     2106    #endif
    20862107
    20872108    Buf_Destroy(buf, FALSE);
     
    23282349                 */
    23292350                do {
    2330                     free (line);
     2351                    efree (line);
    23312352                    line = ParseSkipLine(1);
    23322353                } while (line && Cond_Eval(line) != COND_PARSE);
     
    23352356                /*FALLTHRU*/
    23362357            case COND_PARSE:
    2337                 free ((Address) line);
     2358                efree ((Address) line);
    23382359                line = ParseReadLine();
    23392360                break;
     
    23412362                if (For_Eval(line)) {
    23422363                    int ok;
    2343                     free(line);
     2364                    efree(line);
    23442365                    do {
    23452366                        /*
     
    23532374                        }
    23542375                        ok = For_Eval(line);
    2355                         free(line);
     2376                        efree(line);
    23562377                    }
    23572378                    while (ok);
     
    24302451        while ((line = ParseReadLine ()) != NULL) {
    24312452//debugkso: fprintf(stderr, "%s(%d): inLine=%d line=%s\n", fname, lineno, inLine, line);
     2453            #ifdef NMAKE
     2454            if (*line == '.' || *line == '!') {
     2455            #else
    24322456            if (*line == '.') {
     2457            #endif
    24332458                /*
    24342459                 * Lines that begin with the special character are either
     
    24392464                }
    24402465                if (strncmp (cp, "include", 7) == 0) {
    2441                     ParseDoInclude (cp + 7);
     2466                    ParseDoInclude (cp + 7, *line);
    24422467                    goto nextLine;
    24432468                } else if (strncmp (cp, "error", 5) == 0) {
     
    25532578
    25542579                    cp = Var_Subst (NULL, line, VAR_CMD, TRUE);
    2555                     free (line);
     2580                    efree (line);
    25562581                    line = cp;
    25572582
     
    25732598            nextLine:
    25742599
    2575             free (line);
     2600            efree (line);
    25762601        }
    25772602        /*
     
    26142639Parse_End()
    26152640{
    2616     Lst_Destroy(targCmds, (void (*) __P((ClientData))) free);
     2641    Lst_Destroy(targCmds, (void (*) __P((ClientData))) efree);
    26172642    if (targets)
    26182643        Lst_Destroy(targets, NOFREE);
Note: See TracChangeset for help on using the changeset viewer.