BlockInfo * CfrTil_BeginBlock ( ) { Compiler * compiler = _Context_->Compiler0 ; BlockInfo *bi = _CfrTil_BeginBlock ( ) ; _Stack_Push ( compiler->BlockStack, ( int32 ) bi ) ; // _Context->CompileSpace->IndexStart before set frame size after turn on _Stack_Push ( compiler->CombinatorBlockInfoStack, ( int32 ) bi ) ; // _Context->CompileSpace->IndexStart before set frame size after turn on SetState ( _Context_, C_LHS, true ) ; _Context_->Compiler0->LHS_Word = 0 ; return bi ; }
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 ; }
void _CfrTil_Init ( CfrTil * cfrTil, Namespace * nss ) { uint32 type = CFRTIL ; _Q_->OVT_CfrTil = cfrTil ; // TODO : organize these buffers and their use cfrTil->OriginalInputLineB = _Buffer_NewPermanent ( BUFFER_SIZE ) ; cfrTil->InputLineB = _Buffer_NewPermanent ( BUFFER_SIZE ) ; cfrTil->SourceCodeSPB = _Buffer_NewPermanent ( SOURCE_CODE_BUFFER_SIZE ) ; cfrTil->LambdaCalculusPB = _Buffer_NewPermanent ( BUFFER_SIZE ) ; cfrTil->TokenB = _Buffer_NewPermanent ( BUFFER_SIZE ) ; cfrTil->PrintfB = _Buffer_NewPermanent ( BUFFER_SIZE ) ; cfrTil->Scratch1B = _Buffer_NewPermanent ( BUFFER_SIZE ) ; cfrTil->StringB = _Buffer_NewPermanent ( BUFFER_SIZE ) ; cfrTil->DebugB = _Buffer_NewPermanent ( BUFFER_SIZE ) ; cfrTil->DebugB1 = _Buffer_NewPermanent ( BUFFER_SIZE ) ; cfrTil->DebugB2 = _Buffer_NewPermanent ( BUFFER_SIZE ) ; cfrTil->StringInsertB = _Buffer_NewPermanent ( BUFFER_SIZE ) ; cfrTil->StringInsertB2 = _Buffer_NewPermanent ( BUFFER_SIZE ) ; cfrTil->StringInsertB3 = _Buffer_NewPermanent ( BUFFER_SIZE ) ; cfrTil->TabCompletionBuf = _Buffer_NewPermanent ( BUFFER_SIZE ) ; cfrTil->StringMacroB = _Buffer_NewPermanent ( BUFFER_SIZE ) ; cfrTil->OriginalInputLine = Buffer_Data ( cfrTil->OriginalInputLineB ) ; cfrTil->SourceCodeScratchPad = Buffer_Data ( cfrTil->SourceCodeSPB ) ; cfrTil->LispPrintBuffer = Buffer_Data ( cfrTil->LambdaCalculusPB ) ; cfrTil->TokenBuffer = Buffer_Data ( cfrTil->TokenB ) ; SetState ( cfrTil, CFRTIL_RUN | OPTIMIZE_ON | INLINE_ON, true ) ; if ( _Q_->Verbosity > 2 ) Printf ( ( byte* ) "\nSystem Memory is being reallocated. " ) ; cfrTil->ContextStack = Stack_New ( 256, type ) ; cfrTil->ObjectStack = Stack_New ( 1 * K, type ) ; cfrTil->DebugStateStack = Stack_New ( 1 * K, type ) ; _Stack_Push ( cfrTil->DebugStateStack, 0 ) ; cfrTil->TokenList = _dllist_New ( type ) ; cfrTil->DebugWordList = _dllist_New ( type ) ; _Context_ = cfrTil->Context0 = _Context_New ( cfrTil, type ) ; cfrTil->Debugger0 = _Debugger_New ( type ) ; // nb : must be after System_NamespacesInit cfrTil->cs_CpuState = CpuState_New ( type ) ; if ( cfrTil->SaveDsp && cfrTil->DataStack )// with _Q_->RestartCondition = STOP from Debugger_Stop { Dsp = cfrTil->SaveDsp ; } else { cfrTil->DataStack = Stack_New ( _Q_->DataStackSize, CFRTIL ) ; _CfrTil_DataStack_Init ( cfrTil ) ; } if ( nss ) { cfrTil->Namespaces = nss ; } else { _CfrTil_NamespacesInit ( cfrTil ) ; } cfrTil->StoreWord = _Word_FindAny ( ( byte* ) "store" ) ; cfrTil->PokeWord = _Word_FindAny ( ( byte* ) "poke" ) ; cfrTil->LispNamespace = Namespace_Find ( ( byte* ) "Lisp" ) ; CfrTil_MachineCodePrimitive_AddWords ( ) ; // in any case we need to reinit these for eg. debugger->SaveCpuState (), etc. CfrTil_ReadTables_Setup ( cfrTil ) ; CfrTil_LexerTables_Setup ( cfrTil ) ; cfrTil->LC = 0 ; //LC_New ( ) ; //cfrTil->SCA_BlockedIndex = - 1 ; }