Beispiel #1
0
int ConvertFiles( void )
/**********************/
{
    WResFileID      infile;
    int             error;
    int             fileerror;      /* error while deleting or renaming */

    infile = ResOpenFileRO( CmdLineParms.InFileName );
    if (infile == -1) {
        perror( "Error (input file): " );
        return( TRUE );
    }

    if (WResIsWResFile( infile )) {
        /* the input file is in Open Watcom format so convert to MS format */
        error = ConvertFileWResToMRes( infile );
    } else {
        /* the input file is in MS format so convert to Open Watcom format */
        error = ConvertFileMResToWRes( infile );
    }

    ResCloseFile( infile );

    if (error) {
        puts("Error writing to output file");
        fileerror = remove( TMP_FILENAME );
        if (fileerror) {
            perror( NULL );
        }
    } else {
        error = ChangeTmpToOutFile();
    }

    return( error );
} /* ConvertFiles */
Beispiel #2
0
static void Pass1ResFileShutdown( void )
/**************************************/
{
    bool        error;

    error = false;
    if( CurrResFile.fp != NULL ) {
        if( CmdLineParms.TargetOS == RC_TARGET_OS_OS2 ) {
            WriteOS2Tables();
        } else {
            WriteWINTables();
        }
        if( !ErrorHasOccured ) {
            if( CurrResFile.IsWatcomRes ) {
                error = WResWriteDir( CurrResFile.fp, CurrResFile.dir );
                if( error ) {
                    RcError( ERR_WRITTING_RES_FILE, CurrResFile.filename, LastWresErrStr() );
                }
            }
            if( !error ) {
                ChangeTmpToOutFile( CurrResFile.fp, CmdLineParms.OutResFileName );
            }
        }
        if( CurrResFile.dir != NULL ) {
            WResFreeDir( CurrResFile.dir );
            CurrResFile.dir = NULL;
        }
        if( ResCloseFile( CurrResFile.fp ) ) {
            RcError( ERR_CLOSING_TMP, CurrResFile.filename, LastWresErrStr() );
        }
        CurrResFile.fp = NULL;
    }
} /* Pass1ResFileShutdown */
Beispiel #3
0
extern void RcPass2IoShutdown( bool noerror )
/******************************************/
{
    ClosePass2FilesAndFreeMem();
    if( Pass2Info.IoBuffer != NULL ) {
        RESFREE( Pass2Info.IoBuffer );
        Pass2Info.IoBuffer = NULL;
    }
    if( noerror ) {
        ChangeTmpToOutFile( Pass2Info.TmpFile.fp, CmdLineParms.OutExeFileName );
    }
    ResCloseFile( Pass2Info.TmpFile.fp );
    Pass2Info.TmpFile.fp = NULL;

} /* RcPass2IoShutdown */
Beispiel #4
0
extern void RcPass2IoShutdown( int noerror )
/******************************************/
{
    ClosePass2FilesAndFreeMem();
    if( Pass2Info.IoBuffer != NULL ) {
        RcMemFree( Pass2Info.IoBuffer );
        Pass2Info.IoBuffer = NULL;
    }
    if( noerror ) {
        ChangeTmpToOutFile( Pass2Info.TmpFileName,
                            CmdLineParms.OutExeFileName);
    } else {
        UnregisterTmpFile( Pass2Info.TmpFileName );
        remove( Pass2Info.TmpFileName );
    }
} /* RcPass2IoShutdown */
Beispiel #5
0
static void Pass1ResFileShutdown( void )
/**************************************/
{
    int         error;

    error = FALSE;
    if( CurrResFile.IsOpen ) {
        if( CmdLineParms.TargetOS == RC_TARGET_OS_OS2 )
            WriteOS2Tables();
        else
            WriteTables();
        if( ErrorHasOccured ) {
            ResCloseFile( CurrResFile.handle );
            CurrResFile.IsOpen = false;
            RemoveCurrResFile();
        } else {
            if (CurrResFile.IsWatcomRes) {
                error = WResWriteDir( CurrResFile.handle, CurrResFile.dir );
                if( error ) {
                    RcError( ERR_WRITTING_RES_FILE, CurrResFile.filename,
                                LastWresErrStr() );
                }
            }
            if( ResCloseFile( CurrResFile.handle ) == -1 ) {
                RcError( ERR_CLOSING_TMP, CurrResFile.filename,
                         LastWresErrStr() );
                remove( CurrResFile.filename );
                UnregisterTmpFile( CurrResFile.filename );
            } else if( !error ) {
#ifdef USE_TEMPFILE
                ChangeTmpToOutFile( CurrResFile.filename,
                                CmdLineParms.OutResFileName );
#endif
            }
            CurrResFile.IsOpen = false;
        }
        WResFreeDir( CurrResFile.dir );
        CurrResFile.dir = NULL;
    }
} /* Pass1ResFileShutdown */