2020#include "languages/keywords.en.c"
2121
2222char * comp_array_uds_field (char * p , bc_t * bc );
23- void comp_text_line (char * text );
23+ void comp_text_line (char * text , int addLineNo );
2424bcip_t comp_search_bc (bcip_t ip , code_t code );
2525extern void expr_parser (bc_t * bc );
2626extern void sc_raise2 (const char * fmt , int line , const char * buff ); // sberr
@@ -1332,7 +1332,7 @@ void comp_expression(char *expr, byte no_parser) {
13321332
13331333 // do additional steps
13341334 if (kw_exec_more ) {
1335- comp_text_line (comp_bc_tmp2 );
1335+ comp_text_line (comp_bc_tmp2 , 0 );
13361336 }
13371337}
13381338
@@ -1589,7 +1589,7 @@ int comp_single_line_if(char *text) {
15891589 * pelse = '\0' ;
15901590
15911591 // scan the commands before ELSE
1592- comp_text_line (buf );
1592+ comp_text_line (buf , 0 );
15931593 // add EOC
15941594 bc_eoc (& comp_prog );
15951595
@@ -1612,8 +1612,8 @@ int comp_single_line_if(char *text) {
16121612 }
16131613 } while (pelse != NULL );
16141614 }
1615- // scan the rest commands
1616- comp_text_line (buf );
1615+ // scan the remaining commands
1616+ comp_text_line (buf , 0 );
16171617 // add EOC
16181618 bc_eoc (& comp_prog );
16191619
@@ -2081,7 +2081,7 @@ void comp_text_line_func(long idx, int decl) {
20812081 char * macro = malloc (SB_SOURCELINE_SIZE + 1 );
20822082 sprintf (macro , "%s=%s:%s" , pname , eq_ptr , LCN_END );
20832083 // run comp_text_line again
2084- comp_text_line (macro );
2084+ comp_text_line (macro , 0 );
20852085 free (macro );
20862086 } else {
20872087 sc_raise (MSG_MISSING_UDP_BODY );
@@ -2334,9 +2334,7 @@ int comp_text_line_command(long idx, int decl, int sharp, char *last_cmd) {
23342334 comp_prepare_name (vname , pars [i ], SB_KEYWORD_SIZE );
23352335 if (strlen (vname ) != strlen (pars [i ])) {
23362336 // kwTYPE_LINE is required for executor
2337- bc_add_code (& comp_prog , kwTYPE_LINE );
2338- bc_add_addr (& comp_prog , comp_line );
2339- comp_text_line (pars [i ]);
2337+ comp_text_line (pars [i ], 1 );
23402338 }
23412339 }
23422340 break ;
@@ -2553,7 +2551,7 @@ int comp_text_line_command(long idx, int decl, int sharp, char *last_cmd) {
25532551/*
25542552 * Pass 1: scan source line
25552553 */
2556- void comp_text_line (char * text ) {
2554+ void comp_text_line (char * text , int addLineNo ) {
25572555 long idx ;
25582556 int decl = 0 ;
25592557
@@ -2566,7 +2564,7 @@ void comp_text_line(char *text) {
25662564 // EOL
25672565 if (* p == ':' ) {
25682566 p ++ ;
2569- comp_text_line (p );
2567+ comp_text_line (p , 0 );
25702568 return ;
25712569 }
25722570 // remark
@@ -2607,6 +2605,11 @@ void comp_text_line(char *text) {
26072605 if (idx == kwREM ) {
26082606 return ;
26092607 }
2608+ if (addLineNo ) {
2609+ // add debug info: line-number
2610+ bc_add_code (& comp_prog , kwTYPE_LINE );
2611+ bc_add_addr (& comp_prog , comp_line );
2612+ }
26102613 if (idx == -1 ) {
26112614 idx = comp_is_proc (comp_bc_name );
26122615 if (idx != -1 ) {
@@ -2631,7 +2634,7 @@ void comp_text_line(char *text) {
26312634 if (* p == ':' ) { // command separator
26322635 bc_eoc (& comp_prog );
26332636 p ++ ;
2634- comp_text_line (p );
2637+ comp_text_line (p , 0 );
26352638 }
26362639 return ;
26372640 }
@@ -2691,7 +2694,7 @@ void comp_text_line(char *text) {
26912694 // command separator
26922695 bc_eoc (& comp_prog );
26932696 p ++ ;
2694- comp_text_line (p );
2697+ comp_text_line (p , 0 );
26952698 }
26962699}
26972700
@@ -4231,12 +4234,8 @@ int comp_pass1(const char *section, const char *text) {
42314234 }
42324235 }
42334236
4234- // add debug info: line-number
4235- bc_add_code (& comp_prog , kwTYPE_LINE );
4236- bc_add_addr (& comp_prog , comp_line );
4237-
42384237 strcpy (code_line , ps );
4239- comp_text_line (code_line );
4238+ comp_text_line (code_line , 1 );
42404239 if (comp_error ) {
42414240 break ;
42424241 }
0 commit comments