@@ -25,16 +25,16 @@ typedef enum
25
25
{
26
26
TheEnd
27
27
, 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 */
33
33
, stack2ArrElm
34
- , val2stack // copy value to stack w/o incrementing stack
34
+ , val2stack /* copy value to stack w/o incrementing stack */
35
35
, valPush
36
36
, Afunction
37
- , Pop // decrement stack
37
+ , Pop /* decrement stack */
38
38
, Branch
39
39
, PopBranch
40
40
, valPushBranch
@@ -211,7 +211,7 @@ typedef struct fortharray
211
211
size_t index ;
212
212
size_t rank ;
213
213
size_t * extent ;
214
- size_t * stride ; // Product of extents
214
+ size_t * stride ; /* Product of extents*/
215
215
} fortharray ;
216
216
217
217
typedef union stackvalue
@@ -392,7 +392,6 @@ static fortharray* getArrayPointer(fortharray** arrp, char* name)
392
392
Boolean initialise (fortharray * curarrp , size_t size )
393
393
{
394
394
curarrp -> index = 0 ;
395
- //assert(curarrp->pval == 0);
396
395
assert (curarrp -> pval == 0 || curarrp -> size == size );
397
396
if (curarrp -> pval == 0 )
398
397
curarrp -> pval = (forthvalue * )bmalloc (size * sizeof (forthvalue ));
@@ -426,7 +425,6 @@ static fortharray* getOrCreateArrayPointer(fortharray** arrp, char* name, size_t
426
425
if (curarrp == 0 )
427
426
{
428
427
curarrp = * arrp ;
429
- //assert(*arrp == 0);
430
428
* arrp = (fortharray * )bmalloc (sizeof (fortharray ));
431
429
if (* arrp )
432
430
{
@@ -1461,7 +1459,7 @@ static stackvalue* trcBody(forthMemory* mem)
1461
1459
double ret = 0 ;
1462
1460
naam = wordp -> u .that -> name ;
1463
1461
printf ("%s\n" , naam );
1464
- stackvalue * res = ftrc (sp , wordp , & ret ); // May fail!
1462
+ stackvalue * res = ftrc (sp , wordp , & ret ); /* May fail! */
1465
1463
printf ("%s DONE\n" , naam );
1466
1464
if (!res )
1467
1465
return 0 ;
@@ -1914,7 +1912,7 @@ static int polish1(psk code, Boolean commentsAllowed)
1914
1912
C = polish1 (code -> RIGHT , TRUE);
1915
1913
if (C == -1 )
1916
1914
return -1 ;
1917
- if (C == 0 ) // This results in a NoOp
1915
+ if (C == 0 ) /* This results in a NoOp */
1918
1916
return 7 + R + C ;
1919
1917
if (R == 0 || C == 0 )
1920
1918
return R + C ; /* Function definition on the left and/or right side. */
@@ -2249,12 +2247,7 @@ static psk IntegerNode(double val)
2249
2247
char jotter [512 ];
2250
2248
if (val <= (double )INT64_MIN || val > (double )INT64_MAX )
2251
2249
{
2252
- #if defined __EMSCRIPTEN__
2253
- // long long long1 = (long long)1;
2254
- int64_t long1 = (int64_t )1 ;
2255
- #else
2256
2250
int64_t long1 = (int64_t )1 ;
2257
- #endif
2258
2251
double fcac = (double )(long1 << 52 );
2259
2252
int exponent ;
2260
2253
ULONG flg = 0 ;
@@ -2513,7 +2506,7 @@ static Boolean shortcutJumpChains(forthword* wordp)
2513
2506
wordp -> offset = (unsigned int )(label - wstart );
2514
2507
}
2515
2508
}
2516
- // #define SHOWOPTIMIZATIONS
2509
+ /* #define SHOWOPTIMIZATIONS*/
2517
2510
#ifdef SHOWOPTIMIZATIONS
2518
2511
if (res ) printf ("shortcutJumpChains\n" );
2519
2512
#endif
@@ -3102,20 +3095,20 @@ static Boolean eliminateBranch(forthword* wstart)
3102
3095
125 Pop times
3103
3096
126 floor
3104
3097
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
3106
3099
129 stack2ArrElm T
3107
3100
3108
- 118 NoOp fand // Branch -> NoOp
3101
+ 118 NoOp fand Branch -> NoOp
3109
3102
119 varPush J
3110
3103
120 valPush 10.000000
3111
- 121 PopB < 128 // 119 -> 129 -> 128
3104
+ 121 PopB < 128 119 -> 129 -> 128
3112
3105
122 var2stack J
3113
3106
123 valPush 25.600000
3114
3107
124 Pop times
3115
3108
125 floor
3116
3109
126 stack2ArrElm T
3117
3110
127 var2stackBranch 131 j
3118
- 128 val2stack 0.000000 // val2stackBranch -> val2stack
3111
+ 128 val2stack 0.000000 val2stackBranch -> val2stack
3119
3112
129 stack2ArrElm T
3120
3113
3121
3114
Label 119 replaced by (label of 119)
@@ -3321,7 +3314,7 @@ static Boolean combinePopThenPop(forthword* wstart, char* marks)
3321
3314
for (forthword * wordp = wstart ; wordp -> action != TheEnd ; ++ wordp )
3322
3315
{
3323
3316
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 */
3325
3318
{
3326
3319
switch (wordp -> action )
3327
3320
{
@@ -3742,7 +3735,6 @@ static forthword* polish2(forthMemory* mem, jumpblock* jumps, psk code, forthwor
3742
3735
wordp = polish2 (mem , jumps , code -> RIGHT , wordp , TRUE);
3743
3736
if (!wordp )
3744
3737
{
3745
- //showProblematicNode("wordp==0", code->RIGHT);
3746
3738
return 0 ;
3747
3739
}
3748
3740
if (wordp == saveword )
@@ -4036,9 +4028,7 @@ static forthword* polish2(forthMemory* mem, jumpblock* jumps, psk code, forthwor
4036
4028
size_t rank = arr -> rank ;
4037
4029
if (rank == 0 )
4038
4030
{
4039
- // errorprintf( "idx: Array \"%s\" has unknown rank and extent(s). Assuming %zu, based on idx.\n", arrname, h);
4040
4031
rank = arr -> rank = h ;
4041
- // return 0;
4042
4032
}
4043
4033
if (h != rank )
4044
4034
{
@@ -4108,7 +4098,7 @@ static forthword* polish2(forthMemory* mem, jumpblock* jumps, psk code, forthwor
4108
4098
{
4109
4099
for (func = currentMem -> functions ; func ; func = func -> nextFnc )
4110
4100
{
4111
- if (func != childMem // No recursion! (Has to be tested during compilation)
4101
+ if (func != childMem /* No recursion! (Has to be tested during compilation)*/
4112
4102
&& func -> name
4113
4103
&& !strcmp (func -> name , name )
4114
4104
)
@@ -4126,7 +4116,6 @@ static forthword* polish2(forthMemory* mem, jumpblock* jumps, psk code, forthwor
4126
4116
if (!is_op (rhs ) && parms > func -> parameters )
4127
4117
{
4128
4118
errorprintf ("Too few parameters when calling \"%s\".\n" , name );
4129
- // return 0;
4130
4119
}
4131
4120
psk parm ;
4132
4121
if (Op (rhs ) == COMMA )
@@ -4231,7 +4220,7 @@ static forthword* polish2(forthMemory* mem, jumpblock* jumps, psk code, forthwor
4231
4220
{
4232
4221
for (func = currentMem -> functions ; func ; func = func -> nextFnc )
4233
4222
{
4234
- if (func != childMem // No recursion! (Has to be tested during compilation)
4223
+ if (func != childMem /* No recursion! (Has to be tested during compilation)*/
4235
4224
&& func -> name
4236
4225
&& !strcmp (func -> name , name )
4237
4226
)
@@ -4383,7 +4372,7 @@ static Boolean setparm(size_t Ndecl, forthMemory* forthstuff, psk declaration, B
4383
4372
return FALSE;
4384
4373
}
4385
4374
4386
- if (declaration -> LEFT -> u .sobj == 's' ) // scalar
4375
+ if (declaration -> LEFT -> u .sobj == 's' ) /* scalar */
4387
4376
{
4388
4377
if (is_op (declaration -> RIGHT ))
4389
4378
{
@@ -4404,7 +4393,7 @@ static Boolean setparm(size_t Ndecl, forthMemory* forthstuff, psk declaration, B
4404
4393
npar -> u .v = var ;
4405
4394
}
4406
4395
}
4407
- else // array
4396
+ else /* array */
4408
4397
{
4409
4398
fortharray * a = haveArray (forthstuff , declaration -> RIGHT , in_function );
4410
4399
if (a )
@@ -4634,15 +4623,9 @@ static forthMemory* calcnew(psk arg, forthMemory* parent, Boolean in_function)
4634
4623
jumpblock * j5 = (jumpblock * )(forthstuff -> word );
4635
4624
j5 -> j [estart ].offset = (unsigned int )((& (j5 -> j [0 ]) + sizeof (jumpblock ) / sizeof (forthword )) - forthstuff -> word );
4636
4625
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;
4641
4626
j5 -> j [epopF ].offset = 1 ;
4642
4627
j5 -> j [epopF ].action = Pop ;
4643
- //j5->j[eF].offset = 0;
4644
- //j5->j[eF].action = TheEnd;
4645
-
4628
+
4646
4629
mustpop = enopop ;
4647
4630
4648
4631
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)
4688
4671
somethingdone |= dissolveNextWordBranches (forthstuff -> word );
4689
4672
somethingdone |= combineUnconditionalBranchTovalPush (forthstuff -> word );
4690
4673
memset (marks , 0 , length * sizeof (char ));
4691
- somethingdone |= combineval2stack (forthstuff -> word , marks ); // FAULTY!
4674
+ somethingdone |= combineval2stack (forthstuff -> word , marks ); /* FAULTY! */
4692
4675
memset (marks , 0 , length * sizeof (char ));
4693
4676
somethingdone |= combinePopThenPop (forthstuff -> word , marks );
4694
4677
somethingdone |= eliminateBranch (forthstuff -> word );
0 commit comments