--- freem/src/expr.c 2025/03/30 01:36:58 1.11 +++ freem/src/expr.c 2025/04/10 01:24:38 1.12 @@ -1,5 +1,5 @@ /* - * $Id: expr.c,v 1.11 2025/03/30 01:36:58 snw Exp $ + * $Id: expr.c,v 1.12 2025/04/10 01:24:38 snw Exp $ * expression parser * * @@ -24,6 +24,9 @@ * along with FreeM. If not, see . * * $Log: expr.c,v $ + * Revision 1.12 2025/04/10 01:24:38 snw + * Remove C++ style comments + * * Revision 1.11 2025/03/30 01:36:58 snw * Make it easier to bring back fma_gedit, fix double-free in global handler, limit $CHAR to 7-bit ASCII * @@ -769,7 +772,7 @@ d_o_n: if (merr () == UNDEF) { - //smw 15 nov 2023 merr_raise (ierr < 0 ? OK - CTRLB : OK); + /* smw 15 nov 2023 merr_raise (ierr < 0 ? OK - CTRLB : OK); */ merr_clear (); if (*++codptr == ',') { @@ -954,7 +957,7 @@ undefglvn: stcpy (refsav[refsx], zref); stcpy (refsav[refsx++] + 256, zloc); - ierr -= M7; //smw TODO HUH?? + ierr -= M7; arg--; goto nextchr; @@ -4607,7 +4610,7 @@ extra_fun: obj_field = FALSE; - //dofram0 = dofrmptr; + /* dofram0 = dofrmptr; */ i = 0; codptr++; @@ -4669,7 +4672,7 @@ extra_fun: obj_field = FALSE; - //dofram0 = 0; + /* dofram0 = 0; */ if (*codptr == '(') codptr += 2; } @@ -4745,7 +4748,7 @@ extra_fun: /* save off the return type to be checked by QUIT code */ extr_types[nstx + 1] = ret_type; - //printf ("return_type = '%s' *reg = '%c'\r\n", return_type, *reg); + /* printf ("return_type = '%s' *reg = '%c'\r\n", return_type, *reg); */ } if (*reg == TAB || *reg == SP) goto off; @@ -4880,21 +4883,23 @@ off: else { /* PARSE FORMALLIST */ short fl_type; - short fl_mandatory; - short fl_byref; + /* re-enable following 3 later */ + /*short fl_mandatory;*/ + /*short fl_byref;*/ + /*short lastparm;*/ char fl_typestr[255]; char fl_mand; short dtcheck_result; register short typei; - short lastparm; short gotparm; int paramct; fl_type = DT_AUTO; - fl_mandatory = TRUE; - fl_byref = FALSE; + /* re-enable following 3 later */ + /*fl_mandatory = TRUE;*/ + /*fl_byref = FALSE;*/ + /*lastparm = FALSE;*/ dtcheck_result = FALSE; - lastparm = FALSE; gotparm = FALSE; paramct = 0; @@ -4917,6 +4922,7 @@ off: fl_typestr[typei] = '\0'; fl_mand = *(reg + 1); + /* if ((fl_mand == 'o') || (fl_mand == 'O')) { fl_mandatory = FALSE; } @@ -4931,12 +4937,29 @@ off: goto errexfun; } + */ + + if ((fl_mand != 'o') && (fl_mand != 'O')) { + merr_raise (INVLIBOPT); + dofrmptr = dofram0; + + errex = TRUE; + + nstx--; + estack--; + + goto errexfun; + } + + } else if ((ch == ',') || (ch == ')')) { + /* re-enable later if (ch == ')') { lastparm = TRUE; } + */ gotparm = TRUE; paramct++; @@ -4973,7 +4996,7 @@ off: if (dtcheck_result == FALSE) { merr_raise (TYPMISMATCH); - dofrmptr = dofram0; // reset frame pointer + dofrmptr = dofram0; /* reset frame pointer */ errex = TRUE; @@ -5494,8 +5517,6 @@ errexfun: ilong = ilong1 - (ilong * 86400); lintstr (&a[i], ilong); - -// printf ("unix epoch = %d\r\n", horolog_to_unix (a)); goto exec; @@ -5572,7 +5593,7 @@ errexfun: case SVNecode: - //write_m ("in SVNecode\r\n\201"); + /* write_m ("in SVNecode\r\n\201"); */ if (stlen (user_ecode)) { stcpy (a, user_ecode); @@ -5596,7 +5617,7 @@ errexfun: case SVNetrap: -// write_m ("in SVNetrap\r\n\201"); +/* write_m ("in SVNetrap\r\n\201"); */ stcpy (a, etrap); goto exec; @@ -5680,15 +5701,15 @@ errexfun: goto exec; - ///* $ZX (number of columns) */ - //case 'X': - //intstr (a, n_columns); - // goto exec; - - ///* $ZY (number of rows) */ - //case 'Y': - //intstr (a, n_lines); - //goto exec; + /* $ZX (number of columns) */ + case 'X': + intstr (a, n_columns); + goto exec; + + /* $ZY (number of rows) */ + case 'Y': + intstr (a, n_lines); + goto exec; /* $ZERROR */ case 'E':