Пример #1
0
bool MsgGet( int id, char *buffer )
{
#if defined( USE_TEXT_MSGS )
    int index;

    if( id >= MSG_SHARE_BASE && id < MSG_SHARE_LAST ) {
        index = id - MSG_SHARE_BASE + TXT_SHARE_BASE;
    } else if( id >= MSG_WOMP_BASE && id < MSG_WOMP_LAST ) {
        index = id - MSG_WOMP_BASE + TXT_WOMP_BASE;
    } else if( id >= MSG_WASM_BASE && id < MSG_WASM_LAST ) {
        index = id - MSG_WASM_BASE + TXT_WASM_BASE;
    } else if( id >= MSG_USAGE_BASE ) {
        index = id - MSG_USAGE_BASE + TXT_USAGE_BASE;
    } else {
        buffer[0] = '\0';
        return( false );
    }
    strncpy( buffer, txtmsgs[index], MAX_MESSAGE_SIZE - 1 );
    buffer[MAX_MESSAGE_SIZE - 1] = '\0';
#else
    if( hInstance.status == 0 || WResLoadString( &hInstance, id + MsgShift, (lpstr)buffer, MAX_MESSAGE_SIZE ) <= 0 ) {
        buffer[0] = '\0';
        return( false );
    }
#endif
    return( true );
}
Пример #2
0
static bool MsgReadErrArray( void )
#endif
{
    int         i;
    char        buffer[128];
    unsigned    msg_shift;

    msg_shift = _WResLanguage() * MSG_LANG_SPACING;
    for( i = ERR_FIRST_MESSAGE; i <= ERR_LAST_MESSAGE; i++ ) {
#if !defined(__WINDOWS__)
        if( WResLoadString( &hInstance, i + msg_shift, (lpstr)buffer, sizeof( buffer ) ) <= 0 ) {
#else
        if( LoadString( inst, i + msg_shift, (LPSTR)buffer, sizeof( buffer ) ) <= 0 ) {
#endif
            if( i == ERR_FIRST_MESSAGE )
                return( false );
            buffer[0] = '\0';
        }
        MsgArray[i - ERR_FIRST_MESSAGE] = my_alloc( strlen( buffer ) + 1 );
        if( MsgArray[i - ERR_FIRST_MESSAGE] == NULL )
            return( false );
        _fstrcpy( MsgArray[i - ERR_FIRST_MESSAGE], buffer );
    }
    return( true );
}

#if !defined(__WINDOWS__)
bool MsgInit( void )
{
    char        buffer[_MAX_PATH];
#if defined(_PLS)
    char        *fname;
    char        fullpath[_MAX_PATH];
#endif
    bool        rc;

    hInstance.status = 0;
    if( _cmdname( buffer ) != NULL ) {
        rc = OpenResFile( &hInstance, buffer );
#if defined(_PLS)
        if( !rc ) {
            _splitpath2( buffer, fullpath, NULL, NULL, &fname, NULL );
            _makepath( buffer, NULL, NULL, fname, ".exp" );
            _searchenv( buffer, "PATH", fullpath );
            if( fullpath[0] != '\0' ) {
                rc = OpenResFile( &hInstance, fullpath );
            }
        }
#endif
        if( rc ) {
            MsgReadErrArray();
            CloseResFile( &hInstance );
            return( true );
        }
    }
    CloseResFile( &hInstance );
    posix_write( STDOUT_FILENO, NO_RES_MESSAGE, NO_RES_SIZE );
    return( false );
}
Пример #3
0
bool GetRcMsg( unsigned resid, char *buff, int buff_len )
{
    if( WResLoadString( &Instance, resid + MsgShift, buff, buff_len ) <= 0 ) {
        buff[0] = '\0';
        return( false );
    }
    return( true );
}
Пример #4
0
bool GetMsg( char *buffer, int resourceid )
{
    if( hInstance.status == 0 || WResLoadString( &hInstance, resourceid + MsgShift, (lpstr)buffer, MAX_RESOURCE_SIZE ) <= 0 ) {
        buffer[0] = '\0';
        return( false );
    }
    return( true );
}
Пример #5
0
int GetRcMsg( unsigned resid, char *buff, unsigned buff_len )
{
    if( WResLoadString( &Instance, resid + MsgShift, buff, buff_len ) != 0 ) {
        buff[0] = '\0';
        return( 0 );
    }
    return( 1 );
}
Пример #6
0
static bool Msg_Get( int resourceid, char *buffer )
{
    if( hInstance.status == 0 || WResLoadString( &hInstance, resourceid + MsgShift, (lpstr)buffer, RESOURCE_MAX_SIZE ) <= 0 ) {
        buffer[0] = '\0';
        return( false );
    }
    return( true );
}
Пример #7
0
bool MsgGet( int resourceid, char *buffer )
{
    if( res_failure || WResLoadString( &hInstance, resourceid + MsgShift, (LPSTR)buffer, MAX_RESOURCE_SIZE ) <= 0 ) {
        buffer[0] = '\0';
        return( false );
    }
    return( true );
}
Пример #8
0
bool GUILoadString( gui_res_id id, char *buffer, int buffer_length )
{
    if( hInstance.status && buffer != NULL && buffer_length != 0 ) {
        if( WResLoadString( &hInstance, id, (lpstr)buffer, buffer_length ) > 0 ) {
            return( true );
        } else {
            buffer[0] = '\0';
        }
    }

    return( false );
}
Пример #9
0
bool AsMsgGet( int resourceid, char *buffer )
//*******************************************
{
#ifdef _STANDALONE_
    if( hInstance.status == 0 || WResLoadString( &hInstance, resourceid + msgShift, (lpstr)buffer, MAX_RESOURCE_SIZE ) <= 0 ) {
        buffer[0] = '\0';
        return( false );
    }
#else
    strcpy( buffer, asMessages[resourceid + msgShift] );
#endif
    return( true );
}
Пример #10
0
bool MsgGet( int resourceid, char *buffer )
/*****************************************/
{
#ifdef BOOTSTRAP
    struct idstr *s;
    struct idstr msgid;

    msgid.id = resourceid;
    s = bsearch( &msgid, StringTable, _arraysize( StringTable ), sizeof( *s ), compar );
    if( s == NULL ) {
        buffer[0] = NULLCHAR;
        return( false );
    }
    strcpy( buffer, s->s );
#else
    if( hInstance.status == 0 || WResLoadString( &hInstance, resourceid + MsgShift, (lpstr)buffer, MAX_RESOURCE_SIZE ) <= 0 ) {
        buffer[0] = NULLCHAR;
        return( false );
    }
#endif
    return( true );
}