compile.c
int PushFile(ParseContext *c, const char *name)
{
    System *sys = c->sys;
    IncludedFile *inc;
    ParseFile *f;
    void *fp;
    
    /* check to see if the file has already been included */
    for (inc = c->includedFiles; inc != NULL; inc = inc->next)
        if (strcmp(name, inc->name) == 0)
            return VMTRUE;
    
    /* add this file to the list of already included files */
    if (!(inc = (IncludedFile *)AllocateHighMemory(sys, sizeof(IncludedFile) + strlen(name))))
        Abort(sys, "insufficient memory");
    strcpy(inc->name, name);
    inc->next = c->includedFiles;
    c->includedFiles = inc;

    /* open the input file */
    if (!(fp = VM_open(sys, name, "r")))
        return VMFALSE;
    
    /* allocate a parse file structure */
    if (!(f = (ParseFile *)AllocateHighMemory(sys, sizeof(ParseFile))))
        Abort(sys, "insufficient memory");
    
    /* initialize the parse file structure */
    f->fp = fp;
    f->file = inc;
    f->lineNumber = 0;
    
    /* push the file onto the input file stack */
    f->next = c->currentFile;
    c->currentFile = f;
    
    /* return successfully */
    return VMTRUE;
}
/* PushFile - push a file onto the input file stack */
push a file onto the input file stack
push a file onto the input file stack
int PushFile(ParseContext *c, const char *name)
{
    System *sys = c->sys;
    IncludedFile *inc;
    ParseFile *f;
    void *fp;
    for (inc = c->includedFiles; inc != NULL; inc = inc->next)
        if (strcmp(name, inc->name) == 0)
            return VMTRUE;
    if (!(inc = (IncludedFile *)AllocateHighMemory(sys, sizeof(IncludedFile) + strlen(name))))
        Abort(sys, "insufficient memory");
    strcpy(inc->name, name);
    inc->next = c->includedFiles;
    c->includedFiles = inc;
    if (!(fp = VM_open(sys, name, "r")))
        return VMFALSE;
    if (!(f = (ParseFile *)AllocateHighMemory(sys, sizeof(ParseFile))))
        Abort(sys, "insufficient memory");
    f->fp = fp;
    f->file = inc;
    f->lineNumber = 0;
    f->next = c->currentFile;
    c->currentFile = f;
    return VMTRUE;
}
int PushFile ( ParseContext * c , const char * name ) { System * sys = c -> sys ; IncludedFile * inc ; ParseFile * f ; void * fp ; for ( inc = c -> includedFiles ; inc != NULL ; inc = inc -> next ) if ( strcmp ( name , inc -> name ) == 0 ) return VMTRUE ; if ( ! ( inc = ( IncludedFile * ) AllocateHighMemory ( sys , sizeof ( IncludedFile ) + strlen ( name ) ) ) ) Abort ( sys , " " ) ; strcpy ( inc -> name , name ) ; inc -> next = c -> includedFiles ; c -> includedFiles = inc ; if ( ! ( fp = VM_open ( sys , name , " " ) ) ) return VMFALSE ; if ( ! ( f = ( ParseFile * ) AllocateHighMemory ( sys , sizeof ( ParseFile ) ) ) ) Abort ( sys , " " ) ; f -> fp = fp ; f -> file = inc ; f -> lineNumber = 0 ; f -> next = c -> currentFile ; c -> currentFile = f ; return VMTRUE ; }
PushFile - push a file onto the input file stack
PushFile - push a file onto the input file stack
/* check to see if the file has already been included */ /* add this file to the list of already included files */ /* open the input file */ /* allocate a parse file structure */ /* initialize the parse file structure */ /* push the file onto the input file stack */ /* return successfully */