@@ -25,16 +25,16 @@ typedef enum
2525 {
2626 TheEnd
2727 , varPush
28- , var2stack // copy variable to stack w/o incrementing stack
29- , var2stackBranch // same, then jump
30- , stack2var // copy stack to variable w/o decrementing stack
31- , stack2varBranch // same, then jump
32- , ArrElmValPush // push value of array alement
28+ , var2stack /* copy variable to stack w/o incrementing stack */
29+ , var2stackBranch /* same, then jump */
30+ , stack2var /* copy stack to variable w/o decrementing stack */
31+ , stack2varBranch /* same, then jump */
32+ , ArrElmValPush /* push value of array alement */
3333 , stack2ArrElm
34- , val2stack // copy value to stack w/o incrementing stack
34+ , val2stack /* copy value to stack w/o incrementing stack */
3535 , valPush
3636 , Afunction
37- , Pop // decrement stack
37+ , Pop /* decrement stack */
3838 , Branch
3939 , PopBranch
4040 , valPushBranch
@@ -211,7 +211,7 @@ typedef struct fortharray
211211 size_t index ;
212212 size_t rank ;
213213 size_t * extent ;
214- size_t * stride ; // Product of extents
214+ size_t * stride ; /* Product of extents*/
215215 } fortharray ;
216216
217217typedef union stackvalue
@@ -392,7 +392,6 @@ static fortharray* getArrayPointer(fortharray** arrp, char* name)
392392Boolean initialise (fortharray * curarrp , size_t size )
393393 {
394394 curarrp -> index = 0 ;
395- //assert(curarrp->pval == 0);
396395 assert (curarrp -> pval == 0 || curarrp -> size == size );
397396 if (curarrp -> pval == 0 )
398397 curarrp -> pval = (forthvalue * )bmalloc (size * sizeof (forthvalue ));
@@ -426,7 +425,6 @@ static fortharray* getOrCreateArrayPointer(fortharray** arrp, char* name, size_t
426425 if (curarrp == 0 )
427426 {
428427 curarrp = * arrp ;
429- //assert(*arrp == 0);
430428 * arrp = (fortharray * )bmalloc (sizeof (fortharray ));
431429 if (* arrp )
432430 {
@@ -1461,7 +1459,7 @@ static stackvalue* trcBody(forthMemory* mem)
14611459 double ret = 0 ;
14621460 naam = wordp -> u .that -> name ;
14631461 printf ("%s\n" , naam );
1464- stackvalue * res = ftrc (sp , wordp , & ret ); // May fail!
1462+ stackvalue * res = ftrc (sp , wordp , & ret ); /* May fail! */
14651463 printf ("%s DONE\n" , naam );
14661464 if (!res )
14671465 return 0 ;
@@ -1914,7 +1912,7 @@ static int polish1(psk code, Boolean commentsAllowed)
19141912 C = polish1 (code -> RIGHT , TRUE);
19151913 if (C == -1 )
19161914 return -1 ;
1917- if (C == 0 ) // This results in a NoOp
1915+ if (C == 0 ) /* This results in a NoOp */
19181916 return 7 + R + C ;
19191917 if (R == 0 || C == 0 )
19201918 return R + C ; /* Function definition on the left and/or right side. */
@@ -2249,12 +2247,7 @@ static psk IntegerNode(double val)
22492247 char jotter [512 ];
22502248 if (val <= (double )INT64_MIN || val > (double )INT64_MAX )
22512249 {
2252- #if defined __EMSCRIPTEN__
2253- // long long long1 = (long long)1;
2254- int64_t long1 = (int64_t )1 ;
2255- #else
22562250 int64_t long1 = (int64_t )1 ;
2257- #endif
22582251 double fcac = (double )(long1 << 52 );
22592252 int exponent ;
22602253 ULONG flg = 0 ;
@@ -2513,7 +2506,7 @@ static Boolean shortcutJumpChains(forthword* wordp)
25132506 wordp -> offset = (unsigned int )(label - wstart );
25142507 }
25152508 }
2516- // #define SHOWOPTIMIZATIONS
2509+ /* #define SHOWOPTIMIZATIONS*/
25172510#ifdef SHOWOPTIMIZATIONS
25182511 if (res ) printf ("shortcutJumpChains\n" );
25192512#endif
@@ -3102,20 +3095,20 @@ static Boolean eliminateBranch(forthword* wstart)
31023095 125 Pop times
31033096 126 floor
31043097 127 stack2ArrElm T
3105- 128 var2stackBranch 131 j // This must be some unconditional branch
3098+ 128 var2stackBranch 131 j This must be some unconditional branch
31063099 129 stack2ArrElm T
31073100
3108- 118 NoOp fand // Branch -> NoOp
3101+ 118 NoOp fand Branch -> NoOp
31093102 119 varPush J
31103103 120 valPush 10.000000
3111- 121 PopB < 128 // 119 -> 129 -> 128
3104+ 121 PopB < 128 119 -> 129 -> 128
31123105 122 var2stack J
31133106 123 valPush 25.600000
31143107 124 Pop times
31153108 125 floor
31163109 126 stack2ArrElm T
31173110 127 var2stackBranch 131 j
3118- 128 val2stack 0.000000 // val2stackBranch -> val2stack
3111+ 128 val2stack 0.000000 val2stackBranch -> val2stack
31193112 129 stack2ArrElm T
31203113
31213114Label 119 replaced by (label of 119)
@@ -3321,7 +3314,7 @@ static Boolean combinePopThenPop(forthword* wstart, char* marks)
33213314 for (forthword * wordp = wstart ; wordp -> action != TheEnd ; ++ wordp )
33223315 {
33233316 forthword * label ;
3324- if (marks [(wordp + 1 ) - wstart ] != 1 ) // Nobody is jumping to the next word
3317+ if (marks [(wordp + 1 ) - wstart ] != 1 ) /* Nobody is jumping to the next word */
33253318 {
33263319 switch (wordp -> action )
33273320 {
@@ -3742,7 +3735,6 @@ static forthword* polish2(forthMemory* mem, jumpblock* jumps, psk code, forthwor
37423735 wordp = polish2 (mem , jumps , code -> RIGHT , wordp , TRUE);
37433736 if (!wordp )
37443737 {
3745- //showProblematicNode("wordp==0", code->RIGHT);
37463738 return 0 ;
37473739 }
37483740 if (wordp == saveword )
@@ -4036,9 +4028,7 @@ static forthword* polish2(forthMemory* mem, jumpblock* jumps, psk code, forthwor
40364028 size_t rank = arr -> rank ;
40374029 if (rank == 0 )
40384030 {
4039- // errorprintf( "idx: Array \"%s\" has unknown rank and extent(s). Assuming %zu, based on idx.\n", arrname, h);
40404031 rank = arr -> rank = h ;
4041- // return 0;
40424032 }
40434033 if (h != rank )
40444034 {
@@ -4108,7 +4098,7 @@ static forthword* polish2(forthMemory* mem, jumpblock* jumps, psk code, forthwor
41084098 {
41094099 for (func = currentMem -> functions ; func ; func = func -> nextFnc )
41104100 {
4111- if (func != childMem // No recursion! (Has to be tested during compilation)
4101+ if (func != childMem /* No recursion! (Has to be tested during compilation)*/
41124102 && func -> name
41134103 && !strcmp (func -> name , name )
41144104 )
@@ -4126,7 +4116,6 @@ static forthword* polish2(forthMemory* mem, jumpblock* jumps, psk code, forthwor
41264116 if (!is_op (rhs ) && parms > func -> parameters )
41274117 {
41284118 errorprintf ("Too few parameters when calling \"%s\".\n" , name );
4129- // return 0;
41304119 }
41314120 psk parm ;
41324121 if (Op (rhs ) == COMMA )
@@ -4231,7 +4220,7 @@ static forthword* polish2(forthMemory* mem, jumpblock* jumps, psk code, forthwor
42314220 {
42324221 for (func = currentMem -> functions ; func ; func = func -> nextFnc )
42334222 {
4234- if (func != childMem // No recursion! (Has to be tested during compilation)
4223+ if (func != childMem /* No recursion! (Has to be tested during compilation)*/
42354224 && func -> name
42364225 && !strcmp (func -> name , name )
42374226 )
@@ -4383,7 +4372,7 @@ static Boolean setparm(size_t Ndecl, forthMemory* forthstuff, psk declaration, B
43834372 return FALSE;
43844373 }
43854374
4386- if (declaration -> LEFT -> u .sobj == 's' ) // scalar
4375+ if (declaration -> LEFT -> u .sobj == 's' ) /* scalar */
43874376 {
43884377 if (is_op (declaration -> RIGHT ))
43894378 {
@@ -4404,7 +4393,7 @@ static Boolean setparm(size_t Ndecl, forthMemory* forthstuff, psk declaration, B
44044393 npar -> u .v = var ;
44054394 }
44064395 }
4407- else // array
4396+ else /* array */
44084397 {
44094398 fortharray * a = haveArray (forthstuff , declaration -> RIGHT , in_function );
44104399 if (a )
@@ -4634,15 +4623,9 @@ static forthMemory* calcnew(psk arg, forthMemory* parent, Boolean in_function)
46344623 jumpblock * j5 = (jumpblock * )(forthstuff -> word );
46354624 j5 -> j [estart ].offset = (unsigned int )((& (j5 -> j [0 ]) + sizeof (jumpblock ) / sizeof (forthword )) - forthstuff -> word );
46364625 j5 -> j [estart ].action = Branch ;
4637- //j5->j[epopS].offset = 1;
4638- //j5->j[epopS].action = Pop;
4639- //j5->j[eS].offset = 0;
4640- //j5->j[eS].action = TheEnd;
46414626 j5 -> j [epopF ].offset = 1 ;
46424627 j5 -> j [epopF ].action = Pop ;
4643- //j5->j[eF].offset = 0;
4644- //j5->j[eF].action = TheEnd;
4645-
4628+
46464629 mustpop = enopop ;
46474630
46484631 lastword = polish2 (forthstuff , j5 , code , forthstuff -> word + sizeof (jumpblock ) / sizeof (forthword ), FALSE);
@@ -4688,7 +4671,7 @@ static forthMemory* calcnew(psk arg, forthMemory* parent, Boolean in_function)
46884671 somethingdone |= dissolveNextWordBranches (forthstuff -> word );
46894672 somethingdone |= combineUnconditionalBranchTovalPush (forthstuff -> word );
46904673 memset (marks , 0 , length * sizeof (char ));
4691- somethingdone |= combineval2stack (forthstuff -> word , marks ); // FAULTY!
4674+ somethingdone |= combineval2stack (forthstuff -> word , marks ); /* FAULTY! */
46924675 memset (marks , 0 , length * sizeof (char ));
46934676 somethingdone |= combinePopThenPop (forthstuff -> word , marks );
46944677 somethingdone |= eliminateBranch (forthstuff -> word );
0 commit comments