Ejemplo n.º 1
0
/*
 * _AnotherWindowData - create yet another window data item
 */
LPWDATA _AnotherWindowData( HWND hwnd, va_list al )
{
    LPWDATA     w;
    int         h,hcnt;
    int         _WCI86FAR *hlist;

    w = FARmalloc( sizeof( window_data ) );
    if( w == NULL )
        _OutOfMemoryExit();
    FARmemset( w, 0, sizeof( window_data ) );
    _MainWindowData->windows = FARrealloc( _MainWindowData->windows,
                sizeof( LPWDATA ) * ( _MainWindowData->window_count + 1 ) );
    if( _MainWindowData->windows == NULL )
        _OutOfMemoryExit();
    _MainWindowData->windows[_MainWindowData->window_count] = w;
    _MainWindowData->window_count++;

    w->CurrentLineNumber = 1L;
    w->TopLineNumber = 1L;
    w->LastLineNumber = 1L;
    w->tmpbuff = FARmalloc( sizeof( line_data ) + MAX_BUFF + 1 );
    if( w->tmpbuff == NULL )
        _OutOfMemoryExit();
    w->CaretType = ORIGINAL_CURSOR;
    w->hwnd = hwnd;

    hcnt = 0;
    hlist = NULL;
    while( (h = va_arg( al, int )) != -1 ) {
        hlist = FARrealloc( hlist, ( hcnt + 1 ) * sizeof( h ) );
        hlist[hcnt] = h;
        hcnt++;
    }
    w->handles = hlist;
    w->handle_cnt = hcnt;
    return( w );

} /* _AnotherWindowData */
Ejemplo n.º 2
0
/*
 * _MemReAlloc - allocate some memory
 */
void _WCI86FAR *_MemReAlloc( void _WCI86FAR *ptr, unsigned size )
{
    void _WCI86FAR      *tmp;

    tmp = FARrealloc( ptr, size );
    if( tmp == NULL ) {
        _OutOfMemory();
        while( _MessageLoop( FALSE ) );
        _WindowsExitRtn = NULL;
        exit( 0 );
    }
    return( tmp );

} /* _MemReAlloc */