@@ -408,7 +408,7 @@ bool read_preproc_directive()
408408 if (lex_accept (T_elipsis ))
409409 macro -> is_variadic = true;
410410
411- macro -> start_source_idx = source_idx ;
411+ macro -> start_source_idx = SOURCE -> source_idx ;
412412 skip_macro_body ();
413413 } else {
414414 /* Empty alias, may be dummy alias serves as include guard */
@@ -892,7 +892,7 @@ void read_expr_operand(block_t *parent, basic_block_t **bb)
892892
893893 if (!strcmp (token , "__VA_ARGS__" )) {
894894 /* 'source_idx' has pointed at the character after __VA_ARGS__ */
895- int remainder , t = source_idx ;
895+ int remainder , t = SOURCE -> source_idx ;
896896 macro_t * macro = parent -> macro ;
897897
898898 if (!macro )
@@ -902,13 +902,14 @@ void read_expr_operand(block_t *parent, basic_block_t **bb)
902902
903903 remainder = macro -> num_params - macro -> num_param_defs ;
904904 for (int i = 0 ; i < remainder ; i ++ ) {
905- source_idx = macro -> params [macro -> num_params - remainder + i ];
906- next_char = SOURCE [source_idx ];
905+ SOURCE -> source_idx =
906+ macro -> params [macro -> num_params - remainder + i ];
907+ next_char = SOURCE -> elements [SOURCE -> source_idx ];
907908 next_token = lex_token ();
908909 read_expr (parent , bb );
909910 }
910- source_idx = t ;
911- next_char = SOURCE [ source_idx ];
911+ SOURCE -> source_idx = t ;
912+ next_char = SOURCE -> elements [ SOURCE -> source_idx ];
912913 next_token = lex_token ();
913914 } else if (mac ) {
914915 if (parent -> macro )
@@ -920,16 +921,16 @@ void read_expr_operand(block_t *parent, basic_block_t **bb)
920921
921922 /* 'source_idx' has pointed at the first parameter */
922923 while (!lex_peek (T_close_bracket , NULL )) {
923- mac -> params [mac -> num_params ++ ] = source_idx ;
924+ mac -> params [mac -> num_params ++ ] = SOURCE -> source_idx ;
924925 do {
925926 next_token = lex_token ();
926927 } while (next_token != T_comma &&
927928 next_token != T_close_bracket );
928929 }
929930 /* move 'source_idx' to the macro body */
930- macro_return_idx = source_idx ;
931- source_idx = mac -> start_source_idx ;
932- next_char = SOURCE [ source_idx ];
931+ macro_return_idx = SOURCE -> source_idx ;
932+ SOURCE -> source_idx = mac -> start_source_idx ;
933+ next_char = SOURCE -> elements [ SOURCE -> source_idx ];
933934 lex_expect (T_close_bracket );
934935
935936 skip_newline = 0 ;
@@ -941,13 +942,13 @@ void read_expr_operand(block_t *parent, basic_block_t **bb)
941942 macro_return_idx = 0 ;
942943 } else if (macro_param_idx ) {
943944 /* "expand" the argument from where it comes from */
944- int t = source_idx ;
945- source_idx = macro_param_idx ;
946- next_char = SOURCE [ source_idx ];
945+ int t = SOURCE -> source_idx ;
946+ SOURCE -> source_idx = macro_param_idx ;
947+ next_char = SOURCE -> elements [ SOURCE -> source_idx ];
947948 next_token = lex_token ();
948949 read_expr (parent , bb );
949- source_idx = t ;
950- next_char = SOURCE [ source_idx ];
950+ SOURCE -> source_idx = t ;
951+ next_char = SOURCE -> elements [ SOURCE -> source_idx ];
951952 next_token = lex_token ();
952953 } else if (con ) {
953954 ph1_ir = add_ph1_ir (OP_load_constant );
@@ -3074,15 +3075,15 @@ basic_block_t *read_body_statement(block_t *parent, basic_block_t *bb)
30743075
30753076 /* 'source_idx' has pointed at the first parameter */
30763077 while (!lex_peek (T_close_bracket , NULL )) {
3077- mac -> params [mac -> num_params ++ ] = source_idx ;
3078+ mac -> params [mac -> num_params ++ ] = SOURCE -> source_idx ;
30783079 do {
30793080 next_token = lex_token ();
30803081 } while (next_token != T_comma && next_token != T_close_bracket );
30813082 }
30823083 /* move 'source_idx' to the macro body */
3083- macro_return_idx = source_idx ;
3084- source_idx = mac -> start_source_idx ;
3085- next_char = SOURCE [ source_idx ];
3084+ macro_return_idx = SOURCE -> source_idx ;
3085+ SOURCE -> source_idx = mac -> start_source_idx ;
3086+ next_char = SOURCE -> elements [ SOURCE -> source_idx ];
30863087 lex_expect (T_close_bracket );
30873088
30883089 skip_newline = 0 ;
@@ -3374,8 +3375,8 @@ void parse_internal()
33743375 GLOBAL_FUNC .fn -> bbs = calloc (1 , sizeof (basic_block_t ));
33753376
33763377 /* lexer initialization */
3377- source_idx = 0 ;
3378- next_char = SOURCE [0 ];
3378+ SOURCE -> source_idx = 0 ;
3379+ next_char = SOURCE -> elements [0 ];
33793380 lex_expect (T_start );
33803381
33813382 do {
@@ -3414,8 +3415,8 @@ void load_source_file(char *file)
34143415 strcpy (path + c , buffer + 10 );
34153416 load_source_file (path );
34163417 } else {
3417- strcpy (SOURCE + source_idx , buffer );
3418- source_idx += strlen (buffer );
3418+ strcpy (SOURCE -> elements + SOURCE -> source_idx , buffer );
3419+ SOURCE -> source_idx += strlen (buffer );
34193420 }
34203421 }
34213422 fclose (f );
0 commit comments