Exemplo n.º 1
0
void KeySymbol::setSearchString( String & str, void ** prog,
                                 const char * name )
//------------------------------------------------------------
{
    WBRFree( *prog );   // free existing program
    str = name;         // assign to the string

    try {
        *prog = WBRRegComp( name );
    } catch( CauseOfDeath cause ) {
        IdentifyAssassin( cause );
    }
}
Exemplo n.º 2
0
Symbol * GlobalViewList::getSymbol( int index )
//---------------------------------------------
// FIXME -- have to cast away constness
{
    int             page = IDXTOPAGE( index );
    int             off = IDXTOOFF( index );
    Module *        mod = dbManager()->module();
    KeySymbol *     key = (KeySymbol *) &optManager()->getQueryFilt();
    SearchContext * prev;
    SearchContext * ctxt;
    WVList *        list;
    GBVListPage *   prevPage;
    GBVListPage *   currPage;

    if( index < 0 ) {
        return NULL;
    }

    try {
        while( !full() && _pages->count() <= page ) {
            if( page < 0 || page > _pages->count() ) {
                return NULL;
            } else {
                prevPage = page ? (GBVListPage *)(*_pages)[ page - 1 ] : NULL;
                prev = prevPage ? prevPage->_context : NULL;
            }
            list = new WVList;
            ctxt = mod->findSymbols( list, key, prev, OFFSETMASK + 1 );
            _pages->add( new GBVListPage( ctxt, list ) );

            if( ctxt == NULL ) {
                _full = true;
            }
        }

        if( page < _pages->count() ) {
            currPage = (GBVListPage *)(*_pages)[ page ];
            if( off < currPage->_symbols->count() ) {
                return (Symbol *) (*currPage->_symbols)[ off ];
            }
        }

    } catch( CauseOfDeath cause ) {
        IdentifyAssassin( cause );
    }

    return NULL;
}