summaryrefslogtreecommitdiff
path: root/web/yacco2/library/macros.w
blob: 4f81d59372d21ef8c2e8617b0c7d92a94213704e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
@q file: macros.w@>
@q%   Copyright Dave Bone 1998 - 2015@>
@q% /*@>
@q%    This Source Code Form is subject to the terms of the Mozilla Public@>
@q%    License, v. 2.0. If a copy of the MPL was not distributed with this@>
@q%    file, You can obtain one at http://mozilla.org/MPL/2.0/.@>
@q% */@>
@** Macro definitions.\fbreak
I use macros of \CPLUSPLUS/ and |cweb| variety.
Their use covers terminal constructor initialization, tracing of flow control events,
parse stack configuration and syntax directed directives,
utilities to deal with specific parse situations or results, and
aid macros to debug grammars.

As log trace files can be volumous, i placed within each 
logged message the macro variable's name that controls its output.
For example, |YACCO2_MSG__| controls signalling between threads as in wait-for-wakeup message 
from one of the called threads etc.
I'll see how refined this is by
use of an UNIX shell's scripting language like ``bash'' with piping.
I'll let u posted.  

@*2 Copyright.
@<copyright notice@>=
// copyright

@*2 |EXTERNAL_GPSing| macro is used to print out T's external file.\fbreak
The external file comes from |tok_can|
 container use that registers the external files processed with |FILE_TBL__|.
 A created T has a subscript reference into this stack.
 Sanity check must exist against the |FILE_TBL__| registrar or a possible
 out-of-subscript error could be thrown.

 One misuse is to process the ``command line'' input
  where the input is written to a  holding file.
 A hardwiring of 1 for  the file is used as the ``holding file'' is the first file 
 inputted to |Yacco2|. But if the holding file name is illegal, 
  a T error of ``bad file inputted'' created with this file reference as crap.
  The other potential error is the CLI inputted file is non existent and creating the 
  error T referenced to the holding file which has not been registered 
  with |FILE_TBL__| thru |tok_can<ifstream>| container create also becomes poop-poop.
  
 Now u defined an Error\_handler grammar to trace out those errors  expecting to see the 
 traced output with the external file name and its contents line references.
 Say the ``holding file'' exists with the command line data placed there but 
 never registered the holding file with the |tok_can|.
 Hence the {\bf non registering of the CLI holding file} will not be printed
 by the parser / Error processing grammar.
 See the ``./grammar-testsuite/testout.pdf'' program as an example of
 ``command line processing'' to avoid the above errors. 
 @d EXTERNAL_GPSing(TOK__)
  if(TOK__->tok_co_ords__.external_file_id__ <   yacco2::FILE_TBL__.size()){
   yacco2::lrclog << yacco2::FILE_TBL__[TOK__->tok_co_ords__.external_file_id__].c_str();
  }else {
   yacco2::lrclog << " EXTERNAL_GPSing - No external file registered to use"
   << " stack subscript: "
   << TOK__->tok_co_ords__.external_file_id__;
  } 
@*2 |FILE_LINE| macro source file co-ordinates for tracing.\fbreak
Add the file and line number to the dynamic tracing output.
Allows one to go to the source code
if things are askew.
Gum stuck to your shoe but hey it's an indication.
@d FILE_LINE ' ' << __FILE__ << ": " << __LINE__

@*2 |T_CTOR| macro is used by the terminal defs supplied to the grammar.\fbreak
When a terminal definition needs to be customized, the grammar writer
can roll his own class definition. It just initializes the base
variables within the class constructor's implementation.
Its name is composed of |T| indicating for terminals, and the |CTOR|
uses the \CPLUSPLUS/ naming convention to indicate that it belongs to the
class constructor.
Please have a look at Yacco2's |yacco2_k_symbols.lex| file
that defines the lr constants definitions for a demonstration of use.
For the moment there are 5 parameters: A..E. 
Originally there was more to handle the push-pop-lookahead functors.
From Yacco2's use, these functors were never needed. It was only
during my Master's thesis  that they got their 15 minutes of fame.

\ptindent{Parameter A: provides the terminal's literal name for tracing}
\ptindent{Parameter B is the enumerated value}
 It is symbolically gened
by prefixing an |T_| to the `\CPLUSPLUS/' name of the terminal and ending it off with
a |_| suffix. This is described in |Enumeration of Alphabets|.

\ptindent{Parameter C is the address of the class destructor function or nil}
 I know, this should be automatically
detected by Yacco2's parse generator  but for now this is reality: still outstanding.

|parser__| is the associated parser for the grammar used by the grammar's rules. 
As the |CAbs_lr1_sym|
is a base structure for both the terminals and rules of the grammar, 
it has no associated parser for the terminals as terminals are nomadic by nature.
Normally |tok_co_ords__|'s attributes are overriden by a raw character co-ordinates.
Terminals are composites of other basic entities like raw character terminals.

\ptindent{Parameter D is auto delete boolean value of ON or OFF}
\ptindent{Parameter E is auto abort boolean value of ON or OFF}

An auto delete attribute indicates that the terminal is deleted when popped from the parse stack.
When an abort of a parse occurs, this attribute when turned on indicates
that the object should be deleted. It's a `clean up your own mess' attribute.
Both paramaters relate to the terminal's `AD' and `AB' grammatical attributes.
An example of |T_CTOR| use is:\fbreak
\ptindent{|T_CTOR|("labeled-stmt",|T_T_labeled_stmt_|,|&dtor_T_labeled_stmt|,OFF,ON)}
      
|T_CTOR_RW| macro handles the raw character terminals. 
The additional 2 parameters F, and G are the
source file index and character position within the file. 
Please look at Yacco2's |yacco2_characters.lex| file
to see an example of |T_CTOR_RW| use.
The |Yacco2| runtime environment maintains an index of files included into the source grammar.
|FILE_TBL__| is a vector of file index and the external filename literal. 
|FILE_CNT__| is the matching external variable used by the
include file grammar that stacks them when nested include statements come into and out of scope.
From the raw character classes, the GPS of the character is passed in as parameters.
A specialized |tok_can| template for `file to raw character' object mapping handles this task.
@*2 |T_CTOR|, |T_CTOR_RW| macros.
@d T_CTOR(A,B,C,D,E)
:CAbs_lr1_sym(A,C,B,D,E)
@d T_CTOR_RW(A,B,C,D,E,F,G)
:CAbs_lr1_sym(A,C,B,D,E,F,G)
@*2 Define |YACCO2_define_trace_variables|.\fbreak
See ``The \CPLUSPLUS/ preprocessor coding game'' regarding the individual tracing variable
functionality.
@d YACCO2_define_trace_variables()
int yacco2::YACCO2_T__(OFF);
int yacco2::YACCO2_TLEX__(OFF);
int yacco2::YACCO2_MSG__(OFF);
int yacco2::YACCO2_TH__(OFF);
int yacco2::YACCO2_AR__(OFF);
int yacco2::YACCO2_THP__(OFF);
int yacco2::YACCO2_MU_TRACING__(OFF);
int yacco2::YACCO2_MU_TH_TBL__(OFF);
int yacco2::YACCO2_MU_GRAMMAR__(OFF);

@*2 Token placement macros.\fbreak 
They are used by the grammar writer within
syntax directed code sections of a grammar to place a token into appropriate queues:\fbreak
\ptindent{recycle container --- used to delete or re-integrate tokens back into a parse stream}
\ptindent{accept container --- tokens returned by launched threads for arbitration}
\ptindent{producer container - tokens outputted for other parse stages}
\ptindent{error container --- a container of accrued error tokens}
\ptindent{supplier of tokens --- token stream that a grammar parses}
@*3 |ADD_TOKEN_TO_RECYCLE_BIN|.\fbreak
This is a holding pen for possibly re-use of the token 
that has been pulled out of the token stream.
It is a minor facility but has poco merit.
@d ADD_TOKEN_TO_RECYCLE_BIN(Token)
   rule_info__.parser__->add_token_to_recycle_bin(Token)
@*3 |DELETE_T_SYM| macro.\fbreak
This macro deletes a T when passed by pointer.
It only allows Tes that are from either Error or Meta-terminal classes.
This guards against the erasing of preallocated Tes of LR k or RC (raw chacacter) classes.
They are preallocated from the memory heap for speed.
It checks whether the symbol's |dtor__| static method is present and calls it.
This allows a delete chain calling  of other dependents or other dependencies 
when the |destructor| directive is 
used within the T grammar definition.
Why this route to T symbol deletes rather than c++'s dtor: |~T()|?
Mixed into the fray is my |AB| abort parse stack cleanup.
Whether its of any use this is my experiment.
It required the stack frame pointer as the 2nd parameter.
For the just plain way to deletes, this macro eases the complaints
without the stack frame pointer.
Depending on how your compiler/translator runs,
deleting of Tes could be left to the process teardown.
If your language recognizer is always on and being invoked like an Internet protocol,
then T hygiene is required or those memory leaks will haunt u.
@d DELETE_T_SYM(T)
  if(T != 0){
    if(T->enumerated_id__ > END_OF_RC_ENUMERATE){
      if(T->dtor__ != 0){
       (*T->dtor__)(T,0);// stack frame 0
      }
      delete T;
    }
  }
@*3 Add token to an accept queue: |RSVP|, |RSVP_FSM|, |RSVP_WLA|  macros.\fbreak
|RSVP| places a token into the calling grammar's accept queue that requested this thread.
It can be placed anywhere in the syntax directed code of the grammar except within
the grammar's fsm context where you use the |RSVP_FSM| macro.
The |RSVP_WLA| allows u to override the lookahead bounds instead
of taking as default the current token. 
A quick review of messages, threads, and accept tokens:\fbreak
\ptindent{the calling grammar: 1:m launching of threads}
\ptindent{accept queue: 0:m potential tokens returned by launched threads}
\ptindent{1 wakeup event to calling grammar by thread finished last in execution}

Arbitration is used by the caller grammar 
 when it is re-activated by an event (message) from the thread
 finishing last in execution order:
  the status message ``accept parallel parse'' is posted to just
  wake up the calling grammar regardless of the overall parse
  success by the launched threads. It is the |th_accepting_cnt__| 
  that determines whether the threads were successful or not.  
It only occurs when there are items in the accept queue.
If none of the launched threads are successful in their parsing, then the
calling grammar will attempt to go through its conditional parsing (non-determinism).
Arbitration is the associated code within the grammar's fsm state that launched the threads.
It rules on possibly more than one accept token being returned.
A little french spices up this ho-hum macro.

Why is there an accepted token position?
Remember the current token in the thread's parse stream
 is now the future position in the token stream to continue parsing from
for the calling grammar.
In a long stream of characters that makes up the accept token, 
usually its the start token's
position passed to the called thread that is used to GPS it's position within the token stream.
The current token context ( I call the ``lookahead context'')
is  provided by the last 2 parameters for the |Caccept_parse|.
It is this lookahead context of the accepted token that is used
to continue parsing within the calling grammar.
The arbitrated token is parallel shifted and its accompaning lookahead boundry
is then used to reduce the parallel shift's subrule expression.
All other potential accept tokens are flushed out of the accept queue.
@d RSVP(Token)
   rule_info__.parser__->pp_rsvp__.fill_it(*rule_info__.parser__
   ,*Token,Token->tok_co_ords__.rc_pos__
   ,*rule_info__.parser__->current_token__
   ,rule_info__.parser__->current_token_pos__)

@d RSVP_WLA(Token,LATOK,LAPOS)
   rule_info__.parser__->pp_rsvp__.fill_it(*rule_info__.parser__
   ,*Token,Token->tok_co_ords__.rc_pos__
   ,*LATOK
   ,LAPOS)

@d RSVP_FSM(Token)
   parser__->pp_rsvp__.fill_it(*parser__
   ,*Token,Token->tok_co_ords__.rc_pos__
   ,*parser__->current_token__,parser__->current_token_pos__)

@*3 |ADD_TOKEN_TO_PRODUCER_QUEUE|.\fbreak
 This allows one to output from a parse a terminal stream
that becomes a supplier queue for another grammar to parse. 
@d ADD_TOKEN_TO_PRODUCER_QUEUE(TOKEN) 
   rule_info__.parser__->add_token_to_producer(TOKEN)
@*3 |ADD_TOKEN_TO_ERROR_QUEUE| and |ADD_TOKEN_TO_ERROR_QUEUE_FSM|.\fbreak
This becomes a holding queue
that can be processed by a error grammar. It's a nice way
to format parsing errors. It is the context that determines which macro to use.
@d ADD_TOKEN_TO_ERROR_QUEUE(TOKEN) rule_info__.parser__->add_token_to_error_queue(TOKEN)
@d ADD_TOKEN_TO_ERROR_QUEUE_FSM(TOKEN) parser__->add_token_to_error_queue(TOKEN)


@*2 Generated finite state automaton macros.\fbreak
 They are included in the \CPLUSPLUS/ code of each rule emitted by Yacco2.
 Their names are sufficient to explain their intent.
 Why the wrapping of the macros within the @@$=$ ... @@$>$ construct
 instead of a plain macro ``|#define|'' definition?
 Glad u asked. The |cweave| version ``7.5.5'' on a Mac emits code
  that |pdftex| Version 3.141592-1.30.4-2.2 honks: too many {$``\}''$} or
 {``\$''}. So this is my workaround until i have time to get a
 higher version of cweave. 
 
 Note: the |cweb| Microsoft flavour works.
 More rumblings from within my quest to port Yacco2.
 Screw the port. i need to read it.\fbreak
 Brought back |cweb| macros as they work on the Mac now.

@d ssNEW_TRACEss(ssPss,ssQss) 
 yacco2::lrclog << "\t!!!!! new adr: " << (void*)ssPss 
 << " " << #ssQss << ' '<<__FILE__<<':'<<__LINE__<< std::endl; 
 yacco2::lrclog << "\tfile: " << __FILE__ << " line: " << __LINE__ << std::endl;

@d ssP_TRACEss(ssPss,ssQss) 
 yacco2::lrclog 
 << '\t' << Parse_env->thread_no__ 
 << "\t!!!!! new adr: " << (void*)ssPss 
 << " " << #ssQss <<FILE_LINE<< std::endl; 
 yacco2::lrclog 
 << "\tfile: " << __FILE__ << " line: " << __LINE__ << std::endl;

@d sstrace_terminalsss 
 if(yacco2::YACCO2_TLEX__){
   bool to_trace_or_not_to = trace_parser_env(rule_info__.parser__,FORCE_STK_TRACE); 
   if(to_trace_or_not_to == true){
     yacco2::lrclog 
     << "\tYACCO2_TLEX__::" << rule_info__.parser__->thread_no__ 
     << rule_info__.parser__->fsm_tbl__->id__ << "::" << id__ << "::op()\n"; 
   }
 }

@d sstrace_rulesss 
 if(yacco2::YACCO2_TLEX__){
   bool to_trace_or_not_to = trace_parser_env(rule_info__.parser__,FORCE_STK_TRACE); 
   if(to_trace_or_not_to == true){
     yacco2::lrclog << "\tYACCO2_TLEX__::" << rule_info__.parser__->thread_no__ 
     << "::" << rule_info__.parser__->fsm_tbl__->id__ << "::" << id__ << "::op()\n"; 
   }
 }

@d sstrace_sub_rulesss 
 if(yacco2::YACCO2_TLEX__){
   bool to_trace_or_not_to = trace_parser_env(rule_info__.parser__,FORCE_STK_TRACE); 
   if(to_trace_or_not_to == true){
     yacco2::lrclog << "\tYACCO2_TLEX__::" << rule_info__.parser__->thread_no__ 
     << "::" << rule_info__.parser__->fsm_tbl__->id__ << "::" << id__ << "::op()\n"; 
   }
 }

@d sstrace_stack_rtnsss @/
 if(yacco2::YACCO2_TLEX__){ @/
   bool to_trace_or_not_to = trace_parser_env(Parse_env,FORCE_STK_TRACE)); 
   if(to_trace_or_not_to == true){
     yacco2::lrclog 
     << "\tYACCO2_TLEX__::" << Parse_env->thread_no__ 
     << "::" << Parse_env->fsm_tbl__->id__ << "::op() sym: " << id__ 
     << FILE_LINE<< std::endl; 
   }
 }


@*2 Pushdown automaton's flow control macros.\fbreak
They are placed in stragetic places for operations accept, reduce, shift, and abort.
As there are many points being traced, a little explanation is required to give
some semblance of order.
The messages outputted go to a log file named `tracings.log'.
What type of name is this?
The prefix 1 sorts the file to the top of a directory. The balance of the name
was an attempt to say lr output of clog type. Ugh.
This will be changed.

Messages logged fall into the parsing configuration 
that tries to give a semblance of a stack. 
It prints the stack content in bottomup order.
A sample of the trace is:\fbreak
\ptindent{|..1500::rule_def_phrase.lex::1--identifier-> 3|}
The dots indicate the number of items on the stack to be displayed, 
followed by the thread's identity --- a runtime thread number and 
the grammar's name being traced.
Following this are the stacked items displayed in bottom-to-top order.
Each item contains the finite state that it is in, a vector containing
the stacked item and the finite state's shift into state no. 

Other traces will try to output regular sentences so that they can be parsed by a
grammar or a scripting language. This will allow one to digest intelligently the interplay
between the grammar, and the appropriate running threads.
As there are many threads simultaneously running, this will help in consolidating
the reported tracings.
@^ To do canonize the traced output@>

@*3 |T_0| trace remove items from the parse stack.
@<Trace TH remove items from the parse stack configuration@>=
if(YACCO2_TH__){
  if(fsm_tbl__->debug__ == ON){
	@<acquire trace mu@>;
	 yacco2::lrclog << "YACCO2_TH__::" << thread_no__
	 << "::" << fsm_tbl__->id__ << ":: Popping items from stack # to pop: " 
	 << No_to_remove 
  << FILE_LINE<< std::endl;
	@<release trace mu@>;
	}
}

@*3 |T_0a| trace finished removing items from the parse stack.
@<Trace TH finished removing items from the parse stack configuration@>=
if(YACCO2_TH__){
  if(fsm_tbl__->debug__ == ON){
	@<acquire trace mu@>;
	 yacco2::lrclog << "YACCO2_TH__::" << thread_no__
	 << "::" << fsm_tbl__->id__ << ":: Finished Popping items from stack" 
  << FILE_LINE<< std::endl;
	@<release trace mu@>;
	}
}


@*3 |T_1| trace the parse stack if the grammar is requesting
to be debugged. The returned debug switch's value is dropped. 
@<Trace TH the parse stack configuration@>=
if(YACCO2_TH__){
  bool to_trace_or_not_to = trace_parser_env(this,COND_STK_TRACE);
}

@*3 |T_2| trace when an epsilon rule is being reduced.
@<Trace TH  when an epsilon rule is being reduced@>=
if(YACCO2_TH__){
   bool to_trace_or_not_to = trace_parser_env(this,COND_STK_TRACE);
	if(to_trace_or_not_to == YES){
	@<acquire trace mu@>;
	 yacco2::lrclog << "\tYACCO2_TH__::" << thread_no__
	 << "::" << fsm_tbl__->id__ << "::epsilon" 
  << FILE_LINE<< std::endl;
	@<release trace mu@>;
	}
}

@*3 |T_3| trace the state no when popped from the parse stack.
@<Trace TH  popped state no@>=
if(YACCO2_TH__){
  bool to_trace_or_not_to = trace_parser_env(this,COND_STK_TRACE);
	if(to_trace_or_not_to == YES){
	@<acquire trace mu@>;
	    yacco2::lrclog << "\tYACCO2_TH__::" << thread_no__;
	    yacco2::lrclog
	    << "::" << fsm_tbl__->id__ << "::popped state:: ";
	     yacco2::lrclog
	    << pr->state__->state_no__ 
     << FILE_LINE<< std::endl;
	@<release trace mu@>;
	}
}

@*3 |T_4| trace when invisible shift symbol popped from stack.\fbreak
Because this symbol is universal, ?? chk why zeroed instead of
not having AD on?
@<Trace TH zeroed out symbol situation when popped from parse stack@>=
if(YACCO2_TH__){
  bool to_trace_or_not_to = trace_parser_env(this,COND_STK_TRACE);
	if(to_trace_or_not_to == YES){
		@<acquire trace mu@>;
	    yacco2::lrclog << "\tYACCO2_TH__::" << thread_no__
	    << "::" << fsm_tbl__->id__
	    << "::exposed rule/terminal:: NULL due to invisible shift" 
     << FILE_LINE<< std::endl;
		@<release trace mu@>;
	}
}

@*3 |T_5| trace exposed symbol on parse stack.
@<Trace TH  exposed symbol on parse stack@>=
if(YACCO2_TH__){
  bool to_trace_or_not_to = trace_parser_env(this,COND_STK_TRACE);
	if(to_trace_or_not_to == YES){
@<acquire trace mu@>;
    yacco2::lrclog << "\tYACCO2_TH__::" << thread_no__
    << "::" << fsm_tbl__->id__
    << "::exposed rule/terminal:: " << parse_stack__.top__->symbol__->id__
    << ' ' << parse_stack__.top__->symbol__ 
    << FILE_LINE<< std::endl;
@<release trace mu@>;
}
} 

@*3 |T_6| trace top item on the
parse stack when auto-delete switch on.\fbreak
This is the grammatical attribute AD requesting deletion when popped from the parse stack.
@<Trace TH  advise when symbol deleted due to AD switch@>=
if(YACCO2_TH__){
  bool to_trace_or_not_to = trace_parser_env(this,COND_STK_TRACE);
  if(to_trace_or_not_to == YES){
    if(parse_stack__.top__->symbol__->auto_delete__ == YES){
     @<acquire trace mu@>;
     yacco2::lrclog << "\tYACCO2_TH__::" << thread_no__ << "::"
     << fsm_tbl__->id__
     << "::AD deleting exposed rule/terminal:: "
     << parse_stack__.top__->symbol__->id__ << ' ' 
     << parse_stack__.top__->symbol__ 
     << FILE_LINE<< std::endl;
     @<release trace mu@>;
    }
 }
}

@*3 |T_6a| trace top item on the
parse stack when auto-abort switch on.\fbreak
This occurs usually at abort time of a threaded
parse. It can occur when the grammar writer has not
removed the appropriate objects from being checked
by a destructor directive for deletion in a grammar rule.
@<Trace TH  advise when auto abort happening@>=
if(YACCO2_TH__){
  bool to_trace_or_not_to = trace_parser_env(this,COND_STK_TRACE);
  if(to_trace_or_not_to == YES){
    if(parse_stack__.top__->symbol__->affected_by_abort__ == YES){
    @<acquire trace mu@>;
     yacco2::lrclog << "\tYACCO2_TH__::" << thread_no__ << "::"
     << fsm_tbl__->id__
     << "::AB deleting exposed rule/terminal:: "
     << parse_stack__.top__->symbol__->id__ << ' ' 
     << parse_stack__.top__->symbol__ 
     << FILE_LINE<< std::endl;
     @<release trace mu@>;
   }
 }
}

@*3 |T_7| trace when threading failed: try straight parse. 
@<Trace TH failed parallel try straight parse@>=
if(YACCO2_TH__){
  bool to_trace_or_not_to = trace_parser_env(this,COND_STK_TRACE);
	if(to_trace_or_not_to == YES){
@<acquire trace mu@>;
    yacco2::lrclog << "YACCO2_TH__::" << thread_no__ << "::"
    << fsm_tbl__->id__
    << "::############# TRY STRAIGHT try_straight_due_to_aborted_parallel"
    << " reset token pos: " << current_token_pos__ 
    << " reset token: " 
    << current_token__->id__ 
    << FILE_LINE<< std::endl;
  yacco2::lrclog << "\tYACCO2_TH__::" << thread_no__
  << "::GPS RESET FILE: ";
  EXTERNAL_GPSing(current_token())
  yacco2::lrclog
  << " GPS RESET LINE: " 
  << current_token()->tok_co_ords__.line_no__
  << " GPS RESET CHR POS: " 
  << current_token()->tok_co_ords__.pos_in_line__
  << FILE_LINE<< std::endl;
@<release trace mu@>;
}
}
@*3 |T_7| trace when proc call failed: try straight parse. 
@<Trace TH failed proc call try straight parse@>=
if(YACCO2_TH__){
  bool to_trace_or_not_to = trace_parser_env(this,COND_STK_TRACE);
	if(to_trace_or_not_to == YES){
@<acquire trace mu@>;
    yacco2::lrclog << "YACCO2_TH__::" << thread_no__ << "::"
    << fsm_tbl__->id__
    << "::############# TRY STRAIGHT try_straight_due_to_aborted_parallel"
    << " reset token pos: " 
    << current_token_pos__ << " reset token: " 
    << current_token__->id__ 
    << FILE_LINE<< std::endl;
  yacco2::lrclog << "\tYACCO2_TH__::" << thread_no__
  << "::GPS RESET FILE: ";
  EXTERNAL_GPSing(current_token())
  yacco2::lrclog
  << " GPS RESET LINE: " 
  << current_token()->tok_co_ords__.line_no__
  << " GPS RESET CHR POS: " 
  << current_token()->tok_co_ords__.pos_in_line__
  << FILE_LINE<< std::endl;
@<release trace mu@>;
}
}

@*3 |T_11| straight parse error.\fbreak
How and why NIL pointer?
protects when the 
@<Trace TH  straight parse error@>=
if(YACCO2_TH__){
  bool to_trace_or_not_to = trace_parser_env(this,COND_STK_TRACE);
	if(to_trace_or_not_to == YES){
@<acquire trace mu@>;
    yacco2::lrclog << "\tYACCO2_TH__::" << thread_no__
    << "::" << fsm_tbl__->id__ << "::";
    yacco2::lrclog << "#############straight parse-error current token "
    << '"' << current_token()->id__ 
    << '"' << " pos: " << current_token_pos__ 
    << FILE_LINE<< std::endl;
  yacco2::lrclog << "\tYACCO2_TH__::" << thread_no__
  << "::GPS RESET FILE: ";
  EXTERNAL_GPSing(current_token())
  yacco2::lrclog
  << " GPS RESET LINE: " 
  << current_token()->tok_co_ords__.line_no__
  << " GPS RESET CHR POS: " 
  << current_token()->tok_co_ords__.pos_in_line__
  << FILE_LINE<< std::endl;
@<release trace mu@>;
}
}

@*3 |T_14| trace parallel parse thread startup communication.
@<Trace TH  parallel parse thread start communication@>=
if(YACCO2_TH__){
  bool to_trace_or_not_to = trace_parser_env(this,COND_STK_TRACE);
	if(to_trace_or_not_to == YES){
@<acquire trace mu@>;
  yacco2::lrclog << "YACCO2_TH__::" << "requestor of parallelism* : " 
   << " pp id: " << thread_no__ << "::"
   << thread_name() << " parallel PP started: " << pe->thread_fnct_name__
  << FILE_LINE<< std::endl;
@<release trace mu@>;
  }
}

@*3 |T_17| trace accepted token info.
@<Trace TH  accepted token info@>=
if(YACCO2_TH__){
  bool to_trace_or_not_to = trace_parser_env(this,COND_STK_TRACE);
	if(to_trace_or_not_to == YES){
@<acquire trace mu@>;
  yacco2::lrclog << "\tYACCO2_TH__::" << thread_no__
  << "::||||||||||ACCEPTED token POS: " 
  << arbitrated_token__->accept_token_pos__
  << " token*: " << arbitrated_token__->accept_token__ << " token: "
  << arbitrated_token__->accept_token__->id__ << std::endl;
  yacco2::lrclog << "\tYACCO2_TH__::" << thread_no__
  << "::GPS FILE: ";
  EXTERNAL_GPSing(arbitrated_token__->accept_token__)
  yacco2::lrclog
  << " GPS LINE: " 
  << arbitrated_token__->accept_token__->tok_co_ords__.line_no__
  << " GPS CHR POS: " 
  << arbitrated_token__->accept_token__->tok_co_ords__.pos_in_line__
  << FILE_LINE<< std::endl;
yacco2::lrclog << "\tYACCO2_TH__::" << thread_no__
  << "::||||||||||ACCEPTED la token POS: "
  << arbitrated_token__->la_token_pos__ << " la token: "
  << arbitrated_token__->la_token__->id__ << std::endl;
  yacco2::lrclog << "\t" << thread_no__
  << "::GPS LA FILE: ";
  EXTERNAL_GPSing(arbitrated_token__->la_token__)
  yacco2::lrclog
  << " GPS LA LINE: " 
  << arbitrated_token__->la_token__->tok_co_ords__.line_no__
  << " GPS LA CHR POS: " 
  << arbitrated_token__->la_token__->tok_co_ords__.pos_in_line__
  << FILE_LINE<< std::endl;
@<release trace mu@>;
  }
}


@*3 Trace re-aligned token stream la boundry info.
@<Trace TH re-aligned token stream la boundry info@>=
if(YACCO2_TH__){
  bool to_trace_or_not_to = trace_parser_env(this,COND_STK_TRACE);
	if(to_trace_or_not_to == YES){
@<acquire trace mu@>;
yacco2::lrclog << "\tYACCO2_TH__::" << thread_no__
  << "::|||re-aligned token stream la boundry POS: "
  << current_token_pos__ << " la token: "
  << current_token__->id__ 
  << FILE_LINE<< std::endl;
  yacco2::lrclog << "\tYACCO2_TH__::" << thread_no__
  << "::GPS RE-ALIGN FILE: ";
  EXTERNAL_GPSing(current_token__)
  yacco2::lrclog
  << " GPS RE-ALIGN  LINE: " 
  << current_token__->tok_co_ords__.line_no__
  << " GPS RE-ALIGN CHR POS: " 
  << current_token__->tok_co_ords__.pos_in_line__
  << FILE_LINE<< std::endl;
@<release trace mu@>;
  }
}

@*3 |T_18| trace requesting grammar's received message from a thread.
@<Trace TH  request thread received message from parallel thread@>=
if(YACCO2_TH__){
if(no_requested_ths_to_run__ > 1){
  bool to_trace_or_not_to = trace_parser_env(this,COND_STK_TRACE);
	if(to_trace_or_not_to == YES){
@<acquire trace mu@>;
  yacco2::lrclog << "YACCO2_TH__::" << thread_no__ << "::"
  << fsm_tbl__->id__ << "::"
  <<  "parallel parsing received message from id:"
  << from_thread__->thread_no__ << "::"
  << from_thread__->thread_name() 
  << FILE_LINE<< std::endl;
@<release trace mu@>;
  }
}
}

@*3 |T_22| and |T_22a| trace returned thread accept info.
@<Trace TH  current token, and accepted terminal wrapper@>=
if(YACCO2_TH__){
  bool to_trace_or_not_to = trace_parser_env(this,COND_STK_TRACE);
	if(to_trace_or_not_to == YES){
  if(current_token()!= 0){
@<acquire trace mu@>;
    yacco2::lrclog << "YACCO2_TH__::" << thread_no__ << "::";
    yacco2::lrclog << fsm_tbl__->id__ << "::";
    yacco2::lrclog << "accept-parallel-parse current token "
    << '"' << current_token()->id__ << '"' 
    << " pos: " << current_token_pos__ 
    << FILE_LINE<< std::endl;
yacco2::lrclog << "YACCO2_TH__::" << " accept tok: "
    << pp_rsvp__.accept_token__->id__ << " tok pos: " 
    << pp_rsvp__.accept_token_pos__
    << " la tok: " << pp_rsvp__.la_token__->id__ 
    << " la tok pos: "
    << pp_rsvp__.la_token_pos__ 
    << FILE_LINE<< std::endl;
    yacco2::lrclog << " thru fsm-> parser*: " 
    << fsm_tbl__->parser() << std::endl;
  yacco2::lrclog << "\tYACCO2_TH__::" << thread_no__
  << "::GPS ACCEPT FILE: ";
  EXTERNAL_GPSing(pp_rsvp__.accept_token__)
  yacco2::lrclog   
  << " GPS ACCEPT  LINE: " 
  << pp_rsvp__.accept_token__->tok_co_ords__.line_no__
  << " GPS ACCEPT  CHR POS: " 
  << pp_rsvp__.accept_token__->tok_co_ords__.pos_in_line__
  << FILE_LINE<< std::endl;
  yacco2::lrclog << "\tYACCO2_TH__::" << thread_no__
  << "::GPS ACCEPT LA FILE: ";
  EXTERNAL_GPSing(pp_rsvp__.la_token__)
  yacco2::lrclog  
  << " GPS ACCEPT  LA LINE: " 
  << pp_rsvp__.la_token__->tok_co_ords__.line_no__
  << " GPS ACCEPT LA CHR POS: " 
  << pp_rsvp__.la_token__->tok_co_ords__.pos_in_line__
  << FILE_LINE<< std::endl;
@<release trace mu@>;
  }
 }
}

@*3 |T_23| trace parallel parse current token when an error has occured.
@<Trace TH  parallel parse current token when an error has occured@>=
if(YACCO2_TH__){
  bool to_trace_or_not_to = trace_parser_env(this,COND_STK_TRACE);
	if(to_trace_or_not_to == YES){
	  if(current_token()){
		@<acquire trace mu@>;
		yacco2::lrclog << "YACCO2_TH__::" << thread_no__ << "::";
		yacco2::lrclog << fsm_tbl__->id__ << "::";
		yacco2::lrclog << "YACCO2_TH__::" 
  << "#############parallel parse-error current token "
		<< current_token()->id__ << " pos: " << current_token_pos__
		<< " enum id: " << current_token()->enumerated_id__ 
  << FILE_LINE<< std::endl;
  yacco2::lrclog << "\tYACCO2_TH__::" << thread_no__
  << "::GPS RESET FILE: ";
  EXTERNAL_GPSing(current_token())
  yacco2::lrclog  
  << " GPS RESET LINE: " 
  << current_token()->tok_co_ords__.line_no__
  << " GPS RESET CHR POS: " 
  << current_token()->tok_co_ords__.pos_in_line__
  << FILE_LINE<< std::endl;
		@<release trace mu@>;
  }
}
}

@*3 |T_23| trace proc call parse current token when an error has occured.
@<Trace TH  proc call parse current token when an error has occured@>=
if(YACCO2_TH__){
  bool to_trace_or_not_to = trace_parser_env(this,COND_STK_TRACE);
	if(to_trace_or_not_to == YES){
	  if(current_token()){
		@<acquire trace mu@>;
		yacco2::lrclog << "YACCO2_TH__::" << thread_no__ << "::";
		yacco2::lrclog << fsm_tbl__->id__ << "::";
		yacco2::lrclog << "YACCO2_TH__::" 
  << "#############parallel parse-error current token "
		<< current_token()->id__ << " pos: " << current_token_pos__
		<< " enum id: " << current_token()->enumerated_id__ 
  << FILE_LINE<< std::endl;
  yacco2::lrclog << "\tYACCO2_TH__::" << thread_no__
  << "::GPS RESET FILE: ";
  EXTERNAL_GPSing(current_token())
  yacco2::lrclog  
  << " GPS RESET LINE: " 
  << current_token()->tok_co_ords__.line_no__
  << " GPS RESET CHR POS: " 
  << current_token()->tok_co_ords__.pos_in_line__
  << FILE_LINE<< std::endl;
		@<release trace mu@>;
  }
}
}

@*3 |T_24| trace before parallel parse thread message count reduced.
This allows one to see if threading mutexes etc are behaving.
@<Trace TH  before parallel parse thread message count reduced@>=
if(YACCO2_MSG__){
		@<acquire trace mu@>;
		yacco2::lrclog << "YACCO2_MSG__::" << thread_no__ << "::";
		yacco2::lrclog << fsm_tbl__->id__ << "::";
		yacco2::lrclog << " called thread reducing thread active count of caller thread "
		<< pp_requesting_parallelism__->thread_no__ << "::"
		<< pp_requesting_parallelism__->fsm_tbl__->id__
		<< " active thread count::" << pp_requesting_parallelism__->th_active_cnt__
		<< FILE_LINE<< std::endl;
		@<release trace mu@>;
}

@*3 |T_25| trace parallel parse current token when an error has occured.
@<Trace TH after parallel parse thread message count reduced@>=
if(YACCO2_MSG__){
		@<acquire trace mu@>;
		yacco2::lrclog << "YACCO2_MSG__::" << thread_no__ << "::";
		yacco2::lrclog << fsm_tbl__->id__ << "::";
		yacco2::lrclog << " called thread after reducing thread active count of caller thread "
		<< pp_requesting_parallelism__->thread_no__ << "::"
		<< pp_requesting_parallelism__->fsm_tbl__->id__
		<< " active thread count::" << pp_requesting_parallelism__->th_active_cnt__
		<< FILE_LINE<< std::endl;
		@<release trace mu@>;
}


@*2 Message macros.\fbreak 
They trace the correspondence between various threads.
Here are the thread relationships:\fbreak
\ptindent{grammar calling its spawned threads}
\ptindent{launched threads to the grammar requesting thread service}

These macros are very verbous but it allows one to analyse
whether messages have been dropped.
Typically dropped messages come about when an event depends
on a specific result and the order of execution within the threads
can change the current terminal mapping such that executing produces possibly
an aborted thread parse.
For example when a terminal is fetched with dynamic symbol
table evaluation taking place, depending on the sequence execution
of the threads errant terminal delivery can occur.
This is a critical region problem between the competing
threads.
To fix the problem, either eliminate the competition of threads between themselves
by blending into one thread the competing grammatical sentences, or
use a MUTEX to tame the eradic behavior.

To control messaging back to the requesting grammar when all
threads have finished processing,
an activity thread count 
under the control of its MUTEX is referenced by each launched thread.
The responsibility of who responds back to the grammar requesting parallelism
when all threads are done be it success or failure, is left to the individual threads
launched.
When a thread finishes work, it goes into the 
critical region of the requesting grammar and decrements the active thread
 count. It also
checks if the activity count is zero indicating that it is the last thread in
the house to lock up so wake up the requesting grammar.

@*3 |TT_1| trace thread waiting for message.
@<Trace MSG thread waiting for message@>= 
if(yacco2::YACCO2_MSG__){
@<acquire trace mu@>;
yacco2::lrclog << "YACCO2_MSG__::" << thread_no__
    <<  "::" << thread_name() << " -->WAIT_FOR_EVENT "
	<< " # threads to run:: " << no_requested_ths_to_run__
    << " # active threads: " << th_active_cnt__
    << " # competing threads: " << no_competing_pp_ths__
	<< FILE_LINE<< std::endl;
@<release trace mu@>;
}

@*3 |TT_2| trace message received.\fbreak
Protect against procedure call that has wound down and destroyed itself before the calling
grammar can trace it. Only trace returned call from threads.
@<Trace MSG message received@>=
if(yacco2::YACCO2_MSG__){
@<acquire trace mu@>;
yacco2::lrclog << "YACCO2_MSG__::" << thread_no__
  <<  "::" << thread_name() << " MESSAGE RECEIVED from "
  << from_thread__->thread_no__
  << "::" << from_thread__->thread_name() 
  << FILE_LINE<< std::endl;
@<release trace mu@>;
}

@*3 |TT_4| trace posting from - to thread info.
@<Trace posting from - to thread info@>=
if(yacco2::YACCO2_MSG__){
@<acquire trace mu@>;
yacco2::lrclog << "YACCO2_MSG__::" << From_thread.thread_no__ << "::"
	<< From_thread.thread_name()
	<< " -----> Posting message to: "
	<< To_thread.thread_no__ << "::" << To_thread.thread_name()
	<< FILE_LINE<< std::endl;
@<release trace mu@>;
}

@*3 |TT_4a| trace signaled grammar to wakeup.
@<Trace signaled grammar to wakeup while releasing its mutex@>=
if(yacco2::YACCO2_MSG__){
@<acquire trace mu@>;
yacco2::lrclog << "YACCO2_MSG__::" << From_thread.thread_no__ << "::"
	<< From_thread.thread_name()
	<< " -----> before SIGNAL_COND_VAR() to signal wakeup grammar for: "
	<< To_thread.thread_no__ << "::" << To_thread.thread_name()
	<< FILE_LINE<< std::endl;
@<release trace mu@>;
}

@*3 |TT_4b| trace wakened grammar with its acquired mutex.
@<Trace wakened grammar with its acquired mutex@>=
if(yacco2::YACCO2_MSG__){
@<acquire trace mu@>;
yacco2::lrclog << "YACCO2_MSG__::" << From_thread.thread_no__ << "::"
	<< From_thread.thread_name()
	<< " -----> after SIGNAL_COND_VAR() to waken grammar of "
    << To_thread.thread_no__ << "::"
	<< To_thread.thread_name()
	<< FILE_LINE<< std::endl;
@<release trace mu@>;
}

@*3 |TT_4c| trace trying to acquire grammar's mutex.
@<Trace trying to acquire grammar's mutex@>=
if(yacco2::YACCO2_MU_GRAMMAR__){
	@<acquire trace mu@>;
	yacco2::lrclog << "YACCO2_MU_GRAMMAR__::" << parser.thread_no__ << "::" 
	<< parser.fsm_tbl__->id__ << "::" << " trying to acquire mutex" << Text
 << FILE_LINE<< std::endl;
	@<release trace mu@>;
}

@*3 |TT_4d| trace acquired grammar's mutex.
@<Trace acquired grammar's mutex@>=
if(yacco2::YACCO2_MU_GRAMMAR__){
	@<acquire trace mu@>;
	yacco2::lrclog << "YACCO2_MU_GRAMMAR__::" << parser.thread_no__ << "::" 
	<< parser.fsm_tbl__->id__ << "::" << " acquired mutex" << Text
 << FILE_LINE<< std::endl;
	@<release trace mu@>;
}

@*3 |TT_4e| trace trying to release grammar's mutex.
@<Trace trying to release grammar's mutex@>=
if(yacco2::YACCO2_MU_GRAMMAR__){
	@<acquire trace mu@>;
	yacco2::lrclog << "YACCO2_MU_GRAMMAR__::" << parser.thread_no__ << "::" 
	<< parser.fsm_tbl__->id__ << "::" << " trying to release mutex" << Text 
 << FILE_LINE<< std::endl;
	@<release trace mu@>;
}

@*3 |TT_4f| trace released grammar's mutex.
@<Trace released grammar's mutex@>=
if(yacco2::YACCO2_MU_GRAMMAR__){
	@<acquire trace mu@>;
	yacco2::lrclog << "YACCO2_MU_GRAMMAR__::" << parser.thread_no__ << "::" 
	<< parser.fsm_tbl__->id__ << "::" << " released mutex" << Text 
 << FILE_LINE<< std::endl;
	@<release trace mu@>;
}

@*3 |TT_5| trace start thread.
@<Trace MSG start thread@>=
if(yacco2::YACCO2_MSG__){
@<acquire trace mu@>;
yacco2::lrclog << "YACCO2_MSG__::" << thread_no__ << "::" << fsm_tbl__->id__
	<< " --> start threads" 
 << FILE_LINE<< std::endl;
@<release trace mu@>;
}

@*3 |TT_6| trace of found thread in thread pool waiting to be run.\fbreak
The pool of threads is dynmically built by thread requests.
When a thread finishes work, instead of stopping, it goes into 
hibernation with
an appropriate status indicating its availability.
This is an optimization to speed up parallel processing.
There can be many threads of the same name waiting for work due
to recursion.
@<Trace MSG found thread in thread pool waiting to be run@>=
if(yacco2::YACCO2_MSG__){
@<acquire trace mu@>;
yacco2::lrclog << "YACCO2_MSG__::" << thread_no__
  << "::--> parallel thread worker fnd in thread table CALL WORKER: " 
  << tb->grammar_s_parser__->thread_name()
  << " thread obj*:" << tb->grammar_s_parser__
  << " parm*: " << tb->grammar_s_parser__->pp_requesting_parallelism__ 
  << FILE_LINE<< std::endl;
@<release trace mu@>;
}

@*3 |TT_7| due to recursion trace no thread available in thread pool.\fbreak
This comes about when a thread calls a thread who calls a previous thread.
I call this situation ``nested parallelism''.
The grammar of Pascal's railroad diagrams is an example of such situations.
It is detected due to the thread (thread id number) already has an entry in the
thread pool but there are no available threads ready to run  so... launch another
thread.
@<Trace MSG thread fnd but all busy, so launch another one @>= 
if(yacco2::YACCO2_MSG__){
@<acquire trace mu@>;
yacco2::lrclog << "YACCO2_MSG__::" << thread_no__
  << "::" << pe->thread_fnct_name__ 
  << " --> parallel thread fnd in thread table BUT ALL ARE BUSY "
  << FILE_LINE<< std::endl;
@<release trace mu@>;
}

@*3 |TT_8| trace thread not found in global thread pool.\fbreak
@<Trace MSG thread not found in global thread pool@>=
if(yacco2::YACCO2_MSG__){
@<acquire trace mu@>;
yacco2::lrclog << "YACCO2_MSG__::" << thread_no__
  << "::" << pe->thread_fnct_name__ 
  << " --> parallel thread NOT fnd in thread table" 
  << FILE_LINE<< std::endl;
@<release trace mu@>;
}

@*3 Trace start thread by procedure call instead of threading.
@<Trace MSG start by procedure call@>=
if(yacco2::YACCO2_MSG__){
@<acquire trace mu@>;
yacco2::lrclog << "YACCO2_MSG__::" << thread_no__
  << "::" << thread_name() << " calling PROC::"
  //|<< pe->thread_fnct_name__| 
<< " --> before procedure call" 
<< FILE_LINE<< std::endl;
@<release trace mu@>;
}

@*3 Trace return from procedure call instead of threading.
@<Trace MSG return from by procedure call@>=
if(yacco2::YACCO2_MSG__){
@<acquire trace mu@>;
yacco2::lrclog << "YACCO2_MSG__::" << thread_no__
  << "::" << thread_name()
  << " returned from PROC::" 
//|<< pe->thread_fnct_name__| 
  << " result: " << rslt 
  << FILE_LINE<< std::endl;
@<release trace mu@>;
}
 
@*3 Trace thread idle before setting waiting for work.
@<Trace MSG thread idle before setting waiting for work@>=
if(yacco2::YACCO2_MSG__){
@<acquire trace mu@>;
yacco2::lrclog << "YACCO2_MSG__::" 
  << this->grammar_s_parser__->thread_no__ 
  << "::" << this->grammar_s_parser__->thread_name() 
  << " th_blk*: " << this
  << "this pp*: " << this->grammar_s_parser__
  << "pp*: " << grammar_s_parser__
  << "pp^th blk*: " << &grammar_s_parser__->th_blk__
  << " #: " << thd_id__ 
  << " st: " << status__ 
  << " before setting waiting for work" 
  << ' '
  << grammar_s_parser__->thread_no__
  << "::" << grammar_s_parser__->fsm_tbl__->id__ 
  << FILE_LINE<< std::endl;
@<release trace mu@>;
}
 
@*3 Trace thread idle after setting waiting for work.
@<Trace MSG thread idle after setting waiting for work@>=
if(yacco2::YACCO2_MSG__){
@<acquire trace mu@>;
yacco2::lrclog << "YACCO2_MSG__::" 
  << this->grammar_s_parser__->thread_no__ 
  << "::" << this->grammar_s_parser__->thread_name() 
  << " th_blk*: " << this
  << "this pp*: " << this->grammar_s_parser__
  << "pp*: " << grammar_s_parser__
  << "pp^th blk*: " << &grammar_s_parser__->th_blk__
  << " #: " << thd_id__ 
  << " st: " << status__ 
  << " after setting waiting for work " 
  << grammar_s_parser__->thread_no__
  << "::" << grammar_s_parser__->fsm_tbl__->id__ 
  << FILE_LINE<< std::endl;
@<release trace mu@>;
}

@*3 Trace thread being created.
@<Trace MSG thread being created@>=
if(yacco2::YACCO2_MSG__){
@<acquire trace mu@>;
yacco2::lrclog << "YACCO2_MSG__::" 
  << this->grammar_s_parser__->thread_no__ 
  << "::" << this->grammar_s_parser__->thread_name() 
  << " th_blk*: " << this
  << " pp this: " << this->grammar_s_parser__ 
  << " this^pp^th_blk: " << &this->grammar_s_parser__->th_blk__ 
  << "pp*: " << grammar_s_parser__
  << "pp^th blk*: " << &grammar_s_parser__->th_blk__
  << " #: " << thd_id__ 
  << " thread created " 
  << grammar_s_parser__->thread_no__
  << "::" << grammar_s_parser__->thread_name()
  << " of grammar: " << grammar_s_parser__->fsm_tbl__->id__
  << FILE_LINE<< std::endl;
@<release trace mu@>;
}

@*3 Trace threads in launched list.
@<Trace threads in launched list@>=
if(yacco2::YACCO2_MSG__){
@<acquire trace mu@>;
yacco2::lrclog << "YACCO2_MSG__::" 
  << tb->grammar_s_parser__->thread_no__ 
  << "::" << tb->grammar_s_parser__->thread_name() 
  << " th_blk*: " << this
  << " th_blk*: " << tb
  << " grammar parser: " << tb->grammar_s_parser__ 
  << " #: " << tb->thd_id__ 
  << " st: " << tb->status__
  << " thds in launched list " 
  << FILE_LINE<< std::endl;
yacco2::lrclog
  << "------->" 
  << tb->grammar_s_parser__->thread_no__
  << "::" << tb->grammar_s_parser__->fsm_tbl__->id__
  << FILE_LINE<< std::endl;
@<release trace mu@>;
}

@*3 Trace thread to be launched.
@<Trace thread to be launched@>=
if(yacco2::YACCO2_MSG__){
@<acquire trace mu@>;
yacco2::lrclog << "YACCO2_MSG__::"
  << "pe*: " << pe
  << " thread name: " << pe->thread_fnct_name__
  << " thread proc*: " << pe->thread_fnct_ptr__
  << " thread id: " << pe->thd_id__ 
  << FILE_LINE<< std::endl;
@<release trace mu@>;
}

@*3 All threads reported back.\fbreak
@<Trace MSG all threads reported back@>=
if(yacco2::YACCO2_MSG__){
@<acquire trace mu@>;
yacco2::lrclog << "YACCO2_MSG__::" << thread_no__
  <<  "::" << thread_name() << " all threads reported back "
  << " Caller parser::" << pp_requesting_parallelism__->thread_no__ 
  << "::" << pp_requesting_parallelism__->thread_name()
  << " # competing thds: " 
  << pp_requesting_parallelism__->no_requested_ths_to_run__
  << " # active thds: " 
  << pp_requesting_parallelism__->th_active_cnt__
  << FILE_LINE<< std::endl;
@<release trace mu@>;
}

@*3 NOT all threads reported back.\fbreak
@<Trace MSG not all threads reported back@>=
if(yacco2::YACCO2_MSG__){
@<acquire trace mu@>;
yacco2::lrclog << "YACCO2_MSG__::" << thread_no__
  <<  "::" << thread_name() << " NOT all threads reported back "
  << " Caller parser::" << pp_requesting_parallelism__->thread_no__ 
  << "::" << pp_requesting_parallelism__->thread_name()
  << " # competing thds: " 
  << pp_requesting_parallelism__->no_requested_ths_to_run__
  << " # active thds: " << pp_requesting_parallelism__->th_active_cnt__
  << FILE_LINE<< std::endl;
@<release trace mu@>;
}

@*3 Call procedure but in use.\fbreak
@<Trace MSG proc call in use so call its thread@>=
if(yacco2::YACCO2_MSG__){
@<acquire trace mu@>;
yacco2::lrclog << "YACCO2_MSG__::" << thread_no__
  <<  "::" << thread_name() 
  << " PROC CALL ALREADY IN USE so call its thread "
  << " Caller parser::" << pp_requesting_parallelism__->thread_no__ 
  << "::" << pp_requesting_parallelism__->thread_name()
  << FILE_LINE<< std::endl;
@<release trace mu@>;
}

@** Arbitrator macros.\fbreak
These are the syntax directed code
directives within a grammar's rules that arbitrate between
the returned results of that finite state's configuration.
They are gened as individual procedures per finite state configuration
due to parallelism.
To refine this family of message traces, 
they test whether their grammar has the debug switch turned on.
@*2 |TAR_1| trace the starting of arbitration.
@<Trace AR trace the starting of arbitration@>=
@<pp accept queue AR@>;

@
@<pp accept queue AR@>=
if(yacco2::YACCO2_AR__){
  //|trace_parser_env(Caller_pp,FORCE_STK_TRACE);|
  @<acquire trace mu@>;
  yacco2::lrclog  << "YACCO2_AR__::" 
  << Caller_pp->thread_no__ << "::" << ar_name 
  << " start arbitrating" 
  << FILE_LINE<< std::endl;
  yacco2::lrclog  << "YACCO2_AR__::" 
  << "number of accept tokens: "
  << Caller_pp->th_accepting_cnt__ 
  << FILE_LINE<< std::endl;
  int ii = 1;
  for(;ii<=Caller_pp->th_accepting_cnt__;++ii){
    yacco2::lrclog<< "YACCO2_AR__::" 
    <<"\t terminal in accept queue: "
    <<Caller_pp->pp_accept_queue__[ii].accept_token__->id__
    <<" token pos: "
    <<Caller_pp->pp_accept_queue__[ii].accept_token_pos__
    << FILE_LINE<<std::endl;
  }
  @<release trace mu@>;
}

@*2 |TAR_2| trace no arbitration required.\fbreak
This occurs when only 1 accept terminal is in the accept queue
@<Trace AR no arbitration required@>=
  @<trace AR pp accept queue no arbitration required@>;

@ @<trace AR pp accept queue no arbitration required@>=
if(yacco2::YACCO2_AR__){
	//|trace_parser_env(Caller_pp,FORCE_STK_TRACE);|
	@<acquire trace mu@>;
	  yacco2::lrclog  << "YACCO2_AR__::" 
   << Caller_pp->thread_no__ << "::" << ar_name 
	  << " No Arbitration required" 
   << FILE_LINE<< std::endl;
	  yacco2::lrclog  << "YACCO2_AR__::" 
   << "number of accept tokens: "
	  << Caller_pp->th_accepting_cnt__ 
   << FILE_LINE<< std::endl;
	  int ii = 1;
	  for(;ii <= Caller_pp->th_accepting_cnt__;++ii){
		   yacco2::lrclog<<"\t YACCO2_AR__:: terminal in accept queue: "
     << Caller_pp->pp_accept_queue__[ii].accept_token__->id__
		   <<" token pos: "
     <<Caller_pp->pp_accept_queue__[ii].accept_token_pos__
     << FILE_LINE<<std::endl;
	  }
		@<release trace mu@>;
}


@*2 |TAR_3| trace stopped arbitrating.\fbreak
This occurs when only 1 accept terminal is in the accept queue
@<Trace AR stopped arbitrating@>=
if(yacco2::YACCO2_AR__){
 //|bool to_trace_or_no_to = trace_parser_env(Caller_pp,FORCE_STK_TRACE);|
@<acquire trace mu@>;
  yacco2::lrclog  << "YACCO2_AR__::" 
  << Caller_pp->thread_no__ << "::" << ar_name 
  << " stop arbitrating" 
  << FILE_LINE<< std::endl;
@<release trace mu@>;
  }

@** TLEX macros --- roll-your-own tracing macros.\fbreak
These are ``roll your own'' macros for when the going get rough and tough,
and you don't have a bloody clue. At least you can leave some tracks
of your own originality.
Good luck and this is said with sincerity as I probably needed them once.

The grammar writer can put them inside the grammar's syntax directed code directives.
They basically give the parallel details on the thread, critical region etc.
The passed in parameter is what the grammar writer wants to display.
Basic, crude but may be helpful.
Before going this route though, the other macro traces should be adequate.
Other forms of tracings using |yacco2::lrclog| or |cout| are rudimentary but also effective.
@<c macro...@>+=
#define sstrace_parallel_supportss(ssPROC_NAME) \
if(yacco2::YACCO2_TLEX__){\
  Parser* _ap = parser_of_parallel_support(); \
  yacco2::lrclog  << "YACCO2_TLEX__::" << pthread_self() << "::" \
  << _ap->fsm_tbl__->id__ << "::" \
  << ' ' << #ssPROC_NAME << " this:: " << this << std::endl; \
  yacco2::lrclog  << "\tYACCO2_TLEX__:: parser_of_parallel_support:: " \
  << _ap \
  << FILE_LINE<< std::endl; \
  yacco2::lrclog  << "\tself thread id:: " << thread_no__\
  << FILE_LINE<< std::endl; \
  yacco2::lrclog \ 
  << "\tYACCO2_TLEX__:: embedded thread id:: " \
  << embedded_thread_no()\
  << FILE_LINE<< std::endl;\
  }

@*2 Print interplay between requesting grammar and launched thread.
A roll your own descriptor is passed to the macro.
@<c macro...@>+=
#define  sstrace_parallel_support_envss(ssPROC_NAME) \
if(yacco2::YACCO2_TLEX__){\
  yacco2::lrclog  << "YACCO2_TLEX__::" << GetCurrentThreadid__ << "::" \
  << fsm_tbl__->id__ << "::" \
  << ' ' << #ssPROC_NAME << " this:: " << this \
  << FILE_LINE<< std::endl; \
  yacco2::lrclog  << "\tYACCO2_TLEX__:: self thread id:: "\
  << thread_no__ \
  << FILE_LINE<< std::endl;\
  }

@*2 |trace_parser_env| traces the parsing stack.\fbreak
It check whether the thread has its debug switch on. If it does, it does its own thing.
It returns the thread's debug grammar switch for other trace macros to test 
whether they should do their trace dance. 
@^ To do - parsing stack dump. canonize output trace!@>
@<Extern...@>+=
extern bool trace_parser_env(Parser* parser, bool Trace_type);
@ Print parse stack prefix.
@<Print parse stack prefix@>=
@<acquire trace mu@>;
	for(UINT x=1;x<=parser->parse_stack__.top_sub__;++x) yacco2::lrclog << ".";
	yacco2::lrclog  << parser->thread_no__;
	yacco2::lrclog  << "::";
	yacco2::lrclog  << parser->fsm_tbl__->id__ << "::";
@<release trace mu@>;

@*3 Print items on parse stack in FILO order.
@<Print items on parse stack@>=
@<acquire trace mu@>;
Cparse_record* i = parser->parse_stack__.first_sf__;
Cparse_record* ie = parser->parse_stack__.top__;
for(int xxx(1);i != ie;i=parser->parse_stack__.sf_by_sub(++xxx)){
yacco2::lrclog  << i->state__->state_no__ << "--";
CAbs_lr1_sym* sym = i->symbol__;
if(sym) yacco2::lrclog << sym->id__ << "-> ";
else yacco2::lrclog << "ZEROED OUT SYMBOL" << "-> ";
}
yacco2::lrclog << ie->state__->state_no__;

yacco2::lrclog << FILE_LINE<< std::endl;
@<release trace mu@>;

@*3 Should grammar be traced?.\fbreak
The debug switch supplied by the grammar is checked.
If it's turned on then allow tracing.
This check lowers the volume outputted. 
It's a spot check on `what the hell is going wrong' with my grammar.
@<Should grammar be traced? no ta ta@>=
  if(Trace_type == COND_STK_TRACE){
    if (parser->fsm_tbl__->debug__ == OFF) return NO;
  }

@*2 |trace_parser_env| implementation.\fbreak
There are 2 contexts that stack tracing can take place:\fbreak
\ptindent{1) within the grammar controlled by YACCO2\_TH\_\_ trace variable}
\ptindent{2) forced stack trace used by other trace variables}
@<accrue yacco2 code@>=
extern bool
yacco2::trace_parser_env(Parser* parser,bool Trace_type){
  @<Validate parser's finite state table@>;
  @<Validate that parser stack is not empty@>;
  @<Should grammar be traced?...@>;
  @<Print parse stack prefix@>;
  @<Print items on parse stack@>;
return YES;
}

@*2 Trace pp start info.\fbreak
This is the tabloid 
giving all the gory details about the parallel thread, its requesting grammar,
and the starting token stream to-be-parsed.
@<Trace pp start info@>=    
if(yacco2::YACCO2_MSG__){ 
@<acquire trace mu@>;
sprintf(ma,pp_start,pp_parser.thread_no__,pp_thread_entry.thread_fnct_name__);
yacco2::lrclog << ma;
Parser* pp_ = pp_parser.pp_requesting_parallelism__;
yacco2::lrclog << "YACCO2_MSG__::" 
<< pp_parser.thread_no__
<< "::"
<< pp_parser.thread_name()
<< " requesting parser*: " << pp_ 
<< FILE_LINE<< std::endl;
yacco2::lrclog << "\tYACCO2_MSG__::" << pp_parser.thread_no__ << "::"
<< pp_parser.thread_name()
	<< " Caller's # threads to run:: " << pp_->no_requested_ths_to_run__
    << " Caller's # active threads: " << pp_->th_active_cnt__
    << " Self # competing threads: " << pp_parser.no_competing_pp_ths__ 
    << FILE_LINE<< std::endl;
yacco2::lrclog << "\tYACCO2_MSG__::" 
<< pp_parser.thread_no__ << "::"
<< pp_parser.thread_name()
<< " passed token*: " << pp_->current_token()
<< '"' << pp_parser.current_token()->id__ << '"'
<< " pos: " << pp_parser.current_token_pos__ 
<< FILE_LINE<< std::endl;
  yacco2::lrclog
  << "\t\t::GPS FILE: ";
  EXTERNAL_GPSing(pp_parser.current_token__)
  yacco2::lrclog
  << " GPS LINE: " 
  << pp_parser.current_token__->tok_co_ords__.line_no__
  << " GPS CHR POS: " 
  << pp_parser.current_token__->tok_co_ords__.pos_in_line__
  << FILE_LINE<< std::endl;

@<release trace mu@>;
}
if(yacco2::YACCO2_T__){ 
@<acquire trace mu@>;
yacco2::lrclog << "YACCO2_T__::" 
<< pp_parser.thread_no__
<< "::"
<< pp_parser.thread_name()
<< " token*: " << pp_parser.current_token__ 
<< " enum: " << pp_parser.current_token__->enumerated_id__
<< " pos: " << pp_parser.current_token_pos__ 
<< ' ' << '"' << pp_parser.current_token__->id__ << '"'
<< FILE_LINE<< std::endl;
  yacco2::lrclog
  << "\t\t::GPS FILE: ";
  EXTERNAL_GPSing(pp_parser.current_token__)
  yacco2::lrclog
  << " GPS LINE: " 
  << pp_parser.current_token__->tok_co_ords__.line_no__
  << " GPS CHR POS: " 
  << pp_parser.current_token__->tok_co_ords__.pos_in_line__
  << FILE_LINE<< std::endl;
  yacco2::lrclog
  << "\tGPS LINE: " 
  << pp_parser.current_token()->tok_co_ords__.line_no__
  << " GPS CHR POS: " 
  << pp_parser.current_token()->tok_co_ords__.pos_in_line__
  << FILE_LINE<< std::endl;

@<release trace mu@>;
}

@*2 Trace procedure pp start info.\fbreak
This is the tabloid 
giving all the gory details about the parallel thread, its requesting grammar,
and the starting token stream to-be-parsed.
@<Trace procedure pp start info@>=    
if(yacco2::YACCO2_MSG__){ 
@<acquire trace mu@>;
sprintf(ma,pp_start,proc_parser->thread_no__,called_proc_name);
yacco2::lrclog << ma;
Parser* pp_ = proc_parser->pp_requesting_parallelism__;
yacco2::lrclog << "YACCO2_MSG__::" 
<< proc_parser->thread_no__
<< "::"
<< proc_parser->thread_name()
<< " requesting parser*: " << pp_ 
<< FILE_LINE<< std::endl;
yacco2::lrclog << "\tYACCO2_MSG__::PROC::" << proc_parser->thread_no__ << "::"
<< proc_parser->thread_name()
	<< " Caller's # threads to run:: " << pp_->no_requested_ths_to_run__
    << " Caller's # active threads: " << pp_->th_active_cnt__
    << " Self # competing threads: " << proc_parser->no_competing_pp_ths__ 
    << FILE_LINE<< std::endl;
yacco2::lrclog << "\tYACCO2_MSG__::PROC::" 
<< proc_parser->thread_no__ << "::"
<< proc_parser->thread_name()
<< " passed token*: " << pp_->current_token()
<< '"' << proc_parser->current_token()->id__ << '"'
<< " pos: " << proc_parser->current_token_pos__ 
<< FILE_LINE<< std::endl;
  yacco2::lrclog
  << "\t\t::GPS FILE: ";
  EXTERNAL_GPSing(proc_parser->current_token__)
  yacco2::lrclog
  << " GPS LINE: " 
  << proc_parser->current_token__->tok_co_ords__.line_no__
  << " GPS CHR POS: " 
  << proc_parser->current_token__->tok_co_ords__.pos_in_line__
  << FILE_LINE<< std::endl;
@<release trace mu@>;
}
if(yacco2::YACCO2_T__){ 
@<acquire trace mu@>;
yacco2::lrclog << "YACCO2_T__::" 
<< proc_parser->thread_no__
<< "::"
<< proc_parser->thread_name()
<< " token*: " << proc_parser->current_token__ 
<< " enum: " << proc_parser->current_token__->enumerated_id__
<< " pos: " << proc_parser->current_token_pos__ 
<< ' ' << '"' << proc_parser->current_token__->id__ << '"'
<< FILE_LINE<< std::endl;
  yacco2::lrclog
  << "\t\t::GPS FILE: ";
    EXTERNAL_GPSing(proc_parser->current_token__)
  yacco2::lrclog
  << " GPS LINE: " 
  << proc_parser->current_token__->tok_co_ords__.line_no__
  << " GPS CHR POS: " 
  << proc_parser->current_token__->tok_co_ords__.pos_in_line__
  << FILE_LINE<< std::endl;
@<release trace mu@>;
}

@*2 Trace stop of parallel parse message.
@<Trace stop of parallel parse message@>=
if(yacco2::YACCO2_MSG__){ 
@<acquire trace mu@>;
sprintf(ma,pp_stop,pp_parser.thread_no__,pp_thread_entry.thread_fnct_name__);
yacco2::lrclog << ma;
@<release trace mu@>;
}
	
@*2 Trace pp's last symbol on stack set as autodelete.
@<Trace pp's last symbol on stack set as autodelete@>=
if(yacco2::YACCO2_TH__){ 
THREAD_NO tid =  pp_parser.thread_no__;
@<acquire trace mu@>;
yacco2::lrclog << "YACCO2_TH__:: " << "sym to be deleted: " 
<< tid << "::"
<< pp_parser.fsm_tbl__->id__ << "::"
<< sym->id__ 
<< FILE_LINE<< std::endl;         
@<release trace mu@>;
}
@*2 Trace procedure pp's last symbol on stack set as autodelete.
@<Trace procedure pp's last symbol on stack set as autodelete@>=
if(yacco2::YACCO2_TH__){ 
THREAD_NO tid =  proc_parser->thread_no__;
@<acquire trace mu@>;
yacco2::lrclog << "YACCO2_TH__:: " << "sym to be deleted: " 
<< tid << "::"
<< proc_parser->fsm_tbl__->id__ << "::"
<< sym->id__ 
<< FILE_LINE<< std::endl;         
@<release trace mu@>;
}

@*2 Trace parallel thread waiting-to-do-work.
@<Trace parallel thread waiting-to-do-work@>=
if(yacco2::YACCO2_MSG__){ 
@<acquire trace mu@>;
yacco2::lrclog << "YACCO2_MSG__::" << pp_parser.thread_no__
<< "::" << pp_thread_entry.thread_fnct_name__ 
<< " ==>PP waiting for work: "  
<< FILE_LINE<< std::endl;
@<release trace mu@>;
}

@*2 Trace pp received go start working message.
@<Trace pp received go start working message@>=
if(yacco2::YACCO2_MSG__){ 
@<acquire trace mu@>;
yacco2::lrclog << "YACCO2_MSG__::" << pp_parser.thread_no__
<< "::" << pp_thread_entry.thread_fnct_name__ 
<< " ==>PP go process work: "  
<< FILE_LINE<< std::endl;
@<release trace mu@>;
}

@*2 Trace pp finished working.
@<Trace pp finished working@>=
if(yacco2::YACCO2_MSG__){ 
@<acquire trace mu@>;
yacco2::lrclog << "YACCO2_MSG__::" << pp_parser.thread_no__ 
<< "::" << pp_thread_entry.thread_fnct_name__ 
<< " ==>PP finished working"  
<< FILE_LINE<< std::endl;
@<release trace mu@>;
}
@*2 Trace procedure pp finished working.
@<Trace procedure pp finished working@>=
if(yacco2::YACCO2_MSG__){ 
@<acquire trace mu@>;
yacco2::lrclog << "YACCO2_MSG__::PROC::" << proc_parser->thread_no__ 
<< "::" << called_proc_name
<< " ==>procedure finished working"  
<< FILE_LINE<< std::endl;
@<release trace mu@>;
}

@*2 Trace raw characters.
@<Trace raw characters@>=
if(yacco2::YACCO2_TLEX__){   
@<acquire trace mu@>;
yacco2::lrclog 
<< "YACCO2_TLEX__:: " << "chr: " << Char << " File: " 
<< File_no << " Pos: " << Pos 
<< FILE_LINE<< std::endl;
@<release trace mu@>;
}

@** Thread performance macros.\fbreak
They allow one to see how the thread library stops and starts the threads
by their output.
@*2 Entered into waiting for an event.
@<trace |COND_WAIT|  entered@>=
if(yacco2::YACCO2_THP__ || yacco2::YACCO2_MSG__){
@<acquire trace mu@>;
yacco2::lrclog 
<< "YACCO2_THP__ || yacco2::YACCO2_MSG__::" 
<< parser.thread_no__ 
<< "::" << parser.thread_name()
<< " COND_WAIT entered into Wait on event " 
<< FILE_LINE<< std::endl;
@<release trace mu@>;
}

@*2 Exit out of waiting for an event.
@<trace |COND_WAIT|  exit@>=
if(yacco2::YACCO2_THP__ || yacco2::YACCO2_MSG__){
@<acquire trace mu@>;
yacco2::lrclog 
<< "YACCO2_THP__ || yacco2::YACCO2_MSG__::" << parser.thread_no__ 
<< "::" << parser.thread_name()
<< " COND_WAIT exit on event " 
<<" cv_cond: "<< parser.cv_cond__
<< " no competing thds: " 
<< parser.no_competing_pp_ths__
<<" no active thds: "
<< parser.from_thread__->th_active_cnt__
<< " from: "
<< parser.from_thread__->thread_no__ << "::" 
<< parser.from_thread__->thread_name()
<< FILE_LINE<< std::endl;
@<release trace mu@>;
}

@*2 Before |SIGNAL_COND_VAR|.
@<trace |SIGNAL_COND_VAR| before call@>=
clock_t start_;
if(yacco2::YACCO2_THP__ || yacco2::YACCO2_MSG__){
start_ = clock();
@<acquire trace mu@>;
yacco2::lrclog << "YACCO2_THP__ || yacco2::YACCO2_MSG__::" 
<< parser.thread_no__ << "::" << parser.thread_name()
<< " to signal SIGNAL_COND_VAR: " 
<< To_thread.thread_no__ << "::" << To_thread.thread_name()
<< FILE_LINE<< std::endl;
@<release trace mu@>;
}

@*2 After |SIGNAL_COND_VAR|.
@<trace |SIGNAL_COND_VAR| after call@>=
if(yacco2::YACCO2_THP__ || yacco2::YACCO2_MSG__){
@<acquire trace mu@>;
clock_t stop_ = clock();
yacco2::lrclog << "YACCO2_THP__ || yacco2::YACCO2_MSG__::" 
<< parser.thread_no__ << "::" << parser.thread_name()
<< " after SIGNAL_COND_VAR : " << stop_ - start_ 
<< " to: "<< To_thread.thread_no__ << "::" 
<< To_thread.thread_name()
<< FILE_LINE<< std::endl;
@<release trace mu@>;
}

@*2 Before |CREATE_THREAD|.
@<trace |CREATE_THREAD| before call@>=  
clock_t start_ = clock();
if(yacco2::YACCO2_THP__){
@<acquire trace mu@>;
yacco2::lrclog << "YACCO2_THP__:: " 
<< Parser_requesting_parallelism.thread_no__ << "::" 
<< Parser_requesting_parallelism.thread_name()
<< " before CREATE_THREAD" 
<< FILE_LINE<< std::endl;
@<release trace mu@>;
}

@*2 After |CREATE_THREAD|.
@<trace |CREATE_THREAD| after call@>=
if(yacco2::YACCO2_THP__){
@<acquire trace mu@>;
clock_t stop_ = clock();
yacco2::lrclog << "YACCO2_THP__:: " 
<< Parser_requesting_parallelism.thread_no__ << "::" 
<< Parser_requesting_parallelism.thread_name()
<< " after CREATE_THREAD: " << stop_ - start_ 
<< FILE_LINE<< std::endl;
@<release trace mu@>;
}