@@ -84,41 +84,41 @@ static inline int TranslateIdentifiers(metac_node_t node, void* ctx)
8484 {
8585 case decl_variable :
8686 {
87- decl_variable_t * var = (decl_variable_t * ) node ;
87+ decl_variable_t * var = cast (decl_variable_t * ) node ;
8888 if (var -> VarIdentifier .v && var -> VarIdentifier .v != empty_identifier .v )
8989 TranslateIdentifier (DstTable , SrcTable , & var -> VarIdentifier );
9090 } break ;
9191 case decl_function :
9292 {
93- decl_function_t * func = (decl_function_t * ) node ;
93+ decl_function_t * func = cast (decl_function_t * ) node ;
9494 if (func -> Identifier .v != empty_identifier .v )
9595 TranslateIdentifier (DstTable , SrcTable , & func -> Identifier );
9696 } break ;
9797 case decl_type :
9898 {
99- decl_type_t * type = (decl_type_t * ) node ;
99+ decl_type_t * type = cast (decl_type_t * ) node ;
100100 if (type -> TypeIdentifier .v && type -> TypeIdentifier .v != empty_identifier .v )
101101 TranslateIdentifier (DstTable , SrcTable , & type -> TypeIdentifier );
102102 } break ;
103103 case decl_type_typedef :
104104 {
105- decl_type_typedef_t * typedef_ = (decl_type_typedef_t * ) node ;
105+ decl_type_typedef_t * typedef_ = cast (decl_type_typedef_t * ) node ;
106106 if (typedef_ -> Identifier .v != empty_identifier .v )
107107 {
108108 TranslateIdentifier (DstTable , SrcTable , & typedef_ -> Identifier );
109109 }
110110 } break ;
111111 case decl_type_struct :
112112 {
113- decl_type_struct_t * struct_ = (decl_type_struct_t * ) node ;
113+ decl_type_struct_t * struct_ = cast (decl_type_struct_t * ) node ;
114114 if (struct_ -> BaseIdentifier .v != empty_identifier .v )
115115 TranslateIdentifier (DstTable , SrcTable , & struct_ -> BaseIdentifier );
116116 if (struct_ -> Identifier .v != empty_identifier .v )
117117 TranslateIdentifier (DstTable , SrcTable , & struct_ -> Identifier );
118118 } break ;
119119 case decl_type_enum :
120120 {
121- decl_type_enum_t * enum_ = (decl_type_enum_t * ) node ;
121+ decl_type_enum_t * enum_ = cast (decl_type_enum_t * ) node ;
122122 if (enum_ -> Identifier .v != empty_identifier .v )
123123 {
124124 TranslateIdentifier (DstTable , SrcTable , & enum_ -> Identifier );
@@ -127,7 +127,7 @@ static inline int TranslateIdentifiers(metac_node_t node, void* ctx)
127127/*
128128 case decl_type_functiontype:
129129 {
130- decl_type_functiontype_t* funcionType = (decl_type_functiontype_t*) node;
130+ decl_type_functiontype_t* funcionType = cast (decl_type_functiontype_t*) node;
131131 if (funcionType->Identifier.v != empty_identifier.v)
132132 {
133133 TranslateIdentifier(DstTable, SrcTable, &enum_->Identifier);
@@ -136,7 +136,7 @@ static inline int TranslateIdentifiers(metac_node_t node, void* ctx)
136136*/
137137 case decl_enum_member :
138138 {
139- decl_enum_member_t * enumMember = (decl_enum_member_t * ) node ;
139+ decl_enum_member_t * enumMember = cast (decl_enum_member_t * ) node ;
140140 if (enumMember -> Name .v != empty_identifier .v )
141141 {
142142 TranslateIdentifier (DstTable , SrcTable , & enumMember -> Name );
@@ -225,7 +225,7 @@ static inline int Presemantic(metac_node_t node, void* ctx)
225225
226226 if (node -> Kind == node_decl_type_typedef )
227227 {
228- decl_type_typedef_t * typedef_ = (decl_type_typedef_t * ) node ;
228+ decl_type_typedef_t * typedef_ = cast (decl_type_typedef_t * ) node ;
229229 metac_identifier_ptr_t typedefId = typedef_ -> Identifier ;
230230
231231 metac_type_index_t typeIndex =
@@ -261,7 +261,7 @@ void SeeIdentifier(const char* idStr, uint32_t key, repl_state_t* replCtx)
261261
262262void AddIdentifierToCompletion (repl_state_t * self , const char * idString )
263263{
264- uint32_t len = (uint32_t ) strlen (idString );
264+ uint32_t len = cast (uint32_t ) strlen (idString );
265265 uint32_t hash = crc32c (~0 , idString , len );
266266 uint32_t key = IDENTIFIER_KEY (hash , len );
267267 SeeIdentifier (idString , key , self );
@@ -300,7 +300,7 @@ void Presemantic_(repl_state_t* self)
300300#if 1
301301 {
302302 identifier_callback_t cb ;
303- cb .Ctx = (void * )self ;
303+ cb .Ctx = cast (void * )self ;
304304 cb .FuncP = cast (identifier_cb_t )& SeeIdentifier ;
305305 tmpLpp .Parser .IdentifierCallbacks [0 ] = cb ;
306306 tmpLpp .Parser .IdentifierCallbacksCount = 1 ;
@@ -352,22 +352,22 @@ void Presemantic_(repl_state_t* self)
352352
353353 if (decl -> Kind == decl_type_typedef )
354354 {
355- decl_type_typedef_t * typedef_ = (decl_type_typedef_t * ) decl ;
355+ decl_type_typedef_t * typedef_ = cast (decl_type_typedef_t * ) decl ;
356356 if (typedef_ -> Type -> Kind == decl_type_struct )
357357 {
358- decl_type_struct_t * structPtr = (decl_type_struct_t * )typedef_ -> Type ;
358+ decl_type_struct_t * structPtr = cast (decl_type_struct_t * )typedef_ -> Type ;
359359 if (structPtr -> Identifier .v == empty_identifier .v )
360360 {
361361 printIdentifier = typedef_ -> Identifier ;
362362 }
363- decl = (metac_decl_t * )typedef_ -> Type ;
363+ decl = cast (metac_decl_t * )typedef_ -> Type ;
364364 }
365365 }
366366
367367 if (decl -> Kind == decl_type_struct )
368368 {
369369 const char * structNameStr = 0 ;
370- decl_type_struct_t * struct_ = (decl_type_struct_t * ) decl ;
370+ decl_type_struct_t * struct_ = cast (decl_type_struct_t * ) decl ;
371371 metac_printer_t printer ;
372372
373373 MetaCPrinter_Init (& printer ,
@@ -389,7 +389,7 @@ void Presemantic_(repl_state_t* self)
389389 && printIdentifier .v != empty_identifier .v
390390 && 0 == strcmp ("metac_compiler_t" , structNameStr ))
391391 {
392- compilerStruct = (metac_type_aggregate_t * )
392+ compilerStruct = cast (metac_type_aggregate_t * )
393393 MetaCSemantic_doDeclSemantic (& self -> SemanticState , struct_ );
394394// xprintf("compilerStruct: %s\n",
395395// MetaCPrinter_PrintSemaNode(&printer, &self->SemanticState, cast(metac_node_t)compilerStruct));
@@ -701,20 +701,20 @@ bool Repl_Loop(repl_state_t* repl, repl_ui_context_t* context)
701701 uint32_t estimatedTokenCount = (((sz / 4 ) + 128 ) & ~127 );
702702 if (fileLexer -> TokenCapacity < estimatedTokenCount )
703703 {
704- fileLexer -> Tokens = (metac_token_t * )
704+ fileLexer -> Tokens = cast (metac_token_t * )
705705 malloc (sizeof (metac_token_t ) * estimatedTokenCount );
706706 fileLexer -> TokenCount = 0 ;
707707 fileLexer -> TokenCapacity = estimatedTokenCount ;
708- fileLexer -> Tokens = (metac_token_t * )
708+ fileLexer -> Tokens = cast (metac_token_t * )
709709 malloc (sizeof (metac_token_t ) * estimatedTokenCount );
710710
711- fileLexer -> LocationStorage .Locations = (metac_location_t * )
711+ fileLexer -> LocationStorage .Locations = cast (metac_location_t * )
712712 malloc (sizeof (metac_location_t ) * estimatedTokenCount );
713713 fileLexer -> LocationStorage .LocationSize = 0 ;
714714 fileLexer -> LocationStorage .LocationCapacity = estimatedTokenCount ;
715715 }
716- repl -> SrcBuffer = (char * )calloc (1 , sz + 4 );
717- repl -> FreePtr = (void * )repl -> SrcBuffer ;
716+ repl -> SrcBuffer = cast (char * )calloc (1 , sz + 4 );
717+ repl -> FreePtr = cast (void * )repl -> SrcBuffer ;
718718 repl -> SrcBufferLength = sz ;
719719 fread ((void * )repl -> SrcBuffer , 1 , sz , fd );
720720 repl -> ParseMode = repl_mode_lex_file ;
@@ -896,7 +896,7 @@ bool Repl_Loop(repl_state_t* repl, repl_ui_context_t* context)
896896
897897 if (repl -> ParseMode != repl_mode_lex_file )
898898 {
899- repl -> SrcBuffer = (char * )repl -> Line ;
899+ repl -> SrcBuffer = cast (char * )repl -> Line ;
900900 repl -> SrcBufferLength = line_length ;
901901 }
902902
@@ -1415,7 +1415,7 @@ void Repl_Fiber(void)
14151415
14161416 {
14171417 identifier_callback_t cb ;
1418- cb .Ctx = (void * )repl ;
1418+ cb .Ctx = cast (void * )repl ;
14191419 cb .FuncP = cast (identifier_cb_t )& SeeIdentifier ;
14201420 repl -> LPP .Parser .IdentifierCallbacks [0 ] = cb ;
14211421 repl -> LPP .Parser .IdentifierCallbacksCount = 1 ;
@@ -1437,7 +1437,7 @@ void Repl_Fiber(void)
14371437 while (Repl_Loop (repl , uiContext ) != false)
14381438 {
14391439#ifndef NO_FIBERS
1440- task_t * replTask = (task_t * )(GET_CO ()-> arg );
1440+ task_t * replTask = cast (task_t * )(GET_CO ()-> arg );
14411441 YIELD (ReplYield );
14421442#endif
14431443 }
0 commit comments