Exemplo n.º 1
0
Word *
Finder_Word_FindUsing ( Finder * finder, byte * name )
{
    Word * word = 0 ;
    if ( name )
    {
        if ( finder->QualifyingNamespace )
        {
            if ( String_Equal ( ".", ( char* ) name ) ) word = Word_FindUsing ( name ) ; // keep QualifyingNamespace intact // ?? assumes function of CfrTil_Dot is always and only named "." ??
            else
#if OLD               
            {
                word = Word_FindInOneNamespace ( finder->QualifyingNamespace, name ) ;
                if ( ! GetState ( _Context_, CONTEXT_PARSING_QUALIFIED_ID ) ) Finder_SetQualifyingNamespace ( finder, 0 ) ; // nb. QualifyingNamespace is only good for one find
            }
#else            
            {
                word = Word_FindInOneNamespace ( finder->QualifyingNamespace, name ) ;
                if ( ReadLine_IsReverseTokenQualifiedID ( _Context_->ReadLiner0 ) )
                {
                    SetState ( _Context_, CONTEXT_PARSING_QUALIFIED_ID, false ) ;
                    Finder_SetQualifyingNamespace ( finder, 0 ) ; // nb. QualifyingNamespace is only good for approximately one find
                }
            }
#endif            
        }
        if ( ! word ) word = Word_FindUsing ( name ) ;
    }
    return word ;
}
Exemplo n.º 2
0
Property *
_DObject_FindProperty ( DObject * dobject, byte * name )
{
    Word * word = Word_FindInOneNamespace ( dobject, name ) ;
    if ( word ) return ( (Property*) word ) ;
    else return 0 ;
}
Exemplo n.º 3
0
void
Class_Object_Init ( Word * word, Namespace * ns )
{
    DebugShow_Off ;
    Stack * nsstack = _Context_->Compiler0->NamespacesStack ;
    Stack_Init ( nsstack ) ; // !! ?? put this in Compiler ?? !!
    // init needs to be done by the most super class first successively down to the current class 
    do
    {
        Word * initWord ;
        if ( ( initWord = Word_FindInOneNamespace ( ns, ( byte* ) "init" ) ) )
        {
            _Stack_Push ( nsstack, ( int32 ) initWord ) ;
        }
        ns = ns->ContainingNamespace ;
    }
    while ( ns ) ;
    int32 i, * svDsp = Dsp ;
    //DebugShow_Off ;
    SetState ( _Debugger_, DEBUG_SHTL_OFF, true ) ;
    for ( i = Stack_Depth ( nsstack ) ; i > 0 ; i -- )
    {
        _Push ( ( int32 ) * word->W_PtrToValue ) ;
        Word * initWord = ( Word* ) _Stack_Pop ( nsstack ) ;
        _Word_Eval ( initWord ) ;
    }
    Dsp = svDsp ; // this seems a little too presumptive -- a finer tuned stack adjust maybe be more correct
    SetState ( _Debugger_, DEBUG_SHTL_OFF, false ) ;
    //DebugShow_StateRestore ;
}
Exemplo n.º 4
0
Property *
_DObject_FindProperty_BottomUp ( DObject * dobject, byte * name )
{
    Word * word = 0 ;
    do
    {
        if ( ( word = Word_FindInOneNamespace ( dobject, name ) ) ) break ;
    }
    while ( ( dobject = dobject->ContainingNamespace ) ) ;
    if ( word ) return (Property*) ( word ) ;
    else return 0 ;
}
Exemplo n.º 5
0
void
_InstallGotoPoint_Key ( dlnode * node, int32 bi, int32 key )
{
    Word * word ;
    GotoInfo * gotoInfo = ( GotoInfo* ) node ;
    byte * address = gotoInfo->pb_JmpOffsetPointer ;
    if ( *( int32* ) address == 0 ) // if we move a block its recurse offset remains, check if this looks like at real offset pointer
    {
        if ( ( gotoInfo->GI_CProperty & ( GI_GOTO | GI_CALL_LABEL ) ) && ( key & ( GI_GOTO | GI_CALL_LABEL ) ) )
        {
            //Namespace * ns = Namespace_FindOrNew_SetUsing ( ( byte* ) "__labels__", _Q_->OVT_CfrTil->Namespaces, 1 ) ;
            Namespace * ns = _Namespace_Find ( ( byte* ) "__labels__", _Q_->OVT_CfrTil->Namespaces, 0 ) ;
            if ( ns && ( word = Word_FindInOneNamespace ( ns, gotoInfo->pb_LabelName ) ) )
            {
                _GotoInfo_SetAndDelete ( gotoInfo, ( byte* ) word->W_Value ) ;
            }
        }
        else if ( ( gotoInfo->GI_CProperty & GI_RETURN ) && ( key & GI_RETURN ) )
        {
            _GotoInfo_SetAndDelete ( gotoInfo, Here ) ;
        }
        else if ( ( gotoInfo->GI_CProperty & GI_BREAK ) && ( key & GI_BREAK ) )
        {
            if ( _Context_->Compiler0->BreakPoint )
            {
                _GotoInfo_SetAndDelete ( gotoInfo, _Context_->Compiler0->BreakPoint ) ;
            }
        }
        else if ( ( gotoInfo->GI_CProperty & GI_CONTINUE ) && ( key & GI_CONTINUE ) )
        {
            if ( _Context_->Compiler0->ContinuePoint )
            {
                _GotoInfo_SetAndDelete ( gotoInfo, _Context_->Compiler0->ContinuePoint ) ;
            }
        }
        else if ( ( gotoInfo->GI_CProperty & GI_RECURSE ) && ( key & GI_RECURSE ) )
        {
            _GotoInfo_SetAndDelete ( gotoInfo, ( byte* ) ( ( BlockInfo * ) bi )->bp_First ) ;
        }
        else if ( ( gotoInfo->GI_CProperty & GI_TAIL_CALL ) && ( key & GI_TAIL_CALL ) )
        {
            _GotoInfo_SetAndDelete ( gotoInfo, ( ( BlockInfo * ) bi )->Start ) ; // ( byte* ) _DataStack_GetTop ( ) ) ; // , ( byte* ) bi->bi_FrameStart ) ;
        }
    }
}
Exemplo n.º 6
0
Word *
_CfrTil_VariableGet ( Namespace * ns, byte * name )
{
    Word * word = Word_FindInOneNamespace ( ns, name ) ;
    return word ;
}