예제 #1
0
extern bool RcIoTextInputShutdown( void )
/***************************************/
{
    if( InStack.Buffer != NULL ) {
        RESFREE( InStack.Buffer );
        InStack.Buffer = NULL;
        InStack.BufferSize = 0;
        if( IsEmptyFileStack( InStack ) ) {
            return( false );
        } else {
            while( !IsEmptyFileStack( InStack ) ) {
                RcIoPopTextInputFile();
            }
            // return( true );
        }
    }
    return( true );
} /* RcIoTextInputShutdown */
예제 #2
0
파일: rcio.c 프로젝트: jossk/open-watcom-v2
extern const LogicalFileInfo * RcIoGetLogicalFileInfo( void )
/***********************************************************/
{
    if( IsEmptyFileStack( InStack ) ) {
        return( NULL );
    } else {
        return( &(InStack.Current->Logical) );
    }
} /* RcIoGetLogicalFileInfo */
예제 #3
0
파일: rcio.c 프로젝트: jossk/open-watcom-v2
extern int RcIoTextInputShutdown( void )
/**************************************/
{
    if( InStack.Buffer != NULL ) {
        RcMemFree( InStack.Buffer );
        InStack.Buffer = NULL;
        InStack.BufferSize = 0;
        if( IsEmptyFileStack( InStack ) ) {
            return( FALSE );
        } else {
            while( !IsEmptyFileStack( InStack ) ) {
                RcIoPopInputFile();
            }
            // return( TRUE );
        }
    }
    return( TRUE );
} /* RcIoTextInputShutdown */
예제 #4
0
파일: rcio.c 프로젝트: jossk/open-watcom-v2
extern int RcIoIsCOrHFile( void )
/*******************************/
/* returns true if the current file is a .c or .h file, false otherwise */
{
    if( IsEmptyFileStack( InStack ) ) {
        return( FALSE );
    } else {
        return( InStack.Current->Logical.IsCOrHFile );
    }
} /* RcIoIsCOrHFile */
예제 #5
0
파일: rcio.c 프로젝트: jossk/open-watcom-v2
extern void RcIoOverrideIsCOrHFlag( void )
/****************************************/
{
    LogicalFileInfo *   log;

    if( !IsEmptyFileStack( InStack ) ) {
        log = &(InStack.Current->Logical);
        log->IsCOrHFile = FALSE;
    }
} /* RcIoOverrideIsCOrHFlag */
예제 #6
0
static void SetPhysFileOffset( FileStack * stack )
/************************************************/
{
    PhysFileInfo    *phys;
    size_t          charsinbuff;

    if( !IsEmptyFileStack( *stack ) ) {
        phys = &(stack->Current->Physical);
        charsinbuff = stack->BufferSize - ( stack->NextChar - stack->Buffer );
        phys->Offset = ftell( phys->fp ) - charsinbuff;
    }
} /* SetPhysFileOffset */
예제 #7
0
파일: rcio.c 프로젝트: jossk/open-watcom-v2
extern void RcIoSetLogicalFileInfo( int linenum, char * filename )
/****************************************************************/
{
    LogicalFileInfo *   log;

    if( !IsEmptyFileStack( InStack ) ) {
        log = &(InStack.Current->Logical);
        log->LineNum = linenum;
        if( filename != NULL ) {
            strncpy( log->Filename, filename, _MAX_PATH );
            RcIoSetIsCOrHFlag();
        }
    }
} /* RcIoSetLogicalFileInfo */
예제 #8
0
파일: rcio.c 프로젝트: jossk/open-watcom-v2
extern int RcIoPopInputFile( void )
/*********************************/
{
    PhysFileInfo *  phys;

    phys = &(InStack.Current->Physical);
    ClosePhysicalFile( phys );
    InStack.Current--;
    if( IsEmptyFileStack( InStack ) ) {
        return( TRUE );
    } else {
        ReadBuffer( &(InStack) );
        return( FALSE );
    }
} /* RcIoPopInputFile */
예제 #9
0
bool RcIoPopTextInputFile( void )
/*******************************/
{
    PhysFileInfo *  phys;

    phys = &(InStack.Current->Physical);
    ClosePhysicalFile( phys );
    FreeLogicalFilename();
    FreePhysicalFilename();
    InStack.Current--;
    if( IsEmptyFileStack( InStack ) ) {
        return( true );
    } else {
        ReadBuffer( &(InStack) );
        return( false );
    }
} /* RcIoPopTextInputFile */
예제 #10
0
extern void RcIoSetIsCOrHFlag( void )
/***********************************/
{
    LogicalFileInfo *   log;
    char                ext[_MAX_EXT];

    if( !IsEmptyFileStack( InStack ) ) {
        log = &(InStack.Current->Logical);
        _splitpath( log->Filename, NULL, NULL, NULL, ext );
        /* if this is a c or h file ext will be '.', '[ch]', '\0' */
        if( ( ext[1] == 'c' || ext[1] == 'h' || ext[1] == 'C' || ext[1] == 'H' ) && ext[2] == '\0' ) {
            /* if the logical file is a c or h file */
            log->IsCOrHFile = true;
        } else {
            log->IsCOrHFile = false;
        }
    }
} /* RcIoSetIsCOrHFlag */
예제 #11
0
int RcIoGetChar( void )
/*********************/
{
    bool    isempty;
    bool    error;

    if( IsEmptyFileStack( InStack ) ) {
        return( EOF );
    }

    if( InStack.NextChar >= InStack.EofChar ) {
        /* we have reached the end of the buffer */
        if( InStack.NextChar >= InStack.Buffer + InStack.BufferSize ) {
            /* try to read next buffer */
            error = ReadBuffer( &(InStack) );
            if( error ) {
                /* this error is reported in ReadBuffer so just terminate */
                RcFatalError( ERR_NO_MSG );
            }
        }
        if( InStack.NextChar >= InStack.EofChar ) {
            /* this is a real EOF */
            /* unstack one file */
            isempty = RcIoPopTextInputFile();
            if( isempty ) {
                return( EOF );
            } else {
                /* if we are still at the EOF char, there has been an error */
                if( InStack.NextChar >= InStack.EofChar ) {
                    /* this error is reported in ReadBuffer so just terminate */
                    RcFatalError( ERR_NO_MSG );
                } else {
                    /* return \n which will end the current token properly */
                    /* if it it is not a string and end it with a runaway */
                    /* string error for strings */
                    return( '\n' );
                }
            }
        }
    }
    return( GetLogChar( &InStack ) );
} /* RcIoGetChar */
예제 #12
0
extern void RcIoSetLogicalFileInfo( int linenum, const char * filename )
/**********************************************************************/
{
    LogicalFileInfo *   log;

    if( !IsEmptyFileStack( InStack ) ) {
        log = &(InStack.Current->Logical);
        log->LineNum = linenum;
        if( filename != NULL ) {
            if( log->Filename == NULL ) {
                log->Filename = RESALLOC( strlen( filename ) + 1 );
                strcpy( log->Filename, filename );
            } else if( strcmp( log->Filename, filename ) != 0 ) {
                RESFREE( log->Filename );
                log->Filename = RESALLOC( strlen( filename ) + 1 );
                strcpy( log->Filename, filename );
            }
            RcIoSetIsCOrHFlag();
        }
    }
} /* RcIoSetLogicalFileInfo */