@@ -47,45 +47,45 @@ BasicInterpreter::BasicInterpreter()
4747
4848 /* 20 Commands must be entered lowercase in this table*/
4949 int x = 0 ;
50- strcpy (table[x].command , " print" );
50+ std:: strcpy (table[x].command , " print" );
5151 table[x++].tok = PRINT;
5252
53- strcpy (table[x].command , " sin" );
53+ std:: strcpy (table[x].command , " sin" );
5454 table[x++].tok = SIN;
55- strcpy (table[x].command , " cos" );
55+ std:: strcpy (table[x].command , " cos" );
5656 table[x++].tok = COS;
57- strcpy (table[x].command , " tan" );
57+ std:: strcpy (table[x].command , " tan" );
5858 table[x++].tok = TAN;
59- strcpy (table[x].command , " sqrt" );
59+ std:: strcpy (table[x].command , " sqrt" );
6060 table[x++].tok = SQRT;
61- strcpy (table[x].command , " sqr" );
61+ std:: strcpy (table[x].command , " sqr" );
6262 table[x++].tok = SQR;
63- strcpy (table[x].command , " abs" );
63+ std:: strcpy (table[x].command , " abs" );
6464 table[x++].tok = ABS;
65- strcpy (table[x].command , " trunc" );
65+ std:: strcpy (table[x].command , " trunc" );
6666 table[x++].tok = TRUNC;
67- strcpy (table[x].command , " pi" );
67+ std:: strcpy (table[x].command , " pi" );
6868 table[x++].tok = PI;
6969
70- strcpy (table[x].command , " if" );
70+ std:: strcpy (table[x].command , " if" );
7171 table[x++].tok = IF;
72- strcpy (table[x].command , " then" );
72+ std:: strcpy (table[x].command , " then" );
7373 table[x++].tok = THEN;
74- strcpy (table[x].command , " goto" );
74+ std:: strcpy (table[x].command , " goto" );
7575 table[x++].tok = GOTO;
76- strcpy (table[x].command , " for" );
76+ std:: strcpy (table[x].command , " for" );
7777 table[x++].tok = FOR;
78- strcpy (table[x].command , " next" );
78+ std:: strcpy (table[x].command , " next" );
7979 table[x++].tok = NEXT;
80- strcpy (table[x].command , " to" );
80+ std:: strcpy (table[x].command , " to" );
8181 table[x++].tok = TO;
82- strcpy (table[x].command , " gosub" );
82+ std:: strcpy (table[x].command , " gosub" );
8383 table[x++].tok = GOSUB;
84- strcpy (table[x].command , " return" );
84+ std:: strcpy (table[x].command , " return" );
8585 table[x++].tok = RETURN;
86- strcpy (table[x].command , " end" );
86+ std:: strcpy (table[x].command , " end" );
8787 table[x++].tok = END;
88- strcpy (table[x].command , " " );
88+ std:: strcpy (table[x].command , " " );
8989 table[x++].tok = END + 1 ;
9090}
9191
@@ -132,12 +132,12 @@ void BasicInterpreter::exec_for()
132132
133133 get_token (); /* read the control variable */
134134
135- if (!isalpha (*token)) {
135+ if (!std:: isalpha (*token)) {
136136 serror (4 );
137137 return ;
138138 }
139139
140- i.var = toupper (*token) - ' A' ; /* save its index */
140+ i.var = std:: toupper (*token) - ' A' ; /* save its index */
141141
142142 get_token (); /* read the equals sign */
143143
@@ -221,13 +221,13 @@ int BasicInterpreter::look_up(char *s)
221221 p = s;
222222
223223 while (*p) {
224- *p = tolower (*p);
224+ *p = std:: tolower (*p);
225225 p++;
226226 }
227227
228228 /* see if token is in table */
229229 for (i = 0 ; *table[i].command ; i++) {
230- if (!strcmp (table[i].command , s)) {
230+ if (!std:: strcmp (table[i].command , s)) {
231231 return table[i].tok ;
232232 }
233233 }
@@ -238,7 +238,7 @@ int BasicInterpreter::look_up(char *s)
238238/* Return true if c is a delimiter. */
239239int BasicInterpreter::isdelim (char c)
240240{
241- if (strchr (" ;,+-<>/*%^=()" , c) || c == 9 || c == ' \n ' || c == 0 ) {
241+ if (std:: strchr (" ;,+-<>/*%^=()" , c) || c == 9 || c == ' \n ' || c == 0 ) {
242242 return 1 ;
243243 }
244244
@@ -280,7 +280,7 @@ int BasicInterpreter::get_next_label(char *s)
280280 return t;
281281 }
282282
283- if (!strcmp (label_table[t].name , s)) {
283+ if (!std:: strcmp (label_table[t].name , s)) {
284284 return -2 ; /* dup */
285285 }
286286 }
@@ -350,7 +350,7 @@ int BasicInterpreter::get_token()
350350 return (token_type = QUOTE);
351351 }
352352
353- if (isdigit (*prog)) {
353+ if (std:: isdigit (*prog)) {
354354 /* number */
355355 while (!isdelim (*prog)) {
356356 *temp++ = *prog++;
@@ -360,7 +360,7 @@ int BasicInterpreter::get_token()
360360 return (token_type = NUMBER);
361361 }
362362
363- if (isalpha (*prog)) {
363+ if (std:: isalpha (*prog)) {
364364 /* var or command */
365365 while (!isdelim (*prog)) {
366366 *temp++ = *prog++;
@@ -394,12 +394,12 @@ void BasicInterpreter::assignment()
394394 /* get the variable name */
395395 get_token ();
396396
397- if (!isalpha (*token)) {
397+ if (!std:: isalpha (*token)) {
398398 serror (4 );
399399 return ;
400400 }
401401
402- var = toupper (*token) - ' A' ;
402+ var = std:: toupper (*token) - ' A' ;
403403
404404 /* get the equals sign */
405405 get_token ();
@@ -482,7 +482,7 @@ void BasicInterpreter::scan_labels()
482482 get_token ();
483483
484484 if (token_type == NUMBER) {
485- strcpy (label_table[0 ].name , token);
485+ std:: strcpy (label_table[0 ].name , token);
486486 label_table[0 ].p = prog;
487487 }
488488
@@ -498,7 +498,7 @@ void BasicInterpreter::scan_labels()
498498 (addr == -1 ) ? serror (5 ) : serror (6 );
499499 }
500500
501- strcpy (label_table[addr].name , token);
501+ std:: strcpy (label_table[addr].name , token);
502502 label_table[addr].p = prog; /* current point in program */
503503 }
504504
@@ -520,7 +520,7 @@ char *BasicInterpreter::find_label(char *s)
520520 int t;
521521
522522 for (t = 0 ; t < NUM_LAB; ++t) {
523- if (!strcmp (label_table[t].name , s)) {
523+ if (!std:: strcmp (label_table[t].name , s)) {
524524 return label_table[t].p ;
525525 }
526526 }
@@ -641,12 +641,12 @@ void BasicInterpreter::exec_sin()
641641
642642 get_token (); /* read the control variable */
643643
644- if (!isalpha (*token)) {
644+ if (!std:: isalpha (*token)) {
645645 serror (4 );
646646 return ;
647647 }
648648
649- i.var = toupper (*token) - ' A' ; /* save its index */
649+ i.var = std:: toupper (*token) - ' A' ; /* save its index */
650650
651651 get_token (); /* read the equals sign */
652652
@@ -705,12 +705,12 @@ void BasicInterpreter::greturn()
705705/* Find the value of a variable. */
706706double BasicInterpreter::find_var (char *s)
707707{
708- if (!isalpha (*s)) {
708+ if (!std:: isalpha (*s)) {
709709 serror (4 ); /* not a variable */
710710 return 0 ;
711711 }
712712
713- return variables[toupper (*token) - ' A' ];
713+ return variables[std:: toupper (*token) - ' A' ];
714714}
715715
716716/* Find value of number or variable. */
@@ -787,43 +787,43 @@ void BasicInterpreter::level4(double *result)
787787 case SIN:
788788 get_token ();
789789 level4 (&hold);
790- *result = sin ((M_PI / 180 ) * hold);
790+ *result = std:: sin ((M_PI / 180 ) * hold);
791791 break ;
792792
793793 case COS:
794794 get_token ();
795795 level4 (&hold);
796- *result = cos ((M_PI / 180 ) * hold);
796+ *result = std:: cos ((M_PI / 180 ) * hold);
797797 break ;
798798
799799 case TAN:
800800 get_token ();
801801 level4 (&hold);
802- *result = tan ((M_PI / 180 ) * hold);
802+ *result = std:: tan ((M_PI / 180 ) * hold);
803803 break ;
804804
805805 case SQRT:
806806 get_token ();
807807 level4 (&hold);
808- *result = sqrt (hold);
808+ *result = std:: sqrt (hold);
809809 break ;
810810
811811 case SQR:
812812 get_token ();
813813 level4 (&hold);
814- *result = pow (hold, 2 );
814+ *result = std:: pow (hold, 2 );
815815 break ;
816816
817817 case ABS:
818818 get_token ();
819819 level4 (&hold);
820- *result = abs (hold);
820+ *result = std::fabs (hold);
821821 break ;
822822
823823 case TRUNC:
824824 get_token ();
825825 level4 (&hold);
826- *result = trunc (hold);
826+ *result = std:: trunc (hold);
827827 break ;
828828
829829 case PI:
@@ -920,7 +920,7 @@ int BasicInterpreter::interpretBasic(QString &code)
920920
921921 char *buf = new char [code.toLatin1 ().size () + 1 ];
922922
923- memcpy (buf, code.toLatin1 ().data (), code.toLatin1 ().size ());
923+ std:: memcpy (buf, code.toLatin1 ().data (), code.toLatin1 ().size ());
924924
925925 prog = buf;
926926 scan_labels (); /* find the labels in the program */
0 commit comments