Exemplo n.º 1
0
void LnkMemInit( void )
/*********************/
{
#if defined( __QNX__ )
    /* allocate some memory we can give back to the system if it runs low */
    LastChanceSeg = qnx_segment_alloc( 65000 );
#endif
#ifdef _INT_DEBUG
    Chunks = 0;
#endif
#ifdef TRMEM
    TrHdl = _trmem_open( malloc, free, realloc, _expand,
            NULL, PrintLine,
            _TRMEM_ALLOC_SIZE_0 | _TRMEM_REALLOC_SIZE_0 | _TRMEM_REALLOC_NULL |
            _TRMEM_FREE_NULL | _TRMEM_OUT_OF_MEMORY | _TRMEM_CLOSE_CHECK_FREE );
#endif

// 2014-05-25 SHL
#if defined( USE_OS2HMALLOC )
    {
        APIRET apiret = DosQuerySysInfo( QSV_MAXPRMEM,
                                         QSV_MAXPRMEM,
                                         &os2_private_mem_left,
                                         sizeof( os2_private_mem_left ) );
        if (apiret)
            os2_private_mem_left = 0x20000000;   // 512MB
    }
#endif
}
Exemplo n.º 2
0
/*
 * ScreenInit - get screen info
 */
void ScreenInit( void )
{
    struct _osinfo              info;
    int                         rows, cols;
    unsigned                    size;
    unsigned                    seg;
    vi_rc                       rc;


    QNXCon = console_open( QNXConHandle, O_WRONLY );
    if( QNXCon == NULL ) {
        // FatalError( ERR_WIND_NO_MORE_WINDOWS );
        ChangeDirectory( HomeDirectory );
        exit( 0 );
    }
    if( console_size( QNXCon, QNXConsole, 0, 0, &rows, &cols ) != 0 ) {
        console_close( QNXCon );
        FatalError( ERR_WIND_NO_MORE_WINDOWS );
    }
    rc = BIOSKeyboardInit();
    if( rc != ERR_NO_ERR ) {
        console_close( QNXCon );
        FatalError( rc );
    }
    EditVars.WindMaxWidth = cols;
    EditVars.WindMaxHeight = rows;

    qnx_osinfo( 0, &info );
    switch( info.primary_monitor ) {
    case _MONITOR_PGS:
    case _MONITOR_CGA:
    case _MONITOR_PS30_COLOR:
    case _MONITOR_EGA_COLOR:
    case _MONITOR_VGA_COLOR:
        EditFlags.Color = TRUE;
        break;
    case _MONITOR_EGA_MONO:
    case _MONITOR_VGA_MONO:
    case _MONITOR_PS30_MONO:
        EditFlags.BlackAndWhite = TRUE;
        break;
    default:
        EditFlags.Monocolor = TRUE;
        break;
    }
    size = cols * rows * sizeof( char_info );
    seg = qnx_segment_alloc( size );
    Scrn = MK_FP( seg, 0 );
    ScreenPage( 0 );

} /* ScreenInit */
Exemplo n.º 3
0
void LnkMemInit( void )
/*********************/
{
#if defined( __QNX__ )
    /* allocate some memory we can give back to the system if it runs low */
    LastChanceSeg = qnx_segment_alloc( 65000 );
#endif
#ifdef _INT_DEBUG
    Chunks = 0;
#endif
#ifdef TRMEM
    TrHdl = _trmem_open( malloc, free, realloc, _expand,
            NULL, PrintLine,
            _TRMEM_ALLOC_SIZE_0 | _TRMEM_REALLOC_SIZE_0 | _TRMEM_REALLOC_NULL |
            _TRMEM_FREE_NULL | _TRMEM_OUT_OF_MEMORY | _TRMEM_CLOSE_CHECK_FREE );
#endif
}
Exemplo n.º 4
0
static bool setupscrnbuff( void )
/*******************************/
{
    int                 rows, cols;
    LP_PIXEL            scrn;
    size_t              num;
    int                 i;

    if( console_size( UIConCtrl, UIConsole, 0, 0, &rows, &cols ) != 0 ) {
        return( false );
    }
    UIData->width = cols;
    UIData->height = rows;
    num = UIData->width * UIData->height * 2;
    scrn = UIData->screen.origin;
#if defined( __386__ )
    scrn = realloc( scrn, num );
    if( scrn == NULL )
        return( false );
#else
    {
        unsigned                seg;

        if( scrn == NULL ) {
            seg = qnx_segment_alloc( num );
        } else {
            seg = qnx_segment_realloc( FP_SEG( scrn ), num );
        }
        if( seg == -1 )
            return( false );
        scrn = MK_FP( seg, 0 );
    }
#endif
    num /= 2;
    for( i = 0; i < num; ++i ) {
        scrn[i].ch = ' ';       /* a space with normal attributes */
        scrn[i].attr = 7;       /* a space with normal attributes */
    }
    UIData->screen.origin = scrn;
    UIData->screen.increment = UIData->width;
    return( true );
}
Exemplo n.º 5
0
void _InitSegments( void )
//========================

{
    char __far          *adr;

    _StackSeg = FP_SEG( &adr );         // point to stack segment
    _BiosSeg = 0x40;
    _BiosOff = 0;
    _MonoSeg = 0x28;
    _MonoOff = 0;
    _CgaSeg  = 0x30;
    _CgaOff  = 0;

    adr = qnx_mmap_physical( 0x0a0000L, 0x10000L, _PMF_DATA_RW );
    _EgaSeg = FP_SEG( adr );
    _EgaOff = FP_OFF( adr );

    adr = qnx_mmap_physical( 0x0c0000L, 0x10000L, _PMF_DATA_RW );
    _RomSeg = FP_SEG( adr );
    _RomOff = FP_OFF( adr );

    _CompileBuf = qnx_segment_alloc( 2048 );
    _CompileSeg = qnx_segment_put( 0, _CompileBuf, _PMF_CODE_RX | _PMF_INUSE );
#if 0
    if( _RomSeg == -1 ) {
        fprintf( stderr, "_InitSegments: unable to allocate RomSeg.\n" );
    }
    if( _EgaSeg == -1 ) {
        fprintf( stderr, "_InitSegments: unable to allocate EgaSeg.\n" );
    }
    if( _CompileSeg == -1 ) {
        fprintf( stderr, "_InitSegments: unable to allocate CompileSeg.\n ");
    }
#else
    if( (short)_RomSeg == -1 || (short)_EgaSeg == -1
                || (short)_CompileSeg == -1 || (int)_CompileBuf == -1 ) {
        _ErrorStatus = _GRERROR;
    }
#endif
}
Exemplo n.º 6
0
static bool setupscrnbuff( int srows, int scols )
/***********************************************/
{
    LP_PIXEL    scrn;
    int         num;
    int         i;
    int         rows;
    int         cols;

    if( dev_size( UIConHandle, -1, -1, &rows, &cols ) == -1 )
        return( false );
    if( rows == 0 ) {
        rows = srows;
        if( rows == 0 ) {
            rows = lines;
            if( rows == 0 ) {
                rows = 25;
            }
        }
    }
    if( cols == 0 ) {
        cols = scols;
        if( cols == 0 ) {
            cols = columns;
            if( columns == 0 ) {
                cols = 80;
            }
        }
    }

    UIData->width = cols;
    UIData->height = rows;
    UIData->cursor_type = C_NORMAL;

    num = UIData->width * UIData->height * 2;
    scrn = UIData->screen.origin;
#if defined( __386__ )
    scrn = realloc( scrn, num );
    if( scrn == NULL )
        return( false );
    if( (shadow = realloc( shadow, num )) == NULL ) {
        free( scrn );
        return( false );
    }
#else
    {
        unsigned        seg;

        if( scrn == NULL ) {
            seg = qnx_segment_alloc( num );
        } else {
            seg = qnx_segment_realloc( FP_SEG( scrn ), num );
        }
        if( seg == -1 )
            return( false );
        scrn = MK_FP( seg, 0 );
        if( shadow == NULL ) {
            seg = qnx_segment_alloc( num );
        } else {
            seg = qnx_segment_realloc( FP_SEG( shadow ), num );
        }
        if( seg == -1 ) {
            qnx_segment_free( FP_SEG( scrn ) );
            return( false );
        }
        shadow = MK_FP( seg, 0 );
    }
#endif
    save_cursor_type = -1; /* C_NORMAL; */
    num /= 2;
    for( i = 0; i < num; ++i ) {
        scrn[i].ch = ' ';       /* a space with normal attributes */
        scrn[i].attr = 7;       /* a space with normal attributes */
    }
    UIData->screen.origin = scrn;
    UIData->screen.increment = UIData->width;
    return( true );
}