コード例 #1
0
ファイル: semdiag2.c プロジェクト: Azarien/open-watcom-v2
void SemOS2AddDlgincResource( WResID *name, char *filename )
/**********************************************************/
{
    ResLocation loc;
    bool        error;
    int         err_code;

    loc.start = SemStartResource();
    error = ResWriteString( filename, false, CurrResFile.handle );
    if( error ) {
        err_code = LastWresErr();
        goto OutputWriteError;
    }
    loc.len = SemEndResource( loc.start );
    SemAddResourceFree( name, WResIDFromNum( OS2_RT_DLGINCLUDE ),
                        MEMFLAG_DISCARDABLE | MEMFLAG_MOVEABLE | MEMFLAG_PURE,
                        loc );
    RCFREE( filename );
    return;

OutputWriteError:
    RcError( ERR_WRITTING_RES_FILE, CurrResFile.filename, strerror( err_code ) );
    ErrorHasOccured = true;
    RCFREE( filename );
    return;
}
コード例 #2
0
ファイル: semdiag2.c プロジェクト: Azarien/open-watcom-v2
static void SemOS2FreeDiagCtrlList( FullDiagCtrlListOS2 *list )
/*************************************************************/
{
    FullDialogBoxControlOS2     *ctrl;
    FullDialogBoxControlOS2     *oldctrl;

    ctrl = list->head;
    while( ctrl != NULL ) {
        /* free the contents of pointers within the structure */
        if( ctrl->ctrl.ClassID != NULL ) {
            RCFREE( ctrl->ctrl.ClassID );
        }
        if( ctrl->ctrl.Text != NULL ) {
            RCFREE( ctrl->ctrl.Text );
        }

        oldctrl = ctrl;

        if( ctrl->children != NULL )
            SemOS2FreeDiagCtrlList( ctrl->children );

        SemFreeDataElemList( ctrl->dataListHead );
        SemOS2FreePresParamList( ctrl->presParams );

        ctrl = ctrl->next;

        RCFREE( oldctrl );
    }

    RCFREE( list );
} /* SemOS2FreeDiagCtrlList */
コード例 #3
0
ファイル: semraw.c プロジェクト: MikeyG/open-watcom-v2
ResLocation SemCopyRawFile( const char *filename )
/************************************************/
{
    WResFileID      handle;
    RcStatus        ret;
    char            *buffer;
    char            full_filename[_MAX_PATH];
    ResLocation     loc;
    int             err_code;
    WResFileOffset  pos;

    buffer = RCALLOC( BUFFER_SIZE );

    if( RcFindResource( filename, full_filename ) == -1 ) {
        RcError( ERR_CANT_FIND_FILE, filename );
        goto HANDLE_ERROR;
    }

    if( AddDependency( full_filename ) )
        goto HANDLE_ERROR;

    handle = RcIoOpenInput( full_filename, O_RDONLY | O_BINARY );
    if( handle == NIL_HANDLE ) {
        RcError( ERR_CANT_OPEN_FILE, filename, strerror( errno ) );
        goto HANDLE_ERROR;
    }

    loc.start = SemStartResource();

    pos = RCTELL( handle );
    if( pos == -1 ) {
        RcError( ERR_READING_DATA, full_filename, strerror( errno ) );
        RCCLOSE( handle );
        goto HANDLE_ERROR;
    } else {
        ret = SemCopyDataUntilEOF( pos, handle, buffer, BUFFER_SIZE, &err_code );
        if( ret != RS_OK ) {
            ReportCopyError( ret, ERR_READING_DATA, full_filename, err_code );
            RCCLOSE( handle );
            goto HANDLE_ERROR;
        }
    }

    loc.len = SemEndResource( loc.start );

    RCCLOSE( handle );

    RCFREE( buffer );

    return( loc );


HANDLE_ERROR:
    ErrorHasOccured = true;
    loc.start = 0;
    loc.len = 0;
    RCFREE( buffer );
    return( loc );
}
コード例 #4
0
ファイル: semsnglw.c プロジェクト: MikeyG/open-watcom-v2
static void AddBitmapResource( WResID * name, ResMemFlags flags,
                            const char * filename )
/**************************************************************/
{
    BitmapFileHeader    head;
    WResFileID          handle;
    RcStatus            ret;
    int                 err_code;

    handle = RcIoOpenInput( filename, O_RDONLY | O_BINARY );
    if( handle == NIL_HANDLE)
        goto FILE_OPEN_ERROR;

    ret = readBitmapFileHeader( handle, &head, &err_code );
    if( ret != RS_OK )
        goto READ_HEADER_ERROR;

    if( head.Type != BITMAP_MAGIC )
        goto NOT_BITMAP_ERROR;

    ret = copyBitmap( &head, handle, name, flags, &err_code );
    if( ret != RS_OK )
        goto COPY_BITMAP_ERROR;

    RCCLOSE( handle );

    return;


FILE_OPEN_ERROR:
    RcError( ERR_CANT_OPEN_FILE, filename, strerror( errno ) );
    ErrorHasOccured = true;
    RCFREE( name );
    return;

READ_HEADER_ERROR:
    ReportCopyError( ret, ERR_READING_BITMAP, filename, err_code );
    ErrorHasOccured = true;
    RCFREE( name );
    RCCLOSE( handle );
    return;

NOT_BITMAP_ERROR:
    RcError( ERR_NOT_BITMAP_FILE, filename );
    ErrorHasOccured = true;
    RCFREE( name );
    RCCLOSE( handle );
    return;

COPY_BITMAP_ERROR:
    ReportCopyError( ret, ERR_READING_BITMAP, filename, err_code );
    ErrorHasOccured = true;
    RCCLOSE( handle );
    return;
}
コード例 #5
0
ファイル: semverw.c プロジェクト: ABratovic/open-watcom-v2
static void FreeValList( FullVerValueList * list )
/************************************************/
{
    int     curr_val;

    for( curr_val = 0; curr_val < list->NumItems; curr_val++ ) {
        FreeValItem( list->Item + curr_val );
    }
    RCFREE( list->Item );
    RCFREE( list );
}
コード例 #6
0
ファイル: dbtable.c プロジェクト: ABratovic/open-watcom-v2
void FiniTable( void ) {
/***********************/
    if( charInfo.index != NULL ) {
        RCFREE( charInfo.index );
        charInfo.index = NULL;
    }
    if( charInfo.entries != NULL ) {
        RCFREE( charInfo.entries );
        charInfo.entries = NULL;
    }
}
コード例 #7
0
ファイル: semverw.c プロジェクト: ABratovic/open-watcom-v2
static void FreeVerBlock( FullVerBlock * block )
/**********************************************/
{
    RCFREE( block->Head.Key );
    if( block->Value != NULL ) {
        FreeValList( block->Value );
    }
    if( block->Nest != NULL ) {
        FreeVerBlockNest( block->Nest );
    }

    RCFREE( block );
}
コード例 #8
0
ファイル: semtbarw.c プロジェクト: Azarien/open-watcom-v2
static void semFreeToolBar( ToolBar *toolbar ) {

    ToolBarItems        *cur;
    ToolBarItems        *tmp;

    cur = toolbar->first.next;
    while( cur != NULL ) {
        tmp = cur;
        cur = cur->next;
        RCFREE( tmp );
    }
    RCFREE( toolbar );
}
コード例 #9
0
static void SemOS2FreeMenuItem( FullMenuItemOS2 *curritem )
/*********************************************************/
{
    if( curritem->submenu != NULL ) {
        SemOS2FreeSubMenu( curritem->submenu );
        if (curritem->item.ItemText != NULL) {
            RCFREE( curritem->item.ItemText );
        }
    } else {
        if( curritem->item.ItemText != NULL ) {
            RCFREE( curritem->item.ItemText );
        }
    }
}
コード例 #10
0
ファイル: semaccl2.c プロジェクト: MikeyG/open-watcom-v2
static void SemOS2FreeAccelTable( FullAccelTableOS2 * acctable )
/**************************************************************/
{
    FullAccelEntryOS2   *currentry;
    FullAccelEntryOS2   *oldentry;

    currentry = acctable->head;
    while( currentry != NULL ) {
        oldentry = currentry;
        currentry = currentry->next;
        RCFREE( oldentry );
    }
    RCFREE( acctable );
}
コード例 #11
0
ファイル: semverw.c プロジェクト: ABratovic/open-watcom-v2
static void FreeValItem( VerValueItem * item )
/********************************************/
{
    if( !item->IsNum ) {
        RCFREE( item->Value.String );
    }
}
コード例 #12
0
ファイル: semraw.c プロジェクト: MikeyG/open-watcom-v2
ResLocation SemFlushDataElemList( DataElemList *head, bool call_startend )
/************************************************************************/
{
    DataElemList    *curnode;
    DataElemList    *nextnode;
    ResLocation     resLoc;
    int             i;

    curnode = head;
    nextnode = head;
    resLoc.len = 0;
    if( call_startend ) {
        resLoc.start = SemStartResource();
    } else {
        resLoc.start = 0;
    }
    while( nextnode != NULL ) {
        nextnode = curnode->next;
        for( i = 0; i < curnode->count; i++ ) {
            SemWriteRawDataItem( curnode->data[i] );
        }
        RCFREE( curnode );
        curnode = nextnode;
    }
    if( call_startend ) {
        if( CmdLineParms.MSResFormat
          && CmdLineParms.TargetOS == RC_TARGET_OS_WIN32 ) {
            ResPadDWord( CurrResFile.handle );
        }
        resLoc.len = SemEndResource( resLoc.start );
    }

    return( resLoc );
}
コード例 #13
0
ファイル: exeres2.c プロジェクト: ABratovic/open-watcom-v2
/*
 * WriteOS2ResTable
 * NB when an error occurs this function must return without altering errno
 */
extern RcStatus WriteOS2ResTable( WResFileID handle, OS2ResTable *restab, int *err_code )
/***************************************************************************************/
{
    RcStatus                    ret;
    uint_16                     res_type;
    uint_16                     res_id;
    int                         i;

    ret = RS_OK;
    for( i = 0; i < restab->num_res_segs && ret == RS_OK; i++ ) {
        res_type = restab->resources[i].res_type;
        res_id   = restab->resources[i].res_id;
        if( RCWRITE( handle, &res_type, sizeof( uint_16 ) ) != sizeof( uint_16 ) ) {
            ret = RS_WRITE_ERROR;
        } else {
            if( RCWRITE( handle, &res_id, sizeof( uint_16 ) ) != sizeof( uint_16 ) ) {
                ret = RS_WRITE_ERROR;
            }
        }
    }

    *err_code = errno;
    if( restab->resources != NULL ) {
        RCFREE( restab->resources );
    }

    return( ret );
} /* WriteOS2ResTable */
コード例 #14
0
ファイル: semsngl2.c プロジェクト: ABratovic/open-watcom-v2
static void FreeFontDir( FullFontDir * olddir )
/*********************************************/
{
    FullFontDirEntry *  currentry;
    FullFontDirEntry *  oldentry;

    currentry = olddir->Head;
    while( currentry != NULL ) {
        oldentry = currentry;
        currentry = currentry->Next;

        RCFREE( oldentry );
    }

    RCFREE( olddir );
}
コード例 #15
0
void SemOS2WriteMenu( WResID *name, ResMemFlags flags, FullMenuOS2 *menu,
                   YYTOKENTYPE tokentype, uint_32 codepage )
/***********************************************************************/
{
    ResLocation     loc;
    int             error;
    int             err_code;

    tokentype = tokentype;

    if( !ErrorHasOccured ) {
        loc.start = SemStartResource();
        error = SemOS2WriteSubMenu( menu, &err_code, codepage );
        if( error ) {
            err_code = LastWresErr();
            goto OutputWriteError;
        }
        loc.len = SemEndResource( loc.start );
        SemAddResourceFree( name, WResIDFromNum( OS2_RT_MENU ), flags, loc );
    } else {
        RCFREE( name );
    }

    SemOS2FreeSubMenu( menu );
    return;

OutputWriteError:
    RcError( ERR_WRITTING_RES_FILE, CurrResFile.filename, strerror( err_code ) );
    ErrorHasOccured = TRUE;
    SemOS2FreeSubMenu( menu );
    return;
}
コード例 #16
0
ファイル: semsngl2.c プロジェクト: ABratovic/open-watcom-v2
static RcStatus copyFont( FontInfo * info, WResFileID handle, WResID * name,
                                ResMemFlags flags, int *err_code )
/************************************************************************/
{
    RcStatus            ret;
    char *              buffer;
    ResLocation         loc;
    long                pos;

    buffer = RCALLOC( FONT_BUFFER_SIZE );

    loc.start = SemStartResource();

    if( ResWriteFontInfo( info, CurrResFile.handle ) ) {
        ret = RS_WRITE_ERROR;
        *err_code = LastWresErr();
    } else {
        pos = RCTELL( handle );
        if( pos == -1 ) {
            ret = RS_READ_ERROR;
            *err_code = errno;
        } else {
            ret = SemCopyDataUntilEOF( pos, handle, buffer,
                                         FONT_BUFFER_SIZE, err_code );
        }
    }

    loc.len = SemEndResource( loc.start );
    /* add the font to the RES file directory */
    SemAddResourceFree( name, WResIDFromNum( (long)RT_FONT ), flags, loc );

    RCFREE( buffer );

    return( ret );
} /* copyFont */
コード例 #17
0
ファイル: semsnglw.c プロジェクト: MikeyG/open-watcom-v2
static RcStatus copyBitmap( BitmapFileHeader *head, WResFileID handle,
                            WResID *name, ResMemFlags flags, int *err_code )
/**************************************************************************/
{
    RcStatus            ret;
    char *              buffer;
    ResLocation         loc;
    WResFileOffset      pos;

    buffer = RCALLOC( BITMAP_BUFFER_SIZE );

    loc.start = SemStartResource();

    pos = RCTELL( handle );
    if( pos == -1 ) {
        ret = RS_READ_ERROR;
        *err_code = errno;
    } else {
        ret = CopyData( pos, head->Size - sizeof(BitmapFileHeader),
                          handle, buffer, BITMAP_BUFFER_SIZE, err_code );
    }

    loc.len = SemEndResource( loc.start );
    /* add the bitmap to the RES file directory */
    SemAddResourceFree( name, WResIDFromNum( (long)(pointer_int)RT_BITMAP ), flags, loc );

    RCFREE( buffer );

    return( ret );
} /* copyBitmap */
コード例 #18
0
void SemOS2WriteHelpSubTable( WResID * name, int numWords,
                                     ResMemFlags flags,
                                     FullHelpSubTableOS2 * helptable )
/********************************************************************/
{
    ResLocation     loc;
    bool            error;
    int             err_code;

    if( !ErrorHasOccured ) {
        loc.start = SemStartResource();
        if( helptable != NULL ) {
            helptable->numWords = numWords;
        }
        error = SemOS2WriteHelpSubTableEntries( helptable, CurrResFile.handle );
        if( error ) {
            err_code = LastWresErr();
            goto OutputWriteError;
        }
        loc.len = SemEndResource( loc.start );
        SemAddResourceFree( name, WResIDFromNum( OS2_RT_HELPSUBTABLE ), flags, loc );
    } else {
        RCFREE( name );
    }

    SemOS2FreeHelpSubTable( helptable );
    return;

OutputWriteError:
    RcError( ERR_WRITTING_RES_FILE, CurrResFile.filename, strerror( err_code ) );
    ErrorHasOccured = true;
    SemOS2FreeHelpSubTable( helptable );
    return;

}
コード例 #19
0
static void SemOS2FreeHelpTable( FullHelpTableOS2 *helptable )
/************************************************************/
{
    FullHelpEntryOS2   *currentry;
    FullHelpEntryOS2   *oldentry;

    if( helptable != NULL ) {
        currentry = helptable->head;
        while( currentry != NULL ) {
            oldentry = currentry;
            currentry = currentry->next;
            RCFREE( oldentry );
        }
        RCFREE( helptable );
    }
}
コード例 #20
0
ファイル: semsnglw.c プロジェクト: MikeyG/open-watcom-v2
static RcStatus readCurFileDir( WResFileID handle, FullCurDir *dir, int *err_code )
/*********************************************************************************/
/* this funtion returns one of the above enum constants */
{
    RcStatus            ret;
    int                 currentry;
    FullCurDirEntry *   entry;

    ret = readIcoCurFileDirHeader( &(dir->Header), handle, err_code );
    /* type 2 is a cursor file */
    if( ret == RS_OK && dir->Header.Type != 2 ) {
        return( RS_INVALID_RESOURCE );
    }

    for( currentry = 0; ret == RS_OK && currentry < dir->Header.ResCount;
                            currentry++ ) {
        entry = RCALLOC( sizeof(FullCurDirEntry) );
        entry->Next = NULL;
        entry->Prev = NULL;
        entry->IsCurFileEntry = true;
        ret = readCurFileDirEntry( &(entry->Entry.Cur), handle, err_code );
        if( ret != RS_OK ) {
            RCFREE( entry );
        } else {
            ResAddLLItemAtEnd( (void **) &(dir->Head), (void **) &(dir->Tail), entry );
        }
    }
    return( ret );

} /* readCurFileDir */
コード例 #21
0
ファイル: semaccl2.c プロジェクト: MikeyG/open-watcom-v2
void SemOS2WriteAccelTable( WResID *name, ResMemFlags flags, uint_32 codepage,
                                                FullAccelTableOS2 *acctable )
/****************************************************************************/
{
    ResLocation     loc;
    bool            error;
    int             err_code;

    if( !ErrorHasOccured ) {
        loc.start = SemStartResource();
        error = writeAccelTableEntries( acctable, CurrResFile.handle, codepage );
        if( error ) {
            err_code = LastWresErr();
            goto OutputWriteError;
        }
        loc.len = SemEndResource( loc.start );
        SemAddResourceFree( name, WResIDFromNum( OS2_RT_ACCELTABLE ), flags, loc );
    } else {
        RCFREE( name );
    }

    SemOS2FreeAccelTable( acctable );
    return;

OutputWriteError:
    RcError( ERR_WRITTING_RES_FILE, CurrResFile.filename,
             strerror( err_code ) );
    ErrorHasOccured = true;
    SemOS2FreeAccelTable( acctable );
    return;
}
コード例 #22
0
static void SemOS2FreeHelpSubTable( FullHelpSubTableOS2 *helptable )
/******************************************************************/
{
    FullHelpSubEntryOS2   *currentry;
    FullHelpSubEntryOS2   *oldentry;

    if( helptable != NULL ) {
        currentry = helptable->head;
        while( currentry != NULL ) {
            SemFreeDataElemList( currentry->dataListHead );
            oldentry = currentry;
            currentry = currentry->next;
            RCFREE( oldentry );
        }
        RCFREE( helptable );
    }
}
コード例 #23
0
static void SemOS2FreeSubMenu( FullMenuOS2 *submenu )
/***************************************************/
{
    FullMenuItemOS2   *curritem;
    FullMenuItemOS2   *olditem;

    if( submenu != NULL ) {
        curritem = submenu->head;
        while( curritem != NULL ) {
            SemOS2FreeMenuItem( curritem );
            olditem = curritem;
            curritem = curritem->next;
            RCFREE( olditem );
        }

        RCFREE( submenu );
    }
}
コード例 #24
0
ファイル: semresfl.c プロジェクト: Azarien/open-watcom-v2
static bool copyResourcesFromRes( const char *full_filename )
/***********************************************************/
{
    WResFileID          handle;
    WResDir             dir;
    bool                dup_discarded;
    WResDirWindow       wind;
    char                *buffer;
    bool                error;

    buffer = NULL;
    dir = WResInitDir();
    handle = RcIoOpenBinaryInput( full_filename );
    if( handle == WRES_NIL_HANDLE ) {
        RcError( ERR_CANT_OPEN_FILE, full_filename, strerror( errno ) );
        goto HANDLE_ERROR;
    }

    error = WResReadDir( handle, dir, &dup_discarded );
    if( error ) {
        switch( LastWresStatus() ) {
        case WRS_BAD_SIG:
            RcError( ERR_INVALID_RES, full_filename );
            break;
        case WRS_BAD_VERSION:
            RcError( ERR_BAD_RES_VER, full_filename );
            break;
        default:
            RcError( ERR_READING_RES, full_filename, LastWresErrStr() );
            break;
        }
        goto HANDLE_ERROR;
    }

    if( WResGetTargetOS( dir ) != WResGetTargetOS( CurrResFile.dir ) ) {
        RcError( ERR_RES_OS_MISMATCH, full_filename );
        goto HANDLE_ERROR;
    }
    buffer = RCALLOC( BUFFER_SIZE );
    wind = WResFirstResource( dir );
    while( !WResIsEmptyWindow( wind ) ) {
        copyAResource( handle, &wind, buffer, full_filename );
        wind = WResNextResource( wind, dir );
    }
    RCFREE( buffer );
    WResFreeDir( dir );
    RCCLOSE( handle );
    return( false );

HANDLE_ERROR:
    ErrorHasOccured = true;
    WResFreeDir( dir );
    if( handle != WRES_NIL_HANDLE )
        RCCLOSE( handle );
    return( true );
}
コード例 #25
0
ファイル: semdiag2.c プロジェクト: Azarien/open-watcom-v2
static void SemOS2FreePresParamList( PresParamListOS2 *list )
/***********************************************************/
{
    PresParamsOS2       *presparam;
    PresParamsOS2       *currparam;

    if( list == NULL )
        return;

    presparam = list->head;
    while( presparam != NULL ) {
        RCFREE( presparam->Name );
        SemFreeDataElemList( presparam->dataList );
        currparam = presparam;
        presparam = presparam->next;
        RCFREE( currparam );
    }
    RCFREE( list );
}
コード例 #26
0
ファイル: semsnglw.c プロジェクト: MikeyG/open-watcom-v2
void SemWINAddMessageTable( WResID *name, ScanString *filename ) {
/****************************************************************/

    ResLocation         start;

    if( CmdLineParms.TargetOS == RC_TARGET_OS_WIN32 ) {
        start = SemCopyRawFile( filename->string );
        RCFREE( filename->string );
        RCFREE( filename );
        SemAddResourceFree( name, WResIDFromNum( (long)(pointer_int)RT_MESSAGETABLE ),
                            MEMFLAG_MOVEABLE | MEMFLAG_PURE, start );
    } else {
        RcError( ERR_NT_KEYWORD, SemWINTokenToString( Y_MESSAGETABLE ) );
        ErrorHasOccured = true;
        RCFREE( name );
        RCFREE( filename->string );
        RCFREE( filename );
    }
}
コード例 #27
0
ファイル: semdiag2.c プロジェクト: Azarien/open-watcom-v2
/* The OS/2 dialog templates present us with a problem because the
   template items contain a number of offsets that are not known until
   the template is processed; this means we cannot just start spitting
   the data into a file. Instead we build an in-memory image of the
   resource (the size must be < 64K) and then dump the entire resource
   into the file - which certainly shouldn't hurt performance either.
*/
void SemOS2WriteDialogTemplate( WResID *name, ResMemFlags flags,
                                       uint_32 codepage,
                                       FullDiagCtrlListOS2 *ctrls )
/*********************************************************************/
{
    ResLocation              loc;
    int                      err_code;
    bool                     error;
    int                      size;
    DialogHeaderOS2          *head = NULL;
    char                     *tmpl;
    char                     *ptr;

    size = sizeof( DialogHeaderOS2 ) + SemOS2CalcControlSize( ctrls );
    if( size > 65536 ) {
        // TODO: Error, template is too big
    }

    tmpl = RCALLOC( size );

    head = (DialogHeaderOS2 *)tmpl;
    InitOS2DialogBoxHeader( head, codepage );
    head->Size = size;
    ptr = tmpl + sizeof( DialogHeaderOS2 );

    // Create the DLGTITEM array in memory
    ptr = SemOS2BuildTemplateArray( ptr, ctrls );

    // Dump all other data into memory and update the offsets
    SemOS2DumpTemplateData( tmpl, ptr, ctrls );

    // Write the resource to file
    loc.start = SemStartResource();

    error = ResOS2WriteDlgTemplate( tmpl, size, CurrResFile.handle );
    if( error ) {
        err_code = LastWresErr();
        goto OutputWriteError;
    }

    RCFREE( tmpl );

    loc.len = SemEndResource( loc.start );
    SemAddResourceFree( name, WResIDFromNum( OS2_RT_DIALOG ), flags, loc );

    SemOS2FreeDiagCtrlList( ctrls );

    return;

OutputWriteError:
    RcError( ERR_WRITTING_RES_FILE, CurrResFile.filename, strerror( err_code )  );
    ErrorHasOccured = true;
    SemOS2FreeDiagCtrlList( ctrls );
    return;
} /* SemOS2WriteDialogTemplate */
コード例 #28
0
ファイル: semsnglw.c プロジェクト: MikeyG/open-watcom-v2
static RcStatus copyCursors( FullCurDir * dir, WResFileID handle,
                             ResMemFlags flags, int *err_code )
/***********************************************************************/
/* This function uses the same size of buffers to copy info as for icons */
{
    RcStatus            ret = RS_OK; // should this be RS_PARAM_ERROR ??
    char *              buffer;
    FullCurDirEntry *   entry;
    CurFileDirEntry     fileentry;
    CurHotspot          hotspot;
    BitmapInfoHeader    dibhead;
    ResLocation         loc;

    buffer = RCALLOC( BUFFER_SIZE );

    for( entry = dir->Head; entry != NULL; entry = entry->Next ) {
        /* copy the cursor */
        loc.start = SemStartResource();

        hotspot.X = entry->Entry.Cur.XHotspot;
        hotspot.Y = entry->Entry.Cur.YHotspot;
        if( ResWriteCurHotspot( &hotspot, CurrResFile.handle ) ) {
            ret = RS_WRITE_ERROR;
            *err_code = LastWresErr();
            break;
        }

        /* NOTE: the dibhead structure is filled in as a result of this call */
        ret = copyOneCursor( &(entry->Entry.Cur), handle, buffer,
                        BUFFER_SIZE, &(dibhead), err_code );
        if( ret != RS_OK )
            break;

        loc.len = SemEndResource( loc.start );
        /* add the cursor to the RES file directory */
        SemAddResourceFree( WResIDFromNum( CurrResFile.NextCurOrIcon ),
                WResIDFromNum( (long)(pointer_int)RT_CURSOR ), flags, loc );
        /* change the reference in the cursor directory */
        fileentry = entry->Entry.Cur;
        entry->IsCurFileEntry = false;
        entry->Entry.Res.Width = dibhead.Width;
        entry->Entry.Res.Height = dibhead.Height;
        entry->Entry.Res.Planes = dibhead.Planes;
        entry->Entry.Res.BitCount = dibhead.BitCount;
        /* the hotspot data is now part of the components */
        entry->Entry.Res.Length = fileentry.Length + sizeof(CurHotspot);
        entry->Entry.Res.CurID = CurrResFile.NextCurOrIcon;
        CurrResFile.NextCurOrIcon += 1;
    }

    RCFREE( buffer );

    return( ret );
} /* copyCursors */
コード例 #29
0
ファイル: semraw.c プロジェクト: MikeyG/open-watcom-v2
void SemFreeDataElemList( DataElemList *head )
/********************************************/
{
    DataElemList    *curnode;
    DataElemList    *nextnode;
    int             i;

    curnode = head;
    nextnode = head;
    while( nextnode != NULL ) {
        nextnode = curnode->next;
        for( i = 0; i < curnode->count; i++ ) {
            if( curnode->data[i].IsString ) {
                RCFREE( curnode->data[i].Item.String );
            }
        }
        RCFREE( curnode );
        curnode = nextnode;
    }
}
コード例 #30
0
ファイル: semresfl.c プロジェクト: Azarien/open-watcom-v2
void SemWINAddResFile( char *filename )
/*************************************/
{
    char                full_filename[_MAX_PATH];

    if( RcFindResource( filename, full_filename ) == -1 ) {
        RcError( ERR_CANT_FIND_FILE, filename );
        goto HANDLE_ERROR;
    }
    if( AddDependency( full_filename ) )
        goto HANDLE_ERROR;
    if( copyResourcesFromRes( full_filename ) )
        goto HANDLE_ERROR;
    RCFREE( filename );
    return;

HANDLE_ERROR:
    ErrorHasOccured = true;
    RCFREE( filename );
}