void ModuleInitConnect( // CODE GENERATION FOR MODULE-INIT. CONNECTION void ) { genInitFiniReference( module_init_func , CompInfo.init_priority , CppSpecialName( SPECIAL_MODULE_INIT ) , SEG_INIT_REF ); }
void CgDeclParms( // DEFINE ARGS FOR CURRENT FN IN CORRECT ORDER FN_CTL *fctl, // - current function control pointer SCOPE scope ) // - argument scope { SYMBOL curr; SYMBOL stop; SYMBOL *psym; // - addr[ parameter symbol ] TYPE fn_type; auto VSTK_CTL sym_stack; SYMBOL ret_sym; NAME ret_name; fn_type = FunctionDeclarationType( fctl->func->sym_type ); VstkOpen( &sym_stack, sizeof( SYMBOL ), 16 ); stop = ScopeOrderedStart( scope ); ret_name = CppSpecialName( SPECIAL_RETURN_VALUE ); ret_sym = NULL; curr = NULL; for(;;) { curr = ScopeOrderedNext( stop, curr ); if( curr == NULL ) break; if( ( curr->name != NULL ) && ( ret_name == curr->name->name ) ) { ret_sym = curr; } else { psym = VstkPush( &sym_stack ); *psym = curr; } } IbpDefineParms(); declareParameter( fctl->this_sym ); declareParameter( fctl->cdtor_sym ); declareParameter( ret_sym ); switch( PcCallImpl( fn_type ) ) { case CALL_IMPL_REV_CPP : case CALL_IMPL_REV_C : for(;;) { psym = VstkPop( &sym_stack ); if( psym == NULL ) break; declareParameter( *psym ); } break; case CALL_IMPL_CPP : case CALL_IMPL_C : case CALL_IMPL_ELL_CPP : case CALL_IMPL_ELL_C : { unsigned index; // - parameter index unsigned max_parms; // - # parameters SYMBOL *psym1; // - addr[ parameter symbol ] max_parms = VstkDimension( &sym_stack ); for( index = 0; index < max_parms; ++index ) { psym1 = VstkIndex( &sym_stack, index ); declareParameter( *psym1 ); } } break; } VstkClose( &sym_stack ); CGLastParm(); }
static void outputCallTriggeredWarning( PTREE expr, SYMBOL sym ) { MSG_NUM msg; char *name; msg = ERR_NULL; name = sym->name->name; if( name == CppSpecialName( SPECIAL_BEGINTHREAD ) ) { msg = WARN_MUST_BE_MULTITHREADED; } else if( name == CppSpecialName( SPECIAL_BEGINTHREADEX ) ) { msg = WARN_MUST_BE_MULTITHREADED; } if( msg != ERR_NULL ) { switch( msg ) { case WARN_MUST_BE_MULTITHREADED: if( !CompFlags.bm_switch_used ) { PTreeErrorExprName( expr, msg, name ); } break; DbgDefault( "unexpected message number" ); } } }
SYMBOL CgDeclHiddenParm( // DECLARE HIDDEN ARG (THIS, CDTOR) SCOPE scope, // - function parameters scope TYPE type, // - symbol type SYMBOL symbol_model, // - model for symbol unsigned specname_index ) // - special name index { SYMBOL_NAME name; // - new symbol name SYMBOL sym; // - new symbol name = VstkPush( &stack_symbol_name ); memset( name, 0, sizeof( *name ) ); name->containing = scope; name->name = CppSpecialName( specname_index ); sym = push_inline_sym( symbol_model ); sym->sym_type = type; sym->name = name; return sym; }
void ModuleInitInit( // START MODULE-INITIALIZATION FUNCTION void ) { SYMBOL module_init; // - SYMBOL for mod-init. function SCOPE curr_scope; // - current scope TYPE fn_type; // - type for init function curr_scope = moduleInitSave(); fn_type = TypeVoidFunOfVoid(); module_init = SymCreateFileScope( fn_type , SC_STATIC , 0 , CppSpecialName( SPECIAL_INIT_FUNCTION ) ); module_init_func = module_init; SetCurrScope(GetFileScope()); ScopeBeginFunction( module_init ); FunctionBodyStartup( module_init, &module_fd, FUNC_NULL ); module_fd.retn_opt = false; module_init_scope = GetCurrScope(); ScopeKeep( module_init_scope ); moduleInitRestore( curr_scope ); }