forked from vscosta/yap
-
Notifications
You must be signed in to change notification settings - Fork 0
/
dlocals.h
730 lines (511 loc) · 27.3 KB
/
dlocals.h
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
/// Thread Local Variables. This file now follows C syntax.
#include "Yap.h"
#include "YapHeap.h"
// Macro support
#ifndef LOCAL
#define LOCAL(A, B) A B
#define LOCAL_INIT(A, B, C) A B B = C
#define LOCAL_ARRAY(A, B, C) A B[C]
#define LOCAL_ARRAY_ARRAY(A, B, C,D) A B[C][D]
#define LOCAL_INIT(A, B, C, D) A B[C][D]
#define LOCAL_INITF(A, B, C) A B C
#define LOCAL_INIT_RESTORE(A,B,C,D) A B C D
#endif
/// Current bindings for std streams, includes default s
#define LOCAL_c_input_stream (Yap_local.c_input_stream)
#define REMOTE_c_input_stream(wid) (REMOTE(wid)->c_input_stream)
#define LOCAL_c_output_stream (Yap_local.c_output_stream)
#define REMOTE_c_output_stream(wid) (REMOTE(wid)->c_output_stream)
#define LOCAL_c_error_stream (Yap_local.c_error_stream)
#define REMOTE_c_error_stream(wid) (REMOTE(wid)->c_error_stream)
#define LOCAL_sockets_io (Yap_local.sockets_io)
#define REMOTE_sockets_io(wid) (REMOTE(wid)->sockets_io)
#define LOCAL_within_print_message (Yap_local.within_print_message)
#define REMOTE_within_print_message(wid) (REMOTE(wid)->within_print_message)
//
// Used by the prompts to check if they are after a newline, and then a
// prompt should be output, or if we are in the middle of a line.
//
#define LOCAL_newline (Yap_local.newline)
#define REMOTE_newline(wid) (REMOTE(wid)->newline)
#define LOCAL_AtPrompt (Yap_local.AtPrompt)
#define REMOTE_AtPrompt(wid) (REMOTE(wid)->AtPrompt)
#define LOCAL_Prompt (Yap_local.Prompt)
#define REMOTE_Prompt(wid) (REMOTE(wid)->Prompt)
#define LOCAL_debugger_state (Yap_local.debugger_state)
#define REMOTE_debugger_state(wid) (REMOTE(wid)->debugger_state)
#define LOCAL_encoding (Yap_local.encoding)
#define REMOTE_encoding(wid) (REMOTE(wid)->encoding)
#define LOCAL_quasi_quotations (Yap_local.quasi_quotations)
#define REMOTE_quasi_quotations(wid) (REMOTE(wid)->quasi_quotations)
#define LOCAL_default_priority (Yap_local.default_priority)
#define REMOTE_default_priority(wid) (REMOTE(wid)->default_priority)
#define LOCAL_eot_before_eof (Yap_local.eot_before_eof)
#define REMOTE_eot_before_eof(wid) (REMOTE(wid)->eot_before_eof)
#define LOCAL_max_depth (Yap_local.max_depth)
#define REMOTE_max_depth(wid) (REMOTE(wid)->max_depth)
#define LOCAL_max_list (Yap_local.max_list)
#define REMOTE_max_list(wid) (REMOTE(wid)->max_list)
#define LOCAL_max_write_args (Yap_local.max_write_args)
#define REMOTE_max_write_args(wid) (REMOTE(wid)->max_write_args)
// Restore info
#define LOCAL_OldASP (Yap_local.OldASP)
#define REMOTE_OldASP(wid) (REMOTE(wid)->OldASP)
#define LOCAL_OldLCL0 (Yap_local.OldLCL0)
#define REMOTE_OldLCL0(wid) (REMOTE(wid)->OldLCL0)
#define LOCAL_OldTR (Yap_local.OldTR)
#define REMOTE_OldTR(wid) (REMOTE(wid)->OldTR)
#define LOCAL_OldGlobalBase (Yap_local.OldGlobalBase)
#define REMOTE_OldGlobalBase(wid) (REMOTE(wid)->OldGlobalBase)
#define LOCAL_OldH (Yap_local.OldH)
#define REMOTE_OldH(wid) (REMOTE(wid)->OldH)
#define LOCAL_OldH0 (Yap_local.OldH0)
#define REMOTE_OldH0(wid) (REMOTE(wid)->OldH0)
#define LOCAL_OldTrailBase (Yap_local.OldTrailBase)
#define REMOTE_OldTrailBase(wid) (REMOTE(wid)->OldTrailBase)
#define LOCAL_OldTrailTop (Yap_local.OldTrailTop)
#define REMOTE_OldTrailTop(wid) (REMOTE(wid)->OldTrailTop)
#define LOCAL_OldHeapBase (Yap_local.OldHeapBase)
#define REMOTE_OldHeapBase(wid) (REMOTE(wid)->OldHeapBase)
#define LOCAL_OldHeapTop (Yap_local.OldHeapTop)
#define REMOTE_OldHeapTop(wid) (REMOTE(wid)->OldHeapTop)
#define LOCAL_ClDiff (Yap_local.ClDiff)
#define REMOTE_ClDiff(wid) (REMOTE(wid)->ClDiff)
#define LOCAL_GDiff (Yap_local.GDiff)
#define REMOTE_GDiff(wid) (REMOTE(wid)->GDiff)
#define LOCAL_HDiff (Yap_local.HDiff)
#define REMOTE_HDiff(wid) (REMOTE(wid)->HDiff)
#define LOCAL_GDiff0 (Yap_local.GDiff0)
#define REMOTE_GDiff0(wid) (REMOTE(wid)->GDiff0)
#define LOCAL_GSplit (Yap_local.GSplit)
#define REMOTE_GSplit(wid) (REMOTE(wid)->GSplit)
#define LOCAL_LDiff (Yap_local.LDiff)
#define REMOTE_LDiff(wid) (REMOTE(wid)->LDiff)
#define LOCAL_TrDiff (Yap_local.TrDiff)
#define REMOTE_TrDiff(wid) (REMOTE(wid)->TrDiff)
#define LOCAL_XDiff (Yap_local.XDiff)
#define REMOTE_XDiff(wid) (REMOTE(wid)->XDiff)
#define LOCAL_DelayDiff (Yap_local.DelayDiff)
#define REMOTE_DelayDiff(wid) (REMOTE(wid)->DelayDiff)
#define LOCAL_BaseDiff (Yap_local.BaseDiff)
#define REMOTE_BaseDiff(wid) (REMOTE(wid)->BaseDiff)
// A term containing a copy with all current live registrt
// Reduction counters
#define LOCAL_ReductionsCounter (Yap_local.ReductionsCounter)
#define REMOTE_ReductionsCounter(wid) (REMOTE(wid)->ReductionsCounter)
#define LOCAL_PredEntriesCounter (Yap_local.PredEntriesCounter)
#define REMOTE_PredEntriesCounter(wid) (REMOTE(wid)->PredEntriesCounter)
#define LOCAL_RetriesCounter (Yap_local.RetriesCounter)
#define REMOTE_RetriesCounter(wid) (REMOTE(wid)->RetriesCounter)
#define LOCAL_ReductionsCounterOn (Yap_local.ReductionsCounterOn)
#define REMOTE_ReductionsCounterOn(wid) (REMOTE(wid)->ReductionsCounterOn)
#define LOCAL_PredEntriesCounterOn (Yap_local.PredEntriesCounterOn)
#define REMOTE_PredEntriesCounterOn(wid) (REMOTE(wid)->PredEntriesCounterOn)
#define LOCAL_RetriesCounterOn (Yap_local.RetriesCounterOn)
#define REMOTE_RetriesCounterOn(wid) (REMOTE(wid)->RetriesCounterOn)
// support for consulting files
/* current consult stack */
#define LOCAL_ConsultSp (Yap_local.ConsultSp)
#define REMOTE_ConsultSp(wid) (REMOTE(wid)->ConsultSp)
/* current maximum number of cells in consult stack */
#define LOCAL_ConsultCapacity (Yap_local.ConsultCapacity)
#define REMOTE_ConsultCapacity(wid) (REMOTE(wid)->ConsultCapacity)
/* top of consult stack */
#define LOCAL_ConsultBase (Yap_local.ConsultBase)
#define REMOTE_ConsultBase(wid) (REMOTE(wid)->ConsultBase)
/* low-water mark for consult */
#define LOCAL_ConsultLow (Yap_local.ConsultLow)
#define REMOTE_ConsultLow(wid) (REMOTE(wid)->ConsultLow)
#define LOCAL_VarNames (Yap_local.VarNames)
#define REMOTE_VarNames(wid) (REMOTE(wid)->VarNames)
#define LOCAL_SourceFileName (Yap_local.SourceFileName)
#define REMOTE_SourceFileName(wid) (REMOTE(wid)->SourceFileName)
#define LOCAL_SourceFileLineno (Yap_local.SourceFileLineno)
#define REMOTE_SourceFileLineno(wid) (REMOTE(wid)->SourceFileLineno)
// global variables
#define LOCAL_GlobalArena (Yap_local.GlobalArena)
#define REMOTE_GlobalArena(wid) (REMOTE(wid)->GlobalArena)
#define LOCAL_GlobalArenaOverflows (Yap_local.GlobalArenaOverflows)
#define REMOTE_GlobalArenaOverflows(wid) (REMOTE(wid)->GlobalArenaOverflows)
#define LOCAL_ArenaOverflows (Yap_local.ArenaOverflows)
#define REMOTE_ArenaOverflows(wid) (REMOTE(wid)->ArenaOverflows)
#define LOCAL_DepthArenas (Yap_local.DepthArenas)
#define REMOTE_DepthArenas(wid) (REMOTE(wid)->DepthArenas)
#define LOCAL_LastAssertedPred (Yap_local.LastAssertedPred)
#define REMOTE_LastAssertedPred(wid) (REMOTE(wid)->LastAssertedPred)
#define LOCAL_TmpPred (Yap_local.TmpPred)
#define REMOTE_TmpPred(wid) (REMOTE(wid)->TmpPred)
#define LOCAL_ScannerStack (Yap_local.ScannerStack)
#define REMOTE_ScannerStack(wid) (REMOTE(wid)->ScannerStack)
#define LOCAL_ScannerExtraBlocks (Yap_local.ScannerExtraBlocks)
#define REMOTE_ScannerExtraBlocks(wid) (REMOTE(wid)->ScannerExtraBlocks)
/// worker control information
/// stack limit after which the stack is managed by C-code.
#define LOCAL_CBorder (Yap_local.CBorder)
#define REMOTE_CBorder(wid) (REMOTE(wid)->CBorder)
#define LOCAL_HandleBorder (Yap_local.HandleBorder)
#define REMOTE_HandleBorder(wid) (REMOTE(wid)->HandleBorder)
/// max number of signals (uint64_t)
#define LOCAL_MaxActiveSignals (Yap_local.MaxActiveSignals)
#define REMOTE_MaxActiveSignals(wid) (REMOTE(wid)->MaxActiveSignals)
/// actual life signals
#define LOCAL_Signals (Yap_local.Signals)
#define REMOTE_Signals(wid) (REMOTE(wid)->Signals)
/// indexing help data?
#define LOCAL_IPredArity (Yap_local.IPredArity)
#define REMOTE_IPredArity(wid) (REMOTE(wid)->IPredArity)
#define LOCAL_ProfEnd (Yap_local.ProfEnd)
#define REMOTE_ProfEnd(wid) (REMOTE(wid)->ProfEnd)
#define LOCAL_DoingUndefp (Yap_local.DoingUndefp)
#define REMOTE_DoingUndefp(wid) (REMOTE(wid)->DoingUndefp)
#define LOCAL_OpBuffer (Yap_local.OpBuffer)
#define REMOTE_OpBuffer(wid) (REMOTE(wid)->OpBuffer)
#define LOCAL_StartCharCount (Yap_local.StartCharCount)
#define REMOTE_StartCharCount(wid) (REMOTE(wid)->StartCharCount)
#define LOCAL_StartLineCount (Yap_local.StartLineCount)
#define REMOTE_StartLineCount(wid) (REMOTE(wid)->StartLineCount)
#define LOCAL_StartLinePos (Yap_local.StartLinePos)
#define REMOTE_StartLinePos(wid) (REMOTE(wid)->StartLinePos)
#define LOCAL_ScratchPad (Yap_local.ScratchPad)
#define REMOTE_ScratchPad(wid) (REMOTE(wid)->ScratchPad)
#define LOCAL_WokenGoals (Yap_local.WokenGoals)
#define REMOTE_WokenGoals(wid) (REMOTE(wid)->WokenGoals)
#define LOCAL_DoNotWakeUp (Yap_local.DoNotWakeUp)
#define REMOTE_DoNotWakeUp(wid) (REMOTE(wid)->DoNotWakeUp)
#define LOCAL_AttsMutableList (Yap_local.AttsMutableList)
#define REMOTE_AttsMutableList(wid) (REMOTE(wid)->AttsMutableList)
// gc_stuff
#define LOCAL_GcGeneration (Yap_local.GcGeneration)
#define REMOTE_GcGeneration(wid) (REMOTE(wid)->GcGeneration)
#define LOCAL_GcPhase (Yap_local.GcPhase)
#define REMOTE_GcPhase(wid) (REMOTE(wid)->GcPhase)
#define LOCAL_GcCurrentPhase (Yap_local.GcCurrentPhase)
#define REMOTE_GcCurrentPhase(wid) (REMOTE(wid)->GcCurrentPhase)
#define LOCAL_GcCalls (Yap_local.GcCalls)
#define REMOTE_GcCalls(wid) (REMOTE(wid)->GcCalls)
#define LOCAL_TotGcTime (Yap_local.TotGcTime)
#define REMOTE_TotGcTime(wid) (REMOTE(wid)->TotGcTime)
#define LOCAL_TotGcRecovered (Yap_local.TotGcRecovered)
#define REMOTE_TotGcRecovered(wid) (REMOTE(wid)->TotGcRecovered)
#define LOCAL_LastGcTime (Yap_local.LastGcTime)
#define REMOTE_LastGcTime(wid) (REMOTE(wid)->LastGcTime)
#define LOCAL_LastSSTime (Yap_local.LastSSTime)
#define REMOTE_LastSSTime(wid) (REMOTE(wid)->LastSSTime)
#define LOCAL_OpenArray (Yap_local.OpenArray)
#define REMOTE_OpenArray(wid) (REMOTE(wid)->OpenArray)
/* in a single gc */
#define LOCAL_MallocDepth (Yap_local.MallocDepth)
#define REMOTE_MallocDepth(wid) (REMOTE(wid)->MallocDepth)
#define LOCAL_total_marked (Yap_local.total_marked)
#define REMOTE_total_marked(wid) (REMOTE(wid)->total_marked)
#define LOCAL_total_oldies (Yap_local.total_oldies)
#define REMOTE_total_oldies(wid) (REMOTE(wid)->total_oldies)
#define LOCAL_current_B (Yap_local.current_B)
#define REMOTE_current_B(wid) (REMOTE(wid)->current_B)
#define LOCAL_prev_HB (Yap_local.prev_HB)
#define REMOTE_prev_HB(wid) (REMOTE(wid)->prev_HB)
#define LOCAL_HGEN (Yap_local.HGEN)
#define REMOTE_HGEN(wid) (REMOTE(wid)->HGEN)
#define LOCAL_iptop (Yap_local.iptop)
#define REMOTE_iptop(wid) (REMOTE(wid)->iptop)
#if defined(GC_NO_TAGS)
#define LOCAL_bp (Yap_local.bp)
#define REMOTE_bp(wid) (REMOTE(wid)->bp)
#endif
#define LOCAL_sTR (Yap_local.sTR)
#define REMOTE_sTR(wid) (REMOTE(wid)->sTR)
#define LOCAL_sTR0 (Yap_local.sTR0)
#define REMOTE_sTR0(wid) (REMOTE(wid)->sTR0)
#define LOCAL_new_TR (Yap_local.new_TR)
#define REMOTE_new_TR(wid) (REMOTE(wid)->new_TR)
#define LOCAL_cont_top0 (Yap_local.cont_top0)
#define REMOTE_cont_top0(wid) (REMOTE(wid)->cont_top0)
#define LOCAL_cont_top (Yap_local.cont_top)
#define REMOTE_cont_top(wid) (REMOTE(wid)->cont_top)
#define LOCAL_discard_trail_entries (Yap_local.discard_trail_entries)
#define REMOTE_discard_trail_entries(wid) (REMOTE(wid)->discard_trail_entries)
#define LOCAL_gc_ma_hash_table (Yap_local.gc_ma_hash_table)
#define REMOTE_gc_ma_hash_table(wid) (REMOTE(wid)->gc_ma_hash_table)
#define LOCAL_gc_ma_h_top (Yap_local.gc_ma_h_top)
#define REMOTE_gc_ma_h_top(wid) (REMOTE(wid)->gc_ma_h_top)
#define LOCAL_gc_ma_h_list (Yap_local.gc_ma_h_list)
#define REMOTE_gc_ma_h_list(wid) (REMOTE(wid)->gc_ma_h_list)
#define LOCAL_gc_timestamp (Yap_local.gc_timestamp)
#define REMOTE_gc_timestamp(wid) (REMOTE(wid)->gc_timestamp)
#define LOCAL_db_vec (Yap_local.db_vec)
#define REMOTE_db_vec(wid) (REMOTE(wid)->db_vec)
#define LOCAL_db_vec0 (Yap_local.db_vec0)
#define REMOTE_db_vec0(wid) (REMOTE(wid)->db_vec0)
#define LOCAL_db_root (Yap_local.db_root)
#define REMOTE_db_root(wid) (REMOTE(wid)->db_root)
#define LOCAL_db_nil (Yap_local.db_nil)
#define REMOTE_db_nil(wid) (REMOTE(wid)->db_nil)
#define LOCAL_GC_min_regs (Yap_local.GC_min_regs)
#define REMOTE_GC_min_regs(wid) (REMOTE(wid)->GC_min_regs)
#define LOCAL_GC_Max_regs (Yap_local.GC_Max_regs)
#define REMOTE_GC_Max_regs(wid) (REMOTE(wid)->GC_Max_regs)
/* parser stack, used to be AuxSp, now is Malloc */
#define LOCAL_ParserAuxSp (Yap_local.ParserAuxSp)
#define REMOTE_ParserAuxSp(wid) (REMOTE(wid)->ParserAuxSp)
#define LOCAL_ParserAuxMax (Yap_local.ParserAuxMax)
#define REMOTE_ParserAuxMax(wid) (REMOTE(wid)->ParserAuxMax)
#define LOCAL_ParserAuxBase (Yap_local.ParserAuxBase)
#define REMOTE_ParserAuxBase(wid) (REMOTE(wid)->ParserAuxBase)
#define LOCAL_gc_restore (Yap_local.gc_restore)
#define REMOTE_gc_restore(wid) (REMOTE(wid)->gc_restore)
#define LOCAL_extra_gc_cells (Yap_local.extra_gc_cells)
#define REMOTE_extra_gc_cells(wid) (REMOTE(wid)->extra_gc_cells)
#define LOCAL_extra_gc_cells_base (Yap_local.extra_gc_cells_base)
#define REMOTE_extra_gc_cells_base(wid) (REMOTE(wid)->extra_gc_cells_base)
#define LOCAL_extra_gc_cells_top (Yap_local.extra_gc_cells_top)
#define REMOTE_extra_gc_cells_top(wid) (REMOTE(wid)->extra_gc_cells_top)
#define LOCAL_extra_gc_cells_size (Yap_local.extra_gc_cells_size)
#define REMOTE_extra_gc_cells_size(wid) (REMOTE(wid)->extra_gc_cells_size)
#define LOCAL_DynamicArrays (Yap_local.DynamicArrays)
#define REMOTE_DynamicArrays(wid) (REMOTE(wid)->DynamicArrays)
#define LOCAL_StaticArrays (Yap_local.StaticArrays)
#define REMOTE_StaticArrays(wid) (REMOTE(wid)->StaticArrays)
#define LOCAL_GlobalVariables (Yap_local.GlobalVariables)
#define REMOTE_GlobalVariables(wid) (REMOTE(wid)->GlobalVariables)
#define LOCAL_AllowRestart (Yap_local.AllowRestart)
#define REMOTE_AllowRestart(wid) (REMOTE(wid)->AllowRestart)
// Thread Local Area for Fast Storage of Intermediate Compiled Code
#define LOCAL_CMemFirstBlock (Yap_local.CMemFirstBlock)
#define REMOTE_CMemFirstBlock(wid) (REMOTE(wid)->CMemFirstBlock)
#define LOCAL_CMemFirstBlockSz (Yap_local.CMemFirstBlockSz)
#define REMOTE_CMemFirstBlockSz(wid) (REMOTE(wid)->CMemFirstBlockSz)
// Variable used by the compiler to store number of permanent vars in a clause
#define LOCAL_nperm (Yap_local.nperm)
#define REMOTE_nperm(wid) (REMOTE(wid)->nperm)
#define LOCAL_jMP (Yap_local.jMP)
#define REMOTE_jMP(wid) (REMOTE(wid)->jMP)
// Thread Local Area for Labels
#define LOCAL_LabelFirstArray (Yap_local.LabelFirstArray)
#define REMOTE_LabelFirstArray(wid) (REMOTE(wid)->LabelFirstArray)
#define LOCAL_LabelFirstArraySz (Yap_local.LabelFirstArraySz)
#define REMOTE_LabelFirstArraySz(wid) (REMOTE(wid)->LabelFirstArraySz)
// Thread Local Area for SWI-Prolog emulation routines.
// stInitSruct LOCAL_INIT( PL_local_data*, PL_local_data_p, Yap_InitThreadIO(wid))
#ifdef THREADS
#define LOCAL_ThreadHandle (Yap_local.ThreadHandle)
#define REMOTE_ThreadHandle(wid) (REMOTE(wid)->ThreadHandle)
#endif /* THREADS */
#if defined(YAPOR) || defined(TABLING)
#define LOCAL_optyap_data (Yap_local.optyap_data)
#define REMOTE_optyap_data(wid) (REMOTE(wid)->optyap_data)
#define LOCAL_TabMode (Yap_local.TabMode)
#define REMOTE_TabMode(wid) (REMOTE(wid)->TabMode)
#endif /* YAPOR || TABLING */
#define LOCAL_InterruptsDisabled (Yap_local.InterruptsDisabled)
#define REMOTE_InterruptsDisabled(wid) (REMOTE(wid)->InterruptsDisabled)
#define LOCAL_execution (Yap_local.execution)
#define REMOTE_execution(wid) (REMOTE(wid)->execution)
#if LOW_LEVEL_TRACER
#define LOCAL_total_choicepoints (Yap_local.total_choicepoints)
#define REMOTE_total_choicepoints(wid) (REMOTE(wid)->total_choicepoints)
#endif
#define LOCAL_consult_level (Yap_local.consult_level)
#define REMOTE_consult_level(wid) (REMOTE(wid)->consult_level)
// Variables related to memory allocation
#define LOCAL_LocalBase (Yap_local.LocalBase)
#define REMOTE_LocalBase(wid) (REMOTE(wid)->LocalBase)
#define LOCAL_GlobalBase (Yap_local.GlobalBase)
#define REMOTE_GlobalBase(wid) (REMOTE(wid)->GlobalBase)
#define LOCAL_TrailBase (Yap_local.TrailBase)
#define REMOTE_TrailBase(wid) (REMOTE(wid)->TrailBase)
#define LOCAL_TrailTop (Yap_local.TrailTop)
#define REMOTE_TrailTop(wid) (REMOTE(wid)->TrailTop)
/* error handling info, designed to be easy to pass to the foreign world */
#define LOCAL_ActiveError (Yap_local.ActiveError)
#define REMOTE_ActiveError(wid) (REMOTE(wid)->ActiveError)
#define LOCAL_CommittedError (Yap_local.CommittedError)
#define REMOTE_CommittedError(wid) (REMOTE(wid)->CommittedError)
#define LOCAL_delay (Yap_local.delay)
#define REMOTE_delay(wid) (REMOTE(wid)->delay)
/// pointer to an exception term, from throw
#define LOCAL_IOBotch (Yap_local.IOBotch)
#define REMOTE_IOBotch(wid) (REMOTE(wid)->IOBotch)
/// tokenizer support (should be private to the tokenizer).
#define LOCAL_tokptr (Yap_local.tokptr)
#define REMOTE_tokptr(wid) (REMOTE(wid)->tokptr)
#define LOCAL_toktide (Yap_local.toktide)
#define REMOTE_toktide(wid) (REMOTE(wid)->toktide)
#define LOCAL_VarTable (Yap_local.VarTable)
#define REMOTE_VarTable(wid) (REMOTE(wid)->VarTable)
#define LOCAL_AnonVarTable (Yap_local.AnonVarTable)
#define REMOTE_AnonVarTable(wid) (REMOTE(wid)->AnonVarTable)
#define LOCAL_VarList (Yap_local.VarList)
#define REMOTE_VarList(wid) (REMOTE(wid)->VarList)
#define LOCAL_VarTail (Yap_local.VarTail)
#define REMOTE_VarTail(wid) (REMOTE(wid)->VarTail)
#define LOCAL_Comments (Yap_local.Comments)
#define REMOTE_Comments(wid) (REMOTE(wid)->Comments)
#define LOCAL_CommentsTail (Yap_local.CommentsTail)
#define REMOTE_CommentsTail(wid) (REMOTE(wid)->CommentsTail)
#define LOCAL_CommentsNextChar (Yap_local.CommentsNextChar)
#define REMOTE_CommentsNextChar(wid) (REMOTE(wid)->CommentsNextChar)
#define LOCAL_CommentsBuff (Yap_local.CommentsBuff)
#define REMOTE_CommentsBuff(wid) (REMOTE(wid)->CommentsBuff)
#define LOCAL_CommentsBuffPos (Yap_local.CommentsBuffPos)
#define REMOTE_CommentsBuffPos(wid) (REMOTE(wid)->CommentsBuffPos)
#define LOCAL_CommentsBuffLim (Yap_local.CommentsBuffLim)
#define REMOTE_CommentsBuffLim(wid) (REMOTE(wid)->CommentsBuffLim)
#define LOCAL_RestartEnv (Yap_local.RestartEnv)
#define REMOTE_RestartEnv(wid) (REMOTE(wid)->RestartEnv)
#define LOCAL_TextBuffer (Yap_local.TextBuffer)
#define REMOTE_TextBuffer(wid) (REMOTE(wid)->TextBuffer)
// Prolog State
#define LOCAL_BreakLevel (Yap_local.BreakLevel)
#define REMOTE_BreakLevel(wid) (REMOTE(wid)->BreakLevel)
#define LOCAL_PrologMode (Yap_local.PrologMode)
#define REMOTE_PrologMode(wid) (REMOTE(wid)->PrologMode)
#define LOCAL_CritLocks (Yap_local.CritLocks)
#define REMOTE_CritLocks(wid) (REMOTE(wid)->CritLocks)
// Prolog execution and state flags
#define LOCAL_Flags (Yap_local.Flags)
#define REMOTE_Flags(wid) (REMOTE(wid)->Flags)
#define LOCAL_flagCount (Yap_local.flagCount)
#define REMOTE_flagCount(wid) (REMOTE(wid)->flagCount)
// analyst.c
/* used to find out how many instructions of each kind are executed */
#ifdef ANALYST
#define LOCAL_opcount (Yap_local.opcount)
#define REMOTE_opcount(wid) (REMOTE(wid)->opcount)
#define LOCAL_2opcount (Yap_local.2opcount)
#define REMOTE_2opcount(wid) (REMOTE(wid)->2opcount)
#endif /* ANALYST */
// dbase.c
#define LOCAL_s_dbg (Yap_local.s_dbg)
#define REMOTE_s_dbg(wid) (REMOTE(wid)->s_dbg)
// eval.c
#define LOCAL_mathtt (Yap_local.mathtt)
#define REMOTE_mathtt(wid) (REMOTE(wid)->mathtt)
#define LOCAL_mathstring (Yap_local.mathstring)
#define REMOTE_mathstring(wid) (REMOTE(wid)->mathstring)
#define LOCAL_ctx (Yap_local.ctx)
#define REMOTE_ctx(wid) (REMOTE(wid)->ctx)
// grow.c
#define LOCAL_heap_overflows (Yap_local.heap_overflows)
#define REMOTE_heap_overflows(wid) (REMOTE(wid)->heap_overflows)
#define LOCAL_total_heap_overflow_time (Yap_local.total_heap_overflow_time)
#define REMOTE_total_heap_overflow_time(wid) (REMOTE(wid)->total_heap_overflow_time)
#define LOCAL_stack_overflows (Yap_local.stack_overflows)
#define REMOTE_stack_overflows(wid) (REMOTE(wid)->stack_overflows)
#define LOCAL_total_stack_overflow_time (Yap_local.total_stack_overflow_time)
#define REMOTE_total_stack_overflow_time(wid) (REMOTE(wid)->total_stack_overflow_time)
#define LOCAL_delay_overflows (Yap_local.delay_overflows)
#define REMOTE_delay_overflows(wid) (REMOTE(wid)->delay_overflows)
#define LOCAL_total_delay_overflow_time (Yap_local.total_delay_overflow_time)
#define REMOTE_total_delay_overflow_time(wid) (REMOTE(wid)->total_delay_overflow_time)
#define LOCAL_trail_overflows (Yap_local.trail_overflows)
#define REMOTE_trail_overflows(wid) (REMOTE(wid)->trail_overflows)
#define LOCAL_total_trail_overflow_time (Yap_local.total_trail_overflow_time)
#define REMOTE_total_trail_overflow_time(wid) (REMOTE(wid)->total_trail_overflow_time)
#define LOCAL_atom_table_overflows (Yap_local.atom_table_overflows)
#define REMOTE_atom_table_overflows(wid) (REMOTE(wid)->atom_table_overflows)
#define LOCAL_total_atom_table_overflow_time (Yap_local.total_atom_table_overflow_time)
#define REMOTE_total_atom_table_overflow_time(wid) (REMOTE(wid)->total_atom_table_overflow_time)
// load_dyld
#ifdef LOAD_DYLD
#define LOCAL_dl_errno (Yap_local.dl_errno)
#define REMOTE_dl_errno(wid) (REMOTE(wid)->dl_errno)
#endif
// tracer.c
#ifdef LOW_LEVEL_TRACER
#define LOCAL_do_trace_primitives (Yap_local.do_trace_primitives)
#define REMOTE_do_trace_primitives(wid) (REMOTE(wid)->do_trace_primitives)
#endif
// quick loader
#define LOCAL_ExportAtomHashChain (Yap_local.ExportAtomHashChain)
#define REMOTE_ExportAtomHashChain(wid) (REMOTE(wid)->ExportAtomHashChain)
#define LOCAL_ExportAtomHashTableSize (Yap_local.ExportAtomHashTableSize)
#define REMOTE_ExportAtomHashTableSize(wid) (REMOTE(wid)->ExportAtomHashTableSize)
#define LOCAL_ExportAtomHashTableNum (Yap_local.ExportAtomHashTableNum)
#define REMOTE_ExportAtomHashTableNum(wid) (REMOTE(wid)->ExportAtomHashTableNum)
#define LOCAL_ExportFunctorHashChain (Yap_local.ExportFunctorHashChain)
#define REMOTE_ExportFunctorHashChain(wid) (REMOTE(wid)->ExportFunctorHashChain)
#define LOCAL_ExportFunctorHashTableSize (Yap_local.ExportFunctorHashTableSize)
#define REMOTE_ExportFunctorHashTableSize(wid) (REMOTE(wid)->ExportFunctorHashTableSize)
#define LOCAL_ExportFunctorHashTableNum (Yap_local.ExportFunctorHashTableNum)
#define REMOTE_ExportFunctorHashTableNum(wid) (REMOTE(wid)->ExportFunctorHashTableNum)
#define LOCAL_ExportPredEntryHashChain (Yap_local.ExportPredEntryHashChain)
#define REMOTE_ExportPredEntryHashChain(wid) (REMOTE(wid)->ExportPredEntryHashChain)
#define LOCAL_ExportPredEntryHashTableSize (Yap_local.ExportPredEntryHashTableSize)
#define REMOTE_ExportPredEntryHashTableSize(wid) (REMOTE(wid)->ExportPredEntryHashTableSize)
#define LOCAL_ExportPredEntryHashTableNum (Yap_local.ExportPredEntryHashTableNum)
#define REMOTE_ExportPredEntryHashTableNum(wid) (REMOTE(wid)->ExportPredEntryHashTableNum)
#define LOCAL_ExportDBRefHashChain (Yap_local.ExportDBRefHashChain)
#define REMOTE_ExportDBRefHashChain(wid) (REMOTE(wid)->ExportDBRefHashChain)
#define LOCAL_ExportDBRefHashTableSize (Yap_local.ExportDBRefHashTableSize)
#define REMOTE_ExportDBRefHashTableSize(wid) (REMOTE(wid)->ExportDBRefHashTableSize)
#define LOCAL_ExportDBRefHashTableNum (Yap_local.ExportDBRefHashTableNum)
#define REMOTE_ExportDBRefHashTableNum(wid) (REMOTE(wid)->ExportDBRefHashTableNum)
#define LOCAL_ImportAtomHashChain (Yap_local.ImportAtomHashChain)
#define REMOTE_ImportAtomHashChain(wid) (REMOTE(wid)->ImportAtomHashChain)
#define LOCAL_ImportAtomHashTableSize (Yap_local.ImportAtomHashTableSize)
#define REMOTE_ImportAtomHashTableSize(wid) (REMOTE(wid)->ImportAtomHashTableSize)
#define LOCAL_ImportAtomHashTableNum (Yap_local.ImportAtomHashTableNum)
#define REMOTE_ImportAtomHashTableNum(wid) (REMOTE(wid)->ImportAtomHashTableNum)
#define LOCAL_ImportFunctorHashChain (Yap_local.ImportFunctorHashChain)
#define REMOTE_ImportFunctorHashChain(wid) (REMOTE(wid)->ImportFunctorHashChain)
#define LOCAL_ImportFunctorHashTableSize (Yap_local.ImportFunctorHashTableSize)
#define REMOTE_ImportFunctorHashTableSize(wid) (REMOTE(wid)->ImportFunctorHashTableSize)
#define LOCAL_ImportFunctorHashTableNum (Yap_local.ImportFunctorHashTableNum)
#define REMOTE_ImportFunctorHashTableNum(wid) (REMOTE(wid)->ImportFunctorHashTableNum)
#define LOCAL_ImportOPCODEHashChain (Yap_local.ImportOPCODEHashChain)
#define REMOTE_ImportOPCODEHashChain(wid) (REMOTE(wid)->ImportOPCODEHashChain)
#define LOCAL_ImportOPCODEHashTableSize (Yap_local.ImportOPCODEHashTableSize)
#define REMOTE_ImportOPCODEHashTableSize(wid) (REMOTE(wid)->ImportOPCODEHashTableSize)
#define LOCAL_ImportPredEntryHashChain (Yap_local.ImportPredEntryHashChain)
#define REMOTE_ImportPredEntryHashChain(wid) (REMOTE(wid)->ImportPredEntryHashChain)
#define LOCAL_ImportPredEntryHashTableSize (Yap_local.ImportPredEntryHashTableSize)
#define REMOTE_ImportPredEntryHashTableSize(wid) (REMOTE(wid)->ImportPredEntryHashTableSize)
#define LOCAL_ImportPredEntryHashTableNum (Yap_local.ImportPredEntryHashTableNum)
#define REMOTE_ImportPredEntryHashTableNum(wid) (REMOTE(wid)->ImportPredEntryHashTableNum)
#define LOCAL_ImportDBRefHashChain (Yap_local.ImportDBRefHashChain)
#define REMOTE_ImportDBRefHashChain(wid) (REMOTE(wid)->ImportDBRefHashChain)
#define LOCAL_ImportDBRefHashTableSize (Yap_local.ImportDBRefHashTableSize)
#define REMOTE_ImportDBRefHashTableSize(wid) (REMOTE(wid)->ImportDBRefHashTableSize)
#define LOCAL_ImportDBRefHashTableNum (Yap_local.ImportDBRefHashTableNum)
#define REMOTE_ImportDBRefHashTableNum(wid) (REMOTE(wid)->ImportDBRefHashTableNum)
#define LOCAL_ImportFAILCODE (Yap_local.ImportFAILCODE)
#define REMOTE_ImportFAILCODE(wid) (REMOTE(wid)->ImportFAILCODE)
// exo indexing
#define LOCAL_ibnds (Yap_local.ibnds)
#define REMOTE_ibnds(wid) (REMOTE(wid)->ibnds)
#define LOCAL_exo_it (Yap_local.exo_it)
#define REMOTE_exo_it(wid) (REMOTE(wid)->exo_it)
#define LOCAL_exo_base (Yap_local.exo_base)
#define REMOTE_exo_base(wid) (REMOTE(wid)->exo_base)
#define LOCAL_exo_arity (Yap_local.exo_arity)
#define REMOTE_exo_arity(wid) (REMOTE(wid)->exo_arity)
#define LOCAL_exo_arg (Yap_local.exo_arg)
#define REMOTE_exo_arg(wid) (REMOTE(wid)->exo_arg)
// atom completion
#define LOCAL_search_atoms (Yap_local.search_atoms)
#define REMOTE_search_atoms(wid) (REMOTE(wid)->search_atoms)
#define LOCAL_SearchPreds (Yap_local.SearchPreds)
#define REMOTE_SearchPreds(wid) (REMOTE(wid)->SearchPreds)
/// Slots Status
#define LOCAL_CurSlot (Yap_local.CurSlot)
#define REMOTE_CurSlot(wid) (REMOTE(wid)->CurSlot)
#define LOCAL_FrozenHandles (Yap_local.FrozenHandles)
#define REMOTE_FrozenHandles(wid) (REMOTE(wid)->FrozenHandles)
#define LOCAL_NSlots (Yap_local.NSlots)
#define REMOTE_NSlots(wid) (REMOTE(wid)->NSlots)
#define LOCAL_SlotBase (Yap_local.SlotBase)
#define REMOTE_SlotBase(wid) (REMOTE(wid)->SlotBase)
// Mutexes
#define LOCAL_Mutexes (Yap_local.Mutexes)
#define REMOTE_Mutexes(wid) (REMOTE(wid)->Mutexes)
#define LOCAL_SourceModule (Yap_local.SourceModule)
#define REMOTE_SourceModule(wid) (REMOTE(wid)->SourceModule)
#define LOCAL_Including (Yap_local.Including)
#define REMOTE_Including(wid) (REMOTE(wid)->Including)
#define LOCAL_MAX_SIZE (Yap_local.MAX_SIZE)
#define REMOTE_MAX_SIZE(wid) (REMOTE(wid)->MAX_SIZE)
/* last call to walltime. */
#define LOCAL_LastWTime (Yap_local.LastWTime)
#define REMOTE_LastWTime(wid) (REMOTE(wid)->LastWTime)
#define LOCAL_WorkerBuffer (Yap_local.WorkerBuffer)
#define REMOTE_WorkerBuffer(wid) (REMOTE(wid)->WorkerBuffer)