1/* File: "gambit.h" */
2
3/*
4 * Copyright (c) 1994-2018 by Marc Feeley, All Rights Reserved.
5 */
6
7#ifndef ___GAMBIT_H
8#define ___GAMBIT_H
9
10#ifndef ___VERSION
11#define ___VERSION 409003
12#endif
13
14#if ___VERSION != 409003
15#include "gambit-not409003.h"
16#else
17
18#ifdef HAVE_CONFIG_H
19#include "config.h"
20#endif
21
22/*---------------------------------------------------------------------------*/
23
24/*
25 * This section determines the following characteristics of the target
26 * platform:
27 *
28 *  - C compiler version
29 *  - target operating system (WIN32, POSIX, etc)
30 *  - target processor type (x86, PowerPC, etc)
31 *  - byte order endianness (big-endian or little-endian)
32 *  - width of the integer and floating-point types (char, short, int, etc)
33 */
34
35#ifdef __GNUC__
36#define ___GNUC_VERSION (__GNUC__*100000+__GNUC_MINOR__*1000+__GNUC_PATCHLEVEL__)
37#endif
38
39/*
40 * Determine the target operating system type.  This is used mainly in
41 * the implementation of operating system dependent runtime library
42 * functions (i.e. lib/os*.c), but also to handle some OS quirks in
43 * this include file.
44 */
45
46#ifdef _WIN32
47#define ___OS_WIN32
48#endif
49
50
51/*
52 * Determine the target processor type.  This is used for dynamic code
53 * generation (to convert Scheme procedures into C functions) and to
54 * determine byte order endianness.
55 */
56
57#ifndef ___CPU_x86_32
58
59#ifdef I386
60#define ___CPU_x86_32
61#else
62#ifdef _I386
63#define ___CPU_x86_32
64#else
65#ifdef i386
66#define ___CPU_x86_32
67#else
68#ifdef _i386
69#define ___CPU_x86_32
70#else
71#ifdef __i386
72#define ___CPU_x86_32
73#else
74#ifdef __i386__
75#define ___CPU_x86_32
76#else
77#ifdef __i486
78#define ___CPU_x86_32
79#else
80#ifdef __i486__
81#define ___CPU_x86_32
82#else
83#ifdef __i586
84#define ___CPU_x86_32
85#else
86#ifdef __i586__
87#define ___CPU_x86_32
88#else
89#ifdef __i686
90#define ___CPU_x86_32
91#else
92#ifdef __i686__
93#define ___CPU_x86_32
94#else
95#ifdef __ix86
96#define ___CPU_x86_32
97#else
98#ifdef M_I386
99#define ___CPU_x86_32
100#else
101#ifdef _M_I386
102#define ___CPU_x86_32
103#else
104#ifdef M_I86
105#define ___CPU_x86_32
106#else
107#ifdef _M_I86
108#define ___CPU_x86_32
109#else
110#ifdef _M_IX86
111#define ___CPU_x86_32
112#else
113#ifdef _X86_
114#define ___CPU_x86_32
115#endif
116#endif
117#endif
118#endif
119#endif
120#endif
121#endif
122#endif
123#endif
124#endif
125#endif
126#endif
127#endif
128#endif
129#endif
130#endif
131#endif
132#endif
133#endif
134
135#ifdef ___CPU_x86_32
136#define ___CPU_x86
137#endif
138
139#endif
140
141#ifndef ___CPU_x86_64
142
143#ifdef __x86_64__
144#define ___CPU_x86_64
145#else
146#ifdef _M_AMD64
147#define ___CPU_x86_64
148#endif
149#endif
150
151#ifdef ___CPU_x86_64
152#define ___CPU_x86
153#endif
154
155#endif
156
157#ifndef ___CPU_ppc_32
158
159#ifdef PPC
160#define ___CPU_ppc_32
161#else
162#ifdef ppc
163#define ___CPU_ppc_32
164#else
165#ifdef __ppc
166#define ___CPU_ppc_32
167#else
168#ifdef __ppc__
169#define ___CPU_ppc_32
170#else
171#ifdef _ARCH_PPC
172#define ___CPU_ppc_32
173#else
174#ifdef __POWERPC__
175#define ___CPU_ppc_32
176#else
177#ifdef powerpc
178#define ___CPU_ppc_32
179#else
180#ifdef _POWER
181#define ___CPU_ppc_32
182#else
183#ifdef _ARCH_PWR
184#define ___CPU_ppc_32
185#else
186#ifdef _ARCH_PWR2
187#define ___CPU_ppc_32
188#else
189#ifdef _M_PPC
190#define ___CPU_ppc_32
191#else
192#ifdef _M_MPPC
193#define ___CPU_ppc_32
194#endif
195#endif
196#endif
197#endif
198#endif
199#endif
200#endif
201#endif
202#endif
203#endif
204#endif
205#endif
206
207#ifdef ___CPU_ppc_32
208#define ___CPU_ppc
209#endif
210
211#endif
212
213#ifndef ___CPU_ppc_64
214
215#ifdef __ppc_64__
216#define ___CPU_ppc_64
217#endif
218
219#ifdef ___CPU_ppc_64
220#define ___CPU_ppc
221#endif
222
223#endif
224
225#ifndef ___CPU_sparc
226
227#ifdef SPARC
228#define ___CPU_sparc
229#else
230#ifdef __sparc
231#define ___CPU_sparc
232#else
233#ifdef __sparc__
234#define ___CPU_sparc
235#else
236#ifdef sparc
237#define ___CPU_sparc
238#else
239#ifdef sparc64
240#define ___CPU_sparc
241#else
242#ifdef sparclite
243#define ___CPU_sparc
244#endif
245#endif
246#endif
247#endif
248#endif
249#endif
250
251#endif
252
253#ifndef ___CPU_alpha
254
255#ifdef alpha
256#define ___CPU_alpha
257#else
258#ifdef __alpha
259#define ___CPU_alpha
260#else
261#ifdef __alpha__
262#define ___CPU_alpha
263#else
264#ifdef ALPHA
265#define ___CPU_alpha
266#else
267#ifdef _ALPHA_
268#define ___CPU_alpha
269#else
270#ifdef __ALPHA
271#define ___CPU_alpha
272#else
273#ifdef _M_ALPHA
274#define ___CPU_alpha
275#endif
276#endif
277#endif
278#endif
279#endif
280#endif
281#endif
282
283#endif
284
285#ifndef ___CPU_mips
286
287#ifdef mips
288#define ___CPU_mips
289#else
290#ifdef _mips
291#define ___CPU_mips
292#else
293#ifdef __mips
294#define ___CPU_mips
295#else
296#ifdef __mips__
297#define ___CPU_mips
298#else
299#ifdef MIPSEB
300#define ___CPU_mips
301#else
302#ifdef _MIPSEB
303#define ___CPU_mips
304#else
305#ifdef __MIPSEB
306#define ___CPU_mips
307#else
308#ifdef __MIPSEB__
309#define ___CPU_mips
310#else
311#ifdef MIPSEL
312#define ___CPU_mips
313#else
314#ifdef _MIPSEL
315#define ___CPU_mips
316#else
317#ifdef __MIPSEL
318#define ___CPU_mips
319#else
320#ifdef __MIPSEL__
321#define ___CPU_mips
322#else
323#ifdef _M_MRX000
324#define ___CPU_mips
325#endif
326#endif
327#endif
328#endif
329#endif
330#endif
331#endif
332#endif
333#endif
334#endif
335#endif
336#endif
337#endif
338
339#endif
340
341#ifndef ___CPU_arm
342
343#ifdef arm
344#define ___CPU_arm
345#else
346#ifdef __arm
347#define ___CPU_arm
348#else
349#ifdef __arm__
350#define ___CPU_arm
351#else
352#endif
353#endif
354#endif
355
356#endif
357
358#ifndef ___CPU_vax
359
360#ifdef vax
361#define ___CPU_vax
362#else
363#ifdef __vax
364#define ___CPU_vax
365#else
366#ifdef __vax__
367#define ___CPU_vax
368#endif
369#endif
370#endif
371
372#endif
373
374#ifdef __aarch64__
375#define ___CPU_aarch64
376#else
377#ifdef __arm64__
378#define ___CPU_aarch64
379#endif
380#endif
381
382/*
383 * Determine the byte order endianness based on the processor type.
384 * We assume that all processors are big-endian, except the x86, x86_64,
385 * alpha and vax.  The PowerPC, MIPS and ARM can be either big-endian or
386 * little-endian so extra tests are needed.
387 */
388
389#ifndef ___BIG_ENDIAN
390#ifndef ___LITTLE_ENDIAN
391
392#ifdef ___CPU_x86
393#define ___LITTLE_ENDIAN
394#endif
395
396#ifdef ___CPU_ppc
397#ifdef _LITTLE_ENDIAN
398#define ___LITTLE_ENDIAN
399#endif
400#ifdef __LITTLE_ENDIAN__
401#define ___LITTLE_ENDIAN
402#endif
403#ifdef __LITTLE_ENDIAN_DATA__
404#define ___LITTLE_ENDIAN
405#endif
406#endif
407
408#ifdef ___CPU_alpha
409#define ___LITTLE_ENDIAN
410#endif
411
412#ifdef ___CPU_mips
413#ifdef _MIPSEL
414#define ___LITTLE_ENDIAN
415#endif
416#endif
417
418#ifdef ___CPU_arm
419#ifdef _LITTLE_ENDIAN
420#define ___LITTLE_ENDIAN
421#endif
422#ifdef __LITTLE_ENDIAN__
423#define ___LITTLE_ENDIAN
424#endif
425#ifdef __LITTLE_ENDIAN_DATA__
426#define ___LITTLE_ENDIAN
427#endif
428#ifdef __ARMEL__
429#define ___LITTLE_ENDIAN
430#endif
431#endif
432
433#ifdef ___CPU_vax
434#define ___LITTLE_ENDIAN
435#endif
436
437#ifdef EMSCRIPTEN
438#define ___LITTLE_ENDIAN
439#endif
440
441/* AArch64 can be little or big endian*/
442#ifdef __AARCH64EL__
443#define ___LITTLE_ENDIAN
444#endif
445
446#ifndef ___LITTLE_ENDIAN
447#define ___BIG_ENDIAN
448#endif
449
450#endif
451#endif
452
453/*
454 * Determine the number of bits in various integer and floating point
455 * types and define appropriate macros accordingly.  The macro for a
456 * given type is not defined if the type is not supported by the C
457 * compiler or if it is not 8, 16, 32 or 64 bits wide.
458 */
459
460#ifndef ___CHAR_WIDTH
461#ifdef ___DONT_HAVE_LIMITS_H
462
463/*
464 * If the file "limits.h" is not available then the symbol
465 * ___DONT_HAVE_LIMITS_H must be defined (for example on the compiler's
466 * command line) and the following definitions will be used:
467 */
468
469#define ___CHAR_WIDTH     8   /* if needed, edit to suit your platform */
470#define ___SHORT_WIDTH    16
471#define ___INT_WIDTH      32
472#define ___LONG_WIDTH     32
473
474#ifdef __GNUC__
475#define ___LONGLONG_WIDTH 64
476#endif
477
478#else
479
480/*
481 * If the file "limits.h" is available then it contains macros
482 * defining the range of the integer types.  The following
483 * preprocessor conditional definitions are written so that they will
484 * work regardless of the number of bits in the integer types
485 * supported by the compiler (many compilers for 32 bit machines give
486 * an error for C preprocessor expressions like ULONG_MAX >> 32 or
487 * ULLONG_MAX == 18446744073709551615UL).  Some parentheses seem
488 * redundant, but they are required for MS Visual C/C++ whose
489 * preprocessor signals an error on: x >> 8 >> 8.
490 */
491
492#include <limits.h>
493
494#ifdef UCHAR_MAX
495#if (UCHAR_MAX & 255) == 255
496#if (UCHAR_MAX >> 8) == 0
497#define ___CHAR_WIDTH 8
498#else
499#if ((UCHAR_MAX >> 8) & 255) == 255
500#if ((UCHAR_MAX >> 8) >> 8) == 0
501#define ___CHAR_WIDTH 16
502#else
503#if (((UCHAR_MAX >> 8) >> 8) & 255) == 255
504#if (((UCHAR_MAX >> 8) >> 8) >> 8) != 0
505#if ((((UCHAR_MAX >> 8) >> 8) >> 8) & 255) == 255
506#if ((((UCHAR_MAX >> 8) >> 8) >> 8) >> 8) == 0
507#define ___CHAR_WIDTH 32
508#else
509#if (((((UCHAR_MAX >> 8) >> 8) >> 8) >> 8) & 255) == 255
510#if (((((UCHAR_MAX >> 8) >> 8) >> 8) >> 8) >> 8) != 0
511#if ((((((UCHAR_MAX >> 8) >> 8) >> 8) >> 8) >> 8) & 255) == 255
512#if ((((((UCHAR_MAX >> 8) >> 8) >> 8) >> 8) >> 8) >> 8) != 0
513#if (((((((UCHAR_MAX >> 8) >> 8) >> 8) >> 8) >> 8) >> 8) & 255) == 255
514#if (((((((UCHAR_MAX >> 8) >> 8) >> 8) >> 8) >> 8) >> 8) >> 8) != 0
515#if ((((((((UCHAR_MAX >> 8) >> 8) >> 8) >> 8) >> 8) >> 8) >> 8) & 255) == 255
516#if ((((((((UCHAR_MAX >> 8) >> 8) >> 8) >> 8) >> 8) >> 8) >> 8) >> 8) == 0
517#define ___CHAR_WIDTH 64
518#endif
519#endif
520#endif
521#endif
522#endif
523#endif
524#endif
525#endif
526#endif
527#endif
528#endif
529#endif
530#endif
531#endif
532#endif
533#endif
534#endif
535
536#ifdef USHRT_MAX
537#if (USHRT_MAX & 255) == 255
538#if (USHRT_MAX >> 8) == 0
539#define ___SHORT_WIDTH 8
540#else
541#if ((USHRT_MAX >> 8) & 255) == 255
542#if ((USHRT_MAX >> 8) >> 8) == 0
543#define ___SHORT_WIDTH 16
544#else
545#if (((USHRT_MAX >> 8) >> 8) & 255) == 255
546#if (((USHRT_MAX >> 8) >> 8) >> 8) != 0
547#if ((((USHRT_MAX >> 8) >> 8) >> 8) & 255) == 255
548#if ((((USHRT_MAX >> 8) >> 8) >> 8) >> 8) == 0
549#define ___SHORT_WIDTH 32
550#else
551#if (((((USHRT_MAX >> 8) >> 8) >> 8) >> 8) & 255) == 255
552#if (((((USHRT_MAX >> 8) >> 8) >> 8) >> 8) >> 8) != 0
553#if ((((((USHRT_MAX >> 8) >> 8) >> 8) >> 8) >> 8) & 255) == 255
554#if ((((((USHRT_MAX >> 8) >> 8) >> 8) >> 8) >> 8) >> 8) != 0
555#if (((((((USHRT_MAX >> 8) >> 8) >> 8) >> 8) >> 8) >> 8) & 255) == 255
556#if (((((((USHRT_MAX >> 8) >> 8) >> 8) >> 8) >> 8) >> 8) >> 8) != 0
557#if ((((((((USHRT_MAX >> 8) >> 8) >> 8) >> 8) >> 8) >> 8) >> 8) & 255) == 255
558#if ((((((((USHRT_MAX >> 8) >> 8) >> 8) >> 8) >> 8) >> 8) >> 8) >> 8) == 0
559#define ___SHORT_WIDTH 64
560#endif
561#endif
562#endif
563#endif
564#endif
565#endif
566#endif
567#endif
568#endif
569#endif
570#endif
571#endif
572#endif
573#endif
574#endif
575#endif
576#endif
577
578#ifdef UINT_MAX
579#if (UINT_MAX & 255) == 255
580#if (UINT_MAX >> 8) == 0
581#define ___INT_WIDTH 8
582#else
583#if ((UINT_MAX >> 8) & 255) == 255
584#if ((UINT_MAX >> 8) >> 8) == 0
585#define ___INT_WIDTH 16
586#else
587#if (((UINT_MAX >> 8) >> 8) & 255) == 255
588#if (((UINT_MAX >> 8) >> 8) >> 8) != 0
589#if ((((UINT_MAX >> 8) >> 8) >> 8) & 255) == 255
590#if ((((UINT_MAX >> 8) >> 8) >> 8) >> 8) == 0
591#define ___INT_WIDTH 32
592#else
593#if (((((UINT_MAX >> 8) >> 8) >> 8) >> 8) & 255) == 255
594#if (((((UINT_MAX >> 8) >> 8) >> 8) >> 8) >> 8) != 0
595#if ((((((UINT_MAX >> 8) >> 8) >> 8) >> 8) >> 8) & 255) == 255
596#if ((((((UINT_MAX >> 8) >> 8) >> 8) >> 8) >> 8) >> 8) != 0
597#if (((((((UINT_MAX >> 8) >> 8) >> 8) >> 8) >> 8) >> 8) & 255) == 255
598#if (((((((UINT_MAX >> 8) >> 8) >> 8) >> 8) >> 8) >> 8) >> 8) != 0
599#if ((((((((UINT_MAX >> 8) >> 8) >> 8) >> 8) >> 8) >> 8) >> 8) & 255) == 255
600#if ((((((((UINT_MAX >> 8) >> 8) >> 8) >> 8) >> 8) >> 8) >> 8) >> 8) == 0
601#define ___INT_WIDTH 64
602#endif
603#endif
604#endif
605#endif
606#endif
607#endif
608#endif
609#endif
610#endif
611#endif
612#endif
613#endif
614#endif
615#endif
616#endif
617#endif
618#endif
619
620#ifdef ULONG_MAX
621#if (ULONG_MAX & 255) == 255
622#if (ULONG_MAX >> 8) == 0
623#define ___LONG_WIDTH 8
624#else
625#if ((ULONG_MAX >> 8) & 255) == 255
626#if ((ULONG_MAX >> 8) >> 8) == 0
627#define ___LONG_WIDTH 16
628#else
629#if (((ULONG_MAX >> 8) >> 8) & 255) == 255
630#if (((ULONG_MAX >> 8) >> 8) >> 8) != 0
631#if ((((ULONG_MAX >> 8) >> 8) >> 8) & 255) == 255
632#if ((((ULONG_MAX >> 8) >> 8) >> 8) >> 8) == 0
633#define ___LONG_WIDTH 32
634#else
635#if (((((ULONG_MAX >> 8) >> 8) >> 8) >> 8) & 255) == 255
636#if (((((ULONG_MAX >> 8) >> 8) >> 8) >> 8) >> 8) != 0
637#if ((((((ULONG_MAX >> 8) >> 8) >> 8) >> 8) >> 8) & 255) == 255
638#if ((((((ULONG_MAX >> 8) >> 8) >> 8) >> 8) >> 8) >> 8) != 0
639#if (((((((ULONG_MAX >> 8) >> 8) >> 8) >> 8) >> 8) >> 8) & 255) == 255
640#if (((((((ULONG_MAX >> 8) >> 8) >> 8) >> 8) >> 8) >> 8) >> 8) != 0
641#if ((((((((ULONG_MAX >> 8) >> 8) >> 8) >> 8) >> 8) >> 8) >> 8) & 255) == 255
642#if ((((((((ULONG_MAX >> 8) >> 8) >> 8) >> 8) >> 8) >> 8) >> 8) >> 8) == 0
643#define ___LONG_WIDTH 64
644#endif
645#endif
646#endif
647#endif
648#endif
649#endif
650#endif
651#endif
652#endif
653#endif
654#endif
655#endif
656#endif
657#endif
658#endif
659#endif
660#endif
661
662#ifdef __GNUC__
663
664#define ___LONGLONG_WIDTH 64
665
666#else
667
668/* Handle some non ISO C99 compilers that nevertheless support "long long". */
669
670#ifndef ULLONG_MAX
671#ifdef ULONGLONG_MAX
672#define ULLONG_MAX ULONGLONG_MAX
673#else
674#ifdef ULONG_LONG_MAX
675#define ULLONG_MAX ULONG_LONG_MAX
676#endif
677#endif
678#endif
679
680#ifdef ULLONG_MAX
681#if (ULLONG_MAX & 255) == 255
682#if (ULLONG_MAX >> 8) == 0
683#define ___LONGLONG_WIDTH 8
684#else
685#if ((ULLONG_MAX >> 8) & 255) == 255
686#if ((ULLONG_MAX >> 8) >> 8) == 0
687#define ___LONGLONG_WIDTH 16
688#else
689#if (((ULLONG_MAX >> 8) >> 8) & 255) == 255
690#if (((ULLONG_MAX >> 8) >> 8) >> 8) != 0
691#if ((((ULLONG_MAX >> 8) >> 8) >> 8) & 255) == 255
692#if ((((ULLONG_MAX >> 8) >> 8) >> 8) >> 8) == 0
693#define ___LONGLONG_WIDTH 32
694#else
695#if (((((ULLONG_MAX >> 8) >> 8) >> 8) >> 8) & 255) == 255
696#if (((((ULLONG_MAX >> 8) >> 8) >> 8) >> 8) >> 8) != 0
697#if ((((((ULLONG_MAX >> 8) >> 8) >> 8) >> 8) >> 8) & 255) == 255
698#if ((((((ULLONG_MAX >> 8) >> 8) >> 8) >> 8) >> 8) >> 8) != 0
699#if (((((((ULLONG_MAX >> 8) >> 8) >> 8) >> 8) >> 8) >> 8) & 255) == 255
700#if (((((((ULLONG_MAX >> 8) >> 8) >> 8) >> 8) >> 8) >> 8) >> 8) != 0
701#if ((((((((ULLONG_MAX >> 8) >> 8) >> 8) >> 8) >> 8) >> 8) >> 8) & 255) == 255
702#if ((((((((ULLONG_MAX >> 8) >> 8) >> 8) >> 8) >> 8) >> 8) >> 8) >> 8) == 0
703#define ___LONGLONG_WIDTH 64
704#endif
705#endif
706#endif
707#endif
708#endif
709#endif
710#endif
711#endif
712#endif
713#endif
714#endif
715#endif
716#endif
717#endif
718#endif
719#endif
720#endif
721
722#endif
723
724#endif
725
726/*
727 * If the "long long" type is not supported, then substitute the type
728 * "long".
729 */
730
731#ifndef ___LONGLONG_WIDTH
732#define ___LONGLONG_WIDTH ___LONG_WIDTH
733#define ___LONGLONG long
734#define ___ULONGLONG unsigned long
735#else
736#define ___LONGLONG long long
737#define ___ULONGLONG unsigned long long
738#endif
739
740/*
741 * Some old C compilers do not support the "signed char" and "wchar_t"
742 * types.  The following preprocessor directives allow these types to
743 * be redefined (such as on the C compiler's command line, in
744 * "config.h", ...).
745 */
746
747#ifndef ___SCHAR
748#define ___SCHAR signed char
749#endif
750
751#ifndef ___WCHAR
752#ifdef ___DONT_HAVE_WCHAR_H
753
754/*
755 * If the file "wchar.h" is not available then the symbol
756 * ___DONT_HAVE_WCHAR_H must be defined (for example on the compiler's
757 * command line) and the following definitions will be used:
758 */
759
760#define ___WCHAR unsigned char
761#define ___WCHAR_MIN 0
762#define ___WCHAR_MAX ((1<<___CHAR_WIDTH)-1)
763
764#else
765
766/*
767 * If the file "wchar.h" is available then it should contain macros
768 * defining the range of the wchar_t type.
769 */
770
771#include <wchar.h>
772
773#define ___WCHAR wchar_t
774
775#ifdef WCHAR_MIN
776#define ___WCHAR_MIN WCHAR_MIN
777#else
778#define ___WCHAR_MIN 0
779#endif
780
781#ifdef WCHAR_MAX
782#define ___WCHAR_MAX WCHAR_MAX
783#else
784#ifdef UINT_MAX
785#define ___WCHAR_MAX UINT_MAX
786#else
787#define ___WCHAR_MAX ((1<<___CHAR_WIDTH)-1)
788#endif
789#endif
790
791#endif
792#endif
793
794#ifdef ___DONT_HAVE_FLOAT_H
795
796/*
797 * If the file "float.h" is not available then the symbol
798 * ___DONT_HAVE_FLOAT_H must be defined (for example on the compiler's
799 * command line) and the following definitions will be used:
800 */
801
802#define ___FLOAT_WIDTH  32   /* if needed, edit to suit your platform */
803#define ___DOUBLE_WIDTH 64
804
805#else
806
807/*
808 * If the file "float.h" is available then it contains macros defining
809 * the range of the floating point types.  The following preprocessor
810 * conditional definitions are not completely correct (and may not
811 * even compile properly because it is possible that FLT_MAX_EXP and
812 * DBL_MAX_EXP are not constant expressions).  However, it appears to
813 * work on a wide range of platforms.
814 */
815
816#include <float.h>
817
818#ifdef FLT_MAX_EXP
819#if FLT_MAX_EXP == 128
820#define ___FLOAT_WIDTH 32
821#else
822#if FLT_MAX_EXP == 1024
823#define ___FLOAT_WIDTH 64
824#endif
825#endif
826#endif
827
828#ifdef DBL_MAX_EXP
829#if DBL_MAX_EXP == 128
830#define ___DOUBLE_WIDTH 32
831#else
832#if DBL_MAX_EXP == 1024
833#define ___DOUBLE_WIDTH 64
834#endif
835#endif
836#endif
837
838#endif
839#endif
840
841/*
842 * Size of pointers.
843 *
844 * ___VOIDSTAR_WIDTH must be equal to sizeof(void*) * ___CHAR_WIDTH.
845 * This value can't be computed with the "sizeof" operator because it
846 * must be known at macro expansion time.  If in doubt just do
847 *
848 *  #define ___VOIDSTAR_WIDTH ___LONG_WIDTH
849 *
850 */
851
852#ifndef ___VOIDSTAR_WIDTH
853#define ___VOIDSTAR_WIDTH @CONF_VOIDSTAR_WIDTH@
854#endif
855
856#if ___VOIDSTAR_WIDTH == 32
857#undef ___USE_32_BIT_ADDR
858#define ___USE_32_BIT_ADDR
859#endif
860
861/*---------------------------------------------------------------------------*/
862
863/*
864 * The following symbols must be defined to reflect the integer and
865 * floating-point data types supported by the C compiler.  A symbol is
866 * only defined if the data type exists.  At least ___F64 and one of
867 * the pairs ___S32/___U32 and ___S64/___U64 must be defined.
868 *
869 *  define ___S8 as the signed integer type of exactly 8 bits
870 *  define ___U8 as the unsigned integer type of exactly 8 bits
871 *  define ___SM8 as the signed integer type of at least 8 bits
872 *  define ___UM8 as the unsigned integer type of at least 8 bits
873 *
874 *  define ___S16 as the signed integer type of exactly 16 bits
875 *  define ___U16 as the unsigned integer type of exactly 16 bits
876 *  define ___SM16 as the signed integer type of at least 16 bits
877 *  define ___UM16 as the unsigned integer type of at least 16 bits
878 *
879 *  define ___S32 as the signed integer type of exactly 32 bits
880 *  define ___U32 as the unsigned integer type of exactly 32 bits
881 *  define ___SM32 as the signed integer type of at least 32 bits
882 *  define ___UM32 as the unsigned integer type of at least 32 bits
883 *
884 *  define ___S64 as the signed integer type of exactly 64 bits
885 *  define ___U64 as the unsigned integer type of exactly 64 bits
886 *  define ___SM64 as the signed integer type of at least 64 bits
887 *  define ___UM64 as the unsigned integer type of at least 64 bits
888 *
889 *  define ___F32 as the 32 bit floating-point type
890 *  define ___F64 as the 64 bit floating-point type
891 */
892
893/*
894 * First we make sure that the width of all the integer and
895 * floating-point types is known.
896 */
897
898#ifndef ___CHAR_WIDTH
899#error "The definition for ___CHAR_WIDTH is missing"
900#endif
901
902#ifndef ___SHORT_WIDTH
903#error "The definition for ___SHORT_WIDTH is missing"
904#endif
905
906#ifndef ___INT_WIDTH
907#error "The definition for ___INT_WIDTH is missing"
908#endif
909
910#ifndef ___LONG_WIDTH
911#error "The definition for ___LONG_WIDTH is missing"
912#endif
913
914#ifndef ___LONGLONG_WIDTH
915#error "The definition for ___LONGLONG_WIDTH is missing"
916#endif
917
918#ifndef ___FLOAT_WIDTH
919#error "The definition for ___FLOAT_WIDTH is missing"
920#endif
921
922#ifndef ___DOUBLE_WIDTH
923#error "The definition for ___DOUBLE_WIDTH is missing"
924#endif
925
926#if ___INT_WIDTH == 8
927#define ___S8 int
928#define ___U8 unsigned int
929#else
930#if ___LONG_WIDTH == 8
931#define ___S8 long
932#define ___U8 unsigned long
933#else
934#if ___SHORT_WIDTH == 8
935#define ___S8 short
936#define ___U8 unsigned short
937#else
938#if ___CHAR_WIDTH == 8
939#define ___S8 ___SCHAR
940#define ___U8 unsigned char
941#else
942#if ___LONGLONG_WIDTH == 8
943#define ___S8 ___LONGLONG
944#define ___U8 unsigned ___LONGLONG
945#endif
946#endif
947#endif
948#endif
949#endif
950
951#if ___INT_WIDTH == 16
952#define ___S16 int
953#define ___U16 unsigned int
954#else
955#if ___LONG_WIDTH == 16
956#define ___S16 long
957#define ___U16 unsigned long
958#else
959#if ___SHORT_WIDTH == 16
960#define ___S16 short
961#define ___U16 unsigned short
962#else
963#if ___CHAR_WIDTH == 16
964#define ___S16 ___SCHAR
965#define ___U16 unsigned char
966#else
967#if ___LONGLONG_WIDTH == 16
968#define ___S16 ___LONGLONG
969#define ___U16 unsigned ___LONGLONG
970#endif
971#endif
972#endif
973#endif
974#endif
975
976#if ___INT_WIDTH == 32
977#define ___S32 int
978#define ___U32 unsigned int
979#else
980#if ___LONG_WIDTH == 32
981#define ___S32 long
982#define ___U32 unsigned long
983#else
984#if ___SHORT_WIDTH == 32
985#define ___S32 short
986#define ___U32 unsigned short
987#else
988#if ___CHAR_WIDTH == 32
989#define ___S32 ___SCHAR
990#define ___U32 unsigned char
991#else
992#if ___LONGLONG_WIDTH == 32
993#define ___S32 ___LONGLONG
994#define ___U32 unsigned ___LONGLONG
995#endif
996#endif
997#endif
998#endif
999#endif
1000
1001#if ___INT_WIDTH == 64
1002#define ___S64 int
1003#define ___U64 unsigned int
1004#else
1005#if ___LONG_WIDTH == 64
1006#define ___S64 long
1007#define ___U64 unsigned long
1008#else
1009#if ___SHORT_WIDTH == 64
1010#define ___S64 short
1011#define ___U64 unsigned short
1012#else
1013#if ___CHAR_WIDTH == 64
1014#define ___S64 ___SCHAR
1015#define ___U64 unsigned char
1016#else
1017#if ___LONGLONG_WIDTH == 64
1018#define ___S64 ___LONGLONG
1019#define ___U64 unsigned ___LONGLONG
1020#endif
1021#endif
1022#endif
1023#endif
1024#endif
1025
1026#if ___FLOAT_WIDTH == 32
1027#define ___F32 float
1028#else
1029#if ___DOUBLE_WIDTH == 32
1030#define ___F32 double
1031#endif
1032#endif
1033
1034#if ___DOUBLE_WIDTH == 64
1035#define ___F64 double
1036#else
1037#if ___FLOAT_WIDTH == 64
1038#define ___F64 float
1039#endif
1040#endif
1041
1042#ifdef ___S64
1043#define ___BUILTIN_64BIT_INT_TYPE
1044#define ___SM64 ___S64
1045#define ___UM64 ___U64
1046#endif
1047
1048#ifdef ___S32
1049#define ___SM32 ___S32
1050#define ___UM32 ___U32
1051#else
1052#define ___SM32 ___SM64
1053#define ___UM32 ___UM64
1054#endif
1055
1056#ifdef ___S16
1057#define ___SM16 ___S16
1058#define ___UM16 ___U16
1059#else
1060#define ___SM16 ___SM32
1061#define ___UM16 ___UM32
1062#endif
1063
1064#ifdef ___S8
1065#define ___SM8 ___S8
1066#define ___UM8 ___U8
1067#else
1068#define ___SM8 ___SM16
1069#define ___UM8 ___UM16
1070#endif
1071
1072/*---------------------------------------------------------------------------*/
1073
1074/* SANITY CHECKS AND SETTING OF DEFAULT OPTIONS */
1075
1076/*
1077 * Verify that the byte order endianness is known.
1078 */
1079
1080#ifdef ___BIG_ENDIAN
1081#ifdef ___LITTLE_ENDIAN
1082#error "Define either ___BIG_ENDIAN or ___LITTLE_ENDIAN"
1083#endif
1084#else
1085#ifndef ___LITTLE_ENDIAN
1086#error "Define either ___BIG_ENDIAN or ___LITTLE_ENDIAN"
1087#endif
1088#endif
1089
1090/*
1091 * Generate a single host C procedure or multiple C host
1092 * procedures (default) per Scheme module?
1093 */
1094
1095#ifdef ___SINGLE_HOST
1096#ifdef ___MULTIPLE_HOSTS
1097#error "Define either ___SINGLE_HOST or ___MULTIPLE_HOSTS"
1098#endif
1099#else
1100#ifndef ___MULTIPLE_HOSTS
1101#define ___MULTIPLE_HOSTS
1102#endif
1103#endif
1104
1105/*
1106 * Compiling for dynamic loading or not (default).
1107 */
1108
1109#ifdef ___DYNAMIC
1110#ifdef ___NONDYNAMIC
1111#error "Define either ___DYNAMIC or ___NONDYNAMIC"
1112#endif
1113#else
1114#ifndef ___NONDYNAMIC
1115#define ___NONDYNAMIC
1116#endif
1117#endif
1118
1119/*
1120 * Define symbols appropriate for dynamic loading.
1121 */
1122
1123#ifdef ___DYNAMIC
1124#undef ___LIBRARY
1125#define ___LIBRARY
1126#undef ___SHARED
1127#define ___SHARED
1128#undef ___BIND_LATE
1129#define ___BIND_LATE
1130#endif
1131
1132/*
1133 * Compiling to produce a library or an application with a "main" (default
1134 * unless compiling a flat link file).
1135 */
1136
1137#ifdef ___LIBRARY
1138#ifdef ___APPLICATION
1139#error "Define either ___LIBRARY or ___APPLICATION"
1140#endif
1141#else
1142#ifndef ___APPLICATION
1143#ifdef ___FLAT_LINKFILE
1144#define ___LIBRARY
1145#else
1146#define ___APPLICATION
1147#endif
1148#endif
1149#endif
1150
1151/*
1152 * Compiling to produce a shared-library or not (default).
1153 */
1154
1155#ifdef ___DYNAMIC_LIB
1156#define ___SHARED
1157#endif
1158
1159#ifdef ___SHARED
1160#ifdef ___NONSHARED
1161#error "Define either ___SHARED or ___NONSHARED"
1162#endif
1163#else
1164#ifndef ___NONSHARED
1165#define ___NONSHARED
1166#endif
1167#endif
1168
1169/*
1170 * Select binding time for global variables, symbols, and keywords.
1171 * Early binding (default) produces faster code because it directly
1172 * accesses the resource.  Late binding does an indirection at run
1173 * time.
1174 */
1175
1176#ifdef ___BIND_LATE
1177#ifdef ___BIND_EARLY
1178#error "Define either ___BIND_LATE or ___BIND_EARLY"
1179#endif
1180#else
1181#ifndef ___BIND_EARLY
1182#define ___BIND_EARLY
1183#endif
1184#endif
1185
1186/*
1187 * Range and size of Scheme characters.
1188 *
1189 * ___MAX_CHR must be 0xff, 0xffff or 0x10ffff.  The value 0xff is
1190 * appropriate when text is limited to the ISO-8859-1 subset of
1191 * Unicode.  The value 0xffff is for when text is limited to the BMP
1192 * (Basic Multilingual Plane) subset of Unicode.  The value 0x10ffff
1193 * allows all Unicode characters in text.  Note that the number of
1194 * bytes per character in a string depends on ___MAX_CHR as follows:
1195 *
1196 *   ___MAX_CHR = 0xff      =>  1 byte per character
1197 *   ___MAX_CHR = 0xffff    =>  2 bytes per character
1198 *   ___MAX_CHR = 0x10ffff  =>  4 bytes per character
1199 *
1200 * If in doubt just do
1201 *
1202 *  #define ___MAX_CHR 0x10ffff
1203 *
1204 */
1205
1206#ifndef ___MAX_CHR
1207#define ___MAX_CHR @CONF_MAX_CHR@
1208#endif
1209
1210/*
1211 * Number of registers in the virtual machine.  These definitions must
1212 * agree with those in the file "gsc/_t-c-1.scm".  All Scheme sources
1213 * must be recompiled if these definitions are changed.
1214 *
1215 * ___NB_GVM_REGS = total number of registers available
1216 *                  3 <= ___NB_GVM_REGS <= 25
1217 * ___NB_ARG_REGS = maximum number of arguments passed in registers
1218 *                  1 <= ___NB_ARG_REGS <= min( 12, ___NB_GVM_REGS-2 )
1219 */
1220
1221#ifndef ___NB_GVM_REGS
1222#define ___NB_GVM_REGS 5
1223#endif
1224
1225#ifndef ___NB_ARG_REGS
1226#define ___NB_ARG_REGS 3
1227#endif
1228
1229/*
1230 * Determine if label values (a gcc extension to C) should be supported.
1231 */
1232
1233#ifdef ___NOT_SUPPORT_LABEL_VALUES
1234#ifdef ___SUPPORT_LABEL_VALUES
1235#error "Define either ___SUPPORT_LABEL_VALUES or ___NOT_SUPPORT_LABEL_VALUES"
1236#endif
1237#else
1238#ifndef ___SUPPORT_LABEL_VALUES
1239#define ___SUPPORT_LABEL_VALUES
1240#endif
1241#endif
1242
1243/*
1244 * Determine if label values should be used.
1245 */
1246
1247#ifndef ___SUPPORT_LABEL_VALUES
1248
1249#undef ___USE_LABEL_VALUES
1250#undef ___NOT_USE_LABEL_VALUES
1251#define ___NOT_USE_LABEL_VALUES
1252
1253#else
1254
1255#ifdef ___USE_LABEL_VALUES
1256#ifdef ___NOT_USE_LABEL_VALUES
1257#error "Define either ___USE_LABEL_VALUES or ___NOT_USE_LABEL_VALUES"
1258#endif
1259#else
1260#ifndef ___NOT_USE_LABEL_VALUES
1261#ifdef __GNUC__
1262#if __llvm__ && !__clang__ && ___GNUC_VERSION < 405000
1263/* Avoid possible LLVM GCC bug with label values */
1264#define ___NOT_USE_LABEL_VALUES
1265#else
1266#define ___USE_LABEL_VALUES
1267#endif
1268#else
1269#define ___NOT_USE_LABEL_VALUES
1270#endif
1271#endif
1272#endif
1273
1274#endif
1275
1276/*
1277 * Allow multiple Gambit VM instances or not?
1278 */
1279
1280#ifndef ___SINGLE_VM
1281#ifndef ___MULTIPLE_VMS
1282#define @CONF_SINGLE_MULTIPLE_VMS@
1283#endif
1284#endif
1285
1286#ifdef ___SINGLE_VM
1287#ifdef ___MULTIPLE_VMS
1288#error "Define either ___SINGLE_VM or ___MULTIPLE_VMS"
1289#endif
1290#endif
1291
1292/*
1293 * Are Gambit VM instances single or multiple threaded at the OS
1294 * level?  In other words, is it allowed for multiple OS threads to be
1295 * running in a given VM instance?
1296 */
1297
1298#ifndef ___SINGLE_THREADED_VMS
1299#ifndef ___MULTIPLE_THREADED_VMS
1300#define @CONF_SINGLE_MULTIPLE_THREADED_VMS@
1301#endif
1302#endif
1303
1304#ifdef ___SINGLE_THREADED_VMS
1305#ifdef ___MULTIPLE_THREADED_VMS
1306#error "Define either ___SINGLE_THREADED_VMS or ___MULTIPLE_THREADED_VMS"
1307#endif
1308#endif
1309
1310/*
1311 * Determine the maximum number of OS threads (processors) that can be
1312 * running in a given VM instance.
1313 */
1314
1315#ifdef ___SINGLE_THREADED_VMS
1316#define ___MAX_PROCESSORS 1
1317#else
1318#define ___MAX_PROCESSORS @CONF_MAX_PROCESSORS@
1319#endif
1320
1321/*
1322 * Determine which thread system is being used.  This needs to be
1323 * known by this header file to allow the definition of macros which
1324 * expand to calls to thread system specific functions, thus avoiding
1325 * the overhead of a function call (which could be significant for
1326 * some basic operations such as ___MUTEX_LOCK and ___MUTEX_UNLOCK).
1327 */
1328
1329#ifndef ___USE_NO_THREAD_SYSTEM
1330
1331#ifndef ___USE_POSIX_THREAD_SYSTEM
1332#ifndef ___USE_WIN32_THREAD_SYSTEM
1333#define @CONF_THREAD_SYSTEM@
1334#endif
1335#endif
1336
1337#ifdef ___USE_POSIX_THREAD_SYSTEM
1338#ifdef ___USE_WIN32_THREAD_SYSTEM
1339#error "Define either ___USE_POSIX_THREAD_SYSTEM or ___USE_WIN32_THREAD_SYSTEM"
1340#endif
1341#endif
1342
1343#endif
1344
1345/*
1346 * Determine which thread local storage class keyword to use.  The
1347 * configure script normally determines this because it depends on
1348 * many factors (the compiler, the version and the OS).  It is
1349 * normally __thread on gcc and __declspec(thread) on WIN32.
1350 */
1351
1352#ifndef ___NO_THREAD_LOCAL_STORAGE_CLASS
1353#ifndef ___THREAD_LOCAL_STORAGE_CLASS
1354#define @CONF_THREAD_LOCAL_STORAGE_CLASS@
1355#endif
1356#endif
1357
1358/*
1359 * Determine if the WIN32 CONDITION_VARIABLE type is available.
1360 */
1361
1362#ifdef ___USE_WIN32_THREAD_SYSTEM
1363#ifndef ___HAVE_CONDITION_VARIABLE
1364#ifndef ___DONT_HAVE_CONDITION_VARIABLE
1365#define @CONF_HAVE_CONDITION_VARIABLE@
1366#endif
1367#endif
1368#endif
1369
1370
1371/*
1372 * Determine if an activity log should be kept or not.
1373 */
1374
1375#ifndef ___NO_ACTIVITY_LOG
1376#ifndef ___ACTIVITY_LOG
1377#define @CONF_ACTIVITY_LOG@
1378#endif
1379#endif
1380
1381
1382/*---------------------------------------------------------------------------*/
1383
1384/* Dependencies on language (i.e. C++, ANSI-C, and K&R C). */
1385
1386#ifdef __cplusplus
1387
1388#define ___BEGIN_C_LINKAGE extern "C" {
1389#define ___END_C_LINKAGE }
1390
1391/*
1392 * Define ___BOOL as "bool" or "int", according to what is supported
1393 * by the compiler (this is determined by the configure script) unless
1394 * it is defined elsewhere.
1395 */
1396
1397#ifndef ___BOOL
1398#define ___BOOL @CONF_BOOL@
1399#endif
1400
1401#define ___USE_CPLUSPLUS_NEW_DELETE
1402#define ___USE_CPLUSPLUS_CLEANUP
1403
1404#else
1405
1406#define ___BEGIN_C_LINKAGE
1407#define ___END_C_LINKAGE
1408
1409#ifndef ___BOOL
1410#define ___BOOL int
1411#endif
1412
1413#undef ___USE_SETJMP
1414#define ___USE_SETJMP
1415
1416#endif
1417
1418
1419#ifdef ___FORCE_KR
1420
1421#define ___P(ansi,kr)kr
1422#define ___PVOID ()
1423
1424#else
1425
1426#define ___P(ansi,kr)ansi
1427#ifdef __cplusplus
1428#define ___PVOID ()
1429#else
1430#define ___PVOID (void)
1431#endif
1432
1433#endif
1434
1435
1436#ifdef ___USE_SETJMP
1437
1438#ifdef ___DONT_HAVE_SETJMP_H
1439
1440/*
1441 * If the file "setjmp.h" is not available then the symbol
1442 * ___DONT_HAVE_SETJMP_H must be defined (for example on the compiler's
1443 * command line).  In this case we assume that setjmp is defined as
1444 * a macro.
1445 */
1446
1447#undef ___CAN_IMPORT_SETJMP_DYNAMICALLY
1448#define ___CAN_IMPORT_SETJMP_DYNAMICALLY
1449
1450#else
1451
1452/*
1453 * If the file "setjmp.h" is available then we can use the C
1454 * preprocessor to check if setjmp is a macro (otherwise it has to be
1455 * a function).  If it is a macro then we can't get a pointer to it!
1456 */
1457
1458#include <setjmp.h>
1459
1460#ifdef setjmp
1461#undef ___CAN_IMPORT_SETJMP_DYNAMICALLY
1462#define ___CAN_IMPORT_SETJMP_DYNAMICALLY
1463#endif
1464
1465#endif
1466
1467#endif
1468
1469
1470/*---------------------------------------------------------------------------*/
1471
1472/* C math library properties. */
1473
1474#ifndef ___DONT_HAVE_MATH_H
1475#include <math.h>
1476#endif
1477
1478/*
1479 * We assume that no C compiler has good implementations of atan2 and
1480 * pow.  So we need to define them in the Gambit runtime system.
1481 */
1482
1483#define ___DEFINE_ATAN2
1484#define ___DEFINE_POW
1485
1486#ifdef ___OS_WIN32
1487
1488/*
1489 * Older versions of the Microsoft Visual C compilers did not
1490 * implement some important math functions.  So we need to define them
1491 * in the Gambit runtime system.  We do this even if using another
1492 * C compiler, such as gcc, in order to allow dynamically compiled
1493 * Scheme files to be compiled with a C compiler different from the
1494 * C compiler used for compiling the Gambit runtime system.  If this
1495 * wasn't done, the offsets of the fields in ___global_state_struct
1496 * would be different, causing calls to the wrong conversion functions.
1497 */
1498
1499#define ___DEFINE_SCALBN
1500#define ___DEFINE_ILOGB
1501#define ___DEFINE_EXPM1
1502#define ___DEFINE_LOG1P
1503#define ___DEFINE_ASINH
1504#define ___DEFINE_ACOSH
1505#define ___DEFINE_ATANH
1506
1507#endif
1508
1509#ifdef _MSC_VER
1510
1511#if _MSC_VER >= 1800
1512
1513/*
1514 * Starting with version 18 (released in 2013), the following
1515 * functions are supported by the C math library.
1516 */
1517
1518#define ___HAVE_GOOD_SCALBN
1519#define ___HAVE_GOOD_ILOGB
1520#define ___HAVE_GOOD_EXPM1
1521#define ___HAVE_GOOD_LOG1P
1522#define ___HAVE_GOOD_ASINH
1523#define ___HAVE_GOOD_ACOSH
1524#define ___HAVE_GOOD_ATANH
1525
1526#endif
1527
1528/*
1529 * The following functions seem to be implemented in old versions.
1530 */
1531
1532#define ___HAVE_GOOD_SINH
1533#define ___HAVE_GOOD_COSH
1534#define ___HAVE_GOOD_TANH
1535
1536#else
1537
1538/*
1539 * On other C compilers, we assume that the following math functions
1540 * are implemented.
1541 */
1542
1543#define ___HAVE_GOOD_SCALBN
1544#define ___HAVE_GOOD_ILOGB
1545#define ___HAVE_GOOD_EXPM1
1546#define ___HAVE_GOOD_LOG1P
1547#define ___HAVE_GOOD_ASINH
1548#define ___HAVE_GOOD_ACOSH
1549#define ___HAVE_GOOD_ATANH
1550#define ___HAVE_GOOD_SINH
1551#define ___HAVE_GOOD_COSH
1552#define ___HAVE_GOOD_TANH
1553
1554#endif
1555
1556
1557/*---------------------------------------------------------------------------*/
1558
1559/* signal.h library properties. */
1560
1561#ifndef ___DONT_HAVE_SIGNAL_H
1562
1563#ifndef ___USE_SIGSET_T
1564#ifndef ___USE_NO_SIGSET_T
1565#define @CONF_USE_SIGSET_T@
1566#endif
1567#endif
1568
1569#ifdef ___USE_SIGSET_T
1570#include <signal.h>
1571#endif
1572
1573#endif
1574
1575
1576#ifdef ___USE_SIGSET_T
1577#define ___sigset_type sigset_t
1578#else
1579#define ___sigset_type int
1580#endif
1581
1582
1583/*---------------------------------------------------------------------------*/
1584
1585/* Visibility directives. */
1586
1587#ifndef ___HIDDEN
1588#define ___HIDDEN static
1589#endif
1590
1591#ifndef ___LOCAL
1592#define ___LOCAL static
1593#endif
1594
1595#ifdef _MSC_VER
1596#define ___USE_DECLSPEC
1597#endif
1598
1599#ifdef __WATCOMC__
1600#define ___USE_DECLSPEC
1601#endif
1602
1603#ifdef ___USE_DECLSPEC
1604#define ___EXPORT_FUNC(type,name)__declspec(dllexport) type name
1605#define ___EXPORT_DATA(type,name)__declspec(dllexport) type name
1606#define ___IMPORT_FUNC(type,name)__declspec(dllimport) type name
1607#define ___IMPORT_DATA(type,name)__declspec(dllimport) type name
1608#endif
1609
1610#ifndef ___EXPORT_FUNC
1611#define ___EXPORT_FUNC(type,name)type name
1612#endif
1613
1614#ifndef ___EXPORT_DATA
1615#define ___EXPORT_DATA(type,name)type name
1616#endif
1617
1618#ifndef ___IMPORT_FUNC
1619#define ___IMPORT_FUNC(type,name)extern type name
1620#endif
1621
1622#ifndef ___IMPORT_DATA
1623#define ___IMPORT_DATA(type,name)extern type name
1624#endif
1625
1626#define ___EXP_FUNC(type,name)type name
1627#define ___EXP_DATA(type,name)type name
1628#define ___IMP_FUNC(type,name)extern type name
1629#define ___IMP_DATA(type,name)extern type name
1630
1631#ifdef ___SHARED
1632#ifdef ___LIBRARY
1633#undef ___EXP_FUNC
1634#define ___EXP_FUNC(type,name)___EXPORT_FUNC(type,name)
1635#undef ___EXP_DATA
1636#define ___EXP_DATA(type,name)___EXPORT_DATA(type,name)
1637#endif
1638#ifndef ___PRIMAL
1639#undef ___IMP_FUNC
1640#define ___IMP_FUNC(type,name)___IMPORT_FUNC(type,name)
1641#undef ___IMP_DATA
1642#define ___IMP_DATA(type,name)___IMPORT_DATA(type,name)
1643#endif
1644#endif
1645
1646#ifndef ___OS_WIN32
1647#define ___CAN_IMPORT_EXPORTED
1648#endif
1649
1650#ifndef ___CAN_IMPORT_EXPORTED
1651#ifdef ___SHARED
1652#ifndef ___PRIMAL
1653#undef ___BIND_LATE
1654#define ___BIND_LATE
1655#endif
1656#endif
1657#endif
1658
1659/*---------------------------------------------------------------------------*/
1660
1661#ifdef __GNUC__
1662#if ___GNUC_VERSION >= 300000
1663#define ___USE_builtin_expect
1664#endif
1665#endif
1666
1667#ifdef ___USE_builtin_expect
1668#define ___EXPECT_TRUE(x) __builtin_expect((x),1)
1669#define ___EXPECT_FALSE(x) __builtin_expect((x),0)
1670#else
1671#define ___EXPECT_TRUE(x) (x)
1672#define ___EXPECT_FALSE(x) (x)
1673#endif
1674
1675/*---------------------------------------------------------------------------*/
1676
1677#ifdef __GNUC__
1678#if ___GNUC_VERSION > 500000
1679#define ___USE_builtin_op_overflow
1680#endif
1681#endif
1682
1683#ifdef __clang__
1684#if __has_builtin(__builtin_add_overflow) && __has_builtin(__builtin_sub_overflow) && __has_builtin(__builtin_mul_overflow)
1685#define ___USE_builtin_op_overflow
1686#endif
1687#endif
1688
1689/*---------------------------------------------------------------------------*/
1690
1691/*
1692 * IMPORTANT NOTE
1693 *
1694 * As a general principle, the macros are written in such a way that all
1695 * macros which expand into C expressions yield PRIMARY C expressions.
1696 * Also, macros assume that arguments are PRIMARY expressions.  A PRIMARY
1697 * expression is either:
1698 *
1699 *   an identifier, or
1700 *   a non-negative constant, or
1701 *   a parenthesized expression.
1702 *
1703 * This convention avoids many operator priority problems and helps keep
1704 * the number of parentheses down.  On the other hand, it is easy to
1705 * introduce errors when modifying these macros so be careful.
1706 */
1707
1708/*---------------------------------------------------------------------------*/
1709
1710/*
1711 * The "___CAST" macro is useful to easily locate type casts in the
1712 * source code.  Unfortunately there are still places in the sources
1713 * that don't use this macro.
1714 */
1715
1716#define ___CAST(type,val)((type)(val))
1717
1718/*
1719 * Macros to access ___S64 and ___U64 data types.  Note that ___S64
1720 * and ___U64 are either defined as a macro or as a typedef.
1721 */
1722
1723#define ___FETCH_S64(base,i)*(___CAST(___S64*,base)+(i))
1724#define ___STORE_S64(base,i,val)*(___CAST(___S64*,base)+(i)) = (val)
1725#define ___FETCH_U64(base,i)*(___CAST(___U64*,base)+(i))
1726#define ___STORE_U64(base,i,val)*(___CAST(___U64*,base)+(i)) = (val)
1727#define ___CAST_S64(x)___CAST(___S64,x)
1728#define ___CAST_U64(x)___CAST(___U64,x)
1729
1730/*
1731 * Macros to access ___S32 and ___U32 data types.
1732 */
1733
1734#ifdef ___S32
1735
1736#define ___FETCH_S32(base,i)*(___CAST(___S32*,base)+(i))
1737#define ___STORE_S32(base,i,val)*(___CAST(___S32*,base)+(i)) = (val)
1738#define ___FETCH_U32(base,i)*(___CAST(___U32*,base)+(i))
1739#define ___STORE_U32(base,i,val)*(___CAST(___U32*,base)+(i)) = (val)
1740#define ___CAST_S32(x)___CAST(___S32,x)
1741#define ___CAST_U32(x)___CAST(___U32,x)
1742
1743#else
1744
1745#define ___FETCH_S32(base,i)___CAST_S32(___FETCH_U32(base,i))
1746#define ___STORE_S32(base,i,val)___STORE_U32(base,i,___CAST_U32(val))
1747
1748#ifdef ___BIG_ENDIAN
1749#define ___FETCH_U32(base,i)(((i)&1) \
1750? (*(___CAST(___U64*,base)+((i)>>1))&0xffffffff) \
1751: ((*(___CAST(___U64*,base)+((i)>>1)))>>32))
1752#define ___STORE_U32(base,i,val)*(___CAST(___U64*,base)+((i)>>1)) = ((i)&1) \
1753? (*(___CAST(___U64*,base)+((i)>>1))&___CAST_U64(0xffffffff<<32))|(val) \
1754: (*(___CAST(___U64*,base)+((i)>>1))&0xffffffff)|___CAST_U64((val)<<32)
1755#else
1756#define ___FETCH_U32(base,i)(((i)&1) \
1757? ((*(___CAST(___U64*,base)+((i)>>1)))>>32) \
1758: (*(___CAST(___U64*,base)+((i)>>1))&0xffffffff))
1759#define ___STORE_U32(base,i,val)*(___CAST(___U64*,base)+((i)>>1)) = ((i)&1) \
1760? (*(___CAST(___U64*,base)+((i)>>1))&0xffffffff)|___CAST_U64((val)<<32) \
1761: (*(___CAST(___U64*,base)+((i)>>1))&___CAST_U64(0xffffffff<<32))|(val)
1762#endif
1763
1764#define ___CAST_S32(x)(___CAST_S64((x)<<32)>>32)
1765#define ___CAST_U32(x)___CAST_U64((x)&0xffffffff)
1766
1767#endif
1768
1769/*
1770 * Macros to access ___S16 and ___U16 data types.
1771 */
1772
1773#ifdef ___S16
1774
1775#define ___FETCH_S16(base,i)*(___CAST(___S16*,base)+(i))
1776#define ___STORE_S16(base,i,val)*(___CAST(___S16*,base)+(i)) = (val)
1777#define ___FETCH_U16(base,i)*(___CAST(___U16*,base)+(i))
1778#define ___STORE_U16(base,i,val)*(___CAST(___U16*,base)+(i)) = (val)
1779#define ___CAST_S16(x)___CAST(___S16,x)
1780#define ___CAST_U16(x)___CAST(___U16,x)
1781
1782#else
1783
1784#define ___FETCH_S16(base,i)___CAST_S16(___FETCH_U16(base,i))
1785#define ___STORE_S16(base,i,val)___STORE_U16(base,i,___CAST_U16(val))
1786
1787#ifdef ___S32
1788
1789#ifdef ___BIG_ENDIAN
1790#define ___FETCH_U16(base,i)(((i)&1) \
1791? (*(___CAST(___U32*,base)+((i)>>1))&0xffff) \
1792: ((*(___CAST(___U32*,base)+((i)>>1)))>>16))
1793#define ___STORE_U16(base,i,val)*(___CAST(___U32*,base)+((i)>>1)) = ((i)&1) \
1794? (*(___CAST(___U32*,base)+((i)>>1))&___CAST_U32(0xffff<<16))|(val) \
1795: (*(___CAST(___U32*,base)+((i)>>1))&0xffff)|___CAST_U32((val)<<16)
1796#else
1797#define ___FETCH_U16(base,i)(((i)&1) \
1798? ((*(___CAST(___U32*,base)+((i)>>1)))>>16) \
1799: (*(___CAST(___U32*,base)+((i)>>1))&0xffff))
1800#define ___STORE_U16(base,i,val)*(___CAST(___U32*,base)+((i)>>1)) = ((i)&1) \
1801? (*(___CAST(___U32*,base)+((i)>>1))&0xffff)|___CAST_U32((val)<<16) \
1802: (*(___CAST(___U32*,base)+((i)>>1))&(0xffff<<16))|(___U32)(val)
1803#endif
1804
1805#define ___CAST_S16(x)(___CAST_S32((x)<<16)>>16)
1806#define ___CAST_U16(x)___CAST_U32((x)&0xffff)
1807
1808#else
1809
1810#ifdef ___BIG_ENDIAN
1811#define ___FETCH_S16(base,i)(((i)&1) \
1812? ((*(___CAST(___S64*,base)+((i)>>1)))>>16) \
1813: ((*(___CAST(___S64*,base)+((i)>>1))<<16)>>16))
1814#define ___FETCH_U16(base,i) \
1815((*(___CAST(___U64*,base)+((i)>>2))>>((~(i)&3)<<4))&0xffff)
1816#define ___STORE_U16(base,i,val)*(___CAST(___U64*,base)+((i)>>2)) = \
1817(*(___CAST(___U64*,base)+((i)>>2))&~___CAST_U64(0xffff<<((~(i)&3)<<4))) | \
1818___CAST_U64((val)<<((~(i)&3)<<4))
1819#else
1820#define ___FETCH_U16(base,i) \
1821((*(___CAST(___U64*,base)+((i)>>2))>>(((i)&3)<<4))&0xffff)
1822#define ___STORE_U16(base,i,val)*(___CAST(___U64*,base)+((i)>>2)) = \
1823(*(___CAST(___U64*,base)+((i)>>2))&~___CAST_U64(0xffff<<(((i)&3)<<4))) | \
1824___CAST_U64((val)<<(((i)&3)<<4))
1825#endif
1826
1827#define ___CAST_S16(x)(___CAST_S64((x)<<48)>>48)
1828#define ___CAST_U16(x)___CAST_U64((x)&0xffff)
1829
1830#endif
1831
1832#endif
1833
1834/*
1835 * Macros to access ___S8 and ___U8 data types.
1836 */
1837
1838#ifdef ___S8
1839
1840#define ___FETCH_S8(base,i)*(___CAST(___S8*,base)+(i))
1841#define ___FETCH_U8(base,i)*(___CAST(___U8*,base)+(i))
1842#define ___STORE_S8(base,i,val)*(___CAST(___S8*,base)+(i)) = (val)
1843#define ___STORE_U8(base,i,val)*(___CAST(___U8*,base)+(i)) = (val)
1844#define ___CAST_S8(x)(___S8)(x)
1845#define ___CAST_U8(x)(___U8)(x)
1846
1847#else
1848
1849#define ___FETCH_S8(base,i)___CAST_S8(___FETCH_U8(base,i))
1850#define ___STORE_S8(base,i,val)___STORE_U8(base,i,___CAST_U8(val))
1851
1852#ifdef ___S32
1853
1854#ifdef ___BIG_ENDIAN
1855#define ___FETCH_U8(base,i) \
1856((*(___CAST(___U32*,base)+((i)>>2))>>((~(i)&3)<<3))&0xff)
1857#define ___STORE_U8(base,i,val)*(___CAST(___U32*,base)+((i)>>2)) = \
1858(*(___CAST(___U32*,base)+((i)>>2))&~___CAST_U32(0xff<<((~(i)&3)<<3))) | \
1859___CAST_U32((val)<<((~(i)&3)<<3))
1860#else
1861#define ___FETCH_U8(base,i) \
1862((*(___CAST(___U32*,base)+((i)>>2))>>(((i)&3)<<3))&0xff)
1863#define ___STORE_U8(base,i,val)*(___CAST(___U32*,base)+((i)>>2)) = \
1864(*(___CAST(___U32*,base)+((i)>>2))&~___CAST_U32(0xff<<(((i)&3)<<3))) | \
1865___CAST_U32((val)<<(((i)&3)<<3))
1866#endif
1867
1868#define ___CAST_S8(x)(___CAST_S32((x)<<24)>>24)
1869#define ___CAST_U8(x)___CAST_U32((x)&0xff)
1870
1871#else
1872
1873#ifdef ___BIG_ENDIAN
1874#define ___FETCH_U8(base,i) \
1875((*(___CAST(___U64*,base)+((i)>>3))>>((~(i)&7)<<3))&0xff)
1876#define ___STORE_U8(base,i,val)*(___CAST(___U64*,base)+((i)>>3)) = \
1877(*(___CAST(___U64*,base)+((i)>>3))&~___CAST_U64(0xff<<((~(i)&7)<<3))) | \
1878___CAST_U64((val)<<((~(i)&7)<<3))
1879#else
1880#define ___FETCH_U8(base,i) \
1881((*(___CAST(___U64*,base)+((i)>>3))>>(((i)&7)<<3))&0xff)
1882#define ___STORE_U8(base,i,val)*(___CAST(___U64*,base)+((i)>>3)) = \
1883(*(___CAST(___U64*,base)+((i)>>3))&~___CAST_U64(0xff<<(((i)&7)<<3))) | \
1884___CAST_U64((val)<<(((i)&7)<<3))
1885#endif
1886
1887#define ___CAST_S8(x)(___CAST_S64((x)<<56)>>56)
1888#define ___CAST_U8(x)___CAST_U64((x)&0xff)
1889
1890#endif
1891
1892#endif
1893
1894/*
1895 * Macros to access ___F32 and ___F64 data types.
1896 */
1897
1898#ifdef ___F32
1899#define ___FETCH_F32(base,i)*(___CAST(___F32*,base)+(i))
1900#define ___STORE_F32(base,i,val)*(___CAST(___F32*,base)+(i)) = (val)
1901#define ___CAST_F32(x)___CAST(___F32,x)
1902#endif
1903
1904#ifdef ___F64
1905#define ___FETCH_F64(base,i)*(___CAST(___F64*,base)+(i))
1906#define ___STORE_F64(base,i,val)*(___CAST(___F64*,base)+(i)) = (val)
1907#define ___CAST_F64(x)___CAST(___F64,x)
1908#endif
1909
1910/*---------------------------------------------------------------------------*/
1911
1912/*
1913 * GENERAL DEFINITIONS
1914 *
1915 * ___WORD           an integer type able to contain a pointer with no loss
1916 * ___UWORD          unsigned ___WORD
1917 * ___WORD_WIDTH     is equal to the number of bits in the type ___WORD
1918 * ___LOG_WORD_WIDTH is equal to the base 2 logarithm of ___WORD_WIDTH
1919 * ___WS             is equal to sizeof (___WORD)
1920 * ___LWS            is equal to the base 2 logarithm of ___WS
1921 * ___FLONUM_SIZE    is equal to sizeof (___F64) / ___WS
1922 */
1923
1924#ifdef ___USE_32_BIT_ADDR
1925#define ___SIZE_T ___U32
1926#define ___SSIZE_T ___S32
1927#define ___PTRDIFF_T ___S32
1928#define ___WORD ___S32
1929#define ___UWORD ___U32
1930#define ___WORD_WIDTH 32
1931#define ___PRIdWORD "d"
1932#define ___PRIuWORD "u"
1933#define ___PRIxWORD "08x"
1934#define ___LOG_WORD_WIDTH 5
1935#define ___WS 4
1936#define ___LWS 2
1937#define ___FLONUM_SIZE 2
1938#else
1939#define ___SIZE_T ___U64
1940#define ___SSIZE_T ___S64
1941#define ___PTRDIFF_T ___S64
1942#define ___WORD ___S64
1943#define ___UWORD ___U64
1944#define ___WORD_WIDTH 64
1945#define ___PRIdWORD "ld"
1946#define ___PRIuWORD "lu"
1947#define ___PRIxWORD "016lx"
1948#define ___LOG_WORD_WIDTH 6
1949#define ___WS 8
1950#define ___LWS 3
1951#define ___FLONUM_SIZE 1
1952#endif
1953
1954#define ___SIZE_TS ___SSIZE_T /* temporary hack... in principle ___SIZE_TS should be replaced with ___SIZE_T (unsigned integer) */
1955
1956#define ___SCMOBJ ___WORD
1957#define ___SCMOBJ_WIDTH ___WORD_WIDTH
1958
1959#define ___ISO_8859_1 ___UM8
1960#define ___UTF_8 char
1961#define ___UTF_16 ___UM16
1962#define ___UCS_2 ___UM16
1963#define ___UCS_4 ___UM32
1964#define ___ISO_8859_1STRING ___ISO_8859_1*
1965#define ___UTF_8STRING ___UTF_8*
1966#define ___UTF_16STRING ___UTF_16*
1967#define ___UCS_2STRING ___UCS_2*
1968#define ___UCS_4STRING ___UCS_4*
1969#define ___WCHARSTRING ___WCHAR*
1970
1971#if ___MAX_CHR <= 0xff
1972#define ___CS 1
1973#else
1974#if ___MAX_CHR <= 0xffff
1975#define ___CS 2
1976#else
1977#define ___CS 4
1978#endif
1979#endif
1980
1981#if ___CS == 1
1982#define ___CS_SELECT(cs1,cs2,cs4)cs1
1983#else
1984#if ___CS == 2
1985#define ___CS_SELECT(cs1,cs2,cs4)cs2
1986#else
1987#define ___CS_SELECT(cs1,cs2,cs4)cs4
1988#endif
1989#endif
1990
1991#define ___LCS ___CS_SELECT(0,1,2)
1992
1993#define ___C ___CS_SELECT(___U8,___U16,___U32)
1994
1995#if ___WORD_WIDTH == ___VOIDSTAR_WIDTH
1996#define ___FAKEWORD ___WORD*
1997#define ___CAST_FAKEWORD_TO_WORD(x)___CAST(___WORD,x)
1998#define ___CAST_WORDSTAR_TO_FAKEWORD(x)x
1999#define ___FAKEHOST ___host
2000#define ___CAST_HOST_TO_FAKEHOST(x)x
2001#define ___CAST_FAKEHOST_TO_HOST(x)x
2002#define ___FAKEVOIDSTAR void*
2003#define ___CAST_VOIDSTAR_TO_FAKEVOIDSTAR(x)___CAST(___FAKEVOIDSTAR,x)
2004#define ___CAST_FAKEVOIDSTAR_TO_VOIDSTAR(x)___CAST(void*,x)
2005#else
2006#define ___FAKEWORD ___WORD
2007#define ___CAST_FAKEWORD_TO_WORD(x)x
2008#define ___CAST_WORDSTAR_TO_FAKEWORD(x)___CAST(___WORD,x)
2009#define ___FAKEHOST ___WORD
2010#define ___CAST_HOST_TO_FAKEHOST(x)___CAST(___WORD,x)
2011#define ___CAST_FAKEHOST_TO_HOST(x)___CAST(___host,x)
2012#define ___FAKEVOIDSTAR ___WORD
2013#define ___CAST_VOIDSTAR_TO_FAKEVOIDSTAR(x)___CAST(___WORD,x)
2014#define ___CAST_FAKEVOIDSTAR_TO_VOIDSTAR(x)___CAST(void*,x)
2015#endif
2016
2017/* Padding at end of objects so that they can be aligned to an address */
2018/* multiple of 4 or 8 by moving them up in memory.                     */
2019
2020#ifdef ___USE_32_BIT_ADDR
2021#define ___PADDING ,0
2022#define ___PADDING_SIZE 1
2023#define ___PADDING_LBL ,{0,0,0,0}
2024#define ___PADDING_64 ,0,0
2025#else
2026#define ___PADDING
2027#define ___PADDING_SIZE 0
2028#define ___PADDING_LBL
2029#define ___PADDING_64
2030#endif
2031
2032/* Utility macro to select code for SINGLE/MULTIPLE host. */
2033
2034#ifdef ___SINGLE_HOST
2035#define ___SM(s,m)s
2036#else
2037#define ___SM(s,m)m
2038#endif
2039
2040/*---------------------------------------------------------------------------*/
2041
2042/* OBJECT REPRESENTATION */
2043
2044/*
2045 * For a complete description of the object representation, read the
2046 * file "lib/mem.c".  These definitions must agree with those in the
2047 * files "lib/_gambit#.scm" and "gsc/_t-c-3.scm".
2048 */
2049
2050/*
2051 * Type tag assignment.
2052 *
2053 * Type tags are located in the lower 2 bits of a ___SCMOBJ.
2054 *
2055 * ___TB = number of tag bits
2056 * ___tFIXNUM   = tag for fixnums (small integers), must be 0
2057 * ___tSPECIAL  = tag for other immediates (#f, #t, (), #!eof, chars, ...)
2058 * ___tMEM1     = tag #1 for memory allocated objects
2059 * ___tMEM2     = tag #2 for memory allocated objects
2060 * ___tSUBTYPED = ___tMEM1
2061 * ___tPAIR     = ___tMEM1 or ___tMEM2
2062 */
2063
2064#define ___TB 2
2065#define ___tFIXNUM   0
2066#define ___tMEM2     3
2067
2068#ifdef ___USE_EVEN_TAG_FOR_SUBTYPED
2069#define ___tSPECIAL  1
2070#define ___tMEM1     2
2071#else
2072#define ___tSPECIAL  2
2073#define ___tMEM1     1
2074#endif
2075
2076#define ___tSUBTYPED ___tMEM1
2077
2078#ifdef ___USE_SAME_TAG_FOR_PAIRS_AND_SUBTYPED
2079#define ___tPAIR ___tMEM1
2080#else
2081#define ___tPAIR ___tMEM2
2082#endif
2083
2084#define ___MEM_ALLOCATED(obj)((obj)&___tMEM1)
2085#define ___MEM_ALLOCATED_CLEAR(obj)((obj)&~___CAST(___WORD,___tMEM1))
2086#define ___MEM_ALLOCATED_SET(obj)((obj)|___tMEM1)
2087
2088/*
2089 * Subtype tag assignment.
2090 *
2091 * These tags are stored in the head of memory allocated objects
2092 * (including pairs).
2093 *
2094 * ___SB = number of subtype tag bits
2095 * ___sVECTOR       = tag for vectors
2096 * ___sPAIR         = tag for pairs
2097 * ___sRATNUM       = tag for ratnums
2098 * ___sCPXNUM       = tag for cpxnums
2099 * ___sSTRUCTURE    = tag for structures
2100 * ___sBOXVALUES    = tag for box and multiple-values objects
2101 * ___sMEROON       = tag for Meroon objects
2102 * ___sJAZZ         = tag for Jazz objects
2103 * ___sSYMBOL       = tag for symbols
2104 * ___sKEYWORD      = tag for keywords
2105 * ___sFRAME        = tag for continuation frames
2106 * ___sCONTINUATION = tag for continuations
2107 * ___sPROMISE      = tag for promises
2108 * ___sWEAK         = tag for weak objects (wills and GC hash tables)
2109 * ___sPROCEDURE    = tag for procedures
2110 * ___sRETURN       = tag for returns
2111 * ___sFOREIGN      = tag for foreign data
2112 * ___sSTRING       = tag for strings
2113 * ___sS8VECTOR     = tag for 8-bit signed integer vectors
2114 * ___sU8VECTOR     = tag for 8-bit unsigned integer vectors
2115 * ___sS16VECTOR    = tag for 16-bit signed integer vectors
2116 * ___sU16VECTOR    = tag for 16-bit unsigned integer vectors
2117 * ___sS32VECTOR    = tag for 32-bit signed integer vectors
2118 * ___sU32VECTOR    = tag for 32-bit unsigned integer vectors
2119 * ___sF32VECTOR    = tag for 32-bit floating point number vectors
2120 * ___sS64VECTOR    = tag for 64-bit signed integer vectors
2121 * ___sU64VECTOR    = tag for 64-bit unsigned integer vectors
2122 * ___sF64VECTOR    = tag for 64-bit floating point number vectors
2123 * ___sFLONUM       = tag for flonums
2124 * ___sBIGNUM       = tag for bignums
2125 *
2126 * The five subtype tags ___sS64VECTOR, ___sU64VECTOR, ___sF64VECTOR,
2127 * ___sFLONUM, ___sBIGNUM must come last.  These object types (and
2128 * ___sFOREIGN which is always allocated as a ___STILL object) must
2129 * be aligned on a multiple of 8.
2130 */
2131
2132#define ___SB 5
2133#define ___sVECTOR       0
2134#define ___sPAIR         1
2135#define ___sRATNUM       2
2136#define ___sCPXNUM       3
2137#define ___sSTRUCTURE    4
2138#define ___sBOXVALUES    5
2139#define ___sMEROON       6
2140#define ___sJAZZ         7
2141#define ___sSYMBOL       8
2142#define ___sKEYWORD      9
2143#define ___sFRAME        10
2144#define ___sCONTINUATION 11
2145#define ___sPROMISE      12
2146#define ___sWEAK         13
2147#define ___sPROCEDURE    14
2148#define ___sRETURN       15
2149#define ___sFOREIGN      18
2150#define ___sSTRING       19
2151#define ___sS8VECTOR     20
2152#define ___sU8VECTOR     21
2153#define ___sS16VECTOR    22
2154#define ___sU16VECTOR    23
2155#define ___sS32VECTOR    24
2156#define ___sU32VECTOR    25
2157#define ___sF32VECTOR    26
2158#define ___sS64VECTOR    27
2159#define ___sU64VECTOR    28
2160#define ___sF64VECTOR    29
2161#define ___sFLONUM       30
2162#define ___sBIGNUM       31
2163
2164/*
2165 * Head type tag assignment.
2166 *
2167 * Head type tags are stored in the lower 3 bits of the head of memory
2168 * allocated objects.
2169 *
2170 * ___HTB = number of head tag bits
2171 * ___MOVABLE0 = tag for movable objects in generation 0
2172 * ___MOVABLE1 = tag for movable objects in generation 1
2173 * ___MOVABLE2 = tag for movable objects in generation 2
2174 * ___FORW     = tag for movable objects that have been forwarded
2175 * ___STILL    = tag for still objects
2176 * ___PERM     = tag for permanent objects
2177 *
2178 * note: the tag ___FORW+(1<<___TB) is also used for forwarding pointers
2179 */
2180
2181#define ___HTB 3
2182#define ___MOVABLE0 0
2183#define ___MOVABLE1 1
2184#define ___MOVABLE2 2
2185#define ___FORW     3
2186#define ___STILL    5
2187#define ___PERM     6
2188
2189/*
2190 * Miscellaneous masks.
2191 */
2192
2193#define ___LF (___HTB+___SB)
2194
2195#define ___MASK(type,bits)((___CAST(type,1)<<bits)-1)
2196#define ___TMASK ___MASK(___WORD,___TB)
2197#define ___HTMASK ___MASK(___WORD,___HTB)
2198#define ___SMASK (___MASK(___WORD,___SB)<<___HTB)
2199#define ___LMASK (~___MASK(___UWORD,___LF))
2200#define ___LSMASK (~___MASK(___UWORD,___HTB))
2201
2202/*
2203 * Value constructors for object references inside executable code.
2204 */
2205
2206#define ___FAL      ___SPECIAL(-1)
2207#define ___TRU      ___SPECIAL(-2)
2208#define ___NUL      ___SPECIAL(-3)
2209#define ___EOF      ___SPECIAL(-4)
2210#define ___VOID     ___SPECIAL(-5)
2211#define ___ABSENT   ___SPECIAL(-6)
2212#define ___UNB1     ___SPECIAL(-7)
2213#define ___UNB2     ___SPECIAL(-8)
2214#define ___OPTIONAL ___SPECIAL(-9)
2215#define ___KEYOBJ   ___SPECIAL(-10)
2216#define ___REST     ___SPECIAL(-11)
2217#define ___UNUSED   ___SPECIAL(-14)
2218#define ___DELETED  ___SPECIAL(-15)
2219#define ___SPECIAL(x)(___FIX(x)+___tSPECIAL)
2220#define ___FIX(x)___CAST(___WORD,___CAST(___UWORD,x)<<___TB)
2221#if ___SCMOBJ_WIDTH == 32
2222#define ___BIGFIX(i,x)___SUB(i)
2223#else
2224#define ___BIGFIX(i,x)___FIX(x)
2225#endif
2226#define ___CHR(x)___SPECIAL(___CS_SELECT(___CAST_U8(x),___CAST_U16(x),___CAST_U32(x)))
2227
2228#define ___SYM(i,id)___CAST_FAKEWORD_TO_WORD(___symtbl[i])
2229#define ___KEY(i,id)___CAST_FAKEWORD_TO_WORD(___keytbl[i])
2230#define ___CNS(i)___PAIR_FROM_START(___ALIGNUP(___cnstbl,___WS)+i*(___PAIR_BODY+___PAIR_SIZE))
2231#define ___SUB(i)___CAST_FAKEWORD_TO_WORD(___subtbl[i])
2232
2233/*
2234 * Value constructors for object references inside constant
2235 * memory allocated objects.
2236 */
2237
2238#define ___REF_FAL      ___FAL
2239#define ___REF_TRU      ___TRU
2240#define ___REF_NUL      ___NUL
2241#define ___REF_EOF      ___EOF
2242#define ___REF_VOID     ___VOID
2243#define ___REF_ABSENT   ___ABSENT
2244#define ___REF_UNB1     ___UNB1
2245#define ___REF_UNB2     ___UNB2
2246#define ___REF_OPTIONAL ___OPTIONAL
2247#define ___REF_KEYOBJ   ___KEYOBJ
2248#define ___REF_REST     ___REST
2249#define ___REF_UNUSED   ___UNUSED
2250#define ___REF_DELETED  ___DELETED
2251#define ___REF_FIX(x)___FIX(x)
2252#if ___SCMOBJ_WIDTH == 32
2253#define ___REF_BIGFIX(i,x)___REF_SUB(i)
2254#else
2255#define ___REF_BIGFIX(i,x)___REF_FIX(x)
2256#endif
2257#define ___REF_CHR(x)___CHR(x)
2258
2259#define ___REF_SYM(i,id)(___FIX(-1-i)+___tMEM2)
2260#define ___REF_KEY(i,id)(___FIX(-1-i)+___tMEM1)
2261#define ___REF_CNS(i)(___FIX(i)+___tMEM2)
2262#define ___REF_SUB(i)(___FIX(i)+___tMEM1)
2263
2264#ifdef ___SUBCOUNT
2265#define ___REF_PRC(i)(___FIX(___SUBCOUNT+i)+___tMEM1)
2266#else
2267#define ___REF_PRC(i)(___FIX(i)+___tMEM1)
2268#endif
2269
2270/*---------------------------------------------------------------------------*/
2271
2272/* Miscellaneous macros */
2273
2274#define ___IF(x) if (x) {
2275#define ___END_IF }
2276
2277#define ___NOTHING
2278
2279#define ___NBELEMS(table) (sizeof (table) / sizeof ((table)[0]))
2280
2281#define ___INT(x)((x)>>___TB)
2282
2283#define ___FIX_WIDTH (___SCMOBJ_WIDTH-___TB)
2284#define ___MIN_FIX (-(___CAST(___WORD,1)<<(___FIX_WIDTH-1)))
2285#define ___MAX_FIX ((___CAST(___WORD,1)<<(___FIX_WIDTH-1))-1)
2286
2287#define ___MAX_FIX32 ((___CAST(___WORD,1)<<(32-___TB-1))-1)
2288
2289#if ___TB == 2
2290#if ___SCMOBJ_WIDTH == 32
2291#define ___SQRT_MAX_FIX 23170
2292#else
2293#define ___SQRT_MAX_FIX 1518500249L
2294#endif
2295#endif
2296
2297/*
2298 * The C id prefix must match the definition in the file
2299 * "gsc/_parms.scm".
2300 */
2301
2302#define ___C_ID_PREFIX "___"
2303
2304/*---------------------------------------------------------------------------*/
2305
2306/* Object representation */
2307
2308#ifdef ___SUPPORT_LOWLEVEL_EXEC
2309#define ___REFERENCE_TO_BODY (-1)
2310#define ___LABEL_LOWLEVEL_CODE 1
2311#else
2312#define ___REFERENCE_TO_BODY 1
2313#endif
2314
2315#define ___BODY0(obj)(___UNTAG(obj)+___REFERENCE_TO_BODY)
2316#define ___BODY0_AS(obj,tag)(___UNTAG_AS(obj,tag)+___REFERENCE_TO_BODY)
2317#define ___BODY0_FROM_HP()(___hp+___SUBTYPED_BODY)
2318
2319#ifdef ___USE_HANDLES
2320#define ___PAIR_BODY     2
2321#define ___SUBTYPED_BODY 2
2322#define ___BODY(obj)___CAST(___WORD*,___BODY0(obj)[-2])
2323#define ___BODY_AS(obj,tag)___CAST(___WORD*,___BODY0_AS(obj,tag)[-2])
2324#else
2325#define ___PAIR_BODY     1
2326#define ___SUBTYPED_BODY 1
2327#define ___BODY(obj)___BODY0(obj)
2328#define ___BODY_AS(obj,tag)___BODY0_AS(obj,tag)
2329#endif
2330
2331#define ___ALIGNUP(x,mult) \
2332___CAST(___WORD*,(___CAST(___WORD,x)+((mult)-1))&~((mult)-1))
2333
2334#define ___ALLOC(n) ___hp += (n)
2335
2336#if ___SCMOBJ_WIDTH == 32
2337
2338#define ___ALLOC_ALIGN64(n) \
2339___hp = ___CAST(___WORD*, (___CAST(___WORD,___hp) + (((n)<<___LWS) + 7)) & ~7)
2340
2341#else
2342
2343#define ___ALLOC_ALIGN64(n) ___ALLOC(n)
2344
2345#endif
2346
2347#define ___BEGIN_ALLOC_PAIR()___hp[0] = ___MAKE_HD_WORDS(___PAIR_SIZE,___sPAIR)
2348#define ___ADD_PAIR_ELEM(i,val)___hp[(i)+___PAIR_BODY] = val
2349#define ___END_ALLOC_PAIR()___ALLOC(___PAIR_SIZE+___PAIR_BODY)
2350#define ___GET_PAIR()___PAIR_FROM_END(___hp)
2351
2352#define ___BEGIN_ALLOC_SUBTYPED(hd)___hp[0] = hd
2353#define ___ADD_SUBTYPED_ELEM(i,val)___hp[(i)+___SUBTYPED_BODY] = val
2354#define ___END_ALLOC_SUBTYPED(n)___ALLOC((n)+___SUBTYPED_BODY)
2355#define ___GET_SUBTYPED(n)___SUBTYPED_FROM_END(___hp,n)
2356
2357#define ___PAIR_FROM(ptr,n) \
2358___TAG(___CAST(___WORD*,ptr) - (___REFERENCE_TO_BODY+(n)), ___tPAIR)
2359#define ___PAIR_FROM_START(ptr)___PAIR_FROM(ptr,-___PAIR_BODY)
2360#define ___PAIR_FROM_END(ptr)___PAIR_FROM(ptr,___PAIR_SIZE)
2361#define ___PAIR_FROM_BODY(ptr)___PAIR_FROM(ptr,0)
2362#define ___PAIR_TO(obj,n) \
2363(___UNTAG_AS(obj,___tPAIR) + (___REFERENCE_TO_BODY+(n)))
2364#define ___PAIR_TO_START(obj)___PAIR_TO(obj,-___PAIR_BODY)
2365#define ___PAIR_TO_END(obj)___PAIR_TO(obj,___PAIR_SIZE)
2366#define ___PAIR_TO_BODY(obj)___PAIR_TO(obj,0)
2367
2368#define ___SUBTYPED_FROM(ptr,n) \
2369___TAG(___CAST(___WORD*,ptr) - (___REFERENCE_TO_BODY+(n)), ___tSUBTYPED)
2370#define ___SUBTYPED_FROM_START(ptr)___SUBTYPED_FROM(ptr,-___SUBTYPED_BODY)
2371#define ___SUBTYPED_FROM_END(ptr,n)___SUBTYPED_FROM(ptr,n)
2372#define ___SUBTYPED_FROM_BODY(ptr)___SUBTYPED_FROM(ptr,0)
2373#define ___SUBTYPED_TO(obj,n) \
2374(___UNTAG_AS(obj,___tSUBTYPED) + (___REFERENCE_TO_BODY+(n)))
2375#define ___SUBTYPED_TO_START(obj)___SUBTYPED_TO(obj,-___SUBTYPED_BODY)
2376#define ___SUBTYPED_TO_END(obj,n)___SUBTYPED_TO(obj,n)
2377#define ___SUBTYPED_TO_BODY(obj)___SUBTYPED_TO(obj,0)
2378
2379#define ___TAG(ptr,tag)(___CAST(___WORD,ptr)+(tag))
2380#define ___UNTAG(obj)___CAST(___WORD*,(obj)&~___TMASK)
2381#define ___UNTAG_AS(obj,tag)___CAST(___WORD*,(obj)-(tag))
2382
2383#define ___TYP(x)((x)&___TMASK)
2384#define ___TESTTYPE(x,typ)(___TYP(x)==(typ))
2385
2386#define ___TESTHEADERTAG(x,s)(((x)&___SMASK)==((s)<<___HTB))
2387#define ___TESTSUBTYPETAG(x,s)___TESTHEADERTAG(___SUBTYPED_HEADER(x),s)
2388#define ___TESTSUBTYPE(x,s)(___TYP((___temp=(x)))==___tSUBTYPED&&___TESTSUBTYPETAG(___temp,(s)))
2389#define ___TESTLENGTHSUBTYPETAG(x,bytes,s)((___SUBTYPED_HEADER(x)&___LSMASK)==___MAKE_HD(bytes,s,0))
2390#define ___TESTLENGTHSUBTYPE(x,bytes,s)(___TYP((___temp=(x)))==___tSUBTYPED&&___TESTLENGTHSUBTYPETAG(___temp,bytes,s))
2391
2392#define ___HEADER(obj)___BODY0(obj)[-1]
2393#define ___HEADER_SET(obj,head)___HEADER(obj) = head
2394
2395#define ___SUBTYPED_HEADER(obj)___SUBTYPED_TO_BODY(obj)[-1]
2396#define ___SUBTYPED_HEADER_SET(obj,head)___SUBTYPED_TO_BODY(obj)[-1] = head
2397
2398#define ___MAKE_HD(bytes,subtype,tag)(((bytes)<<___LF)+((subtype)<<___HTB)+(tag))
2399#define ___HD_TYP(head)((head)&___HTMASK)
2400#define ___HD_BYTES(head)(___CAST(___UWORD,head)>>___LF)
2401#define ___HD_WORDS(head)(((___CAST(___UWORD,head)+((___WS-1)<<___LF)))>>(___LF+___LWS))
2402#define ___HD_FIELDS(head)(___CAST(___UWORD,head)>>(___LF+___LWS))
2403#define ___HD_SUBTYPE(head)((head)>>___HTB&((1<<___SB)-1))
2404
2405#define ___FIELD(obj,i)(*(___BODY_AS(obj,___tSUBTYPED)+i))
2406
2407#define ___WORDS(bytes)(((bytes)+___WS-1)>>___LWS)
2408
2409#define ___MAKE_HD_BYTES(bytes,subtype)___MAKE_HD(bytes,subtype,___MOVABLE0)
2410#define ___MAKE_HD_WORDS(words,subtype)___MAKE_HD(((words)<<___LWS),subtype,___MOVABLE0)
2411
2412/* Flonum boxing and unboxing */
2413
2414#define ___FLONUM_VAL(obj) *___CAST(___F64*,___BODY_AS(obj,___tSUBTYPED))
2415
2416#define ___F64UNBOX(x) ___FLONUM_VAL(x)
2417
2418#define ___F64BOX(x) \
2419(___ALLOC_ALIGN64(1+___FLONUM_SIZE), \
2420 ___hp[-(1+___FLONUM_SIZE)] = ___MAKE_HD_WORDS(___FLONUM_SIZE,___sFLONUM), \
2421 *___CAST(___F64*,___hp-___FLONUM_SIZE) = (x), \
2422 ___GET_SUBTYPED(___FLONUM_SIZE))
2423
2424#define ___D_F64(x)___F64 x;
2425#define ___SET_F64(x,y)x=y;
2426
2427/* Bignum representation */
2428
2429#define ___BIG_FBASE_WIDTH 8
2430
2431#if ___SCMOBJ_WIDTH == 32
2432#define ___BIG_MBASE_WIDTH 16
2433#else
2434#define ___BIG_MBASE_WIDTH 32
2435#endif
2436
2437#ifndef ___BUILTIN_64BIT_INT_TYPE
2438#define ___BIG_ABASE_WIDTH 32
2439#else
2440#define ___BIG_ABASE_WIDTH 64
2441#endif
2442
2443#if ___BIG_ABASE_WIDTH == 32
2444
2445#define ___BIGAFETCH(base,i) ___FETCH_U32(base,i)
2446#define ___BIGAFETCHSIGNED(base,i) ___FETCH_S32(base,i)
2447#define ___BIGASTORE(base,i,val) ___STORE_U32(base,i,val)
2448#define ___BIGASTORESIGNED(base,i,val) ___STORE_S32(base,i,val)
2449#define ___BIGALENGTH(vect) ___U32VECTORLENGTH(vect)
2450#define ___BIGADIGIT ___U32
2451#define ___BIGADIGITSIGNED ___S32
2452#define ___BIGASHRINK(x,y) ___U32VECTORSHRINK(x,y)
2453#define ___BIGATEMP ___u32_temp
2454
2455#else
2456
2457#define ___BIGAFETCH(base,i) ___FETCH_U64(base,i)
2458#define ___BIGAFETCHSIGNED(base,i) ___FETCH_S64(base,i)
2459#define ___BIGASTORE(base,i,val) ___STORE_U64(base,i,val)
2460#define ___BIGASTORESIGNED(base,i,val) ___STORE_S64(base,i,val)
2461#define ___BIGALENGTH(vect) ___U64VECTORLENGTH(vect)
2462#define ___BIGADIGIT ___U64
2463#define ___BIGADIGITSIGNED ___S64
2464#define ___BIGASHRINK(x,y) ___U64VECTORSHRINK(x,y)
2465#define ___BIGATEMP ___u64_temp
2466
2467#endif
2468
2469#define ___BIG_ABASE_MIN_1 (~___CAST(___BIGADIGIT,0))
2470
2471#if ___BIG_ABASE_WIDTH == 32
2472
2473#define ___S32UNBOX(x) \
2474(___TYP((___temp=x)) == ___tFIXNUM \
2475 ? ___INT(___temp) \
2476 : ___BIGAFETCHSIGNED(___BODY_AS(___temp,___tSUBTYPED),0))
2477
2478#define ___U32UNBOX(x) \
2479(___TYP((___temp=x)) == ___tFIXNUM \
2480 ? ___CAST_U32(___INT(___temp)) \
2481 : ___BIGAFETCH(___BODY_AS(___temp,___tSUBTYPED),0))
2482
2483#define ___S64UNBOX(x) \
2484(___TYP((___temp=x)) == ___tFIXNUM \
2485 ? ___S64_from_SM32(___INT(___temp)) \
2486 : (___HD_BYTES(___SUBTYPED_HEADER(___temp)) == (1<<2) \
2487    ? ___S64_from_SM32(___BIGAFETCHSIGNED(___BODY_AS(___temp,___tSUBTYPED),0)) \
2488    : ___S64_from_SM32_UM32(___BIGAFETCHSIGNED(___BODY_AS(___temp,___tSUBTYPED),1),___BIGAFETCH(___BODY_AS(___temp,___tSUBTYPED),0))))
2489
2490#define ___U64UNBOX(x) \
2491(___TYP((___temp=x)) == ___tFIXNUM \
2492 ? ___U64_from_UM32(___CAST_U32(___INT(___temp))) \
2493 : (___HD_BYTES(___SUBTYPED_HEADER(___temp)) == (1<<2) \
2494    ? ___U64_from_UM32(___BIGAFETCH(___BODY_AS(___temp,___tSUBTYPED),0)) \
2495    : ___U64_from_UM32_UM32(___BIGAFETCH(___BODY_AS(___temp,___tSUBTYPED),1),___BIGAFETCH(___BODY_AS(___temp,___tSUBTYPED),0))))
2496
2497#if ___SCMOBJ_WIDTH == 32
2498
2499#define ___S32BOX(x) \
2500(___s32_temp=(x), \
2501 (___s32_temp >= ___MIN_FIX && ___s32_temp <= ___MAX_FIX \
2502  ? ___FIX(___s32_temp) \
2503  : (___ALLOC(1+___WORDS(1<<2)), \
2504     ___hp[-(1+___WORDS(1<<2))] = ___MAKE_HD_BYTES(1<<2,___sBIGNUM), \
2505     ___BIGASTORESIGNED(___hp,-1,___s32_temp), \
2506     ___GET_SUBTYPED(___WORDS(1<<2)))))
2507
2508#define ___U32BOX(x) \
2509(___u32_temp=(x), \
2510 (___u32_temp <= ___CAST_U32(___MAX_FIX) \
2511  ? ___FIX(___u32_temp) \
2512  : (___CAST_S32(___u32_temp) < 0 \
2513     ? (___ALLOC(1+___WORDS(2<<2)), \
2514        ___hp[-(1+___WORDS(2<<2))] = ___MAKE_HD_BYTES(2<<2,___sBIGNUM), \
2515        ___BIGASTORE(___hp,-2,___u32_temp), \
2516        ___BIGASTORE(___hp,-1,0), \
2517        ___GET_SUBTYPED(___WORDS(2<<2))) \
2518     : (___ALLOC(1+___WORDS(1<<2)), \
2519        ___hp[-(1+___WORDS(1<<2))] = ___MAKE_HD_BYTES(1<<2,___sBIGNUM), \
2520        ___BIGASTORE(___hp,-1,___u32_temp), \
2521        ___GET_SUBTYPED(___WORDS(1<<2))))))
2522
2523#define ___S64BOX(x) \
2524(___s64_temp=(x), \
2525 (((___s32_temp = ___CAST_S32(___S64_lo32(___s64_temp)))>>31) \
2526  == ___S64_hi32(___s64_temp) \
2527  ? (___s32_temp >= ___MIN_FIX && ___s32_temp <= ___MAX_FIX \
2528     ? ___FIX(___s32_temp) \
2529     : (___ALLOC(1+___WORDS(1<<2)), \
2530        ___hp[-(1+___WORDS(1<<2))] = ___MAKE_HD_BYTES(1<<2,___sBIGNUM), \
2531        ___BIGASTORE(___hp,-1,___s32_temp), \
2532        ___GET_SUBTYPED(___WORDS(1<<2)))) \
2533  : (___ALLOC(1+___WORDS(2<<2)), \
2534     ___hp[-(1+___WORDS(2<<2))] = ___MAKE_HD_BYTES(2<<2,___sBIGNUM), \
2535     ___BIGASTORE(___hp,-2,___s32_temp), \
2536     ___BIGASTORESIGNED(___hp,-1,___S64_hi32(___s64_temp)), \
2537     ___GET_SUBTYPED(___WORDS(2<<2)))))
2538
2539#define ___U64BOX(x) \
2540(___u64_temp=(x), \
2541 (___CAST_S32(___U64_hi32(___u64_temp)) < 0 \
2542  ? (___ALLOC(1+___WORDS(3<<2)), \
2543     ___hp[-(1+___WORDS(3<<2))] = ___MAKE_HD_BYTES(3<<2,___sBIGNUM), \
2544     ___BIGASTORE(___hp,-3,___U64_lo32(___u64_temp)), \
2545     ___BIGASTORE(___hp,-2,___U64_hi32(___u64_temp)), \
2546     ___BIGASTORE(___hp,-1,0), \
2547     ___GET_SUBTYPED(___WORDS(3<<2))) \
2548  : (((___u32_temp = ___U64_lo32(___u64_temp)) & (___CAST_U32(1)<<31)) \
2549     == ___U64_hi32(___u64_temp) \
2550     ? (___u32_temp <= ___MAX_FIX \
2551        ? ___FIX(___u32_temp) \
2552        : (___ALLOC(1+___WORDS(1<<2)), \
2553           ___hp[-(1+___WORDS(1<<2))] = ___MAKE_HD_BYTES(1<<2,___sBIGNUM), \
2554           ___BIGASTORE(___hp,-1,___u32_temp), \
2555           ___GET_SUBTYPED(___WORDS(1<<2)))) \
2556     : (___ALLOC(1+___WORDS(2<<2)), \
2557        ___hp[-(1+___WORDS(2<<2))] = ___MAKE_HD_BYTES(2<<2,___sBIGNUM), \
2558        ___BIGASTORE(___hp,-2,___u32_temp), \
2559        ___BIGASTORESIGNED(___hp,-1,___S64_hi32(___u64_temp)), \
2560        ___GET_SUBTYPED(___WORDS(2<<2))))))
2561
2562#else
2563
2564#define ___S32BOX(x) ___FIX(___CAST_S64(x))
2565#define ___U32BOX(x) ___FIX(___CAST_U64(x))
2566
2567#define ___S64BOX(x) \
2568(___s64_temp=(x), \
2569 (___s64_temp >= ___MIN_FIX && ___s64_temp <= ___MAX_FIX \
2570  ? ___FIX(___s64_temp) \
2571  : ((___CAST_S32(___S64_lo32(___s64_temp))>>31) == ___S64_hi32(___s64_temp) \
2572     ? (___ALLOC(1+___WORDS(1<<2)), \
2573        ___hp[-(1+___WORDS(1<<2))] = ___MAKE_HD_BYTES(1<<2,___sBIGNUM), \
2574        ___BIGASTORE(___hp,-1,___S64_lo32(___s64_temp)), \
2575        ___GET_SUBTYPED(___WORDS(1<<2))) \
2576     : (___ALLOC(1+___WORDS(2<<2)), \
2577        ___hp[-(1+___WORDS(2<<2))] = ___MAKE_HD_BYTES(2<<2,___sBIGNUM), \
2578        ___BIGASTORE(___hp,-2,___S64_lo32(___s64_temp)), \
2579        ___BIGASTORESIGNED(___hp,-1,___S64_hi32(___s64_temp)), \
2580        ___GET_SUBTYPED(___WORDS(2<<2))))))
2581
2582#define ___U64BOX(x) \
2583(___u64_temp=(x), \
2584 (___u64_temp <= ___CAST_U64(___MAX_FIX) \
2585  ? ___FIX(___u64_temp) \
2586  : (___CAST_S64(___u64_temp) < 0 \
2587     ? (___ALLOC(1+___WORDS(3<<2)), \
2588        ___hp[-(1+___WORDS(3<<2))] = ___MAKE_HD_BYTES(3<<2,___sBIGNUM), \
2589        ___BIGASTORE(___hp,-3,___U64_lo32(___u64_temp)), \
2590        ___BIGASTORE(___hp,-2,___U64_hi32(___u64_temp)), \
2591        ___BIGASTORE(___hp,-1,0), \
2592        ___GET_SUBTYPED(___WORDS(3<<2))) \
2593     : ((___U64_lo32(___u64_temp) & (___CAST_U32(1)<<31)) == ___U64_hi32(___u64_temp) \
2594        ? (___ALLOC(1+___WORDS(1<<2)), \
2595           ___hp[-(1+___WORDS(1<<2))] = ___MAKE_HD_BYTES(1<<2,___sBIGNUM), \
2596           ___BIGASTORE(___hp,-1,___S64_lo32(___u64_temp)), \
2597           ___GET_SUBTYPED(___WORDS(1<<2))) \
2598        : (___ALLOC(1+___WORDS(2<<2)), \
2599           ___hp[-(1+___WORDS(2<<2))] = ___MAKE_HD_BYTES(2<<2,___sBIGNUM), \
2600           ___BIGASTORE(___hp,-2,___S64_lo32(___u64_temp)), \
2601           ___BIGASTORESIGNED(___hp,-1,___S64_hi32(___u64_temp)), \
2602           ___GET_SUBTYPED(___WORDS(2<<2)))))))
2603
2604#endif
2605
2606#else
2607
2608#define ___S32UNBOX(x) \
2609(___TYP((___temp=x)) == ___tFIXNUM \
2610 ? ___INT(___temp) \
2611 : ___CAST_S32(___U64_lo32(___BIGAFETCH(___BODY_AS(___temp,___tSUBTYPED),0))))
2612
2613#define ___U32UNBOX(x) \
2614(___TYP((___temp=x)) == ___tFIXNUM \
2615 ? ___CAST_U32(___INT(___temp)) \
2616 : ___U64_lo32(___BIGAFETCH(___BODY_AS(___temp,___tSUBTYPED),0)))
2617
2618#define ___S64UNBOX(x) \
2619(___TYP((___temp=x)) == ___tFIXNUM \
2620 ? ___INT(___temp) \
2621 : ___BIGAFETCHSIGNED(___BODY_AS(___temp,___tSUBTYPED),0))
2622
2623#define ___U64UNBOX(x) \
2624(___TYP((___temp=x)) == ___tFIXNUM \
2625 ? ___CAST_U64(___INT(___temp)) \
2626 : ___BIGAFETCH(___BODY_AS(___temp,___tSUBTYPED),0))
2627
2628#if ___SCMOBJ_WIDTH == 32
2629
2630#define ___S32BOX(x) \
2631(___s32_temp=(x), \
2632 (___s32_temp >= ___MIN_FIX && ___s32_temp <= ___MAX_FIX \
2633  ? ___FIX(___s32_temp) \
2634  : (___ALLOC_ALIGN64(1+___WORDS(1<<3)), \
2635     ___hp[-(1+___WORDS(1<<3))] = ___MAKE_HD_BYTES(1<<3,___sBIGNUM), \
2636     ___BIGASTORESIGNED(___hp,-1,___S64_from_SM32(___s32_temp)), \
2637     ___GET_SUBTYPED(___WORDS(1<<3)))))
2638
2639#define ___U32BOX(x) \
2640(___u32_temp=(x), \
2641 (___u32_temp <= ___CAST_U32(___MAX_FIX) \
2642  ? ___FIX(___u32_temp) \
2643  : (___ALLOC_ALIGN64(1+___WORDS(1<<3)), \
2644     ___hp[-(1+___WORDS(1<<3))] = ___MAKE_HD_BYTES(1<<3,___sBIGNUM), \
2645     ___BIGASTORE(___hp,-1,___U64_from_UM32(___u32_temp)), \
2646     ___GET_SUBTYPED(___WORDS(1<<3)))))
2647
2648#else
2649
2650#define ___S32BOX(x) ___FIX(___CAST_S64(x))
2651#define ___U32BOX(x) ___FIX(___CAST_U64(x))
2652
2653#endif
2654
2655#define ___S64BOX(x) \
2656(___s64_temp=(x), \
2657 (___s64_temp >= ___MIN_FIX && ___s64_temp <= ___MAX_FIX \
2658  ? ___FIX(___s64_temp) \
2659  : (___ALLOC_ALIGN64(1+___WORDS(1<<3)), \
2660     ___hp[-(1+___WORDS(1<<3))] = ___MAKE_HD_BYTES(1<<3,___sBIGNUM), \
2661     ___BIGASTORESIGNED(___hp,-1,___s64_temp), \
2662     ___GET_SUBTYPED(___WORDS(1<<3)))))
2663
2664#define ___U64BOX(x) \
2665(___u64_temp=(x), \
2666 (___u64_temp <= ___CAST_U64(___MAX_FIX) \
2667  ? ___FIX(___u64_temp) \
2668  : (___CAST_S64(___u64_temp) < 0 \
2669     ? (___ALLOC_ALIGN64(1+___WORDS(2<<3)), \
2670        ___hp[-(1+___WORDS(2<<3))] = ___MAKE_HD_BYTES(2<<3,___sBIGNUM), \
2671        ___BIGASTORE(___hp,-2,___u64_temp), \
2672        ___BIGASTORE(___hp,-1,0), \
2673        ___GET_SUBTYPED(___WORDS(2<<3))) \
2674     : (___ALLOC_ALIGN64(1+___WORDS(1<<3)), \
2675        ___hp[-(1+___WORDS(1<<3))] = ___MAKE_HD_BYTES(1<<3,___sBIGNUM), \
2676        ___BIGASTORE(___hp,-1,___u64_temp), \
2677        ___GET_SUBTYPED(___WORDS(1<<3))))))
2678
2679#endif
2680
2681#if ___BIG_ABASE_WIDTH == 32
2682
2683#if ___SCMOBJ_WIDTH == 32
2684
2685#define ___BIGFROMFIX(x) \
2686(___ALLOC(1+___WORDS(1<<2)), \
2687 ___hp[-(1+___WORDS(1<<2))] = ___MAKE_HD_BYTES(1<<2,___sBIGNUM), \
2688 ___BIGASTORESIGNED(___hp,-1,___INT(x)), \
2689 ___GET_SUBTYPED(___WORDS(1<<2)))
2690
2691#else
2692
2693#define ___BIGFROMFIX(x) \
2694(___ALLOC(1+___WORDS(2<<2)), \
2695 ___hp[-(1+___WORDS(2<<2))] = ___MAKE_HD_BYTES(2<<2,___sBIGNUM), \
2696 ___BIGASTORE(___hp,-2,___S64_lo32(___INT(x))), \
2697 ___BIGASTORESIGNED(___hp,-1,___S64_hi32(___INT(x))), \
2698 ___GET_SUBTYPED(___WORDS(2<<2)))
2699
2700#endif
2701
2702#else
2703
2704#define ___BIGFROMFIX(x) \
2705(___ALLOC_ALIGN64(1+___WORDS(1<<3)), \
2706 ___hp[-(1+___WORDS(1<<3))] = ___MAKE_HD_BYTES(1<<3,___sBIGNUM), \
2707 ___BIGASTORESIGNED(___hp,-1,___CAST(___BIGADIGIT,___INT(x))), \
2708 ___GET_SUBTYPED(___WORDS(1<<3)))
2709
2710#endif
2711
2712#define ___BIGALESSP(x,y,i) \
2713(___BIGAFETCH(___BODY_AS(x,___tSUBTYPED),(i)>>___TB) \
2714 < (___BIGAFETCH(___BODY_AS(y,___tSUBTYPED),(i)>>___TB)))
2715
2716#define ___BIGAEQP(x,y,i) \
2717(___BIGAFETCH(___BODY_AS(x,___tSUBTYPED),(i)>>___TB) \
2718 == (___BIGAFETCH(___BODY_AS(y,___tSUBTYPED),(i)>>___TB)))
2719
2720#define ___BIGAONESP(x,i) \
2721(___BIGAFETCH(___BODY_AS(x,___tSUBTYPED),(i)>>___TB) == ___BIG_ABASE_MIN_1)
2722
2723#define ___BIGAZEROP(x,i) \
2724(___BIGAFETCH(___BODY_AS(x,___tSUBTYPED),(i)>>___TB) == 0)
2725
2726#define ___BIGANEGATIVEP(x,i) \
2727(___BIGAFETCHSIGNED(___BODY_AS(x,___tSUBTYPED),(i)>>___TB) < 0)
2728
2729#define ___BIGTOFIX(x) \
2730(___BIGATEMP=___BIGAFETCH(___BODY_AS(x,___tSUBTYPED),0), \
2731 (___BIGATEMP == ___CAST(___BIGADIGIT,___INT(___FIX(___BIGATEMP))) ? ___FIX(___BIGATEMP) : ___FAL))
2732
2733
2734#define ___BIGACAT(x,i,hi,j,lo,k,divider) \
2735___BIGATEMP=((___BIGADIGIT)___BIGAFETCH(___BODY_AS(hi,___tSUBTYPED),(j)>>___TB) << ___INT(divider)) | \
2736            ((___BIGADIGIT)___BIGAFETCH(___BODY_AS(lo,___tSUBTYPED),(k)>>___TB) >> (___BIG_ABASE_WIDTH - ___INT(divider))); \
2737___BIGASTORE(___BODY_AS(x,___tSUBTYPED),(i)>>___TB,(___BIGADIGIT)___BIGATEMP);
2738
2739#define ___BIGAAND(x,i,y,j) \
2740___BIGATEMP= ___BIGAFETCH(___BODY_AS(x,___tSUBTYPED),(i)>>___TB) & ___BIGAFETCH(___BODY_AS(y,___tSUBTYPED),(j)>>___TB); \
2741___BIGASTORE(___BODY_AS(x,___tSUBTYPED),(i)>>___TB,(___BIGADIGIT)___BIGATEMP);
2742
2743#define ___BIGAIOR(x,i,y,j) \
2744___BIGATEMP= ___BIGAFETCH(___BODY_AS(x,___tSUBTYPED),(i)>>___TB) | ___BIGAFETCH(___BODY_AS(y,___tSUBTYPED),(j)>>___TB); \
2745___BIGASTORE(___BODY_AS(x,___tSUBTYPED),(i)>>___TB,(___BIGADIGIT)___BIGATEMP);
2746
2747#define ___BIGAXOR(x,i,y,j) \
2748___BIGATEMP= ___BIGAFETCH(___BODY_AS(x,___tSUBTYPED),(i)>>___TB) ^ ___BIGAFETCH(___BODY_AS(y,___tSUBTYPED),(j)>>___TB); \
2749___BIGASTORE(___BODY_AS(x,___tSUBTYPED),(i)>>___TB,(___BIGADIGIT)___BIGATEMP);
2750
2751#define ___BIGANOT(x,i) \
2752___BIGATEMP= ~___BIGAFETCH(___BODY_AS(x,___tSUBTYPED),(i)>>___TB); \
2753___BIGASTORE(___BODY_AS(x,___tSUBTYPED),(i)>>___TB,(___BIGADIGIT)___BIGATEMP);
2754
2755
2756
2757#define ___BIGNEGATIVEP(x) \
2758(___BIGAFETCHSIGNED(___BODY_AS(x,___tSUBTYPED),___FIXSUB(___BIGALENGTH(x),___FIX_1)>>___TB) < 0)
2759
2760#define ___BIGACOPY(result,i,y,j) \
2761___BIGASTORE(___BODY_AS(result,___tSUBTYPED),(i)>>___TB, \
2762___BIGAFETCH(___BODY_AS(y,___tSUBTYPED),(j)>>___TB));
2763
2764#define ___BIGAINC(x,i) \
2765(___BIGATEMP = (___BIGADIGIT)___BIGAFETCH(___BODY_AS(x,___tSUBTYPED),(i)>>___TB)+(___BIGADIGIT) 1, \
2766 ___BIGASTORE(___BODY_AS(x,___tSUBTYPED),(i)>>___TB,(___BIGADIGIT)___BIGATEMP), \
2767(___BIGATEMP == 0 ? ___FIX_1 : ___FIX_0))
2768
2769#define ___BIGADEC(x,i) \
2770(___BIGATEMP = (___BIGADIGIT)___BIGAFETCH(___BODY_AS(x,___tSUBTYPED),(i)>>___TB)-(___BIGADIGIT) 1, \
2771 ___BIGASTORE(___BODY_AS(x,___tSUBTYPED),(i)>>___TB,(___BIGADIGIT)___BIGATEMP), \
2772(___BIGATEMP == ___BIG_ABASE_MIN_1 ? ___FIX_1 : ___FIX_0))
2773
2774#define ___BIGAADD(result,i,y,j,carry) \
2775(carry ? (___BIGATEMP=(___BIGADIGIT)___BIGAFETCH(___BODY_AS(result,___tSUBTYPED),___INT(i))+ \
2776                      (___BIGADIGIT)___BIGAFETCH(___BODY_AS(     y,___tSUBTYPED),___INT(j))+ \
2777                      (___BIGADIGIT) 1, \
2778          ((___BIGADIGIT) ___BIGATEMP <= (___BIGADIGIT)___BIGAFETCH(___BODY_AS(result,___tSUBTYPED),___INT(i)) \
2779           ? \
2780           (___BIGASTORE(___BODY_AS(result,___tSUBTYPED),___INT(i),(___BIGADIGIT)___BIGATEMP), ___FIX_1) \
2781           : \
2782           (___BIGASTORE(___BODY_AS(result,___tSUBTYPED),___INT(i),(___BIGADIGIT)___BIGATEMP), ___FIX_0))) \
2783         : \
2784         (___BIGATEMP=(___BIGADIGIT)___BIGAFETCH(___BODY_AS(result,___tSUBTYPED),___INT(i))+ \
2785                      (___BIGADIGIT)___BIGAFETCH(___BODY_AS(     y,___tSUBTYPED),___INT(j)), \
2786          ((___BIGADIGIT) ___BIGATEMP < (___BIGADIGIT)___BIGAFETCH(___BODY_AS(result,___tSUBTYPED),___INT(i)) \
2787           ? \
2788           (___BIGASTORE(___BODY_AS(result,___tSUBTYPED),___INT(i),(___BIGADIGIT)___BIGATEMP), ___FIX_1) \
2789           : \
2790           (___BIGASTORE(___BODY_AS(result,___tSUBTYPED),___INT(i),(___BIGADIGIT)___BIGATEMP), ___FIX_0))))
2791
2792#define ___BIGASUB(result,i,y,j,borrow) \
2793(borrow ? (___BIGATEMP=(___BIGADIGIT)___BIGAFETCH(___BODY_AS(result,___tSUBTYPED),___INT(i))- \
2794                       (___BIGADIGIT)___BIGAFETCH(___BODY_AS(     y,___tSUBTYPED),___INT(j))- \
2795                       (___BIGADIGIT) 1, \
2796           ((___BIGADIGIT) ___BIGATEMP >= (___BIGADIGIT)___BIGAFETCH(___BODY_AS(result,___tSUBTYPED),___INT(i)) \
2797            ? \
2798            (___BIGASTORE(___BODY_AS(result,___tSUBTYPED),___INT(i),(___BIGADIGIT)___BIGATEMP), ___FIX_1) \
2799            : \
2800            (___BIGASTORE(___BODY_AS(result,___tSUBTYPED),___INT(i),(___BIGADIGIT)___BIGATEMP), ___FIX_0))) \
2801          : \
2802          (___BIGATEMP=(___BIGADIGIT)___BIGAFETCH(___BODY_AS(result,___tSUBTYPED),___INT(i))- \
2803                       (___BIGADIGIT)___BIGAFETCH(___BODY_AS(     y,___tSUBTYPED),___INT(j)), \
2804           ((___BIGADIGIT) ___BIGATEMP > (___BIGADIGIT)___BIGAFETCH(___BODY_AS(result,___tSUBTYPED),___INT(i)) \
2805            ? \
2806            (___BIGASTORE(___BODY_AS(result,___tSUBTYPED),___INT(i),(___BIGADIGIT)___BIGATEMP), ___FIX_1) \
2807            : \
2808            (___BIGASTORE(___BODY_AS(result,___tSUBTYPED),___INT(i),(___BIGADIGIT)___BIGATEMP), ___FIX_0))))
2809
2810#if ___BIG_MBASE_WIDTH == 16
2811
2812#ifdef ___BIG_ENDIAN
2813
2814#if ___BIG_ABASE_WIDTH == 64
2815#define ___BIG_END_MFLIP(x)((x)^___FIX(3))
2816#else
2817#define ___BIG_END_MFLIP(x)((x)^___FIX(1))
2818#endif
2819#else
2820#define ___BIG_END_MFLIP(x)(x)
2821#endif
2822
2823#define ___BIGMLENGTH(v) ___U16VECTORLENGTH(v)
2824#define ___BIGMFETCH(base,i) ___FETCH_U16(base,i)
2825#define ___BIGMSTORE(base,i,val) ___STORE_U16(base,i,val)
2826#define ___BIGMDIGIT ___U16
2827#define ___BIGMDOUBLEDIGIT ___U32
2828
2829#else
2830
2831#ifdef ___BIG_ENDIAN
2832#define ___BIG_END_MFLIP(x)((x)^___FIX(1))
2833#else
2834#define ___BIG_END_MFLIP(x)(x)
2835#endif
2836
2837#define ___BIGMLENGTH(v) ___U32VECTORLENGTH(v)
2838#define ___BIGMFETCH(base,i) ___FETCH_U32(base,i)
2839#define ___BIGMSTORE(base,i,val) ___STORE_U32(base,i,val)
2840#define ___BIGMDIGIT ___U32
2841#define ___BIGMDOUBLEDIGIT ___U64
2842
2843#endif
2844
2845#define ___BIG_MBASE ((___BIGMDOUBLEDIGIT)1 << ___BIG_MBASE_WIDTH)
2846
2847#define ___BIGMREF(x,j) \
2848___FIX(___BIGMFETCH(___BODY_AS(x,___tSUBTYPED),___BIG_END_MFLIP(j)>>___TB))
2849
2850#define ___BIGMSET(result,i,carry) \
2851___BIGMSTORE(___BODY_AS(result,___tSUBTYPED),___BIG_END_MFLIP(i)>>___TB,___INT(carry));
2852
2853#define ___BIGMMUL(result,i,y,j,multiplier,carry) \
2854     (___temp=(___BIGMDOUBLEDIGIT)___BIGMFETCH(___BODY_AS(result,___tSUBTYPED),___INT(___BIG_END_MFLIP(i))) \
2855      + (___BIGMDOUBLEDIGIT)___BIGMFETCH(___BODY_AS(y,___tSUBTYPED),___INT(___BIG_END_MFLIP(j))) \
2856      * (___BIGMDOUBLEDIGIT)___INT(multiplier) \
2857      + (___BIGMDOUBLEDIGIT)___INT(carry), \
2858      ___BIGMSTORE(___BODY_AS(result,___tSUBTYPED),___INT(___BIG_END_MFLIP(i)),(___BIGMDIGIT)___temp), \
2859      ___FIX((___BIGMDOUBLEDIGIT)___temp >> ___BIG_MBASE_WIDTH))
2860
2861#define ___BIGMDIV(u,i,v,k,q,borrow) \
2862     (___temp = (___BIGMDOUBLEDIGIT)___BIGMFETCH(___BODY_AS(u,___tSUBTYPED),___INT(___BIG_END_MFLIP(i))) \
2863                -(___BIGMDOUBLEDIGIT)___BIGMFETCH(___BODY_AS(v,___tSUBTYPED),___INT(___BIG_END_MFLIP(k))) \
2864                 * (___BIGMDOUBLEDIGIT)___INT(q) \
2865                 + (___BIGMDOUBLEDIGIT)___INT(borrow),\
2866      ___BIGMSTORE(___BODY_AS(u,___tSUBTYPED),___INT(___BIG_END_MFLIP(i)),((___BIGMDIGIT) ___temp)), \
2867      ___temp >>= ___BIG_MBASE_WIDTH, \
2868      (___temp > 0 ? ___FIX(___temp - ___BIG_MBASE) : ___FIX(___temp)))
2869
2870
2871#define ___BIGMQUO(u,j,v) \
2872___FIX((((___BIGMDOUBLEDIGIT)___BIGMFETCH(___BODY_AS(u,___tSUBTYPED),___INT(___BIG_END_MFLIP(j))) << ___BIG_MBASE_WIDTH) \
2873+___BIGMFETCH(___BODY_AS(u,___tSUBTYPED),___INT(___BIG_END_MFLIP(j-___FIX(1)))))/___INT(v))
2874
2875
2876#define ___BIGMREM(u,j,v,q) \
2877___FIX((((___BIGMDOUBLEDIGIT)___BIGMFETCH(___BODY_AS(u,___tSUBTYPED),___INT(___BIG_END_MFLIP(j))) << ___BIG_MBASE_WIDTH) \
2878+___BIGMFETCH(___BODY_AS(u,___tSUBTYPED),___INT(___BIG_END_MFLIP(j-___FIX(1))))) \
2879-((___BIGMDOUBLEDIGIT)___INT(v)*(___BIGMDOUBLEDIGIT)___INT(q)))
2880
2881#define ___BIGMTESTP(q,v,r,u) \
2882(((___BIGMDOUBLEDIGIT)___INT(v)*___INT(q))>((___BIGMDOUBLEDIGIT)___INT(r) << ___BIG_MBASE_WIDTH) +___INT(u))
2883
2884
2885
2886
2887#ifdef ___BIG_ENDIAN
2888
2889#if ___BIG_ABASE_WIDTH == 64
2890#define ___BIG_END_FFLIP(x)((x)^___FIX(7))
2891#else
2892#define ___BIG_END_FFLIP(x)((x)^___FIX(3))
2893#endif
2894
2895#else
2896
2897#define ___BIG_END_FFLIP(x)(x)
2898
2899#endif
2900
2901#define ___BIGFREF(x,j)___U8VECTORREF(x,___BIG_END_FFLIP(j))
2902
2903#define ___BIGFSET(result,i,carry)___U8VECTORSET(result,___BIG_END_FFLIP(i),carry)
2904
2905#define ___BIGFLENGTH(x)___U8VECTORLENGTH(x)
2906
2907/*---------------------------------------------------------------------------*/
2908
2909/* Inlinable operations (for 'apply' and 'ifjump' GVM instructions) */
2910
2911/* APPLY-able operations */
2912
2913#define ___TYPE(x)___FIX(___TYP(x))
2914#define ___TYPECAST(x,y)(((x)&~___TMASK)+___INT(y))
2915#define ___SUBTYPE(x)((___HEADER(x)&___SMASK)>>(___HTB-___TB))
2916#define ___SUBTYPESET(x,y)___temp=(x);___HEADER_SET(___temp,(___HEADER(___temp)&~___SMASK)+((y)<<(___HTB-___TB)));
2917
2918/* IFJUMP-able operations */
2919
2920#define ___FALSEP(x)((x)==___FAL)
2921#define ___NOTFALSEP(x)((x)!=___FAL)
2922#define ___BOOLEANP(x)(((x)&(___TRU-___tSPECIAL+___TMASK))==___TRU)
2923#define ___NULLP(x)((x)==___NUL)
2924#define ___FALSEORNULLP(x)(((x)&(___NUL-___tSPECIAL+___TMASK))==___NUL)
2925#define ___FALSEORVOIDP(x)(((x)&(___VOID-___tSPECIAL+___TMASK))==___VOID)
2926#define ___UNBOUNDP(x)(((___temp=(x))==___UNB1)||(___temp==___UNB2))
2927#define ___EQP(x,y)((x)==(y))
2928#define ___EOFP(x)((x)==___EOF)
2929
2930/* IFJUMP-able operations */
2931
2932#define ___FIXNUMP(x)___TESTTYPE(x,___tFIXNUM)
2933#define ___FLONUMP(x)___TESTSUBTYPE(x,___sFLONUM)
2934#define ___SPECIALP(x)___TESTTYPE(x,___tSPECIAL)
2935#if ___tPAIR == ___tSUBTYPED
2936#define ___PAIRP(x)___TESTSUBTYPE(x,___sPAIR)
2937#else
2938#define ___PAIRP(x)___TESTTYPE(x,___tPAIR)
2939#endif
2940#define ___MUTABLEP(obj)(___HD_TYP(___HEADER(obj))!=___PERM)
2941#define ___SUBTYPEDP(x)___TESTTYPE(x,___tSUBTYPED)
2942#define ___SUBTYPEDMUTABLEP(obj)(___HD_TYP(___SUBTYPED_HEADER(obj))!=___PERM)
2943#define ___SUBTYPEDVECTORP(x)___TESTSUBTYPETAG(x,___sVECTOR)
2944#define ___SUBTYPEDSYMBOLP(x)___TESTSUBTYPETAG(x,___sSYMBOL)
2945#define ___SUBTYPEDFLONUMP(x)___TESTSUBTYPETAG(x,___sFLONUM)
2946#define ___SUBTYPEDBIGNUMP(x)___TESTSUBTYPETAG(x,___sBIGNUM)
2947#define ___VECTORP(x)___TESTSUBTYPE(x,___sVECTOR)
2948#define ___RATNUMP(x)___TESTSUBTYPE(x,___sRATNUM)
2949#define ___CPXNUMP(x)___TESTSUBTYPE(x,___sCPXNUM)
2950#define ___EXACTINTP(x)(___FIXNUMP(x)||___BIGNUMP(x))
2951#define ___STRUCTUREP(x)___TESTSUBTYPE(x,___sSTRUCTURE)
2952#define ___BOXP(x)(___TYP((___temp=x))==___tSUBTYPED&&(___SUBTYPED_HEADER(___temp)&___LSMASK)==___MAKE_HD((___BOX_SIZE<<___LWS),___sBOXVALUES,0))
2953#define ___VALUESP(x)(___TYP((___temp=x))==___tSUBTYPED&&___TESTSUBTYPETAG(___temp,___sBOXVALUES)&&(___SUBTYPED_HEADER(___temp)&___LSMASK)!=___MAKE_HD((___BOX_SIZE<<___LWS),___sBOXVALUES,0))
2954#define ___MEROONP(x)___TESTSUBTYPE(x,___sMEROON)
2955#define ___JAZZP(x)___TESTSUBTYPE(x,___sJAZZ)
2956#define ___SYMBOLP(x)___TESTSUBTYPE(x,___sSYMBOL)
2957#define ___KEYWORDP(x)___TESTSUBTYPE(x,___sKEYWORD)
2958#define ___SYMKEYP(x)(___SYMBOLP(x)||___KEYWORDP(x))
2959#define ___FRAMEP(x)___TESTSUBTYPE(x,___sFRAME)
2960#define ___CONTINUATIONP(x)___TESTSUBTYPE(x,___sCONTINUATION)
2961#define ___PROMISEP(x)___TESTSUBTYPE(x,___sPROMISE)
2962#define ___WILLP(x)___TESTLENGTHSUBTYPE(x,(___WILL_SIZE<<___LWS),___sWEAK)
2963#define ___GCHASHTABLEP(x)(___TYP((___temp=(x)))==___tSUBTYPED&&___TESTHEADERTAG((___temp=___SUBTYPED_HEADER(___temp)),___sWEAK)&&(___temp&___LSMASK)!=___MAKE_HD((___WILL_SIZE<<___LWS),___sWEAK,0))
2964#define ___MEMALLOCATEDP(x)___MEM_ALLOCATED(x)
2965#define ___PROCEDUREP(x)___TESTSUBTYPE(x,___sPROCEDURE)
2966#define ___SUBPROCEDUREP(x) \
2967(___PROCEDUREP(x) && \
2968 ___LABEL_ENTRY_GET(x) == x && \
2969 !___TESTHEADERTAG(___SUBTYPED_TO_BODY(x)[-___LABEL_SIZE-1],___sVECTOR))
2970#define ___CLOSUREP(x) \
2971(___PROCEDUREP(x) && \
2972 ___HD_TYP(___SUBTYPED_HEADER(x)) != ___PERM)
2973#define ___RETURNP(x)___TESTSUBTYPE(x,___sRETURN)
2974#define ___FOREIGNP(x)___TESTSUBTYPE(x,___sFOREIGN)
2975#define ___STRINGP(x)___TESTSUBTYPE(x,___sSTRING)
2976#define ___S8VECTORP(x)___TESTSUBTYPE(x,___sS8VECTOR)
2977#define ___U8VECTORP(x)___TESTSUBTYPE(x,___sU8VECTOR)
2978#define ___S16VECTORP(x)___TESTSUBTYPE(x,___sS16VECTOR)
2979#define ___U16VECTORP(x)___TESTSUBTYPE(x,___sU16VECTOR)
2980#define ___S32VECTORP(x)___TESTSUBTYPE(x,___sS32VECTOR)
2981#define ___U32VECTORP(x)___TESTSUBTYPE(x,___sU32VECTOR)
2982#define ___S64VECTORP(x)___TESTSUBTYPE(x,___sS64VECTOR)
2983#define ___U64VECTORP(x)___TESTSUBTYPE(x,___sU64VECTOR)
2984#define ___F32VECTORP(x)___TESTSUBTYPE(x,___sF32VECTOR)
2985#define ___F64VECTORP(x)___TESTSUBTYPE(x,___sF64VECTOR)
2986#define ___BIGNUMP(x)___TESTSUBTYPE(x,___sBIGNUM)
2987#define ___CHARP(x)(___TYP((___temp=x))==___tSPECIAL&&___temp>=0)
2988#define ___NUMBERP(x)___COMPLEXP(x)
2989#define ___COMPLEXP(x)((___TYP((___temp=(x)))==___tFIXNUM)||(___TYP(___temp)==___tSUBTYPED&&((___temp=(___SUBTYPED_HEADER(___temp)&___SMASK))==(___sFLONUM<<___HTB)||___temp==(___sBIGNUM<<___HTB)||___temp==(___sRATNUM<<___HTB)||___temp==(___sCPXNUM<<___HTB))))
2990
2991#define ___OBJECTBEFOREP(x,y)((x)<(y))
2992
2993/* APPLY-able operations */
2994
2995#define ___FIX_0 ___FIX(0)
2996#define ___FIXPOS(x)((___WORD)(x))
2997#define ___FIXMAX(x,y)(((x)<(y))?(y):(x))
2998#define ___FIXMIN(x,y)(((x)<(y))?(x):(y))
2999
3000#define ___FIXWRAPADD(x,y)___CAST(___WORD,___CAST(___UWORD,x)+___CAST(___UWORD,y))
3001#define ___FIXADD(x,y)((___WORD)((x)+(y)))
3002
3003#ifdef ___USE_builtin_op_overflow
3004#define ___FIXADDP_NOTFALSEP(var,x,y)!___EXPECT_FALSE(__builtin_add_overflow((___WORD)(x),(___WORD)(y),&var))
3005#else
3006#define ___FIXADDP_NOTFALSEP(var,x,y)(___temp=___FIXWRAPADD(x,y),___EXPECT_FALSE(((___temp^(x))&(___temp^(y)))<0)?0:(var=___temp,1))
3007#endif
3008#define ___FIXADDP(x,y)(___FIXADDP_NOTFALSEP(___temp,x,y)?___temp:___FAL)
3009
3010#define ___FIX_1 ___FIX(1)
3011#define ___FIXWRAPMUL(x,y)___CAST(___WORD,___CAST(___UWORD,x)*___CAST(___UWORD,___INT(y)))
3012#define ___FIXMUL(x,y)((___WORD)((x)*___INT(y)))
3013
3014#ifdef ___USE_builtin_op_overflow
3015#define ___FIXMULP_NOTFALSEP(var,x,y)!___EXPECT_FALSE(__builtin_mul_overflow((___WORD)(x),___INT(y),&var))
3016#else
3017#define ___FIXMULP_NOTFALSEP(var,x,y)(___EXPECT_FALSE(___FIXQUO((___temp=___FIXWRAPMUL(x,y)),y)!=(x))?0:(var=___temp,1))
3018#endif
3019#define ___FIXMULP(x,y)(___FIXMULP_NOTFALSEP(___temp,x,y)?___temp:___FAL)
3020
3021#define ___FIXWRAPSQUARE(x)___FIXWRAPMUL(x,x)
3022#define ___FIXSQUARE(x)___FIXMUL(x,x)
3023#define ___FIXSQUAREP_NOTFALSEP(var,x)(___EXPECT_FALSE(___CAST(___UWORD,x)+___CAST(___UWORD,___FIX(___SQRT_MAX_FIX))>(___CAST(___UWORD,___FIX(___SQRT_MAX_FIX))<<1))?0:(var=___FIXSQUARE(x),1))
3024#define ___FIXSQUAREP(x)(___FIXSQUAREP_NOTFALSEP(___temp,x)?___temp:___FAL)
3025
3026#define ___FIXWRAPNEG(x)___CAST(___WORD,-___CAST(___UWORD,x))
3027#define ___FIXNEG(x)((___WORD)(-(x)))
3028#define ___FIXNEGP_NOTFALSEP(var,x)(___EXPECT_FALSE((x)==___FIX(___MIN_FIX))?0:(var=___FIXNEG(x),1))
3029#define ___FIXNEGP(x)(___EXPECT_FALSE((x)==___FIX(___MIN_FIX))?___FAL:___FIXNEG(x))
3030
3031#define ___FIXWRAPSUB(x,y)___CAST(___WORD,___CAST(___UWORD,x)-___CAST(___UWORD,y))
3032#define ___FIXSUB(x,y)((___WORD)((x)-(y)))
3033
3034#ifdef ___USE_builtin_op_overflow
3035#define ___FIXSUBP_NOTFALSEP(var,x,y)!___EXPECT_FALSE(__builtin_sub_overflow((___WORD)(x),(___WORD)(y),&var))
3036#else
3037#define ___FIXSUBP_NOTFALSEP(var,x,y)(___temp=___FIXWRAPSUB(x,y),___EXPECT_FALSE(((___temp^(x))&((y)^(x)))<0)?0:(var=___temp,1))
3038#endif
3039#define ___FIXSUBP(x,y)(___FIXSUBP_NOTFALSEP(___temp,x,y)?___temp:___FAL)
3040
3041#define ___FIXWRAPQUO(x,y)((y)==___FIX(-1)?___FIXWRAPNEG(x):___FIXQUO(x,y))
3042#define ___FIXQUO(x,y)___FIX(((x)/(y)))
3043
3044#define ___FIXREM(x,y)((___WORD)((x)%(y)))/****is this ok?*******/
3045#define ___FIXMOD(x,y)((___temp=___FIXREM((___ps->temp1=x),(___ps->temp2=y)))==0?___FIX(0):((___ps->temp1<0)==(___ps->temp2<0)?___temp:___FIXADD(___temp,___ps->temp2)))
3046#define ___FIXNOT(x)((___WORD)((x)^~___TMASK))
3047#define ___FIXAND(x,y)((___WORD)((x)&(y)))
3048#define ___FIX_M1 ___FIX(-1)
3049#define ___FIXIOR(x,y)((___WORD)((x)|(y)))
3050#define ___FIXXOR(x,y)((___WORD)((x)^(y)))
3051#define ___FIXIF(x,y,z)((___WORD)(((x)&(y))|(~(x)&(z))))
3052
3053#define ___FIXWRAPABS(x)((x)<0?___FIXWRAPNEG(x):(x))
3054#define ___FIXABS(x)((x)<0?___FIXNEG(x):(x))
3055#define ___FIXABSP_NOTFALSEP(var,x)((x)<0?(___EXPECT_FALSE((x)==___FIX(___MIN_FIX))?0:(var=___FIXNEG(x),1)):(var=(x),1))
3056#define ___FIXABSP(x)((x)<0?(___EXPECT_FALSE((x)==___FIX(___MIN_FIX))?___FAL:___FIXNEG(x)):(x))
3057
3058#if ___SCMOBJ_WIDTH == 32
3059#define ___SCMOBJ_MASK(x,y)y
3060#define ___BITCOUNT_TEMP() \
3061(___temp=(___temp&___SCMOBJ_MASK(0x55555555,0x55555555))+ \
3062         ((___temp>>1)&___SCMOBJ_MASK(0x55555555,0x55555555)), \
3063 ___temp=(___temp&___SCMOBJ_MASK(0x33333333,0x33333333))+ \
3064         ((___temp>>2)&___SCMOBJ_MASK(0x33333333,0x33333333)), \
3065 ___temp=(___temp&___SCMOBJ_MASK(0x0f0f0f0f,0x0f0f0f0f))+ \
3066         ((___temp>>4)&___SCMOBJ_MASK(0x0f0f0f0f,0x0f0f0f0f)), \
3067 ___temp=___temp+(___temp>>8), \
3068 ___temp=___temp+(___temp>>16), \
3069 ___FIX(___temp&0xff))
3070#define ___FIXLENGTH(x) \
3071(((___temp=___INT(x))<0)&&(___temp=~___temp), \
3072 ___temp|=(___temp>>1), \
3073 ___temp|=(___temp>>2), \
3074 ___temp|=(___temp>>4), \
3075 ___temp|=(___temp>>8), \
3076 ___temp|=(___temp>>16), \
3077 ___BITCOUNT_TEMP())
3078#define ___FIXFIRSTBITSET(x) \
3079(((___temp=(x))==0) \
3080 ?___FIX(-1) \
3081 :(___temp=(___temp&-___temp), \
3082   ___FIX((((___temp&~___SCMOBJ_MASK(0x55555555,0x55555555))!=0)| \
3083           (((___temp&~___SCMOBJ_MASK(0x33333333,0x33333333))!=0)<<1)| \
3084           (((___temp&~___SCMOBJ_MASK(0x0f0f0f0f,0x0f0f0f0f))!=0)<<2)| \
3085           (((___temp&~___SCMOBJ_MASK(0x00ff00ff,0x00ff00ff))!=0)<<3)| \
3086           (((___temp&~___SCMOBJ_MASK(0x0000ffff,0x0000ffff))!=0)<<4))-___TB)))
3087#else
3088#define ___SCMOBJ_MASK(x,y)((___CAST(___SCMOBJ,x)<<32)|y)
3089#define ___BITCOUNT_TEMP() \
3090(___temp=((___temp)&___SCMOBJ_MASK(0x55555555,0x55555555))+ \
3091         (((___temp)>>1)&___SCMOBJ_MASK(0x55555555,0x55555555)), \
3092 ___temp=(___temp&___SCMOBJ_MASK(0x33333333,0x33333333))+ \
3093         ((___temp>>2)&___SCMOBJ_MASK(0x33333333,0x33333333)), \
3094 ___temp=(___temp&___SCMOBJ_MASK(0x0f0f0f0f,0x0f0f0f0f))+ \
3095         ((___temp>>4)&___SCMOBJ_MASK(0x0f0f0f0f,0x0f0f0f0f)), \
3096 ___temp=___temp+(___temp>>8), \
3097 ___temp=___temp+(___temp>>16), \
3098 ___temp=___temp+(___temp>>32), \
3099 ___FIX(___temp&0xff))
3100#define ___FIXLENGTH(x) \
3101(((___temp=___INT(x))<0)&&(___temp=~___temp), \
3102 ___temp|=(___temp>>1), \
3103 ___temp|=(___temp>>2), \
3104 ___temp|=(___temp>>4), \
3105 ___temp|=(___temp>>8), \
3106 ___temp|=(___temp>>16), \
3107 ___temp|=(___temp>>32), \
3108 ___BITCOUNT_TEMP())
3109#define ___FIXFIRSTBITSET(x) \
3110(((___temp=(x))==0) \
3111 ?___FIX(-1) \
3112 :(___temp=(___temp&-___temp), \
3113   ___FIX((((___temp&~___SCMOBJ_MASK(0x55555555,0x55555555))!=0)| \
3114           (((___temp&~___SCMOBJ_MASK(0x33333333,0x33333333))!=0)<<1)| \
3115           (((___temp&~___SCMOBJ_MASK(0x0f0f0f0f,0x0f0f0f0f))!=0)<<2)| \
3116           (((___temp&~___SCMOBJ_MASK(0x00ff00ff,0x00ff00ff))!=0)<<3)| \
3117           (((___temp&~___SCMOBJ_MASK(0x0000ffff,0x0000ffff))!=0)<<4)| \
3118           (((___temp&~___SCMOBJ_MASK(0x00000000,0xffffffff))!=0)<<5))-___TB)))
3119#endif
3120#define ___FIXBITCOUNT(x) \
3121((((___temp=___INT(x))<0)&&(___temp=~___temp)),___BITCOUNT_TEMP())
3122#define ___FIXBITSETP(x,y)((y)&(___CAST(___SCMOBJ,1)<<(___INT(x)+___TB)))
3123
3124#define ___FIXWRAPASH(x,y)___FIXASH(x,y)
3125#define ___FIXWRAPASHP(x,y)((y)<___FIX(0)?((y)>=___FIX(-___FIX_WIDTH)?___FIXASHR(x,-(y)):___FAL):((y)<=___FIX(___FIX_WIDTH)?___FIXWRAPASHL(x,y):___FAL))
3126#define ___FIXASH(x,y)((y)<___FIX(0)?___FIXASHR(x,(y)>=___FIX(-___FIX_WIDTH)?-(y):___FIX(___FIX_WIDTH)):___FIXASHL(x,(y)<=___FIX(___FIX_WIDTH)?(y):___FIX(___FIX_WIDTH)))
3127#define ___FIXASHP(x,y)((y)<___FIX(0)?((y)>=___FIX(-___FIX_WIDTH)?___FIXASHR(x,-(y)):___FAL):((y)<=___FIX(___FIX_WIDTH)?___FIXASHLP2(x,y):___FAL))
3128#define ___FIXWRAPASHL(x,y)___FIXASHL(x,y)
3129#define ___FIXWRAPASHLP(x,y)((y)>=___FIX(0)&&(y)<=___FIX(___FIX_WIDTH)?___FIXWRAPASHL(x,y):___FAL)
3130#define ___FIXASHL(x,y)___CAST(___WORD,___CAST(___UWORD,x)<<___INT(y))
3131#define ___FIXASHLP(x,y)((y)>=___FIX(0)&&(y)<=___FIX(___FIX_WIDTH)?___FIXASHLP2(x,y):___FAL)
3132#define ___FIXASHLP2(x,y)((x)==((___temp=___FIXASHL(x,y))>>___INT(y))?___temp:___FAL)
3133#define ___FIXWRAPASHR(x,y)___FIXASHR(x,y)
3134#define ___FIXASHR(x,y)(((x)>>___INT(y))&~___TMASK)
3135#define ___FIXASHRP(x,y)((y)>=___FIX(0)?___FIXASHR(x,(y)<=___FIX(___FIX_WIDTH)?(y):___FIX(___FIX_WIDTH)):___FAL)
3136#define ___FIXWRAPLSHR(x,y)((___WORD)(((___UWORD)(x)>>___INT(y))&~___TMASK))
3137#define ___FIXWRAPLSHRP(x,y)((y)>=___FIX(0)?___FIXWRAPLSHR(x,(y)<=___FIX(___FIX_WIDTH)?(y):___FIX(___FIX_WIDTH)):___FAL)
3138#define ___FIXLSHR(x,y)___FIXWRAPLSHR(x,y) /*TODO: remove*/
3139#define ___FIXLSHRP(x,y)___FIXWRAPLSHRP(x,y) /*TODO: remove*/
3140#define ___FIXTOCHR(x)(((x)&~___TMASK)+___tSPECIAL)
3141#define ___FIXFROMCHR(x)((x)&~___TMASK)
3142
3143/*
3144 * The following definitions must match the structure of ports defined
3145 * in _io#.scm .
3146 */
3147
3148#define ___PORT_MUTEX                1
3149#define ___PORT_RKIND                2
3150#define ___PORT_WKIND                3
3151#define ___PORT_NAME                 4
3152#define ___PORT_WAIT                 5
3153#define ___PORT_CLOSE                6
3154#define ___PORT_ROPTIONS             7
3155#define ___PORT_RTIMEOUT             8
3156#define ___PORT_RTIMEOUT_THUNK       9
3157#define ___PORT_SET_RTIMEOUT         10
3158#define ___PORT_WOPTIONS             11
3159#define ___PORT_WTIMEOUT             12
3160#define ___PORT_WTIMEOUT_THUNK       13
3161#define ___PORT_SET_WTIMEOUT         14
3162#define ___PORT_IO_EXCEPTION_HANDLER 15
3163
3164#define ___PORT_OBJECT_READ_DATUM    16
3165#define ___PORT_OBJECT_WRITE_DATUM   17
3166#define ___PORT_OBJECT_NEWLINE       18
3167#define ___PORT_OBJECT_FORCE_OUTPUT  19
3168
3169#define ___PORT_OBJECT_OTHER1        20
3170#define ___PORT_OBJECT_OTHER2        21
3171#define ___PORT_OBJECT_OTHER3        22
3172
3173#define ___PORT_CHAR_RBUF            20
3174#define ___PORT_CHAR_RLO             21
3175#define ___PORT_CHAR_RHI             22
3176#define ___PORT_CHAR_RCHARS          23
3177#define ___PORT_CHAR_RLINES          24
3178#define ___PORT_CHAR_RCURLINE        25
3179#define ___PORT_CHAR_RBUF_FILL       26
3180#define ___PORT_CHAR_PEEK_EOFP       27
3181
3182#define ___PORT_CHAR_WBUF            28
3183#define ___PORT_CHAR_WLO             29
3184#define ___PORT_CHAR_WHI             30
3185#define ___PORT_CHAR_WCHARS          31
3186#define ___PORT_CHAR_WLINES          32
3187#define ___PORT_CHAR_WCURLINE        33
3188#define ___PORT_CHAR_WBUF_DRAIN      34
3189#define ___PORT_INPUT_READTABLE      35
3190#define ___PORT_OUTPUT_READTABLE     36
3191#define ___PORT_OUTPUT_WIDTH         37
3192
3193#define ___PORT_CHAR_OTHER1          38
3194#define ___PORT_CHAR_OTHER2          39
3195#define ___PORT_CHAR_OTHER3          40
3196#define ___PORT_CHAR_OTHER4          41
3197#define ___PORT_CHAR_OTHER5          42
3198
3199#define ___PORT_BYTE_RBUF            38
3200#define ___PORT_BYTE_RLO             39
3201#define ___PORT_BYTE_RHI             40
3202#define ___PORT_BYTE_RBUF_FILL       41
3203
3204#define ___PORT_BYTE_WBUF            42
3205#define ___PORT_BYTE_WLO             43
3206#define ___PORT_BYTE_WHI             44
3207#define ___PORT_BYTE_WBUF_DRAIN      45
3208
3209#define ___PORT_BYTE_OTHER1          46
3210#define ___PORT_BYTE_OTHER2          47
3211
3212#define ___PORT_RDEVICE_CONDVAR      46
3213#define ___PORT_WDEVICE_CONDVAR      47
3214
3215#define ___PORT_DEVICE_OTHER1        48
3216#define ___PORT_DEVICE_OTHER2        49
3217
3218#define ___DENV_INPUT_PORT  5
3219#define ___DENV_OUTPUT_PORT 6
3220
3221#define ___PEEKCHAR0P \
3222{ ___SCMOBJ port = ___CDR(___FIELD(___FIELD(___CURRENTTHREAD,___THREAD_DENV),___DENV_INPUT_PORT)); \
3223  ___PEEKCHAR1P(port) \
3224}
3225
3226#define ___PEEKCHAR1P(port) \
3227{ ___SCMOBJ rlo; \
3228  ___SCMOBJ rhi; \
3229  ___SCMOBJ mutex = ___FIELD(port,___PORT_MUTEX); \
3230  if (___PRIMITIVETRYLOCK(mutex,___FIX(___OBJ_LOCK1),___FIX(___OBJ_LOCK2))) \
3231    { \
3232      rlo = ___FIELD(port,___PORT_CHAR_RLO); \
3233      rhi = ___FIELD(port,___PORT_CHAR_RHI); \
3234      if (___FIXGE(rlo,rhi) || ___CHAREQP((___temp = ___STRINGREF(___FIELD(port,___PORT_CHAR_RBUF),rlo)),___CHR(10))) \
3235        ___temp = ___FAL; \
3236      ___PRIMITIVEUNLOCK(mutex,___FIX(___OBJ_LOCK1),___FIX(___OBJ_LOCK2)) \
3237    } \
3238  else \
3239    ___temp = ___FAL; \
3240}
3241
3242#define ___READCHAR0P \
3243{ ___SCMOBJ port = ___CDR(___FIELD(___FIELD(___CURRENTTHREAD,___THREAD_DENV),___DENV_INPUT_PORT)); \
3244  ___READCHAR1P(port) \
3245}
3246
3247#define ___READCHAR1P(port) \
3248{ ___SCMOBJ rlo; \
3249  ___SCMOBJ rhi; \
3250  ___SCMOBJ mutex = ___FIELD(port,___PORT_MUTEX); \
3251  if (___PRIMITIVETRYLOCK(mutex,___FIX(___OBJ_LOCK1),___FIX(___OBJ_LOCK2))) \
3252    { \
3253      rlo = ___FIELD(port,___PORT_CHAR_RLO); \
3254      rhi = ___FIELD(port,___PORT_CHAR_RHI); \
3255      if (___FIXGE(rlo,rhi) || ___CHAREQP((___temp = ___STRINGREF(___FIELD(port,___PORT_CHAR_RBUF),rlo)),___CHR(10))) \
3256        ___temp = ___FAL; \
3257      else \
3258        ___FIELD(port,___PORT_CHAR_RLO) = ___FIXADD(rlo,___FIX(1L)); \
3259      ___PRIMITIVEUNLOCK(mutex,___FIX(___OBJ_LOCK1),___FIX(___OBJ_LOCK2)) \
3260    } \
3261  else \
3262    ___temp = ___FAL; \
3263}
3264
3265#define ___WRITECHAR1P(c) \
3266{ ___SCMOBJ port = ___CDR(___FIELD(___FIELD(___CURRENTTHREAD,___THREAD_DENV),___DENV_OUTPUT_PORT)); \
3267  ___WRITECHAR2P(c,port) \
3268}
3269
3270#define ___WRITECHAR2P(c,port) \
3271if (___CHAREQP(c,___CHR(10)) || ___FIXLT(___FIXAND(___FIELD(port,___PORT_WOPTIONS),___FIX(2047L)),___FIX(1024L))) \
3272  ___temp = ___FAL; \
3273else \
3274  { \
3275    ___SCMOBJ wbuf; \
3276    ___SCMOBJ whi; \
3277    ___SCMOBJ mutex = ___FIELD(port,___PORT_MUTEX); \
3278    if (___PRIMITIVETRYLOCK(mutex,___FIX(___OBJ_LOCK1),___FIX(___OBJ_LOCK2))) \
3279      { \
3280        wbuf = ___FIELD(port,___PORT_CHAR_WBUF); \
3281        whi = ___FIXADD(___FIELD(port,___PORT_CHAR_WHI),___FIX(1L)); \
3282        if (___FIXGE(whi,___STRINGLENGTH(wbuf))) \
3283          ___temp = ___FAL; \
3284        else \
3285          { \
3286            ___STRINGSET(wbuf,___FIXSUB(whi,___FIX(1L)),c) \
3287            ___FIELD(port,___PORT_CHAR_WHI) = whi; \
3288            ___temp = ___VOID; \
3289          } \
3290        ___PRIMITIVEUNLOCK(mutex,___FIX(___OBJ_LOCK1),___FIX(___OBJ_LOCK2)) \
3291      } \
3292    else \
3293      ___temp = ___FAL; \
3294  }
3295
3296/* IFJUMP-able operations */
3297
3298#define ___FIXZEROP(x)((x)==0)
3299#define ___FIXPOSITIVEP(x)((x)>0)
3300#define ___FIXNEGATIVEP(x)((x)<0)
3301#define ___FIXODDP(x)((x)&___FIX(1))
3302#define ___FIXEVENP(x)!((x)&___FIX(1))
3303#define ___FIXEQ(x,y)((x)==(y))
3304#define ___FIXLT(x,y)((x)<(y))
3305#define ___FIXGT(x,y)((x)>(y))
3306#define ___FIXLE(x,y)((x)<=(y))
3307#define ___FIXGE(x,y)((x)>=(y))
3308
3309/* APPLY-able operations */
3310
3311#define ___F64TOFIX(x)___FIX(___CAST(___WORD,x))
3312#define ___F64FROMFIX(x)___INT(x)
3313#define ___F64_0 0.0
3314#define ___F64POS(x)x
3315#define ___F64MAX(x,y)(___F64NANP(x)?x:(((x)>(y))?(x):(y)))
3316#define ___F64MIN(x,y)(___F64NANP(x)?x:(((x)<(y))?(x):(y)))
3317#define ___F64ADD(x,y)((x)+(y))
3318#define ___F64_1 1.0
3319#define ___F64MUL(x,y)((x)*(y))
3320#define ___F64SQUARE(x)((x)*(x))
3321#define ___F64NEG(x)(-(x))
3322#define ___F64SUB(x,y)((x)-(y))
3323#define ___F64INV(x)(1.0/(x))
3324#define ___F64DIV(x,y)((x)/(y))
3325#define ___F64ABS(x)___CLIBEXT(fabs)(x)
3326#define ___F64FLOOR(x)___CLIBEXT(floor)(x)
3327#define ___F64CEILING(x)___CLIBEXT(ceil)(x)
3328#define ___F64TRUNCATE(x)___EXT(___trunc)(x)
3329#define ___F64ROUND(x)___EXT(___round)(x)
3330#ifdef ___HAVE_GOOD_SCALBN
3331#define ___F64SCALBN(x,n)___CLIBEXT(scalbn)(x,___INT(n))
3332#else
3333#define ___F64SCALBN(x,n)___EXT(___scalbn)(x,___INT(n))
3334#endif
3335#ifdef ___HAVE_GOOD_ILOGB
3336#define ___F64ILOGB(x)___FIX(___CLIBEXT(ilogb)(x))
3337#else
3338#define ___F64ILOGB(x)___FIX(___EXT(___ilogb)(x))
3339#endif
3340#define ___F64EXP(x)___CLIBEXT(exp)(x)
3341#ifdef ___HAVE_GOOD_EXPM1
3342#define ___F64EXPM1(x)___CLIBEXT(expm1)(x)
3343#else
3344#define ___F64EXPM1(x)___EXT(___expm1)(x)
3345#endif
3346#define ___F64LOG(x)___CLIBEXT(log)(x)
3347#ifdef ___HAVE_GOOD_LOG1P
3348#define ___F64LOG1P(x)___CLIBEXT(log1p)(x)
3349#else
3350#define ___F64LOG1P(x)___EXT(___log1p)(x)
3351#endif
3352#define ___F64SIN(x)___CLIBEXT(sin)(x)
3353#define ___F64COS(x)___CLIBEXT(cos)(x)
3354#define ___F64TAN(x)___CLIBEXT(tan)(x)
3355#define ___F64ASIN(x)___CLIBEXT(asin)(x)
3356#define ___F64ACOS(x)___CLIBEXT(acos)(x)
3357#define ___F64ATAN(x)___CLIBEXT(atan)(x)
3358#ifdef ___HAVE_GOOD_SINH
3359#define ___F64SINH(x)___CLIBEXT(sinh)(x)
3360#else
3361#define ___F64SINH(x)___EXT(___sinh)(x)
3362#endif
3363#ifdef ___HAVE_GOOD_COSH
3364#define ___F64COSH(x)___CLIBEXT(cosh)(x)
3365#else
3366#define ___F64COSH(x)___EXT(___cosh)(x)
3367#endif
3368#ifdef ___HAVE_GOOD_TANH
3369#define ___F64TANH(x)___CLIBEXT(tanh)(x)
3370#else
3371#define ___F64TANH(x)___EXT(___tanh)(x)
3372#endif
3373#ifdef ___HAVE_GOOD_ASINH
3374#define ___F64ASINH(x)___CLIBEXT(asinh)(x)
3375#else
3376#define ___F64ASINH(x)___EXT(___asinh)(x)
3377#endif
3378#ifdef ___HAVE_GOOD_ACOSH
3379#define ___F64ACOSH(x)___CLIBEXT(acosh)(x)
3380#else
3381#define ___F64ACOSH(x)___EXT(___acosh)(x)
3382#endif
3383#ifdef ___HAVE_GOOD_ATANH
3384#define ___F64ATANH(x)___CLIBEXT(atanh)(x)
3385#else
3386#define ___F64ATANH(x)___EXT(___atanh)(x)
3387#endif
3388#ifdef ___HAVE_GOOD_ATAN2
3389#define ___F64ATAN2(y,x)___CLIBEXT(atan2)(y,x)
3390#else
3391#define ___F64ATAN2(y,x)___EXT(___atan2)(y,x)
3392#endif
3393#ifdef ___HAVE_GOOD_POW
3394#define ___F64EXPT(x,y)___CLIBEXT(pow)(x,y)
3395#else
3396#define ___F64EXPT(x,y)___EXT(___pow)(x,y)
3397#endif
3398#define ___F64SQRT(x)___CLIBEXT(sqrt)(x)
3399#define ___F64COPYSIGN(x,y)___EXT(___copysign)(x,y)
3400
3401#define ___F64TOSTRING(x) \
3402(___W_HEAP_EXPR, \
3403 ___temp=___EXT(___F64_to_STRING) (___PSP x), \
3404 ___R_HEAP_EXPR, \
3405 ___temp)
3406
3407/* IFJUMP-able operations */
3408
3409#define ___F64INTEGERP(x)(!___F64INFINITEP(x) && (x)==___F64FLOOR(x))
3410#define ___F64ZEROP(x)((x)==0.0)
3411#define ___F64POSITIVEP(x)((x)>0.0)
3412#define ___F64NEGATIVEP(x)((x)<0.0)
3413#define ___F64ODDP(x)(___F64INTEGERP(x) && (x)!=2.0*___F64FLOOR((x)*0.5))
3414#define ___F64EVENP(x)(___F64INTEGERP(x) && (x)==2.0*___F64FLOOR((x)*0.5))
3415#define ___F64FINITEP(x)___EXT(___isfinite)(x)
3416#define ___F64INFINITEP(x)((x)!=0.0 && (x)==2.0*(x))
3417#ifdef ___USE_ISNAN
3418#define ___F64NANP(x)___EXT(___isnan)(x)
3419#else
3420#define ___F64NANP(x)((x)!=(x))
3421#endif
3422#if ___SCMOBJ_WIDTH == 32
3423#define ___F64FROMFIXEXACTP(x)(1)
3424#else
3425#define ___F64FROMFIXEXACTP(x)(___INT(x)==(___WORD)(___F64)___INT(x))
3426#endif
3427#define ___F64EQ(x,y)((x)==(y))
3428#define ___F64LT(x,y)((x)<(y))
3429#define ___F64GT(x,y)((x)>(y))
3430#define ___F64LE(x,y)((x)<=(y))
3431#define ___F64GE(x,y)((x)>=(y))
3432#ifdef ___BUILTIN_64BIT_INT_TYPE
3433#define ___F64EQV(x,y)(___ps->f64_temp1=(x),___ps->f64_temp2=(y),*___CAST(___U64*,&___ps->f64_temp1)==*___CAST(___U64*,&___ps->f64_temp2))
3434#else
3435#define ___F64EQV(x,y)(___ps->f64_temp1=(x),___ps->f64_temp2=(y),___U64_hi32((*___CAST(___U64*,&___ps->f64_temp1)))==___U64_hi32((*___CAST(___U64*,&___ps->f64_temp2)))&&___U64_lo32((*___CAST(___U64*,&___ps->f64_temp1)))==___U64_lo32((*___CAST(___U64*,&___ps->f64_temp2))))
3436#endif
3437
3438/* IFJUMP-able operations */
3439
3440#define ___CHAREQP(x,y)((x)==(y))
3441#define ___CHARLTP(x,y)((x)<(y))
3442#define ___CHARGTP(x,y)((x)>(y))
3443#define ___CHARLEP(x,y)((x)<=(y))
3444#define ___CHARGEP(x,y)((x)>=(y))
3445
3446#define ___CHARALPHABETICP(x)___EXT(___iswalpha)(___INT(x))
3447#define ___CHARNUMERICP(x)___EXT(___iswdigit)(___INT(x))
3448#define ___CHARWHITESPACEP(x)___EXT(___iswspace)(___INT(x))
3449#define ___CHARUPPERCASEP(x)___EXT(___iswupper)(___INT(x))
3450#define ___CHARLOWERCASEP(x)___EXT(___iswlower)(___INT(x))
3451#define ___CHARUPCASE(x)___CHR(___EXT(___towupper)(___INT(x)))
3452#define ___CHARDOWNCASE(x)___CHR(___EXT(___towlower)(___INT(x)))
3453
3454/* APPLY-able operations */
3455
3456#define ___PAIR_SIZE 2
3457#define ___PAIR_CDR 0
3458#define ___PAIR_CAR 1
3459
3460#define ___CAR_FIELD(obj)___PAIR_TO_BODY(obj)[___PAIR_CAR]
3461#define ___CDR_FIELD(obj)___PAIR_TO_BODY(obj)[___PAIR_CDR]
3462
3463#define ___ALLOC_PAIR_EXPR(x,y)(___BEGIN_ALLOC_PAIR(), \
3464___ADD_PAIR_ELEM(___PAIR_CAR,x), \
3465___ADD_PAIR_ELEM(___PAIR_CDR,y), \
3466___END_ALLOC_PAIR())
3467#define ___ALLOC_PAIR(x,y){___BEGIN_ALLOC_PAIR(); \
3468___ADD_PAIR_ELEM(___PAIR_CAR,x); \
3469___ADD_PAIR_ELEM(___PAIR_CDR,y); \
3470___END_ALLOC_PAIR();}
3471
3472#define ___CONS(x,y)(___ALLOC_PAIR_EXPR(x,y),___GET_PAIR())
3473
3474#define ___SETCAR(obj,car)___CAR_FIELD(obj)=car;
3475#define ___SETCDR(obj,cdr)___CDR_FIELD(obj)=cdr;
3476#define ___CAR(obj)___CAR_FIELD(obj)
3477#define ___CDR(obj)___CDR_FIELD(obj)
3478#define ___CAAR(obj)___CAR(___CAR(obj))
3479#define ___CADR(obj)___CAR(___CDR(obj))
3480#define ___CDAR(obj)___CDR(___CAR(obj))
3481#define ___CDDR(obj)___CDR(___CDR(obj))
3482#define ___CAAAR(obj)___CAR(___CAR(___CAR(obj)))
3483#define ___CAADR(obj)___CAR(___CAR(___CDR(obj)))
3484#define ___CADAR(obj)___CAR(___CDR(___CAR(obj)))
3485#define ___CADDR(obj)___CAR(___CDR(___CDR(obj)))
3486#define ___CDAAR(obj)___CDR(___CAR(___CAR(obj)))
3487#define ___CDADR(obj)___CDR(___CAR(___CDR(obj)))
3488#define ___CDDAR(obj)___CDR(___CDR(___CAR(obj)))
3489#define ___CDDDR(obj)___CDR(___CDR(___CDR(obj)))
3490#define ___CAAAAR(obj)___CAR(___CAR(___CAR(___CAR(obj))))
3491#define ___CAAADR(obj)___CAR(___CAR(___CAR(___CDR(obj))))
3492#define ___CAADAR(obj)___CAR(___CAR(___CDR(___CAR(obj))))
3493#define ___CAADDR(obj)___CAR(___CAR(___CDR(___CDR(obj))))
3494#define ___CADAAR(obj)___CAR(___CDR(___CAR(___CAR(obj))))
3495#define ___CADADR(obj)___CAR(___CDR(___CAR(___CDR(obj))))
3496#define ___CADDAR(obj)___CAR(___CDR(___CDR(___CAR(obj))))
3497#define ___CADDDR(obj)___CAR(___CDR(___CDR(___CDR(obj))))
3498#define ___CDAAAR(obj)___CDR(___CAR(___CAR(___CAR(obj))))
3499#define ___CDAADR(obj)___CDR(___CAR(___CAR(___CDR(obj))))
3500#define ___CDADAR(obj)___CDR(___CAR(___CDR(___CAR(obj))))
3501#define ___CDADDR(obj)___CDR(___CAR(___CDR(___CDR(obj))))
3502#define ___CDDAAR(obj)___CDR(___CDR(___CAR(___CAR(obj))))
3503#define ___CDDADR(obj)___CDR(___CDR(___CAR(___CDR(obj))))
3504#define ___CDDDAR(obj)___CDR(___CDR(___CDR(___CAR(obj))))
3505#define ___CDDDDR(obj)___CDR(___CDR(___CDR(___CDR(obj))))
3506
3507/* APPLY-able operations */
3508
3509#define ___BOX(x) \
3510(___BEGIN_ALLOC_SUBTYPED(___MAKE_HD_WORDS(___BOX_SIZE,___sBOXVALUES)), \
3511___ADD_SUBTYPED_ELEM(0,x), \
3512___END_ALLOC_SUBTYPED(___BOX_SIZE), \
3513___GET_SUBTYPED(___BOX_SIZE))
3514#define ___UNBOX(x)___BODY_AS(x,___tSUBTYPED)[0]
3515#define ___SETBOX(x,y)___BODY_AS(x,___tSUBTYPED)[0]=y;
3516
3517#define ___VALUESLENGTH(v)___FIX(___HD_FIELDS(___SUBTYPED_HEADER(v)))
3518#define ___VALUESREF(v,i)*(___WORD*)(((___WORD)___BODY_AS(v,___tSUBTYPED))+((i)<<(___LWS-___TB)))
3519#define ___VALUESSET(v,i,val)*(___WORD*)(((___WORD)___BODY_AS(v,___tSUBTYPED))+((i)<<(___LWS-___TB)))=val;
3520
3521#define ___VECTORLENGTH(v)___FIX(___HD_FIELDS(___SUBTYPED_HEADER(v)))
3522#define ___VECTORREF(v,i)*(___WORD*)(((___WORD)___BODY_AS(v,___tSUBTYPED))+((i)<<(___LWS-___TB)))
3523#define ___VECTORSET(v,i,val)*(___WORD*)(((___WORD)___BODY_AS(v,___tSUBTYPED))+((i)<<(___LWS-___TB)))=val;
3524#define ___VECTORSHRINK(v,i)___temp=v;___SUBTYPED_HEADER_SET(___temp,(___SUBTYPED_HEADER(___temp)&~___LMASK)+((i)<<(___LF-___TB+___LWS)));
3525#define ___VECTORCAS(v,i,val,oldval)___COMPARE_AND_SWAP_WORD((___WORD*)(((___WORD)___BODY_AS(v,___tSUBTYPED))+((i)<<(___LWS-___TB))),oldval,val)
3526#define ___VECTORINC(v,i,val)___FETCH_AND_ADD_WORD((___WORD*)(((___WORD)___BODY_AS(v,___tSUBTYPED))+((i)<<(___LWS-___TB))),val)
3527
3528#define ___STRINGLENGTH(x)___FIX((___HD_BYTES(___SUBTYPED_HEADER(x))>>___LCS))
3529#define ___STRINGREF(x,y)___CHR(___CS_SELECT( \
3530___FETCH_U8(___BODY_AS(x,___tSUBTYPED),(y)>>___TB), \
3531___FETCH_U16(___BODY_AS(x,___tSUBTYPED),(y)>>___TB), \
3532___FETCH_U32(___BODY_AS(x,___tSUBTYPED),(y)>>___TB)))
3533#define ___STRINGSET(x,y,z)___CS_SELECT( \
3534___STORE_U8(___BODY_AS(x,___tSUBTYPED),(y)>>___TB,___INT(z)), \
3535___STORE_U16(___BODY_AS(x,___tSUBTYPED),(y)>>___TB,___INT(z)), \
3536___STORE_U32(___BODY_AS(x,___tSUBTYPED),(y)>>___TB,___INT(z)));
3537#define ___STRINGSHRINK(x,y)___temp=x;___SUBTYPED_HEADER_SET(___temp,(___SUBTYPED_HEADER(___temp)&~___LMASK)+((y)<<(___LF-___TB+___LCS)));
3538
3539#define ___S8VECTORLENGTH(x)___FIX(___HD_BYTES(___SUBTYPED_HEADER(x)))
3540#define ___S8VECTORREF(x,y) \
3541___FIX(___FETCH_S8(___BODY_AS(x,___tSUBTYPED),(y)>>___TB))
3542#define ___S8VECTORSET(x,y,z) \
3543___STORE_S8(___BODY_AS(x,___tSUBTYPED),(y)>>___TB,___INT(z));
3544#define ___S8VECTORSHRINK(x,y)___temp=x;___SUBTYPED_HEADER_SET(___temp,(___SUBTYPED_HEADER(___temp)&~___LMASK)+((y)<<(___LF-___TB)));
3545
3546#define ___U8VECTORLENGTH(x)___FIX(___HD_BYTES(___SUBTYPED_HEADER(x)))
3547#define ___U8VECTORREF(x,y) \
3548___FIX(___FETCH_U8(___BODY_AS(x,___tSUBTYPED),(y)>>___TB))
3549#define ___U8VECTORSET(x,y,z) \
3550___STORE_U8(___BODY_AS(x,___tSUBTYPED),(y)>>___TB,___INT(z));
3551#define ___U8VECTORSHRINK(x,y)___temp=x;___SUBTYPED_HEADER_SET(___temp,(___SUBTYPED_HEADER(___temp)&~___LMASK)+((y)<<(___LF-___TB)));
3552
3553#define ___S16VECTORLENGTH(x)___FIX((___HD_BYTES(___SUBTYPED_HEADER(x))>>1))
3554#define ___S16VECTORREF(x,y) \
3555___FIX(___FETCH_S16(___BODY_AS(x,___tSUBTYPED),(y)>>___TB))
3556#define ___S16VECTORSET(x,y,z) \
3557___STORE_S16(___BODY_AS(x,___tSUBTYPED),(y)>>___TB,___INT(z));
3558#define ___S16VECTORSHRINK(x,y)___temp=x;___SUBTYPED_HEADER_SET(___temp,(___SUBTYPED_HEADER(___temp)&~___LMASK)+((y)<<(___LF-___TB+1)));
3559
3560#define ___U16VECTORLENGTH(x)___FIX((___HD_BYTES(___SUBTYPED_HEADER(x))>>1))
3561#define ___U16VECTORREF(x,y) \
3562___FIX(___FETCH_U16(___BODY_AS(x,___tSUBTYPED),(y)>>___TB))
3563#define ___U16VECTORSET(x,y,z) \
3564___STORE_U16(___BODY_AS(x,___tSUBTYPED),(y)>>___TB,___INT(z));
3565#define ___U16VECTORSHRINK(x,y)___temp=x;___SUBTYPED_HEADER_SET(___temp,(___SUBTYPED_HEADER(___temp)&~___LMASK)+((y)<<(___LF-___TB+1)));
3566
3567#define ___S32VECTORLENGTH(x)___FIX((___HD_BYTES(___SUBTYPED_HEADER(x))>>2))
3568#define ___S32VECTORREF(x,y) \
3569___S32BOX(___FETCH_S32(___BODY_AS(x,___tSUBTYPED),(y)>>___TB))
3570#define ___S32VECTORSET(x,y,z) \
3571___STORE_S32(___BODY_AS(x,___tSUBTYPED),(y)>>___TB,___S32UNBOX(z));
3572#define ___S32VECTORSHRINK(x,y)___temp=x;___SUBTYPED_HEADER_SET(___temp,(___SUBTYPED_HEADER(___temp)&~___LMASK)+((y)<<(___LF-___TB+2)));
3573
3574#define ___U32VECTORLENGTH(x)___FIX((___HD_BYTES(___SUBTYPED_HEADER(x))>>2))
3575#define ___U32VECTORREF(x,y) \
3576___U32BOX(___FETCH_U32(___BODY_AS(x,___tSUBTYPED),(y)>>___TB))
3577#define ___U32VECTORSET(x,y,z) \
3578___STORE_U32(___BODY_AS(x,___tSUBTYPED),(y)>>___TB,___U32UNBOX(z));
3579#define ___U32VECTORSHRINK(x,y)___temp=x;___SUBTYPED_HEADER_SET(___temp,(___SUBTYPED_HEADER(___temp)&~___LMASK)+((y)<<(___LF-___TB+2)));
3580
3581#define ___S64VECTORLENGTH(x)___FIX((___HD_BYTES(___SUBTYPED_HEADER(x))>>3))
3582#define ___S64VECTORREF(x,y) \
3583___S64BOX(___FETCH_S64(___BODY_AS(x,___tSUBTYPED),(y)>>___TB))
3584#define ___S64VECTORSET(x,y,z) \
3585___STORE_S64(___BODY_AS(x,___tSUBTYPED),(y)>>___TB,___S64UNBOX(z));
3586#define ___S64VECTORSHRINK(x,y)___temp=x;___SUBTYPED_HEADER_SET(___temp,(___SUBTYPED_HEADER(___temp)&~___LMASK)+((y)<<(___LF-___TB+3)));
3587
3588#define ___U64VECTORLENGTH(x)___FIX((___HD_BYTES(___SUBTYPED_HEADER(x))>>3))
3589#define ___U64VECTORREF(x,y) \
3590___U64BOX(___FETCH_U64(___BODY_AS(x,___tSUBTYPED),(y)>>___TB))
3591#define ___U64VECTORSET(x,y,z) \
3592___STORE_U64(___BODY_AS(x,___tSUBTYPED),(y)>>___TB,___U64UNBOX(z));
3593#define ___U64VECTORSHRINK(x,y)___temp=x;___SUBTYPED_HEADER_SET(___temp,(___SUBTYPED_HEADER(___temp)&~___LMASK)+((y)<<(___LF-___TB+3)));
3594
3595#define ___F32VECTORLENGTH(x)___FIX((___HD_BYTES(___SUBTYPED_HEADER(x))>>2))
3596#ifdef ___F32
3597#define ___F32VECTORREF(x,y)*(___F32*)(((___WORD)___BODY_AS(x,___tSUBTYPED))+((y)<<(2-___TB)))
3598#define ___F32VECTORSET(x,y,z)*(___F32*)(((___WORD)___BODY_AS(x,___tSUBTYPED))+((y)<<(2-___TB)))=z;
3599#else
3600#define ___F32VECTORREF(x,y)0.0
3601#define ___F32VECTORSET(x,y,z);
3602#endif
3603#define ___F32VECTORSHRINK(x,y)___temp=x;___SUBTYPED_HEADER_SET(___temp,(___SUBTYPED_HEADER(___temp)&~___LMASK)+((y)<<(___LF-___TB+2)));
3604
3605#define ___F64VECTORLENGTH(x)___FIX((___HD_BYTES(___SUBTYPED_HEADER(x))>>3))
3606#define ___F64VECTORREF(x,y)*(___F64*)(((___WORD)___BODY_AS(x,___tSUBTYPED))+((y)<<(3-___TB)))
3607#define ___F64VECTORSET(x,y,z)*(___F64*)(((___WORD)___BODY_AS(x,___tSUBTYPED))+((y)<<(3-___TB)))=z;
3608#define ___F64VECTORSHRINK(x,y)___temp=x;___SUBTYPED_HEADER_SET(___temp,(___SUBTYPED_HEADER(___temp)&~___LMASK)+((y)<<(___LF-___TB+3)));
3609
3610#define ___TYPEID(x)___VECTORREF(x,___FIX(1))
3611#define ___TYPENAME(x)___VECTORREF(x,___FIX(2))
3612#define ___TYPEFLAGS(x)___VECTORREF(x,___FIX(3))
3613#define ___TYPESUPER(x)___VECTORREF(x,___FIX(4))
3614#define ___TYPEFIELDS(x)___VECTORREF(x,___FIX(5))
3615
3616#define ___STRUCTURETYPE(x)___VECTORREF(x,___FIX(0))
3617#define ___STRUCTURETYPESET(x,type)___VECTORSET(x,___FIX(0),type)
3618#define ___STRUCTUREDIOP(x,typeid)(___TESTSUBTYPE(x,___sSTRUCTURE)&&___TYPEID(___STRUCTURETYPE(___temp))==(typeid))
3619#define ___UNCHECKEDSTRUCTUREREF(x,i,type,proc)___VECTORREF(x,i)
3620#define ___UNCHECKEDSTRUCTURESET(x,val,i,type,proc)___VECTORSET(x,i,val)
3621#define ___UNCHECKEDSTRUCTURECAS(x,val,oldval,i,type,proc)___VECTORCAS(x,i,val,oldval)
3622
3623#define ___GLOBALVARSTRUCT(gv)___CAST(___glo_struct*,___FIELD(gv,___SYMBOL_GLOBAL))
3624#define ___GLOBALVARREF(gv)___GLOCELL(___GLOBALVARSTRUCT(gv)->val)
3625#define ___GLOBALVARPRIMREF(gv)___PRMCELL(___GLOBALVARSTRUCT(gv)->prm)
3626#define ___GLOBALVARSET(gv,x)___GLOCELL(___GLOBALVARSTRUCT(gv)->val) = x;
3627#define ___GLOBALVARPRIMSET(gv,x)___PRMCELL(___GLOBALVARSTRUCT(gv)->prm) = x;
3628
3629#define ___RATNUMMAKE(num,den) \
3630(___BEGIN_ALLOC_SUBTYPED(___MAKE_HD_WORDS(___RATNUM_SIZE,___sRATNUM)), \
3631___ADD_SUBTYPED_ELEM(0,num), \
3632___ADD_SUBTYPED_ELEM(1,den), \
3633___END_ALLOC_SUBTYPED(___RATNUM_SIZE), \
3634___GET_SUBTYPED(___RATNUM_SIZE))
3635
3636#define ___RATNUMNUMERATOR(obj)___FIELD(obj,0)
3637#define ___RATNUMDENOMINATOR(obj)___FIELD(obj,1)
3638
3639#define ___CPXNUMMAKE(real,imag) \
3640(___BEGIN_ALLOC_SUBTYPED(___MAKE_HD_WORDS(___CPXNUM_SIZE,___sCPXNUM)), \
3641___ADD_SUBTYPED_ELEM(0,real), \
3642___ADD_SUBTYPED_ELEM(1,imag), \
3643___END_ALLOC_SUBTYPED(___CPXNUM_SIZE), \
3644___GET_SUBTYPED(___CPXNUM_SIZE))
3645
3646#define ___CPXNUMREAL(obj)___FIELD(obj,0)
3647#define ___CPXNUMIMAG(obj)___FIELD(obj,1)
3648
3649#define ___REALPART(obj)(___CPXNUMP(obj)?___CPXNUMREAL(obj):obj)
3650#define ___IMAGPART(obj)(___CPXNUMP(obj)?___CPXNUMIMAG(obj):___FIX(0L))
3651
3652#define ___MAKEDELAYPROMISE(x) \
3653(___BEGIN_ALLOC_SUBTYPED(___MAKE_HD_WORDS(___PROMISE_STATE_SIZE,___sVECTOR)), \
3654___ADD_SUBTYPED_ELEM(0,___SUBTYPED_FROM_START(___hp)), \
3655___ADD_SUBTYPED_ELEM(1,x), \
3656___END_ALLOC_SUBTYPED(___PROMISE_STATE_SIZE), \
3657___BEGIN_ALLOC_SUBTYPED(___MAKE_HD_WORDS(___PROMISE_SIZE,___sPROMISE)), \
3658___ADD_SUBTYPED_ELEM(0,___GET_SUBTYPED(___PROMISE_STATE_SIZE)), \
3659___END_ALLOC_SUBTYPED(___PROMISE_SIZE), \
3660___GET_SUBTYPED(___PROMISE_SIZE))
3661
3662#define ___PROMISESTATE(obj)___FIELD(obj,___PROMISE_STATE)
3663#define ___PROMISESTATESET(obj,val)___FIELD(obj,___PROMISE_STATE) = val;
3664
3665#define ___MAKECONTINUATION(frame,denv) \
3666(___BEGIN_ALLOC_SUBTYPED(___MAKE_HD_WORDS(___CONTINUATION_SIZE,___sCONTINUATION)), \
3667___ADD_SUBTYPED_ELEM(___CONTINUATION_FRAME,frame), \
3668___ADD_SUBTYPED_ELEM(___CONTINUATION_DENV,denv), \
3669___END_ALLOC_SUBTYPED(___CONTINUATION_SIZE), \
3670___GET_SUBTYPED(___CONTINUATION_SIZE))
3671
3672#define ___CONTINUATIONFRAME(obj)___FIELD(obj,___CONTINUATION_FRAME)
3673#define ___CONTINUATIONFRAMESET(obj,val)___FIELD(obj,___CONTINUATION_FRAME) = val;
3674#define ___CONTINUATIONDENV(obj)___FIELD(obj,___CONTINUATION_DENV)
3675#define ___CONTINUATIONDENVSET(obj,val)___FIELD(obj,___CONTINUATION_DENV) = val;
3676
3677#define ___END_OF_CONT_MARKER ___VOID
3678
3679#define ___MAKESYMBOL(name,hash) \
3680(___BEGIN_ALLOC_SUBTYPED(___MAKE_HD_WORDS(___SYMBOL_SIZE,___sSYMBOL)), \
3681___ADD_SUBTYPED_ELEM(___SYMKEY_NAME,name), \
3682___ADD_SUBTYPED_ELEM(___SYMKEY_HASH,hash), \
3683___ADD_SUBTYPED_ELEM(___SYMKEY_NEXT,___FAL), \
3684___ADD_SUBTYPED_ELEM(___SYMBOL_GLOBAL,0), \
3685___END_ALLOC_SUBTYPED(___SYMBOL_SIZE), \
3686___GET_SUBTYPED(___SYMBOL_SIZE))
3687
3688#define ___SYMBOLNAME(obj)___FIELD(obj,___SYMKEY_NAME)
3689#define ___SYMBOLNAMESET(obj,val)___FIELD(obj,___SYMKEY_NAME) = val;
3690#define ___SYMBOLHASH(obj)___FIELD(obj,___SYMKEY_HASH)
3691#define ___SYMBOLHASHSET(obj,val)___FIELD(obj,___SYMKEY_HASH) = val;
3692#define ___SYMBOLINTERNEDP(obj)___FIELD(obj,___SYMKEY_NEXT)
3693
3694#define ___MAKEKEYWORD(name,hash) \
3695(___BEGIN_ALLOC_SUBTYPED(___MAKE_HD_WORDS(___KEYWORD_SIZE,___sKEYWORD)), \
3696___ADD_SUBTYPED_ELEM(___SYMKEY_NAME,name), \
3697___ADD_SUBTYPED_ELEM(___SYMKEY_HASH,hash), \
3698___ADD_SUBTYPED_ELEM(___SYMKEY_NEXT,___FAL), \
3699___END_ALLOC_SUBTYPED(___KEYWORD_SIZE), \
3700___GET_SUBTYPED(___KEYWORD_SIZE))
3701
3702#define ___KEYWORDNAME(obj)___FIELD(obj,___SYMKEY_NAME)
3703#define ___KEYWORDNAMESET(obj,val)___FIELD(obj,___SYMKEY_NAME) = val;
3704#define ___KEYWORDHASH(obj)___FIELD(obj,___SYMKEY_HASH)
3705#define ___KEYWORDHASHSET(obj,val)___FIELD(obj,___SYMKEY_HASH) = val;
3706#define ___KEYWORDINTERNEDP(obj)___FIELD(obj,___SYMKEY_NEXT)
3707
3708#define ___MAKEWILL(testator,action) \
3709(___BEGIN_ALLOC_SUBTYPED(___MAKE_HD_WORDS(___WILL_SIZE,___sWEAK)), \
3710___ADD_SUBTYPED_ELEM(0,___ps->mem.nonexecutable_wills_), \
3711___ADD_SUBTYPED_ELEM(___WILL_TESTATOR,testator), \
3712___ADD_SUBTYPED_ELEM(___WILL_ACTION,action), \
3713___ps->mem.nonexecutable_wills_=___TAG(___hp,0), \
3714___END_ALLOC_SUBTYPED(___WILL_SIZE), \
3715___GET_SUBTYPED(___WILL_SIZE))
3716
3717#define ___WILLTESTATOR(obj)___FIELD(obj,___WILL_TESTATOR)
3718#define ___WILLTESTATORSET(obj,val)___FIELD(obj,___WILL_TESTATOR) = val;
3719#define ___WILLACTION(obj)___FIELD(obj,___WILL_ACTION)
3720#define ___WILLACTIONSET(obj,val)___FIELD(obj,___WILL_ACTION) = val;
3721
3722#define ___FOREIGNTAGS(obj)___FIELD(obj,___FOREIGN_TAGS)
3723
3724#define ___EXECUTABLE_WILL        1
3725#define ___UNMARKED_TESTATOR_WILL 2
3726
3727#define ___GCHASHTABLEREF(x,y)___EXT(___gc_hash_table_ref)(x,y)
3728#define ___GCHASHTABLESET(x,y,z)___EXT(___gc_hash_table_set)(x,y,z)
3729#define ___GCHASHTABLEUNION(x,y,z)___EXT(___gc_hash_table_union_find)(x,y,z,0)
3730#define ___GCHASHTABLEFIND(x,y,z)___EXT(___gc_hash_table_union_find)(x,y,z,1)
3731#define ___GCHASHTABLEREHASH(x,y)___EXT(___gc_hash_table_rehash)(x,y)
3732
3733#define ___ROTL32(n,shift) (((n)<<(shift)) | ((n)>>((-(shift))&31)))
3734#define ___ROTR32(n,shift) (((n)>>(shift)) | ((n)<<((-(shift))&31)))
3735#define ___ROTL64(n,shift) (((n)<<(shift)) | ((n)>>((-(shift))&63)))
3736#define ___ROTR64(n,shift) (((n)>>(shift)) | ((n)<<((-(shift))&63)))
3737
3738#if ___WS == 4
3739
3740#define ___GCHASHTABLE_HASH_STEP_MULT(hash,step,obj,size) \
3741do { \
3742  ___U32 x = ___ROTR32(obj,___TB); \
3743  x ^= ((4096+256+1)*___ROTL32(x,16)); \
3744  hash = (___CAST(___U64,x) * ___CAST(___U32,size)) >> 32; \
3745  step = 1; \
3746} while (0)
3747
3748#else
3749
3750#define ___GCHASHTABLE_HASH_STEP_MULT(hash,step,obj,size) \
3751do { \
3752  ___U64 o = ___ROTR64(obj,___TB); \
3753  ___U32 x = o ^ (o >> 32); \
3754  x ^= ((4096+256+1)*___ROTL32(x,16)); \
3755  hash = (___CAST(___U64,x) * ___CAST(___U32,size)) >> 32; \
3756  step = 1; \
3757} while (0)
3758
3759#endif
3760
3761#define ___GCHASHTABLE_HASH_STEP_MOD(hash,step,obj,size) \
3762do { \
3763  hash = (___CAST(___UWORD,obj)>>___TB) % (size); \
3764  step = 1; \
3765} while (0)
3766
3767#define ___GCHASHTABLE_HASH_STEP(hash,step,obj,size) \
3768___GCHASHTABLE_HASH_STEP_MULT(hash,step,obj,size)
3769
3770#define ___GCHASHTABLE_FLAG_WEAK_KEYS      1
3771#define ___GCHASHTABLE_FLAG_WEAK_VALS      2
3772#define ___GCHASHTABLE_FLAG_KEY_MOVED      4
3773#define ___GCHASHTABLE_FLAG_ENTRY_DELETED  8
3774#define ___GCHASHTABLE_FLAG_MEM_ALLOC_KEYS 16
3775#define ___GCHASHTABLE_FLAG_NEED_REHASH    32
3776#define ___GCHASHTABLE_FLAG_UNION_FIND     64
3777
3778#define ___GCHASHTABLE_NEXT      0
3779#define ___GCHASHTABLE_FLAGS     1
3780#define ___GCHASHTABLE_COUNT     2
3781#define ___GCHASHTABLE_MIN_COUNT 3
3782#define ___GCHASHTABLE_FREE      4
3783#define ___GCHASHTABLE_KEY0      5
3784#define ___GCHASHTABLE_VAL0      6
3785
3786#define ___CURRENTTHREAD ___FIELD(___CURRENTPROCESSOR,___PROCESSOR_CURRENT_THREAD)
3787#define ___CURRENTTHREADSET(thread)___FIELD(___CURRENTPROCESSOR,___PROCESSOR_CURRENT_THREAD) = thread;
3788
3789#define ___PROCESSOR_SCMOBJ(ps) \
3790___SUBTYPED_FROM_START(___ALIGNUP((ps)->processor_scmobj,___WS))
3791
3792#define ___CURRENTPROCESSOR ___PROCESSOR_SCMOBJ(___ps)
3793#define ___CURRENTPROCESSORID ___FIX(___PROCESSOR_ID(___ps,___VMSTATE_FROM_PSTATE(___ps)))
3794#define ___PROCESSOR(id) ___PROCESSOR_SCMOBJ(___PSTATE_FROM_PROCESSOR_ID(___INT(id),___VMSTATE_FROM_PSTATE(___ps)))
3795
3796#define ___VM_SCMOBJ(vms) \
3797___SUBTYPED_FROM_START(___ALIGNUP((vms)->vm_scmobj,___WS))
3798
3799#define ___CURRENTVM ___VM_SCMOBJ(___VMSTATE_FROM_PSTATE(___ps))
3800
3801#define ___TICKETLOCK ___ticketlock_struct
3802
3803#define ___TICKETLOCK_DECL(id) ___TICKETLOCK id;
3804
3805#define ___TICKETLOCK_INIT(lock) \
3806(lock).next_ticket = (lock).current_ticket = ___FIX(0)
3807
3808#define ___TICKETLOCK_DESTROY(lock)
3809
3810#define ___TICKETLOCK_LOCK(lock) \
3811___TICKETLOCK_LOCK2((lock).next_ticket, (lock).current_ticket)
3812
3813#define ___TICKETLOCK_UNLOCK(lock) \
3814___TICKETLOCK_UNLOCK2((lock).next_ticket,(lock).current_ticket)
3815
3816#ifdef ___DEBUG_TICKETLOCK
3817
3818#define ___TICKETLOCK_LOCK2(next,current) \
3819do { \
3820  ___WORD ___ticket = ___FETCH_AND_ADD_WORD(___CAST(___VOLATILE ___WORD*,&next),___FIX(1)); \
3821  int ___count = 0; \
3822  while (*___CAST(___VOLATILE ___WORD*,&current) != ___ticket) \
3823    { \
3824      if (++___count == 100000000) \
3825        { \
3826          ___WORD ___n = ___VMSTATE->ticketlock_history_index; \
3827          ___WORD ___i = ___n; \
3828          while (___i > 0 && ___n-___i < ___TICKETLOCK_HISTORY_LENGTH) \
3829            { \
3830              ___ticketlock_location *___probe = &___VMSTATE->ticketlock_history[--___i % ___TICKETLOCK_HISTORY_LENGTH]; \
3831              if (___probe->id == &current && ___probe->lock_op) \
3832                { \
3833                  printf("*** ERROR at \"%s\"@%d.1 -- lock attempt on TICKETLOCK %p spinning too long\ndue to successful locking at \"%s\"@%d.1 (current=%d ticket=%d)\n",__FILE__,__LINE__,&current,___probe->location.file,___probe->location.line,___INT(*___CAST(___VOLATILE ___WORD*,&current)),___INT(___ticket)); \
3834                  ___i = -1; \
3835                } \
3836            } \
3837          if (___i != -1) \
3838            printf("*** ERROR at \"%s\"@%d.1 -- lock attempt on TICKETLOCK %p spinning too long (current=%d ticket=%d)\n",__FILE__,__LINE__,&current,___INT(*___CAST(___VOLATILE ___WORD*,&current)),___INT(___ticket)); \
3839        } \
3840      ___CPU_RELAX(); \
3841    } \
3842  { ___ticketlock_location *___ptr = &___VMSTATE->ticketlock_history[___FETCH_AND_ADD_WORD(&___VMSTATE->ticketlock_history_index,1) % ___TICKETLOCK_HISTORY_LENGTH]; \
3843    ___ptr->id = &current; \
3844    ___ptr->lock_op = 1; \
3845    ___ptr->location.file = __FILE__; \
3846    ___ptr->location.line = __LINE__; \
3847    ___SHARED_MEMORY_BARRIER(); \
3848  } \
3849} while (0)
3850
3851#define ___TICKETLOCK_TRYLOCK2(next,current,temp) \
3852(temp=*___CAST(___VOLATILE ___WORD*,&current), \
3853 ___COMPARE_AND_SWAP_WORD(___CAST(___VOLATILE ___WORD*,&next),temp,___FIXWRAPADD(temp,___FIX(1)))==temp)
3854
3855#define ___TICKETLOCK_UNLOCK2(next,current) \
3856do { \
3857  if (___FETCH_AND_ADD_WORD(___CAST(___VOLATILE ___WORD*,&current),___FIX(1)) >= *___CAST(___VOLATILE ___WORD*,&next)) \
3858    { \
3859      ___WORD ___n = ___VMSTATE->ticketlock_history_index; \
3860      ___WORD ___i = ___n; \
3861      while (___i > 0 && ___n-___i < ___TICKETLOCK_HISTORY_LENGTH) \
3862        { \
3863          ___ticketlock_location *___probe = &___VMSTATE->ticketlock_history[--___i % ___TICKETLOCK_HISTORY_LENGTH]; \
3864          if (___probe->id == &current && !___probe->lock_op) \
3865            { \
3866              printf("*** ERROR at \"%s\"@%d.1 -- duplicate unlock attempt on TICKETLOCK %p\nwhich was also unlocked at \"%s\"@%d.1 (current=%d next=%d)\n",__FILE__,__LINE__,&current,___probe->location.file,___probe->location.line,___INT(*___CAST(___VOLATILE ___WORD*,&current)),___INT(*___CAST(___VOLATILE ___WORD*,&next))); \
3867              ___i = -1; \
3868            } \
3869        } \
3870      if (___i != -1) \
3871        printf("*** ERROR at \"%s\"@%d.1 -- duplicate unlock attempt on TICKETLOCK %p (current=%d next=%d)\n",__FILE__,__LINE__,&current,___INT(*___CAST(___VOLATILE ___WORD*,&current)),___INT(*___CAST(___VOLATILE ___WORD*,&next))); \
3872    } \
3873  { ___ticketlock_location *___ptr = &___VMSTATE->ticketlock_history[___FETCH_AND_ADD_WORD(&___VMSTATE->ticketlock_history_index,1) % ___TICKETLOCK_HISTORY_LENGTH]; \
3874    ___ptr->id = &current; \
3875    ___ptr->lock_op = 0; \
3876    ___ptr->location.file = __FILE__; \
3877    ___ptr->location.line = __LINE__; \
3878    ___SHARED_MEMORY_BARRIER(); \
3879  } \
3880} while (0)
3881
3882#else
3883
3884#define ___TICKETLOCK_LOCK2(next,current) \
3885do { \
3886  ___WORD ___ticket = ___FETCH_AND_ADD_WORD(___CAST(___VOLATILE ___WORD*,&next),___FIX(1)); \
3887  while (*___CAST(___VOLATILE ___WORD*,&current) != ___ticket) \
3888    ___CPU_RELAX(); \
3889} while (0)
3890
3891#define ___TICKETLOCK_TRYLOCK2(next,current,temp) \
3892(temp=*___CAST(___VOLATILE ___WORD*,&current), \
3893 ___COMPARE_AND_SWAP_WORD(___CAST(___VOLATILE ___WORD*,&next),temp,___FIXWRAPADD(temp,___FIX(1)))==temp)
3894
3895#define ___TICKETLOCK_UNLOCK2(next,current) \
3896___FETCH_AND_ADD_WORD(___CAST(___VOLATILE ___WORD*,&current),___FIX(1))
3897
3898#endif
3899
3900#ifdef ___SINGLE_THREADED_VMS
3901
3902#define ___VOLATILE
3903
3904#define ___PRIMITIVELOCK(obj,next,current)
3905#define ___PRIMITIVETRYLOCK(obj,next,current) 1
3906#define ___PRIMITIVEUNLOCK(obj,next,current)
3907
3908#define ___SPINLOCK int
3909#define ___SPINLOCK_DECL(id)
3910#define ___SPINLOCK_INIT(lock)
3911#define ___SPINLOCK_DESTROY(lock)
3912#define ___SPINLOCK_LOCK(lock)
3913#define ___SPINLOCK_UNLOCK(lock)
3914
3915#else
3916
3917#define ___VOLATILE volatile
3918
3919#define ___PRIMITIVELOCK(obj,next,current) \
3920___TICKETLOCK_LOCK2(___FIELD(obj,___INT(next)),___FIELD(obj,___INT(current)));
3921
3922#define ___PRIMITIVETRYLOCK(obj,next,current) \
3923___TICKETLOCK_TRYLOCK2(___FIELD(obj,___INT(next)),___FIELD(obj,___INT(current)),___temp)
3924
3925#define ___PRIMITIVEUNLOCK(obj,next,current) \
3926___TICKETLOCK_UNLOCK2(___FIELD(obj,___INT(next)),___FIELD(obj,___INT(current)));
3927
3928#ifdef ___USE_MUTEX_FOR_SPINLOCK
3929
3930#define ___SPINLOCK ___MUTEX
3931#define ___SPINLOCK_DECL(id) ___MUTEX_DECL(id)
3932#define ___SPINLOCK_INIT(lock) ___MUTEX_INIT(lock)
3933#define ___SPINLOCK_DESTROY(lock) ___MUTEX_DESTROY(lock)
3934#define ___SPINLOCK_LOCK(lock) ___MUTEX_LOCK(lock)
3935#define ___SPINLOCK_UNLOCK(lock) ___MUTEX_UNLOCK(lock)
3936
3937#else
3938
3939#define ___SPINLOCK ___TICKETLOCK
3940#define ___SPINLOCK_DECL(id) ___TICKETLOCK_DECL(id)
3941#define ___SPINLOCK_INIT(lock) ___TICKETLOCK_INIT(lock)
3942#define ___SPINLOCK_DESTROY(lock) ___TICKETLOCK_DESTROY(lock)
3943#define ___SPINLOCK_LOCK(lock) ___TICKETLOCK_LOCK(lock)
3944#define ___SPINLOCK_UNLOCK(lock) ___TICKETLOCK_UNLOCK(lock)
3945
3946#endif
3947
3948#endif
3949
3950
3951#define ___THREAD_SAVE \
3952if (___R0 == ___ps->handler_break) \
3953  frame = ___STK(-___BREAK_FRAME_NEXT); \
3954else \
3955  { \
3956    ___SET_STK(-___FRAME_STACK_RA,___R0) \
3957    ___R0 = ___ps->handler_break; \
3958    frame = ___CAST(___SCMOBJ,___fp); \
3959    ___ADJFP(___BREAK_FRAME_SPACE) \
3960    ___SET_STK(-___BREAK_FRAME_NEXT,frame) \
3961    ___ps->stack_break = ___fp; \
3962  } \
3963thread = ___CURRENTTHREAD; \
3964___FIELD(___FIELD(thread,___THREAD_CONT),___CONTINUATION_FRAME) = frame;
3965
3966
3967#define ___JUMP_THREAD_SAVE1(jump) \
3968{ ___SCMOBJ proc; \
3969  ___SCMOBJ thread; \
3970  ___SCMOBJ frame; \
3971  ___POP_ARGS1(proc) \
3972  ___THREAD_SAVE \
3973  ___PUSH_ARGS1(thread) \
3974  jump(___SET_NARGS(1),proc) \
3975}
3976
3977#define ___JUMP_THREAD_SAVE2(jump) \
3978{ ___SCMOBJ proc; \
3979  ___SCMOBJ arg1; \
3980  ___SCMOBJ thread; \
3981  ___SCMOBJ frame; \
3982  ___POP_ARGS2(proc,arg1) \
3983  ___THREAD_SAVE \
3984  ___PUSH_ARGS2(thread,arg1) \
3985  jump(___SET_NARGS(2),proc) \
3986}
3987
3988#define ___JUMP_THREAD_SAVE3(jump) \
3989{ ___SCMOBJ proc; \
3990  ___SCMOBJ arg1; \
3991  ___SCMOBJ arg2; \
3992  ___SCMOBJ thread; \
3993  ___SCMOBJ frame; \
3994  ___POP_ARGS3(proc,arg1,arg2) \
3995  ___THREAD_SAVE \
3996  ___PUSH_ARGS3(thread,arg1,arg2) \
3997  jump(___SET_NARGS(3),proc) \
3998}
3999
4000#define ___JUMP_THREAD_SAVE4(jump) \
4001{ ___SCMOBJ proc; \
4002  ___SCMOBJ arg1; \
4003  ___SCMOBJ arg2; \
4004  ___SCMOBJ arg3; \
4005  ___SCMOBJ thread; \
4006  ___SCMOBJ frame; \
4007  ___POP_ARGS4(proc,arg1,arg2,arg3) \
4008  ___THREAD_SAVE \
4009  ___PUSH_ARGS4(thread,arg1,arg2,arg3) \
4010  jump(___SET_NARGS(4),proc) \
4011}
4012
4013#define ___THREAD_RESTORE \
4014{ ___SCMOBJ cont = ___FIELD(thread,___THREAD_CONT); \
4015  ___SET_FP(___ps->stack_break) \
4016  ___SET_STK(-___BREAK_FRAME_NEXT,___FIELD(cont,___CONTINUATION_FRAME)) \
4017  ___FIELD(cont,___CONTINUATION_FRAME) = ___END_OF_CONT_MARKER; \
4018  ___INTERRUPT_MASK_SET(___FIELD(___FIELD(thread,___THREAD_DENV),___DENV_INTERRUPT_MASK)); \
4019  ___FIELD(thread,___THREAD_LAST_PROCESSOR) = ___CURRENTPROCESSOR; \
4020  ___CURRENTTHREADSET(thread) \
4021  ___SET_R0(___ps->handler_break) \
4022}
4023
4024#define ___JUMP_THREAD_RESTORE2(jump) \
4025{ ___SCMOBJ thread; \
4026  ___SCMOBJ proc; \
4027  ___POP_ARGS2(thread,proc) \
4028  ___THREAD_RESTORE \
4029  jump(___SET_NARGS(0),proc) \
4030}
4031
4032#define ___JUMP_THREAD_RESTORE3(jump) \
4033{ ___SCMOBJ thread; \
4034  ___SCMOBJ proc; \
4035  ___SCMOBJ arg1; \
4036  ___POP_ARGS3(thread,proc,arg1) \
4037  ___THREAD_RESTORE \
4038  ___PUSH_ARGS1(arg1) \
4039  jump(___SET_NARGS(1),proc) \
4040}
4041
4042#define ___JUMP_THREAD_RESTORE4(jump) \
4043{ ___SCMOBJ thread; \
4044  ___SCMOBJ proc; \
4045  ___SCMOBJ arg1; \
4046  ___SCMOBJ arg2; \
4047  ___POP_ARGS4(thread,proc,arg1,arg2) \
4048  ___THREAD_RESTORE \
4049  ___PUSH_ARGS2(arg1,arg2) \
4050  jump(___SET_NARGS(2),proc) \
4051}
4052
4053#define ___JUMP_THREAD_RESTORE5(jump) \
4054{ ___SCMOBJ thread; \
4055  ___SCMOBJ proc; \
4056  ___SCMOBJ arg1; \
4057  ___SCMOBJ arg2; \
4058  ___SCMOBJ arg3; \
4059  ___POP_ARGS5(thread,proc,arg1,arg2,arg3) \
4060  ___THREAD_RESTORE \
4061  ___PUSH_ARGS3(arg1,arg2,arg3) \
4062  jump(___SET_NARGS(3),proc) \
4063}
4064
4065#define ___BOX_SIZE 1
4066#define ___RATNUM_SIZE 2
4067#define ___CPXNUM_SIZE 2
4068#define ___TABLE_SIZE 5
4069
4070#define ___SYMBOL_SIZE   4
4071#define ___KEYWORD_SIZE  3
4072#define ___SYMKEY_NAME   0
4073#define ___SYMKEY_HASH   1
4074#define ___SYMKEY_NEXT   2
4075#define ___SYMBOL_GLOBAL 3
4076
4077#define ___PROMISE_SIZE  1
4078#define ___PROMISE_STATE 0
4079#define ___PROMISE_STATE_SIZE 2
4080
4081#define ___CONTINUATION_SIZE  2
4082#define ___CONTINUATION_FRAME 0
4083#define ___CONTINUATION_DENV  1
4084
4085#define ___WILL_SIZE     3
4086#define ___WILL_NEXT     0
4087#define ___WILL_TESTATOR 1
4088#define ___WILL_ACTION   2
4089
4090#define ___FOREIGN_SIZE       3
4091#define ___FOREIGN_TAGS       0
4092#define ___FOREIGN_RELEASE_FN 1
4093#define ___FOREIGN_PTR        2
4094
4095#define ___OBJ_LOCK1    1
4096#define ___OBJ_LOCK2    9
4097
4098#define ___BTQ_DEQ_NEXT 2
4099#define ___BTQ_DEQ_PREV 3
4100#define ___BTQ_COLOR    4
4101#define ___BTQ_PARENT   5
4102#define ___BTQ_LEFT     6
4103#define ___BTQ_RIGHT    7
4104#define ___BTQ_LEFTMOST 7
4105#define ___BTQ_OWNER    8
4106
4107#define ___CONDVAR_NAME 10
4108
4109#define ___THREAD_CONT           23
4110#define ___THREAD_DENV           24
4111#define ___THREAD_DENV_CACHE1    25
4112#define ___THREAD_DENV_CACHE2    26
4113#define ___THREAD_DENV_CACHE3    27
4114#define ___THREAD_LAST_PROCESSOR 33
4115
4116#define ___PROCESSOR_SIZE           21
4117#define ___PROCESSOR_CURRENT_THREAD 14
4118
4119#define ___VM_SIZE 20
4120
4121#define ___ENV_NAME_VAL 0
4122#define ___ENV_LEFT     1
4123#define ___ENV_RIGHT    2
4124
4125#define ___DENV_LOCAL              0
4126#define ___DENV_DYNWIND            1
4127#define ___DENV_INTERRUPT_MASK     2
4128#define ___DENV_DEBUGGING_SETTINGS 3
4129#define ___DENV_EXCEPTION_HANDLER  4
4130#define ___DENV_INPUT_PORT         5
4131#define ___DENV_OUTPUT_PORT        6
4132
4133#define ___FRAME_OVERHEAD(n) (___FRAME_SPACE(n)-(n))
4134#define ___RETI_RA (-___FRAME_OVERHEAD(___NB_GVM_REGS+1))
4135#define ___FRAME_RETI_RA (1-___FRAME_RESERVE-___RETI_RA)
4136
4137#define ___FRAME_EXTRA_SLOTS 1
4138#define ___FRAME_STACK_RA 0
4139#define ___FRAME_RA 0
4140
4141#define ___FRAME_STORE_RA(ra) \
4142if (___fp != ___ps->stack_break) \
4143  ___SET_STK(-___FRAME_STACK_RA,ra)
4144
4145#define ___FRAME_FETCH_RA \
4146((___fp != ___ps->stack_break) \
4147? ___STK(-___FRAME_STACK_RA) \
4148: ___ps->handler_break)
4149
4150#define ___CONTINUATION_CAPTURE \
4151if (___R0 == ___ps->handler_break) \
4152  frame = ___STK(-___BREAK_FRAME_NEXT); \
4153else \
4154  { \
4155    ___SET_STK(-___FRAME_STACK_RA,___R0) \
4156    ___R0 = ___ps->handler_break; \
4157    frame = ___CAST(___SCMOBJ,___fp); \
4158  } \
4159___ADJFP(___ROUND_TO_MULT(___SUBTYPED_BODY+___CONTINUATION_SIZE,___FRAME_ALIGN)) \
4160___SET_STK(0,___MAKE_HD_WORDS(___CONTINUATION_SIZE,___sCONTINUATION)) \
4161___SET_STK(-1,frame) \
4162___SET_STK(-2,___FIELD(___CURRENTTHREAD,___THREAD_DENV)) \
4163cont = ___SUBTYPED_FROM_START(&___STK(0)); \
4164___ADJFP(___BREAK_FRAME_SPACE) \
4165___SET_STK(-___BREAK_FRAME_NEXT,frame) \
4166___ps->stack_break = ___fp;
4167
4168#define ___JUMP_CONTINUATION_CAPTURE1(jump) \
4169{ ___SCMOBJ proc; \
4170  ___SCMOBJ frame; \
4171  ___SCMOBJ cont; \
4172  ___POP_ARGS1(proc) \
4173  ___CONTINUATION_CAPTURE \
4174  ___PUSH_ARGS1(cont); \
4175  jump(___SET_NARGS(1),proc) \
4176}
4177
4178#define ___JUMP_CONTINUATION_CAPTURE2(jump) \
4179{ ___SCMOBJ proc; \
4180  ___SCMOBJ arg1; \
4181  ___SCMOBJ frame; \
4182  ___SCMOBJ cont; \
4183  ___POP_ARGS2(proc,arg1) \
4184  ___CONTINUATION_CAPTURE \
4185  ___PUSH_ARGS2(cont,arg1); \
4186  jump(___SET_NARGS(2),proc) \
4187}
4188
4189#define ___JUMP_CONTINUATION_CAPTURE3(jump) \
4190{ ___SCMOBJ proc; \
4191  ___SCMOBJ arg1; \
4192  ___SCMOBJ arg2; \
4193  ___SCMOBJ frame; \
4194  ___SCMOBJ cont; \
4195  ___POP_ARGS3(proc,arg1,arg2) \
4196  ___CONTINUATION_CAPTURE \
4197  ___PUSH_ARGS3(cont,arg1,arg2); \
4198  jump(___SET_NARGS(3),proc) \
4199}
4200
4201#define ___JUMP_CONTINUATION_CAPTURE4(jump) \
4202{ ___SCMOBJ proc; \
4203  ___SCMOBJ arg1; \
4204  ___SCMOBJ arg2; \
4205  ___SCMOBJ arg3; \
4206  ___SCMOBJ frame; \
4207  ___SCMOBJ cont; \
4208  ___POP_ARGS4(proc,arg1,arg2,arg3) \
4209  ___CONTINUATION_CAPTURE \
4210  ___PUSH_ARGS4(cont,arg1,arg2,arg3); \
4211  jump(___SET_NARGS(4),proc) \
4212}
4213
4214#define ___CONTINUATION_GRAFT_NO_WINDING \
4215___SET_FP(___ps->stack_break) \
4216___SET_STK(-___BREAK_FRAME_NEXT,___FIELD(cont,___CONTINUATION_FRAME)) \
4217temp = ___FIELD(cont,___CONTINUATION_DENV); \
4218thread = ___CURRENTTHREAD; \
4219___FIELD(thread,___THREAD_DENV) = temp; \
4220temp = ___FIELD(___FIELD(temp,___DENV_LOCAL),___ENV_NAME_VAL); \
4221___FIELD(thread,___THREAD_DENV_CACHE1) = temp; \
4222___FIELD(thread,___THREAD_DENV_CACHE2) = temp; \
4223___FIELD(thread,___THREAD_DENV_CACHE3) = temp; \
4224___SET_R0(___ps->handler_break)
4225
4226#define ___JUMP_CONTINUATION_GRAFT_NO_WINDING2(jump) \
4227{ ___SCMOBJ cont; \
4228  ___SCMOBJ proc; \
4229  ___SCMOBJ temp; \
4230  ___SCMOBJ thread; \
4231  ___POP_ARGS2(cont,proc) \
4232  ___CONTINUATION_GRAFT_NO_WINDING \
4233  jump(___SET_NARGS(0),proc) \
4234}
4235
4236#define ___JUMP_CONTINUATION_GRAFT_NO_WINDING3(jump) \
4237{ ___SCMOBJ cont; \
4238  ___SCMOBJ proc; \
4239  ___SCMOBJ arg1; \
4240  ___SCMOBJ temp; \
4241  ___SCMOBJ thread; \
4242  ___POP_ARGS3(cont,proc,arg1) \
4243  ___CONTINUATION_GRAFT_NO_WINDING \
4244  ___PUSH_ARGS1(arg1) \
4245  jump(___SET_NARGS(1),proc) \
4246}
4247
4248#define ___JUMP_CONTINUATION_GRAFT_NO_WINDING4(jump) \
4249{ ___SCMOBJ cont; \
4250  ___SCMOBJ proc; \
4251  ___SCMOBJ arg1; \
4252  ___SCMOBJ arg2; \
4253  ___SCMOBJ temp; \
4254  ___SCMOBJ thread; \
4255  ___POP_ARGS4(cont,proc,arg1,arg2) \
4256  ___CONTINUATION_GRAFT_NO_WINDING \
4257  ___PUSH_ARGS2(arg1,arg2) \
4258  jump(___SET_NARGS(2),proc) \
4259}
4260
4261#define ___JUMP_CONTINUATION_GRAFT_NO_WINDING5(jump) \
4262{ ___SCMOBJ cont; \
4263  ___SCMOBJ proc; \
4264  ___SCMOBJ arg1; \
4265  ___SCMOBJ arg2; \
4266  ___SCMOBJ arg3; \
4267  ___SCMOBJ temp; \
4268  ___SCMOBJ thread; \
4269  ___POP_ARGS5(cont,proc,arg1,arg2,arg3) \
4270  ___CONTINUATION_GRAFT_NO_WINDING \
4271  ___PUSH_ARGS3(arg1,arg2,arg3) \
4272  jump(___SET_NARGS(3),proc) \
4273}
4274
4275#define ___JUMP_CONTINUATION_RETURN_NO_WINDING2(jump) \
4276{ ___SCMOBJ cont; \
4277  ___SCMOBJ result; \
4278  ___SCMOBJ temp; \
4279  ___SCMOBJ thread; \
4280  ___POP_ARGS2(cont,result) \
4281  ___SET_R1(result) \
4282  ___SET_FP(___ps->stack_break) \
4283  ___SET_STK(-___BREAK_FRAME_NEXT,___FIELD(cont,___CONTINUATION_FRAME)) \
4284  temp = ___FIELD(cont,___CONTINUATION_DENV); \
4285  thread = ___CURRENTTHREAD; \
4286  ___FIELD(thread,___THREAD_DENV) = temp; \
4287  temp = ___FIELD(___FIELD(temp,___DENV_LOCAL),___ENV_NAME_VAL); \
4288  ___FIELD(thread,___THREAD_DENV_CACHE1) = temp; \
4289  ___FIELD(thread,___THREAD_DENV_CACHE2) = temp; \
4290  ___FIELD(thread,___THREAD_DENV_CACHE3) = temp; \
4291  ___JUMPPRM(___NOTHING,___ps->handler_break) \
4292}
4293
4294/*---------------------------------------------------------------------------*/
4295
4296/* Stack manipulation */
4297
4298#define ___SET_FP(fp)___fp=(fp);
4299
4300#define ___FP_AFTER(fp1,fp2)((fp1) < (fp2))
4301#define ___FP_PUSH(fp,val)*--fp=(val);
4302#define ___FP_POP(fp)*fp++
4303#define ___FP_STK(fp,fpo)fp[-(fpo)]
4304#define ___FP_SET_STK(fp,fpo,val)fp[-(fpo)]=(val);
4305#define ___FP_ADJFP(fp,fpa)fp-=(fpa);
4306
4307#define ___PUSH(val)___FP_PUSH(___fp,val)
4308#define ___POP ___FP_POP(___fp)
4309#define ___STK(fpo)___FP_STK(___fp,fpo)
4310#define ___SET_STK(fpo,val)___FP_SET_STK(___fp,fpo,val)
4311#define ___ADJFP(fpa)___FP_ADJFP(___fp,fpa)
4312#define ___PSSTK(fpo)___FP_STK(___PSFP,fpo)
4313#define ___PSADJFP(fpa)___FP_ADJFP(___PSFP,fpa)
4314
4315#ifdef ___SINGLE_VM
4316#define ___GLOCELL_IN_VM(vm,x)x
4317#define ___GLOCELL(x)x
4318#else
4319#define ___GLOCELL_IN_VM(vm,x)vm->glos[x]
4320#define ___GLOCELL(x)___GLOCELL_IN_VM(___VMSTATE_FROM_PSTATE(___ps),x)
4321#endif
4322
4323#define ___PRMCELL(x)x
4324
4325#define ___PRM(i,glo)___PRMCELL(___GLOSTRUCT(i,glo).prm)
4326#define ___GLO(i,glo)___GLOCELL(___GLOSTRUCT(i,glo).val)
4327#define ___SET_GLO(i,glo,x)___GLO(i,glo)=x;
4328#ifdef ___BIND_LATE
4329#define ___GLOSTRUCT(i,glo)(*___CAST(___glo_struct*,___glotbl[i]))
4330#else
4331#define ___GLOSTRUCT(i,glo)glo
4332#endif
4333
4334#define ___HOST_PROC ___SM(___MH_PROC,___PH_PROC)
4335#define ___HOST_LBL0 ___SM(1,___PH_LBL0)
4336
4337#define ___BEGIN_M_COD ___SM(___BEGIN_COD,___NOTHING)
4338#define ___END_M_COD ___SM(___END_COD,___NOTHING)
4339
4340#define ___BEGIN_M_HLBL ___SM(___BEGIN_HLBL,___NOTHING)
4341#define ___DEF_M_HLBL_INTRO ___SM(___DEF_HLBL_INTRO,___NOTHING)
4342#define ___DEF_M_HLBL(id)___SM(___DEF_HLBL(id),___NOTHING)
4343#define ___END_M_HLBL ___SM(___END_HLBL,___NOTHING)
4344
4345#define ___BEGIN_M_SW ___SM(___BEGIN_SW,___NOTHING)
4346#define ___END_M_SW ___SM(___END_SW,___NOTHING)
4347
4348#define ___BEGIN_P_COD ___SM(___NOTHING,___BEGIN_COD)
4349#define ___END_P_COD ___SM(___NOTHING,___END_COD)
4350
4351#define ___BEGIN_P_HLBL ___SM(___NOTHING,___BEGIN_HLBL)
4352#define ___DEF_P_HLBL_INTRO ___SM(___NOTHING,___DEF_HLBL_INTRO)
4353#define ___DEF_P_HLBL(id)___SM(___NOTHING,___DEF_HLBL(id))
4354#define ___END_P_HLBL ___SM(___NOTHING,___END_HLBL)
4355
4356#define ___BEGIN_P_SW ___SM(___NOTHING,___BEGIN_SW)
4357#define ___END_P_SW ___SM(___NOTHING,___END_SW)
4358
4359#define ___D_ALL ___SM(___MD_ALL,___PD_ALL)
4360#define ___R_ALL ___SM(___MR_ALL,___PR_ALL)
4361#define ___W_ALL ___SM(___MW_ALL,___PW_ALL)
4362
4363#define ___BEGIN_COD \
4364___HIDDEN ___WORD ___HOST_PROC ___P((___processor_state ___ps),(___ps) \
4365___processor_state ___ps;) { \
4366___WORD ___pc, ___start, ___temp; \
4367___S32 ___s32_temp; /*******************/ \
4368___U32 ___u32_temp; /*******************/ \
4369___S64 ___s64_temp; /*******************/ \
4370___U64 ___u64_temp; /*******************/ \
4371___D_ALL
4372
4373#define ___END_COD \
4374___ps->pc=___pc; ___W_ALL return ___pc; }
4375
4376#ifdef ___DEBUG_CTRL_FLOW_HISTORY
4377
4378#define ___CTRL_FLOW_HISTORY_LENGTH 1024
4379
4380#define ___AM_HERE \
4381do { ___processor_state ___ps = ___PSTATE; ___AM_HERE_PS } while (0)
4382
4383#define ___AM_HERE_PS \
4384{ int ___i = ___ps->ctrl_flow_history_index; \
4385  ___source_location *___ptr = ___ps->ctrl_flow_history+___i; \
4386  ___ptr->file = __FILE__; \
4387  ___ptr->line = __LINE__; \
4388  ___ps->ctrl_flow_history_index = (___i+1) % ___CTRL_FLOW_HISTORY_LENGTH; \
4389}
4390
4391#else
4392
4393#define ___AM_HERE
4394#define ___AM_HERE_PS
4395
4396#endif
4397
4398#ifdef ___DEBUG_HOST_CHANGES
4399
4400#define ___REGISTER_HOST_ENTRY \
4401___EXT(___register_host_entry) (___PSP ___start, ___MODULE_NAME, __FILE__, __LINE__);
4402
4403#else
4404
4405#define ___REGISTER_HOST_ENTRY
4406
4407#endif
4408
4409#define ___USES_INDIRECT_GOTO 1
4410#define ___SETUP_FIXUP_DONE   2
4411
4412#ifdef ___USE_LABEL_VALUES
4413
4414#define ___MODULE_FLAGS ___USES_INDIRECT_GOTO
4415
4416#define ___BEGIN_HLBL static void *___hlbltbl[]={
4417#define ___DEF_HLBL_INTRO 0,
4418#define ___DEF_HLBL(id)&&id,
4419#define ___END_HLBL \
44200}; if (___EXPECT_FALSE(___ps == 0)) return ___CAST(___WORD,___hlbltbl);
4421
4422#define ___BEGIN_SW \
4423___R_ALL ___start=___MLBL(___HOST_LBL0); ___pc=___ps->pc; \
4424___REGISTER_HOST_ENTRY \
4425goto *___LABEL_HOST_LABEL_GET(___pc);
4426
4427#define ___DEF_SW(n)
4428
4429#ifdef ___INLINE_JUMPS
4430
4431#define ___END_SW \
4432___jumpext:
4433
4434#define ___JUMP(dest) \
4435{___pc=dest; \
4436 if (___EXPECT_TRUE(___LABEL_HOST_GET(___pc) == ___HOST_PROC)) \
4437   goto *___LABEL_HOST_LABEL_GET(___pc); \
4438 goto ___jumpext;}
4439
4440#else
4441
4442#define ___END_SW \
4443___jump: \
4444if (___EXPECT_TRUE(___LABEL_HOST_GET(___pc) == ___HOST_PROC)) \
4445  goto *___LABEL_HOST_LABEL_GET(___pc); \
4446___jumpext:
4447
4448#define ___JUMP(dest){___pc=dest;goto ___jump;}
4449
4450#endif
4451
4452#define ___JUMPEXT(dest){___pc=dest;goto ___jumpext;}
4453
4454#else
4455
4456#define ___MODULE_FLAGS 0
4457
4458#define ___BEGIN_HLBL
4459#define ___DEF_HLBL_INTRO
4460#define ___DEF_HLBL(id)
4461#define ___END_HLBL
4462
4463#define ___BEGIN_SW \
4464___R_ALL ___start=___MLBL(___HOST_LBL0); ___pc=___ps->pc; \
4465___REGISTER_HOST_ENTRY \
4466___jump: \
4467switch((___pc-=___start)/(___LABEL_SIZE*___WS)) \
4468{
4469
4470#define ___DEF_SW(n)case ___PH_LBL0-___HOST_LBL0+n:
4471
4472#define ___END_SW \
4473}___pc+=___start;___jumpext:
4474
4475#define ___JUMP(dest){___pc=dest;goto ___jump;}
4476#define ___JUMPEXT(dest){___pc=dest;goto ___jumpext;}
4477
4478#endif
4479
4480#define ___BEGIN_P_SLBL ___SM(___NOTHING,___BEGIN_SLBL)
4481#define ___DEF_P_SLBL(id)
4482#define ___END_P_SLBL ___SM(___NOTHING,___END_SLBL)
4483
4484#define ___REGISTER
4485
4486#define ___PSHEAP ___ps->hp
4487#define ___D_HEAP ___REGISTER ___WORD *___hp;
4488#define ___R_HEAP ___R_HEAP_EXPR;
4489#define ___W_HEAP ___W_HEAP_EXPR;
4490#define ___R_HEAP_EXPR ___hp=___PSHEAP
4491#define ___W_HEAP_EXPR ___PSHEAP=___hp
4492
4493#define ___PSFP ___ps->fp
4494#define ___D_FP ___REGISTER ___WORD *___fp;
4495#define ___R_FP ___SET_FP(___PSFP)
4496#define ___W_FP ___PSFP=___fp;
4497
4498/*---------------------------------------------------------------------------*/
4499
4500/* GVM registers */
4501
4502#ifndef ___MAX_LOCAL_GVM_REGS
4503#define ___MAX_LOCAL_GVM_REGS 25
4504#endif
4505
4506#if ___NB_ARG_REGS == 0
4507#define ___PUSH_ARGS1(a)___PUSH(a)
4508#define ___POP_ARGS1(a)a = ___POP;
4509#define ___PUSH_ARGS2(a,b)___PUSH(a)___PUSH(b)
4510#define ___POP_ARGS2(a,b)b = ___POP; a = ___POP;
4511#define ___PUSH_ARGS3(a,b,c)___PUSH(a)___PUSH(b)___PUSH(c)
4512#define ___POP_ARGS3(a,b,c)c = ___POP; b = ___POP; a = ___POP;
4513#define ___PUSH_ARGS4(a,b,c,d)___PUSH(a)___PUSH(b)___PUSH(c)___PUSH(d)
4514#define ___POP_ARGS4(a,b,c,d)d = ___POP; c = ___POP; b = ___POP; a = ___POP;
4515#define ___PUSH_ARGS5(a,b,c,d,e)___PUSH(a)___PUSH(b)___PUSH(c)___PUSH(d)___PUSH(e)
4516#define ___POP_ARGS5(a,b,c,d,e)e = ___POP; d = ___POP; c = ___POP; b = ___POP; a = ___POP;
4517#else
4518#define ___PUSH_ARGS1(a)___SET_R1(a)
4519#define ___POP_ARGS1(a)a = ___R1;
4520#if ___NB_ARG_REGS == 1
4521#define ___PUSH_ARGS2(a,b)___PUSH(a)___SET_R1(b)
4522#define ___POP_ARGS2(a,b)b = ___R1; a = ___POP;
4523#define ___PUSH_ARGS3(a,b,c)___PUSH(a)___PUSH(b)___SET_R1(c)
4524#define ___POP_ARGS3(a,b,c)c = ___R1; b = ___POP; a = ___POP;
4525#define ___PUSH_ARGS4(a,b,c,d)___PUSH(a)___PUSH(b)___PUSH(c)___SET_R1(d)
4526#define ___POP_ARGS4(a,b,c,d)d = ___R1; c = ___POP; b = ___POP; a = ___POP;
4527#define ___PUSH_ARGS5(a,b,c,d,e)___PUSH(a)___PUSH(b)___PUSH(c)___PUSH(d)___SET_R1(e)
4528#define ___POP_ARGS5(a,b,c,d,e)e = ___R1; d = ___POP; c = ___POP; b = ___POP; a = ___POP;
4529#else
4530#define ___PUSH_ARGS2(a,b)___SET_R1(a)___SET_R2(b)
4531#define ___POP_ARGS2(a,b)b = ___R2; a = ___R1;
4532#if ___NB_ARG_REGS == 2
4533#define ___PUSH_ARGS3(a,b,c)___PUSH(a)___SET_R1(b)___SET_R2(c)
4534#define ___POP_ARGS3(a,b,c)c = ___R2; b = ___R1; a = ___POP;
4535#define ___PUSH_ARGS4(a,b,c,d)___PUSH(a)___PUSH(b)___SET_R1(c)___SET_R2(d)
4536#define ___POP_ARGS4(a,b,c,d)d = ___R2; c = ___R1; b = ___POP; a = ___POP;
4537#define ___PUSH_ARGS5(a,b,c,d,e)___PUSH(a)___PUSH(b)___PUSH(c)___SET_R1(d)___SET_R2(e)
4538#define ___POP_ARGS5(a,b,c,d,e)e = ___R2; d = ___R1; c = ___POP; b = ___POP; a = ___POP;
4539#else
4540#define ___PUSH_ARGS3(a,b,c)___SET_R1(a)___SET_R2(b)___SET_R3(c)
4541#define ___POP_ARGS3(a,b,c)c = ___R3; b = ___R2; a = ___R1;
4542#if ___NB_ARG_REGS == 3
4543#define ___PUSH_ARGS4(a,b,c,d)___PUSH(a)___SET_R1(b)___SET_R2(c)___SET_R3(d)
4544#define ___POP_ARGS4(a,b,c,d)d = ___R3; c = ___R2; b = ___R1; a = ___POP;
4545#define ___PUSH_ARGS5(a,b,c,d,e)___PUSH(a)___PUSH(b)___SET_R1(c)___SET_R2(d)___SET_R3(e)
4546#define ___POP_ARGS5(a,b,c,d,e)e = ___R3; d = ___R2; c = ___R1; b = ___POP; a = ___POP;
4547#else
4548#define ___PUSH_ARGS4(a,b,c,d)___SET_R1(a)___SET_R2(b)___SET_R3(c)___SET_R4(d)
4549#define ___POP_ARGS4(a,b,c,d)d = ___R4; c = ___R3; b = ___R2; a = ___R1;
4550#if ___NB_ARG_REGS == 4
4551#define ___PUSH_ARGS5(a,b,c,d,e)___PUSH(a)___SET_R1(b)___SET_R2(c)___SET_R3(d)___SET_R4(e)
4552#define ___POP_ARGS5(a,b,c,d,e)e = ___R4; d = ___R3; c = ___R2; b = ___R1; a = ___POP;
4553#else
4554#define ___PUSH_ARGS5(a,b,c,d,e)___SET_R1(a)___SET_R2(b)___SET_R3(c)___SET_R4(d)___SET_R5(e)
4555#define ___POP_ARGS5(a,b,c,d,e)e = ___R5; d = ___R4; c = ___R3; b = ___R2; a = ___R1;
4556#endif
4557#endif
4558#endif
4559#endif
4560#endif
4561
4562#define ___PSR0 ___ps->r[0]
4563#if ___MAX_LOCAL_GVM_REGS > 0
4564#define ___D_R0 ___REGISTER ___WORD ___r0;
4565#define ___R_R0 ___r0=___PSR0;
4566#define ___W_R0 ___PSR0=___r0;
4567#define ___R0 ___r0
4568#else
4569#define ___D_R0
4570#define ___R_R0
4571#define ___W_R0
4572#define ___R0 ___PSR0
4573#endif
4574#define ___SET_R0(val)___R0=val;
4575#define ___PUSH_R0 ___PUSH(___R0)
4576#define ___POP_R0 ___SET_R0(___POP)
4577
4578#if ___NB_ARG_REGS == 0
4579#define ___PUSH_ARGS_IN_REGS(na)
4580#define ___POP_ARGS_IN_REGS(na)
4581#define ___PSSELF ___PSR1
4582#define ___SELF ___R1
4583#define ___LD_ARG_REGS
4584#define ___ST_ARG_REGS
4585#endif
4586
4587#define ___PSR1 ___ps->r[1]
4588#if ___MAX_LOCAL_GVM_REGS > 1
4589#define ___D_R1 ___REGISTER ___WORD ___r1;
4590#define ___R_R1 ___r1=___PSR1;
4591#define ___W_R1 ___PSR1=___r1;
4592#define ___R1 ___r1
4593#else
4594#define ___D_R1
4595#define ___R_R1
4596#define ___W_R1
4597#define ___R1 ___PSR1
4598#endif
4599#define ___SET_R1(val)___R1=(val);
4600#define ___PUSH_R1_TO_R1 ___PUSH(___R1)
4601#define ___POP_R1_TO_R1 ___SET_R1(___POP)
4602#define ___LD_R1_TO_R1 ___D_R1 ___R_R1
4603#define ___ST_R1_TO_R1 ___W_R1
4604
4605#if ___NB_ARG_REGS == 1
4606#define ___PUSH_ARGS_IN_REGS(na) \
4607if ((na)>0) ___PUSH_R1_TO_R1
4608#define ___POP_ARGS_IN_REGS(na) \
4609if ((na)>0) ___POP_R1_TO_R1
4610#define ___PSSELF ___PSR2
4611#define ___SELF ___R2
4612#define ___LD_ARG_REGS ___LD_R1_TO_R1
4613#define ___ST_ARG_REGS ___ST_R1_TO_R1
4614#endif
4615
4616#if ___NB_GVM_REGS == 2
4617
4618#define ___PUSH_REGS ___PUSH_R0 ___PUSH_R1_TO_R1
4619#define ___POP_REGS ___POP_R1_TO_R1 ___POP_R0
4620
4621#else
4622
4623#define ___PSR2 ___ps->r[2]
4624#if ___MAX_LOCAL_GVM_REGS > 2
4625#define ___D_R2 ___REGISTER ___WORD ___r2;
4626#define ___R_R2 ___r2=___PSR2;
4627#define ___W_R2 ___PSR2=___r2;
4628#define ___R2 ___r2
4629#else
4630#define ___D_R2
4631#define ___R_R2
4632#define ___W_R2
4633#define ___R2 ___PSR2
4634#endif
4635#define ___SET_R2(val)___R2=(val);
4636#define ___PUSH_R1_TO_R2 ___PUSH_R1_TO_R1 ___PUSH(___R2)
4637#define ___POP_R2_TO_R1 ___SET_R2(___POP)___POP_R1_TO_R1
4638#define ___LD_R1_TO_R2 ___D_R2 ___LD_R1_TO_R1 ___R_R2
4639#define ___ST_R1_TO_R2 ___ST_R1_TO_R1 ___W_R2
4640
4641#if ___NB_ARG_REGS == 2
4642#define ___PUSH_ARGS_IN_REGS(na) \
4643switch (na) \
4644  { \
4645  case 0:  break; \
4646  case 1:  ___PUSH_R1_TO_R1 break; \
4647  default: ___PUSH_R1_TO_R2 \
4648  }
4649#define ___POP_ARGS_IN_REGS(na) \
4650switch (na) \
4651  { \
4652  case 0:  break; \
4653  case 1:  ___POP_R1_TO_R1 break; \
4654  default: ___POP_R2_TO_R1 \
4655  }
4656#define ___PSSELF ___PSR3
4657#define ___SELF ___R3
4658#define ___LD_ARG_REGS ___LD_R1_TO_R2
4659#define ___ST_ARG_REGS ___ST_R1_TO_R2
4660#endif
4661
4662#if ___NB_GVM_REGS == 3
4663
4664#define ___PUSH_REGS ___PUSH_R0 ___PUSH_R1_TO_R2
4665#define ___POP_REGS ___POP_R2_TO_R1 ___POP_R0
4666
4667#else
4668
4669#define ___PSR3 ___ps->r[3]
4670#if ___MAX_LOCAL_GVM_REGS > 3
4671#define ___D_R3 ___REGISTER ___WORD ___r3;
4672#define ___R_R3 ___r3=___PSR3;
4673#define ___W_R3 ___PSR3=___r3;
4674#define ___R3 ___r3
4675#else
4676#define ___D_R3
4677#define ___R_R3
4678#define ___W_R3
4679#define ___R3 ___PSR3
4680#endif
4681#define ___SET_R3(val)___R3=(val);
4682#define ___PUSH_R1_TO_R3 ___PUSH_R1_TO_R2 ___PUSH(___R3)
4683#define ___POP_R3_TO_R1 ___SET_R3(___POP)___POP_R2_TO_R1
4684#define ___LD_R1_TO_R3 ___D_R3 ___LD_R1_TO_R2 ___R_R3
4685#define ___ST_R1_TO_R3 ___ST_R1_TO_R2 ___W_R3
4686
4687#if ___NB_ARG_REGS == 3
4688#define ___PUSH_ARGS_IN_REGS(na) \
4689switch (na) \
4690  { \
4691  case 0:  break; \
4692  case 1:  ___PUSH_R1_TO_R1 break; \
4693  case 2:  ___PUSH_R1_TO_R2 break; \
4694  default: ___PUSH_R1_TO_R3 \
4695  }
4696#define ___POP_ARGS_IN_REGS(na) \
4697switch (na) \
4698  { \
4699  case 0:  break; \
4700  case 1:  ___POP_R1_TO_R1 break; \
4701  case 2:  ___POP_R2_TO_R1 break; \
4702  default: ___POP_R3_TO_R1 \
4703  }
4704#define ___PSSELF ___PSR4
4705#define ___SELF ___R4
4706#define ___LD_ARG_REGS ___LD_R1_TO_R3
4707#define ___ST_ARG_REGS ___ST_R1_TO_R3
4708#endif
4709
4710#if ___NB_GVM_REGS == 4
4711
4712#define ___PUSH_REGS ___PUSH_R0 ___PUSH_R1_TO_R3
4713#define ___POP_REGS ___POP_R3_TO_R1 ___POP_R0
4714
4715#else
4716
4717#define ___PSR4 ___ps->r[4]
4718#if ___MAX_LOCAL_GVM_REGS > 4
4719#define ___D_R4 ___REGISTER ___WORD ___r4;
4720#define ___R_R4 ___r4=___PSR4;
4721#define ___W_R4 ___PSR4=___r4;
4722#define ___R4 ___r4
4723#else
4724#define ___D_R4
4725#define ___R_R4
4726#define ___W_R4
4727#define ___R4 ___PSR4
4728#endif
4729#define ___SET_R4(val)___R4=(val);
4730#define ___PUSH_R1_TO_R4 ___PUSH_R1_TO_R3 ___PUSH(___R4)
4731#define ___POP_R4_TO_R1 ___SET_R4(___POP)___POP_R3_TO_R1
4732#define ___LD_R1_TO_R4 ___D_R4 ___LD_R1_TO_R3 ___R_R4
4733#define ___ST_R1_TO_R4 ___ST_R1_TO_R3 ___W_R4
4734
4735#if ___NB_ARG_REGS == 4
4736#define ___PUSH_ARGS_IN_REGS(na) \
4737switch (na) \
4738  { \
4739  case 0:  break; \
4740  case 1:  ___PUSH_R1_TO_R1 break; \
4741  case 2:  ___PUSH_R1_TO_R2 break; \
4742  case 3:  ___PUSH_R1_TO_R3 break; \
4743  default: ___PUSH_R1_TO_R4 \
4744  }
4745#define ___POP_ARGS_IN_REGS(na) \
4746switch (na) \
4747  { \
4748  case 0:  break; \
4749  case 1:  ___POP_R1_TO_R1 break; \
4750  case 2:  ___POP_R2_TO_R1 break; \
4751  case 3:  ___POP_R3_TO_R1 break; \
4752  default: ___POP_R4_TO_R1 \
4753  }
4754#define ___PSSELF ___PSR5
4755#define ___SELF ___R5
4756#define ___LD_ARG_REGS ___LD_R1_TO_R4
4757#define ___ST_ARG_REGS ___ST_R1_TO_R4
4758#endif
4759
4760#if ___NB_GVM_REGS == 5
4761
4762#define ___PUSH_REGS ___PUSH_R0 ___PUSH_R1_TO_R4
4763#define ___POP_REGS ___POP_R4_TO_R1 ___POP_R0
4764
4765#else
4766
4767#define ___PSR5 ___ps->r[5]
4768#if ___MAX_LOCAL_GVM_REGS > 5
4769#define ___D_R5 ___REGISTER ___WORD ___r5;
4770#define ___R_R5 ___r5=___PSR5;
4771#define ___W_R5 ___PSR5=___r5;
4772#define ___R5 ___r5
4773#else
4774#define ___D_R5
4775#define ___R_R5
4776#define ___W_R5
4777#define ___R5 ___PSR5
4778#endif
4779#define ___SET_R5(val)___R5=(val);
4780#define ___PUSH_R1_TO_R5 ___PUSH_R1_TO_R4 ___PUSH(___R5)
4781#define ___POP_R5_TO_R1 ___SET_R5(___POP)___POP_R4_TO_R1
4782#define ___LD_R1_TO_R5 ___D_R5 ___LD_R1_TO_R4 ___R_R5
4783#define ___ST_R1_TO_R5 ___ST_R1_TO_R4 ___W_R5
4784
4785#if ___NB_ARG_REGS == 5
4786#define ___PUSH_ARGS_IN_REGS(na) \
4787switch (na) \
4788  { \
4789  case 0:  break; \
4790  case 1:  ___PUSH_R1_TO_R1 break; \
4791  case 2:  ___PUSH_R1_TO_R2 break; \
4792  case 3:  ___PUSH_R1_TO_R3 break; \
4793  case 4:  ___PUSH_R1_TO_R4 break; \
4794  default: ___PUSH_R1_TO_R5 \
4795  }
4796#define ___POP_ARGS_IN_REGS(na) \
4797switch (na) \
4798  { \
4799  case 0:  break; \
4800  case 1:  ___POP_R1_TO_R1 break; \
4801  case 2:  ___POP_R2_TO_R1 break; \
4802  case 3:  ___POP_R3_TO_R1 break; \
4803  case 4:  ___POP_R4_TO_R1 break; \
4804  default: ___POP_R5_TO_R1 \
4805  }
4806#define ___PSSELF ___PSR6
4807#define ___SELF ___R6
4808#define ___LD_ARG_REGS ___LD_R1_TO_R5
4809#define ___ST_ARG_REGS ___ST_R1_TO_R5
4810#endif
4811
4812#if ___NB_GVM_REGS == 6
4813
4814#define ___PUSH_REGS ___PUSH_R0 ___PUSH_R1_TO_R5
4815#define ___POP_REGS ___POP_R5_TO_R1 ___POP_R0
4816
4817#else
4818
4819#define ___PSR6 ___ps->r[6]
4820#if ___MAX_LOCAL_GVM_REGS > 6
4821#define ___D_R6 ___REGISTER ___WORD ___r6;
4822#define ___R_R6 ___r6=___PSR6;
4823#define ___W_R6 ___PSR6=___r6;
4824#define ___R6 ___r6
4825#else
4826#define ___D_R6
4827#define ___R_R6
4828#define ___W_R6
4829#define ___R6 ___PSR6
4830#endif
4831#define ___SET_R6(val)___R6=(val);
4832#define ___PUSH_R1_TO_R6 ___PUSH_R1_TO_R5 ___PUSH(___R6)
4833#define ___POP_R6_TO_R1 ___SET_R6(___POP)___POP_R5_TO_R1
4834#define ___LD_R1_TO_R6 ___D_R6 ___LD_R1_TO_R5 ___R_R6
4835#define ___ST_R1_TO_R6 ___ST_R1_TO_R5 ___W_R6
4836
4837#if ___NB_ARG_REGS == 6
4838#define ___PUSH_ARGS_IN_REGS(na) \
4839switch (na) \
4840  { \
4841  case 0:  break; \
4842  case 1:  ___PUSH_R1_TO_R1 break; \
4843  case 2:  ___PUSH_R1_TO_R2 break; \
4844  case 3:  ___PUSH_R1_TO_R3 break; \
4845  case 4:  ___PUSH_R1_TO_R4 break; \
4846  case 5:  ___PUSH_R1_TO_R5 break; \
4847  default: ___PUSH_R1_TO_R6 \
4848  }
4849#define ___POP_ARGS_IN_REGS(na) \
4850switch (na) \
4851  { \
4852  case 0:  break; \
4853  case 1:  ___POP_R1_TO_R1 break; \
4854  case 2:  ___POP_R2_TO_R1 break; \
4855  case 3:  ___POP_R3_TO_R1 break; \
4856  case 4:  ___POP_R4_TO_R1 break; \
4857  case 5:  ___POP_R5_TO_R1 break; \
4858  default: ___POP_R6_TO_R1 \
4859  }
4860#define ___PSSELF ___PSR7
4861#define ___SELF ___R7
4862#define ___LD_ARG_REGS ___LD_R1_TO_R6
4863#define ___ST_ARG_REGS ___ST_R1_TO_R6
4864#endif
4865
4866#if ___NB_GVM_REGS == 7
4867
4868#define ___PUSH_REGS ___PUSH_R0 ___PUSH_R1_TO_R6
4869#define ___POP_REGS ___POP_R6_TO_R1 ___POP_R0
4870
4871#else
4872
4873#define ___PSR7 ___ps->r[7]
4874#if ___MAX_LOCAL_GVM_REGS > 7
4875#define ___D_R7 ___REGISTER ___WORD ___r7;
4876#define ___R_R7 ___r7=___PSR7;
4877#define ___W_R7 ___PSR7=___r7;
4878#define ___R7 ___r7
4879#else
4880#define ___D_R7
4881#define ___R_R7
4882#define ___W_R7
4883#define ___R7 ___PSR7
4884#endif
4885#define ___SET_R7(val)___R7=(val);
4886#define ___PUSH_R1_TO_R7 ___PUSH_R1_TO_R6 ___PUSH(___R7)
4887#define ___POP_R7_TO_R1 ___SET_R7(___POP)___POP_R6_TO_R1
4888#define ___LD_R1_TO_R7 ___D_R7 ___LD_R1_TO_R6 ___R_R7
4889#define ___ST_R1_TO_R7 ___ST_R1_TO_R6 ___W_R7
4890
4891#if ___NB_ARG_REGS == 7
4892#define ___PUSH_ARGS_IN_REGS(na) \
4893switch (na) \
4894  { \
4895  case 0:  break; \
4896  case 1:  ___PUSH_R1_TO_R1 break; \
4897  case 2:  ___PUSH_R1_TO_R2 break; \
4898  case 3:  ___PUSH_R1_TO_R3 break; \
4899  case 4:  ___PUSH_R1_TO_R4 break; \
4900  case 5:  ___PUSH_R1_TO_R5 break; \
4901  case 6:  ___PUSH_R1_TO_R6 break; \
4902  default: ___PUSH_R1_TO_R7 \
4903  }
4904#define ___POP_ARGS_IN_REGS(na) \
4905switch (na) \
4906  { \
4907  case 0:  break; \
4908  case 1:  ___POP_R1_TO_R1 break; \
4909  case 2:  ___POP_R2_TO_R1 break; \
4910  case 3:  ___POP_R3_TO_R1 break; \
4911  case 4:  ___POP_R4_TO_R1 break; \
4912  case 5:  ___POP_R5_TO_R1 break; \
4913  case 6:  ___POP_R6_TO_R1 break; \
4914  default: ___POP_R7_TO_R1 \
4915  }
4916#define ___PSSELF ___PSR8
4917#define ___SELF ___R8
4918#define ___LD_ARG_REGS ___LD_R1_TO_R7
4919#define ___ST_ARG_REGS ___ST_R1_TO_R7
4920#endif
4921
4922#if ___NB_GVM_REGS == 8
4923
4924#define ___PUSH_REGS ___PUSH_R0 ___PUSH_R1_TO_R7
4925#define ___POP_REGS ___POP_R7_TO_R1 ___POP_R0
4926
4927#else
4928
4929#define ___PSR8 ___ps->r[8]
4930#if ___MAX_LOCAL_GVM_REGS > 8
4931#define ___D_R8 ___REGISTER ___WORD ___r8;
4932#define ___R_R8 ___r8=___PSR8;
4933#define ___W_R8 ___PSR8=___r8;
4934#define ___R8 ___r8
4935#else
4936#define ___D_R8
4937#define ___R_R8
4938#define ___W_R8
4939#define ___R8 ___PSR8
4940#endif
4941#define ___SET_R8(val)___R8=(val);
4942#define ___PUSH_R1_TO_R8 ___PUSH_R1_TO_R7 ___PUSH(___R8)
4943#define ___POP_R8_TO_R1 ___SET_R8(___POP)___POP_R7_TO_R1
4944#define ___LD_R1_TO_R8 ___D_R8 ___LD_R1_TO_R7 ___R_R8
4945#define ___ST_R1_TO_R8 ___ST_R1_TO_R7 ___W_R8
4946
4947#if ___NB_ARG_REGS == 8
4948#define ___PUSH_ARGS_IN_REGS(na) \
4949switch (na) \
4950  { \
4951  case 0:  break; \
4952  case 1:  ___PUSH_R1_TO_R1 break; \
4953  case 2:  ___PUSH_R1_TO_R2 break; \
4954  case 3:  ___PUSH_R1_TO_R3 break; \
4955  case 4:  ___PUSH_R1_TO_R4 break; \
4956  case 5:  ___PUSH_R1_TO_R5 break; \
4957  case 6:  ___PUSH_R1_TO_R6 break; \
4958  case 7:  ___PUSH_R1_TO_R7 break; \
4959  default: ___PUSH_R1_TO_R8 \
4960  }
4961#define ___POP_ARGS_IN_REGS(na) \
4962switch (na) \
4963  { \
4964  case 0:  break; \
4965  case 1:  ___POP_R1_TO_R1 break; \
4966  case 2:  ___POP_R2_TO_R1 break; \
4967  case 3:  ___POP_R3_TO_R1 break; \
4968  case 4:  ___POP_R4_TO_R1 break; \
4969  case 5:  ___POP_R5_TO_R1 break; \
4970  case 6:  ___POP_R6_TO_R1 break; \
4971  case 7:  ___POP_R7_TO_R1 break; \
4972  default: ___POP_R8_TO_R1 \
4973  }
4974#define ___PSSELF ___PSR9
4975#define ___SELF ___R9
4976#define ___LD_ARG_REGS ___LD_R1_TO_R8
4977#define ___ST_ARG_REGS ___ST_R1_TO_R8
4978#endif
4979
4980#if ___NB_GVM_REGS == 9
4981
4982#define ___PUSH_REGS ___PUSH_R0 ___PUSH_R1_TO_R8
4983#define ___POP_REGS ___POP_R8_TO_R1 ___POP_R0
4984
4985#else
4986
4987#define ___PSR9 ___ps->r[9]
4988#if ___MAX_LOCAL_GVM_REGS > 9
4989#define ___D_R9 ___REGISTER ___WORD ___r9;
4990#define ___R_R9 ___r9=___PSR9;
4991#define ___W_R9 ___PSR9=___r9;
4992#define ___R9 ___r9
4993#else
4994#define ___D_R9
4995#define ___R_R9
4996#define ___W_R9
4997#define ___R9 ___PSR9
4998#endif
4999#define ___SET_R9(val)___R9=(val);
5000#define ___PUSH_R1_TO_R9 ___PUSH_R1_TO_R8 ___PUSH(___R9)
5001#define ___POP_R9_TO_R1 ___SET_R9(___POP)___POP_R8_TO_R1
5002#define ___LD_R1_TO_R9 ___D_R9 ___LD_R1_TO_R8 ___R_R9
5003#define ___ST_R1_TO_R9 ___ST_R1_TO_R8 ___W_R9
5004
5005#if ___NB_ARG_REGS == 9
5006#define ___PUSH_ARGS_IN_REGS(na) \
5007switch (na) \
5008  { \
5009  case 0:  break; \
5010  case 1:  ___PUSH_R1_TO_R1 break; \
5011  case 2:  ___PUSH_R1_TO_R2 break; \
5012  case 3:  ___PUSH_R1_TO_R3 break; \
5013  case 4:  ___PUSH_R1_TO_R4 break; \
5014  case 5:  ___PUSH_R1_TO_R5 break; \
5015  case 6:  ___PUSH_R1_TO_R6 break; \
5016  case 7:  ___PUSH_R1_TO_R7 break; \
5017  case 8:  ___PUSH_R1_TO_R8 break; \
5018  default: ___PUSH_R1_TO_R9 \
5019  }
5020#define ___POP_ARGS_IN_REGS(na) \
5021switch (na) \
5022  { \
5023  case 0:  break; \
5024  case 1:  ___POP_R1_TO_R1 break; \
5025  case 2:  ___POP_R2_TO_R1 break; \
5026  case 3:  ___POP_R3_TO_R1 break; \
5027  case 4:  ___POP_R4_TO_R1 break; \
5028  case 5:  ___POP_R5_TO_R1 break; \
5029  case 6:  ___POP_R6_TO_R1 break; \
5030  case 7:  ___POP_R7_TO_R1 break; \
5031  case 8:  ___POP_R8_TO_R1 break; \
5032  default: ___POP_R9_TO_R1 \
5033  }
5034#define ___PSSELF ___PSR10
5035#define ___SELF ___R10
5036#define ___LD_ARG_REGS ___LD_R1_TO_R9
5037#define ___ST_ARG_REGS ___ST_R1_TO_R9
5038#endif
5039
5040#if ___NB_GVM_REGS == 10
5041
5042#define ___PUSH_REGS ___PUSH_R0 ___PUSH_R1_TO_R9
5043#define ___POP_REGS ___POP_R9_TO_R1 ___POP_R0
5044
5045#else
5046
5047#define ___PSR10 ___ps->r[10]
5048#if ___MAX_LOCAL_GVM_REGS > 10
5049#define ___D_R10 ___REGISTER ___WORD ___r10;
5050#define ___R_R10 ___r10=___PSR10;
5051#define ___W_R10 ___PSR10=___r10;
5052#define ___R10 ___r10
5053#else
5054#define ___D_R10
5055#define ___R_R10
5056#define ___W_R10
5057#define ___R10 ___PSR10
5058#endif
5059#define ___SET_R10(val)___R10=(val);
5060#define ___PUSH_R1_TO_R10 ___PUSH_R1_TO_R9 ___PUSH(___R10)
5061#define ___POP_R10_TO_R1 ___SET_R10(___POP)___POP_R9_TO_R1
5062#define ___LD_R1_TO_R10 ___D_R10 ___LD_R1_TO_R9 ___R_R10
5063#define ___ST_R1_TO_R10 ___ST_R1_TO_R9 ___W_R10
5064
5065#if ___NB_ARG_REGS == 10
5066#define ___PUSH_ARGS_IN_REGS(na) \
5067switch (na) \
5068  { \
5069  case 0:  break; \
5070  case 1:  ___PUSH_R1_TO_R1 break; \
5071  case 2:  ___PUSH_R1_TO_R2 break; \
5072  case 3:  ___PUSH_R1_TO_R3 break; \
5073  case 4:  ___PUSH_R1_TO_R4 break; \
5074  case 5:  ___PUSH_R1_TO_R5 break; \
5075  case 6:  ___PUSH_R1_TO_R6 break; \
5076  case 7:  ___PUSH_R1_TO_R7 break; \
5077  case 8:  ___PUSH_R1_TO_R8 break; \
5078  case 9:  ___PUSH_R1_TO_R9 break; \
5079  default: ___PUSH_R1_TO_R10 \
5080  }
5081#define ___POP_ARGS_IN_REGS(na) \
5082switch (na) \
5083  { \
5084  case 0:  break; \
5085  case 1:  ___POP_R1_TO_R1 break; \
5086  case 2:  ___POP_R2_TO_R1 break; \
5087  case 3:  ___POP_R3_TO_R1 break; \
5088  case 4:  ___POP_R4_TO_R1 break; \
5089  case 5:  ___POP_R5_TO_R1 break; \
5090  case 6:  ___POP_R6_TO_R1 break; \
5091  case 7:  ___POP_R7_TO_R1 break; \
5092  case 8:  ___POP_R8_TO_R1 break; \
5093  case 9:  ___POP_R9_TO_R1 break; \
5094  default: ___POP_R10_TO_R1 \
5095  }
5096#define ___PSSELF ___PSR11
5097#define ___SELF ___R11
5098#define ___LD_ARG_REGS ___LD_R1_TO_R10
5099#define ___ST_ARG_REGS ___ST_R1_TO_R10
5100#endif
5101
5102#if ___NB_GVM_REGS == 11
5103
5104#define ___PUSH_REGS ___PUSH_R0 ___PUSH_R1_TO_R10
5105#define ___POP_REGS ___POP_R10_TO_R1 ___POP_R0
5106
5107#else
5108
5109#define ___PSR11 ___ps->r[11]
5110#if ___MAX_LOCAL_GVM_REGS > 11
5111#define ___D_R11 ___REGISTER ___WORD ___r11;
5112#define ___R_R11 ___r11=___PSR11;
5113#define ___W_R11 ___PSR11=___r11;
5114#define ___R11 ___r11
5115#else
5116#define ___D_R11
5117#define ___R_R11
5118#define ___W_R11
5119#define ___R11 ___PSR11
5120#endif
5121#define ___SET_R11(val)___R11=(val);
5122#define ___PUSH_R1_TO_R11 ___PUSH_R1_TO_R10 ___PUSH(___R11)
5123#define ___POP_R11_TO_R1 ___SET_R11(___POP)___POP_R10_TO_R1
5124#define ___LD_R1_TO_R11 ___D_R11 ___LD_R1_TO_R10 ___R_R11
5125#define ___ST_R1_TO_R11 ___ST_R1_TO_R10 ___W_R11
5126
5127#if ___NB_ARG_REGS == 11
5128#define ___PUSH_ARGS_IN_REGS(na) \
5129switch (na) \
5130  { \
5131  case 0:  break; \
5132  case 1:  ___PUSH_R1_TO_R1 break; \
5133  case 2:  ___PUSH_R1_TO_R2 break; \
5134  case 3:  ___PUSH_R1_TO_R3 break; \
5135  case 4:  ___PUSH_R1_TO_R4 break; \
5136  case 5:  ___PUSH_R1_TO_R5 break; \
5137  case 6:  ___PUSH_R1_TO_R6 break; \
5138  case 7:  ___PUSH_R1_TO_R7 break; \
5139  case 8:  ___PUSH_R1_TO_R8 break; \
5140  case 9:  ___PUSH_R1_TO_R9 break; \
5141  case 10:  ___PUSH_R1_TO_R10 break; \
5142  default: ___PUSH_R1_TO_R11 \
5143  }
5144#define ___POP_ARGS_IN_REGS(na) \
5145switch (na) \
5146  { \
5147  case 0:  break; \
5148  case 1:  ___POP_R1_TO_R1 break; \
5149  case 2:  ___POP_R2_TO_R1 break; \
5150  case 3:  ___POP_R3_TO_R1 break; \
5151  case 4:  ___POP_R4_TO_R1 break; \
5152  case 5:  ___POP_R5_TO_R1 break; \
5153  case 6:  ___POP_R6_TO_R1 break; \
5154  case 7:  ___POP_R7_TO_R1 break; \
5155  case 8:  ___POP_R8_TO_R1 break; \
5156  case 9:  ___POP_R9_TO_R1 break; \
5157  case 10:  ___POP_R10_TO_R1 break; \
5158  default: ___POP_R11_TO_R1 \
5159  }
5160#define ___PSSELF ___PSR12
5161#define ___SELF ___R12
5162#define ___LD_ARG_REGS ___LD_R1_TO_R11
5163#define ___ST_ARG_REGS ___ST_R1_TO_R11
5164#endif
5165
5166#if ___NB_GVM_REGS == 12
5167
5168#define ___PUSH_REGS ___PUSH_R0 ___PUSH_R1_TO_R11
5169#define ___POP_REGS ___POP_R11_TO_R1 ___POP_R0
5170
5171#else
5172
5173#define ___PSR12 ___ps->r[12]
5174#if ___MAX_LOCAL_GVM_REGS > 12
5175#define ___D_R12 ___REGISTER ___WORD ___r12;
5176#define ___R_R12 ___r12=___PSR12;
5177#define ___W_R12 ___PSR12=___r12;
5178#define ___R12 ___r12
5179#else
5180#define ___D_R12
5181#define ___R_R12
5182#define ___W_R12
5183#define ___R12 ___PSR12
5184#endif
5185#define ___SET_R12(val)___R12=(val);
5186#define ___PUSH_R1_TO_R12 ___PUSH_R1_TO_R11 ___PUSH(___R12)
5187#define ___POP_R12_TO_R1 ___SET_R12(___POP)___POP_R11_TO_R1
5188#define ___LD_R1_TO_R12 ___D_R12 ___LD_R1_TO_R11 ___R_R12
5189#define ___ST_R1_TO_R12 ___ST_R1_TO_R11 ___W_R12
5190
5191#if ___NB_ARG_REGS == 12
5192#define ___PUSH_ARGS_IN_REGS(na) \
5193switch (na) \
5194  { \
5195  case 0:  break; \
5196  case 1:  ___PUSH_R1_TO_R1 break; \
5197  case 2:  ___PUSH_R1_TO_R2 break; \
5198  case 3:  ___PUSH_R1_TO_R3 break; \
5199  case 4:  ___PUSH_R1_TO_R4 break; \
5200  case 5:  ___PUSH_R1_TO_R5 break; \
5201  case 6:  ___PUSH_R1_TO_R6 break; \
5202  case 7:  ___PUSH_R1_TO_R7 break; \
5203  case 8:  ___PUSH_R1_TO_R8 break; \
5204  case 9:  ___PUSH_R1_TO_R9 break; \
5205  case 10:  ___PUSH_R1_TO_R10 break; \
5206  case 11:  ___PUSH_R1_TO_R11 break; \
5207  default: ___PUSH_R1_TO_R12 \
5208  }
5209#define ___POP_ARGS_IN_REGS(na) \
5210switch (na) \
5211  { \
5212  case 0:  break; \
5213  case 1:  ___POP_R1_TO_R1 break; \
5214  case 2:  ___POP_R2_TO_R1 break; \
5215  case 3:  ___POP_R3_TO_R1 break; \
5216  case 4:  ___POP_R4_TO_R1 break; \
5217  case 5:  ___POP_R5_TO_R1 break; \
5218  case 6:  ___POP_R6_TO_R1 break; \
5219  case 7:  ___POP_R7_TO_R1 break; \
5220  case 8:  ___POP_R8_TO_R1 break; \
5221  case 9:  ___POP_R9_TO_R1 break; \
5222  case 10:  ___POP_R10_TO_R1 break; \
5223  case 11:  ___POP_R11_TO_R1 break; \
5224  default: ___POP_R12_TO_R1 \
5225  }
5226#define ___PSSELF ___PSR13
5227#define ___SELF ___R13
5228#define ___LD_ARG_REGS ___LD_R1_TO_R12
5229#define ___ST_ARG_REGS ___ST_R1_TO_R12
5230#endif
5231
5232#if ___NB_GVM_REGS == 13
5233
5234#define ___PUSH_REGS ___PUSH_R0 ___PUSH_R1_TO_R12
5235#define ___POP_REGS ___POP_R12_TO_R1 ___POP_R0
5236
5237#else
5238
5239#define ___PSR13 ___ps->r[13]
5240#if ___MAX_LOCAL_GVM_REGS > 13
5241#define ___D_R13 ___REGISTER ___WORD ___r13;
5242#define ___R_R13 ___r13=___PSR13;
5243#define ___W_R13 ___PSR13=___r13;
5244#define ___R13 ___r13
5245#else
5246#define ___D_R13
5247#define ___R_R13
5248#define ___W_R13
5249#define ___R13 ___PSR13
5250#endif
5251#define ___SET_R13(val)___R13=(val);
5252#define ___PUSH_R1_TO_R13 ___PUSH_R1_TO_R12 ___PUSH(___R13)
5253#define ___POP_R13_TO_R1 ___SET_R13(___POP)___POP_R12_TO_R1
5254#define ___LD_R1_TO_R13 ___D_R13 ___LD_R1_TO_R12 ___R_R13
5255#define ___ST_R1_TO_R13 ___ST_R1_TO_R12 ___W_R13
5256
5257#if ___NB_GVM_REGS == 14
5258
5259#define ___PUSH_REGS ___PUSH_R0 ___PUSH_R1_TO_R13
5260#define ___POP_REGS ___POP_R13_TO_R1 ___POP_R0
5261
5262#else
5263
5264#define ___PSR14 ___ps->r[14]
5265#if ___MAX_LOCAL_GVM_REGS > 14
5266#define ___D_R14 ___REGISTER ___WORD ___r14;
5267#define ___R_R14 ___r14=___PSR14;
5268#define ___W_R14 ___PSR14=___r14;
5269#define ___R14 ___r14
5270#else
5271#define ___D_R14
5272#define ___R_R14
5273#define ___W_R14
5274#define ___R14 ___PSR14
5275#endif
5276#define ___SET_R14(val)___R14=(val);
5277#define ___PUSH_R1_TO_R14 ___PUSH_R1_TO_R13 ___PUSH(___R14)
5278#define ___POP_R14_TO_R1 ___SET_R14(___POP)___POP_R13_TO_R1
5279#define ___LD_R1_TO_R14 ___D_R14 ___LD_R1_TO_R13 ___R_R14
5280#define ___ST_R1_TO_R14 ___ST_R1_TO_R13 ___W_R14
5281
5282#if ___NB_GVM_REGS == 15
5283
5284#define ___PUSH_REGS ___PUSH_R0 ___PUSH_R1_TO_R14
5285#define ___POP_REGS ___POP_R14_TO_R1 ___POP_R0
5286
5287#else
5288
5289#define ___PSR15 ___ps->r[15]
5290#if ___MAX_LOCAL_GVM_REGS > 15
5291#define ___D_R15 ___REGISTER ___WORD ___r15;
5292#define ___R_R15 ___r15=___PSR15;
5293#define ___W_R15 ___PSR15=___r15;
5294#define ___R15 ___r15
5295#else
5296#define ___D_R15
5297#define ___R_R15
5298#define ___W_R15
5299#define ___R15 ___PSR15
5300#endif
5301#define ___SET_R15(val)___R15=(val);
5302#define ___PUSH_R1_TO_R15 ___PUSH_R1_TO_R14 ___PUSH(___R15)
5303#define ___POP_R15_TO_R1 ___SET_R15(___POP)___POP_R14_TO_R1
5304#define ___LD_R1_TO_R15 ___D_R15 ___LD_R1_TO_R14 ___R_R15
5305#define ___ST_R1_TO_R15 ___ST_R1_TO_R14 ___W_R15
5306
5307#if ___NB_GVM_REGS == 16
5308
5309#define ___PUSH_REGS ___PUSH_R0 ___PUSH_R1_TO_R15
5310#define ___POP_REGS ___POP_R15_TO_R1 ___POP_R0
5311
5312#else
5313
5314#define ___PSR16 ___ps->r[16]
5315#if ___MAX_LOCAL_GVM_REGS > 16
5316#define ___D_R16 ___REGISTER ___WORD ___r16;
5317#define ___R_R16 ___r16=___PSR16;
5318#define ___W_R16 ___PSR16=___r16;
5319#define ___R16 ___r16
5320#else
5321#define ___D_R16
5322#define ___R_R16
5323#define ___W_R16
5324#define ___R16 ___PSR16
5325#endif
5326#define ___SET_R16(val)___R16=(val);
5327#define ___PUSH_R1_TO_R16 ___PUSH_R1_TO_R15 ___PUSH(___R16)
5328#define ___POP_R16_TO_R1 ___SET_R16(___POP)___POP_R15_TO_R1
5329#define ___LD_R1_TO_R16 ___D_R16 ___LD_R1_TO_R15 ___R_R16
5330#define ___ST_R1_TO_R16 ___ST_R1_TO_R15 ___W_R16
5331
5332#if ___NB_GVM_REGS == 17
5333
5334#define ___PUSH_REGS ___PUSH_R0 ___PUSH_R1_TO_R16
5335#define ___POP_REGS ___POP_R16_TO_R1 ___POP_R0
5336
5337#else
5338
5339#define ___PSR17 ___ps->r[17]
5340#if ___MAX_LOCAL_GVM_REGS > 17
5341#define ___D_R17 ___REGISTER ___WORD ___r17;
5342#define ___R_R17 ___r17=___PSR17;
5343#define ___W_R17 ___PSR17=___r17;
5344#define ___R17 ___r17
5345#else
5346#define ___D_R17
5347#define ___R_R17
5348#define ___W_R17
5349#define ___R17 ___PSR17
5350#endif
5351#define ___SET_R17(val)___R17=(val);
5352#define ___PUSH_R1_TO_R17 ___PUSH_R1_TO_R16 ___PUSH(___R17)
5353#define ___POP_R17_TO_R1 ___SET_R17(___POP)___POP_R16_TO_R1
5354#define ___LD_R1_TO_R17 ___D_R17 ___LD_R1_TO_R16 ___R_R17
5355#define ___ST_R1_TO_R17 ___ST_R1_TO_R16 ___W_R17
5356
5357#if ___NB_GVM_REGS == 18
5358
5359#define ___PUSH_REGS ___PUSH_R0 ___PUSH_R1_TO_R17
5360#define ___POP_REGS ___POP_R17_TO_R1 ___POP_R0
5361
5362#else
5363
5364#define ___PSR18 ___ps->r[18]
5365#if ___MAX_LOCAL_GVM_REGS > 18
5366#define ___D_R18 ___REGISTER ___WORD ___r18;
5367#define ___R_R18 ___r18=___PSR18;
5368#define ___W_R18 ___PSR18=___r18;
5369#define ___R18 ___r18
5370#else
5371#define ___D_R18
5372#define ___R_R18
5373#define ___W_R18
5374#define ___R18 ___PSR18
5375#endif
5376#define ___SET_R18(val)___R18=(val);
5377#define ___PUSH_R1_TO_R18 ___PUSH_R1_TO_R17 ___PUSH(___R18)
5378#define ___POP_R18_TO_R1 ___SET_R18(___POP)___POP_R17_TO_R1
5379#define ___LD_R1_TO_R18 ___D_R18 ___LD_R1_TO_R17 ___R_R18
5380#define ___ST_R1_TO_R18 ___ST_R1_TO_R17 ___W_R18
5381
5382#if ___NB_GVM_REGS == 19
5383
5384#define ___PUSH_REGS ___PUSH_R0 ___PUSH_R1_TO_R18
5385#define ___POP_REGS ___POP_R18_TO_R1 ___POP_R0
5386
5387#else
5388
5389#define ___PSR19 ___ps->r[19]
5390#if ___MAX_LOCAL_GVM_REGS > 19
5391#define ___D_R19 ___REGISTER ___WORD ___r19;
5392#define ___R_R19 ___r19=___PSR19;
5393#define ___W_R19 ___PSR19=___r19;
5394#define ___R19 ___r19
5395#else
5396#define ___D_R19
5397#define ___R_R19
5398#define ___W_R19
5399#define ___R19 ___PSR19
5400#endif
5401#define ___SET_R19(val)___R19=(val);
5402#define ___PUSH_R1_TO_R19 ___PUSH_R1_TO_R18 ___PUSH(___R19)
5403#define ___POP_R19_TO_R1 ___SET_R19(___POP)___POP_R18_TO_R1
5404#define ___LD_R1_TO_R19 ___D_R19 ___LD_R1_TO_R18 ___R_R19
5405#define ___ST_R1_TO_R19 ___ST_R1_TO_R18 ___W_R19
5406
5407#if ___NB_GVM_REGS == 20
5408
5409#define ___PUSH_REGS ___PUSH_R0 ___PUSH_R1_TO_R19
5410#define ___POP_REGS ___POP_R19_TO_R1 ___POP_R0
5411
5412#else
5413
5414#define ___PSR20 ___ps->r[20]
5415#if ___MAX_LOCAL_GVM_REGS > 20
5416#define ___D_R20 ___REGISTER ___WORD ___r20;
5417#define ___R_R20 ___r20=___PSR20;
5418#define ___W_R20 ___PSR20=___r20;
5419#define ___R20 ___r20
5420#else
5421#define ___D_R20
5422#define ___R_R20
5423#define ___W_R20
5424#define ___R20 ___PSR20
5425#endif
5426#define ___SET_R20(val)___R20=(val);
5427#define ___PUSH_R1_TO_R20 ___PUSH_R1_TO_R19 ___PUSH(___R20)
5428#define ___POP_R20_TO_R1 ___SET_R20(___POP)___POP_R19_TO_R1
5429#define ___LD_R1_TO_R20 ___D_R20 ___LD_R1_TO_R19 ___R_R20
5430#define ___ST_R1_TO_R20 ___ST_R1_TO_R19 ___W_R20
5431
5432#if ___NB_GVM_REGS == 21
5433
5434#define ___PUSH_REGS ___PUSH_R0 ___PUSH_R1_TO_R20
5435#define ___POP_REGS ___POP_R20_TO_R1 ___POP_R0
5436
5437#else
5438
5439#define ___PSR21 ___ps->r[21]
5440#if ___MAX_LOCAL_GVM_REGS > 21
5441#define ___D_R21 ___REGISTER ___WORD ___r21;
5442#define ___R_R21 ___r21=___PSR21;
5443#define ___W_R21 ___PSR21=___r21;
5444#define ___R21 ___r21
5445#else
5446#define ___D_R21
5447#define ___R_R21
5448#define ___W_R21
5449#define ___R21 ___PSR21
5450#endif
5451#define ___SET_R21(val)___R21=(val);
5452#define ___PUSH_R1_TO_R21 ___PUSH_R1_TO_R20 ___PUSH(___R21)
5453#define ___POP_R21_TO_R1 ___SET_R21(___POP)___POP_R20_TO_R1
5454#define ___LD_R1_TO_R21 ___D_R21 ___LD_R1_TO_R20 ___R_R21
5455#define ___ST_R1_TO_R21 ___ST_R1_TO_R20 ___W_R21
5456
5457#if ___NB_GVM_REGS == 22
5458
5459#define ___PUSH_REGS ___PUSH_R0 ___PUSH_R1_TO_R21
5460#define ___POP_REGS ___POP_R21_TO_R1 ___POP_R0
5461
5462#else
5463
5464#define ___PSR22 ___ps->r[22]
5465#if ___MAX_LOCAL_GVM_REGS > 22
5466#define ___D_R22 ___REGISTER ___WORD ___r22;
5467#define ___R_R22 ___r22=___PSR22;
5468#define ___W_R22 ___PSR22=___r22;
5469#define ___R22 ___r22
5470#else
5471#define ___D_R22
5472#define ___R_R22
5473#define ___W_R22
5474#define ___R22 ___PSR22
5475#endif
5476#define ___SET_R22(val)___R22=(val);
5477#define ___PUSH_R1_TO_R22 ___PUSH_R1_TO_R21 ___PUSH(___R22)
5478#define ___POP_R22_TO_R1 ___SET_R22(___POP)___POP_R21_TO_R1
5479#define ___LD_R1_TO_R22 ___D_R22 ___LD_R1_TO_R21 ___R_R22
5480#define ___ST_R1_TO_R22 ___ST_R1_TO_R21 ___W_R22
5481
5482#if ___NB_GVM_REGS == 23
5483
5484#define ___PUSH_REGS ___PUSH_R0 ___PUSH_R1_TO_R22
5485#define ___POP_REGS ___POP_R22_TO_R1 ___POP_R0
5486
5487#else
5488
5489#define ___PSR23 ___ps->r[23]
5490#if ___MAX_LOCAL_GVM_REGS > 23
5491#define ___D_R23 ___REGISTER ___WORD ___r23;
5492#define ___R_R23 ___r23=___PSR23;
5493#define ___W_R23 ___PSR23=___r23;
5494#define ___R23 ___r23
5495#else
5496#define ___D_R23
5497#define ___R_R23
5498#define ___W_R23
5499#define ___R23 ___PSR23
5500#endif
5501#define ___SET_R23(val)___R23=(val);
5502#define ___PUSH_R1_TO_R23 ___PUSH_R1_TO_R22 ___PUSH(___R23)
5503#define ___POP_R23_TO_R1 ___SET_R23(___POP)___POP_R22_TO_R1
5504#define ___LD_R1_TO_R23 ___D_R23 ___LD_R1_TO_R22 ___R_R23
5505#define ___ST_R1_TO_R23 ___ST_R1_TO_R22 ___W_R23
5506
5507#if ___NB_GVM_REGS == 24
5508
5509#define ___PUSH_REGS ___PUSH_R0 ___PUSH_R1_TO_R23
5510#define ___POP_REGS ___POP_R23_TO_R1 ___POP_R0
5511
5512#else
5513
5514#define ___PSR24 ___ps->r[24]
5515#if ___MAX_LOCAL_GVM_REGS > 24
5516#define ___D_R24 ___REGISTER ___WORD ___r24;
5517#define ___R_R24 ___r24=___PSR24;
5518#define ___W_R24 ___PSR24=___r24;
5519#define ___R24 ___r24
5520#else
5521#define ___D_R24
5522#define ___R_R24
5523#define ___W_R24
5524#define ___R24 ___PSR24
5525#endif
5526#define ___SET_R24(val)___R24=(val);
5527#define ___PUSH_R1_TO_R24 ___PUSH_R1_TO_R23 ___PUSH(___R24)
5528#define ___POP_R24_TO_R1 ___SET_R24(___POP)___POP_R23_TO_R1
5529#define ___LD_R1_TO_R24 ___D_R24 ___LD_R1_TO_R23 ___R_R24
5530#define ___ST_R1_TO_R24 ___ST_R1_TO_R23 ___W_R24
5531
5532#if ___NB_GVM_REGS == 25
5533
5534#define ___PUSH_REGS ___PUSH_R0 ___PUSH_R1_TO_R24
5535#define ___POP_REGS ___POP_R24_TO_R1 ___POP_R0
5536
5537#endif
5538#endif
5539#endif
5540#endif
5541#endif
5542#endif
5543#endif
5544#endif
5545#endif
5546#endif
5547#endif
5548#endif
5549#endif
5550#endif
5551#endif
5552#endif
5553#endif
5554#endif
5555#endif
5556#endif
5557#endif
5558#endif
5559#endif
5560#endif
5561
5562/*---------------------------------------------------------------------------*/
5563
5564/* Labels and switches */
5565
5566#define ___NOT(x)!x
5567#define ___AND(x,y)(x&&y)
5568
5569#define ___MLBL(n)___lp+((n)*___LABEL_SIZE*___WS)
5570#define ___LBL(n)___start+((___PH_LBL0-___HOST_LBL0+n)*___LABEL_SIZE*___WS)
5571#define ___DEF_SLBL(n,lbl)___DEF_SW(n)___DEF_GLBL(lbl)
5572#define ___DEF_GLBL(lbl)lbl:___AM_HERE_PS
5573#define ___GOTO(lbl)goto lbl;
5574#define ___IF_GOTO(test,lbl)if (test) ___GOTO(lbl)
5575#define ___JUMPINT(nargs,prc,lbl)___SM(___GOTO(lbl),{nargs ___JUMP(prc)})
5576#define ___JUMPEXTPRM(nargs,val){nargs ___JUMPEXT(val)}
5577#define ___JUMPEXTNOTSAFE(nargs,val) \
5578{nargs ___SELF=val; \
5579___JUMPEXT(___LABEL_ENTRY_GET(___SELF))}
5580#define ___JUMPPRM(nargs,val){nargs ___JUMP(val)}
5581
5582#define ___JUMPNOTSAFE(nargs,val) \
5583{nargs ___SELF=val; \
5584___JUMP(___LABEL_ENTRY_GET(___SELF))}
5585
5586#define ___JUMPSAFE(nargs,val) ___JUMPNOTSAFE(nargs,val) /***************/
5587
5588#define ___JUMPGENNOTSAFE(nargs,val)___JUMPNOTSAFE(nargs,val)
5589#define ___JUMPGLONOTSAFE(nargs,i,glo)___JUMPNOTSAFE(nargs,___GLO(i,glo))
5590#define ___JUMPGENSAFE(nargs,val) \
5591{nargs ___SELF=val; \
5592if (___EXPECT_TRUE(___PROCEDUREP(___SELF))) \
5593  ___JUMP(___LABEL_ENTRY_GET(___SELF)) \
5594___ps->temp1=___SELF;___JUMPEXTPRM(___NOTHING,___ps->handler_not_proc)}
5595#define ___JUMPGLOSAFE(nargs,i,glo) \
5596{nargs ___SELF=___GLO(i,glo); \
5597if (___EXPECT_TRUE(___PROCEDUREP(___SELF))) \
5598  ___JUMP(___LABEL_ENTRY_GET(___SELF)) \
5599___ps->temp4=(___WORD)&___GLOSTRUCT(i,glo);___JUMPEXTPRM(___NOTHING,___ps->handler_not_proc_glo)}
5600
5601#ifdef ___NOT_SAFE_CALLS
5602#undef ___JUMPGENSAFE
5603#undef ___JUMPGLOSAFE
5604#define ___JUMPGENSAFE(nargs,val)___JUMPGENNOTSAFE(nargs,val)
5605#define ___JUMPGLOSAFE(nargs,i,glo)___JUMPGLONOTSAFE(nargs,i,glo)
5606#endif
5607
5608#ifdef ___SAFE_CALLS
5609#undef ___JUMPGENNOTSAFE
5610#undef ___JUMPGLONOTSAFE
5611#define ___JUMPGENNOTSAFE(nargs,val)___JUMPGENSAFE(nargs,val)
5612#define ___JUMPGLONOTSAFE(nargs,i,glo)___JUMPGLOSAFE(nargs,i,glo)
5613#endif
5614
5615#define ___BEGIN_SWITCH(x) switch (x) {
5616#define ___SWITCH_CASE_GOTO(obj,lbl) case (obj): ___GOTO(lbl)
5617#define ___END_SWITCH }
5618
5619#define ___BEGIN_SWITCH_FIXNUM(x) { ___SCMOBJ ___sw = (x); \
5620if (___EXPECT_TRUE(___FIXNUMP(___sw))) switch(___INT(___sw)) {
5621#define ___SWITCH_FIXNUM_CASE_GOTO(obj,lbl) case (___INT(obj)): ___GOTO(lbl)
5622#define ___END_SWITCH_FIXNUM }}
5623
5624#define ___BEGIN_SWITCH_CHAR(x) { ___SCMOBJ ___sw = (x); \
5625if (___EXPECT_TRUE(___CHARP(___sw))) switch(___INT(___sw)) {
5626#define ___SWITCH_CHAR_CASE_GOTO(obj,lbl) case (___INT(obj)): ___GOTO(lbl)
5627#define ___END_SWITCH_CHAR }}
5628
5629#define ___BEGIN_SWITCH_SYMKEY(x,mod,guard) { ___SCMOBJ ___sw = (x); \
5630if (___EXPECT_TRUE(guard(___sw))) switch(___INT(___FIELD(___sw,___SYMKEY_HASH)) & ((mod)-1)) {
5631#define ___SWITCH_SYMKEY_CASE(hash) case (hash):
5632#define ___SWITCH_SYMKEY_CASE_GOTO(obj,lbl) ___IF_GOTO(___EQP(___sw,obj),lbl)
5633#define ___END_SWITCH_SYMKEY }}
5634
5635/*---------------------------------------------------------------------------*/
5636
5637#define ___PRC(i)___start+((i-___HOST_LBL0)*___LABEL_SIZE*___WS)
5638
5639#define ___SET_NARGS(n)___ps->na=n;
5640
5641#define ___IF_NARGS_EQ(n,code)if (___EXPECT_TRUE(___ps->na==n)) {code} else
5642
5643#define ___WRONG_NARGS(lbl,nb_req,nb_opt,nb_key) \
5644{___ps->temp1=___LBL(lbl); \
5645___JUMPEXTPRM(___NOTHING,___ps->handler_wrong_nargs)}
5646
5647#define ___GET_REST(lbl,nb_req,nb_opt,nb_key) \
5648if (___ps->na>=0){___ps->temp1=___LBL(lbl); \
5649___JUMPEXTPRM(___NOTHING,___ps->handler_get_rest)}
5650
5651#define ___GET_KEY(lbl,nb_req,nb_opt,nb_key,key_descr) \
5652if (___ps->na>=0){___ps->temp1=___LBL(lbl);___ps->temp2=nb_req+nb_opt; \
5653___ps->temp3=key_descr;___JUMPEXTPRM(___NOTHING,___ps->handler_get_key)}
5654
5655#define ___GET_REST_KEY(lbl,nb_req,nb_opt,nb_key,key_descr) \
5656if (___ps->na>=0){___ps->temp1=___LBL(lbl);___ps->temp2=nb_req+nb_opt; \
5657___ps->temp3=key_descr;___ps->temp4=1; \
5658___JUMPEXTPRM(___NOTHING,___ps->handler_get_key_rest)}
5659
5660#define ___GET_KEY_REST(lbl,nb_req,nb_opt,nb_key,key_descr) \
5661if (___ps->na>=0){___ps->temp1=___LBL(lbl);___ps->temp2=nb_req+nb_opt; \
5662___ps->temp3=key_descr;___ps->temp4=0; \
5663___JUMPEXTPRM(___NOTHING,___ps->handler_get_key_rest)}
5664
5665#define ___BOOLEAN(x)(x)?___TRU:___FAL
5666#define ___EXPR(x)x;
5667
5668#ifdef ___SUPPORT_LOWLEVEL_EXEC
5669
5670#ifdef ___CPU_x86
5671
5672/* Useful to have constant bit pattern in low 16 bits of pstate */
5673#define ___PSTATE_ALIGN_MULTIPLIER (1<<16)
5674#define ___PSTATE_ALIGN_MODULUS    0x8888
5675
5676#ifdef ___CPU_x86_32
5677
5678#define ___CLO_LOWLEVEL_TRAMPOLINE_SIZE 2
5679#define ___CLO_LOWLEVEL_TRAMPOLINE_SETUP(ptr,lbl) \
5680do { \
5681     /* generate x86-32 instruction: call lbl */ \
5682     ___WORD dist = ___CAST(___WORD, \
5683                            ___CAST(___UWORD,lbl) - \
5684                            (___CAST(___UWORD,ptr) + ___WS + ___tSUBTYPED + 5)); \
5685     (ptr)[___LABEL_LOWLEVEL_CODE] = (0xe8L << (8*___tSUBTYPED)) \
5686                                     + (dist << (8*(___tSUBTYPED+1))); \
5687     (ptr)[___LABEL_LOWLEVEL_CODE+1] = (dist >> (8*(___WS-(___tSUBTYPED+1)))); \
5688   } while (0)
5689
5690#define ___LABEL_LOWLEVEL_TRAMPOLINE_SIZE 1
5691#define ___LABEL_LOWLEVEL_TRAMPOLINE_SETUP(ptr) \
5692do { \
5693     /* generate x86-32 instruction: call *-4(%ecx) */ \
5694     (ptr)[___LABEL_LOWLEVEL_CODE] = 0xfc51ff << (8*___tSUBTYPED); \
5695   } while (0)
5696
5697#endif
5698
5699#ifdef ___CPU_x86_64
5700
5701#define ___CLO_LOWLEVEL_TRAMPOLINE_SIZE 1
5702#define ___CLO_LOWLEVEL_TRAMPOLINE_SETUP(ptr,lbl) \
5703do { \
5704     /* generate x86-64 instruction: call *-15(%rip) */ \
5705     (ptr)[___LABEL_LOWLEVEL_CODE] = 0xfffffff115ffL << (8*___tSUBTYPED); \
5706   } while (0)
5707
5708#define ___LABEL_LOWLEVEL_TRAMPOLINE_SIZE 1
5709#define ___LABEL_LOWLEVEL_TRAMPOLINE_SETUP(ptr) \
5710do { \
5711     /* generate x86-64 instruction: call *-8(%rcx) */ \
5712     (ptr)[___LABEL_LOWLEVEL_CODE] = 0xf851ff << (8*___tSUBTYPED); \
5713   } while (0)
5714
5715#endif
5716
5717#endif
5718
5719#endif
5720
5721#ifdef ___CLO_LOWLEVEL_TRAMPOLINE_SIZE
5722#ifdef ___SUPPORT_LABEL_VALUES
5723#define ___UNALIGNED_LABEL_SIZE (4+___LABEL_LOWLEVEL_TRAMPOLINE_SIZE)
5724#else
5725#define ___UNALIGNED_LABEL_SIZE (3+___LABEL_LOWLEVEL_TRAMPOLINE_SIZE)
5726#endif
5727#else
5728#define ___UNALIGNED_LABEL_SIZE 4
5729#define ___CLO_LOWLEVEL_TRAMPOLINE_SIZE 0
5730#define ___CLO_LOWLEVEL_TRAMPOLINE_SETUP(ptr,lbl)
5731#endif
5732
5733#ifdef ___USE_ALIGNED_LABEL_SIZE
5734#if ___UNALIGNED_LABEL_SIZE <= 4
5735#define ___LABEL_SIZE 4
5736#else
5737#define ___LABEL_SIZE 8
5738#endif
5739#else
5740#define ___LABEL_SIZE ___UNALIGNED_LABEL_SIZE
5741#endif
5742
5743#define ___CLO_FREEVARS (1+___CLO_LOWLEVEL_TRAMPOLINE_SIZE)
5744
5745#define ___ALLOC_CLO(n)(___BEGIN_ALLOC_SUBTYPED(___MAKE_HD_WORDS(n+___CLO_FREEVARS,___sPROCEDURE)),___END_ALLOC_SUBTYPED(n+___CLO_FREEVARS),___GET_SUBTYPED(n+___CLO_FREEVARS))
5746#define ___BEGIN_SETUP_CLO(n,clo,lbl) \
5747{___WORD *___ptr=___BODY0_AS(clo,___tSUBTYPED); \
5748___ptr[___LABEL_ENTRY_OR_DESCR]=___LBL(lbl); \
5749___CLO_LOWLEVEL_TRAMPOLINE_SETUP(___ptr,___LBL(lbl));
5750#define ___ADD_CLO_ELEM(i,val)___ptr[i+___CLO_FREEVARS]=(val);
5751#define ___END_SETUP_CLO(n) }
5752#define ___CLO(x,y)___BODY_AS(x,___tSUBTYPED)[y+(___CLO_FREEVARS-1)]
5753#define ___SET_CLO(x,y,z)___BODY_AS(x,___tSUBTYPED)[y+(___CLO_FREEVARS-1)]=z;
5754
5755#define ___CLOSURELENGTH(x)___FIX(___HD_FIELDS(___SUBTYPED_HEADER(x))-___CLO_LOWLEVEL_TRAMPOLINE_SIZE)
5756#define ___CLOSURECODE(x)___CLO(x,-___CLO_LOWLEVEL_TRAMPOLINE_SIZE)
5757#define ___CLOSUREREF(x,y)___CLO(x,___INT(y))
5758#define ___CLOSURESET(x,y,z)___SET_CLO(x,___INT(y),z)
5759
5760#define ___BEGIN_ALLOC_LIST(n,last)___ALLOC_PAIR(last,___NUL)
5761#define ___ADD_LIST_ELEM(i,val)___ALLOC_PAIR(val,___GET_PAIR())
5762#define ___END_ALLOC_LIST(n)
5763#define ___GET_LIST(n)___GET_PAIR()
5764
5765#define ___BEGIN_ALLOC_STRING(n) \
5766___BEGIN_ALLOC_SUBTYPED(___MAKE_HD_BYTES(n<<___LCS,___sSTRING));
5767#define ___ADD_STRING_ELEM(i,val)___CS_SELECT( \
5768___STORE_U8(___BODY0_FROM_HP(),i,___INT(val)), \
5769___STORE_U16(___BODY0_FROM_HP(),i,___INT(val)), \
5770___STORE_U32(___BODY0_FROM_HP(),i,___INT(val)));
5771#define ___END_ALLOC_STRING(n)___ALLOC(___WORDS(n<<___LCS)+1);
5772#define ___GET_STRING(n)___GET_SUBTYPED(___WORDS(n<<___LCS))
5773
5774#define ___BEGIN_ALLOC_S8VECTOR(n) \
5775___BEGIN_ALLOC_SUBTYPED(___MAKE_HD_BYTES(n,___sS8VECTOR));
5776#define ___ADD_S8VECTOR_ELEM(i,val)___STORE_S8(___BODY0_FROM_HP(),i,___INT(val));
5777#define ___END_ALLOC_S8VECTOR(n)___ALLOC(___WORDS(n)+1);
5778#define ___GET_S8VECTOR(n)___GET_SUBTYPED(___WORDS(n))
5779
5780#define ___BEGIN_ALLOC_U8VECTOR(n) \
5781___BEGIN_ALLOC_SUBTYPED(___MAKE_HD_BYTES(n,___sU8VECTOR));
5782#define ___ADD_U8VECTOR_ELEM(i,val)___STORE_U8(___BODY0_FROM_HP(),i,___INT(val));
5783#define ___END_ALLOC_U8VECTOR(n)___ALLOC(___WORDS(n)+1);
5784#define ___GET_U8VECTOR(n)___GET_SUBTYPED(___WORDS(n))
5785
5786#define ___BEGIN_ALLOC_S16VECTOR(n) \
5787___BEGIN_ALLOC_SUBTYPED(___MAKE_HD_BYTES(n<<1,___sS16VECTOR));
5788#define ___ADD_S16VECTOR_ELEM(i,val)___STORE_S16(___BODY0_FROM_HP(),i,___INT(val));
5789#define ___END_ALLOC_S16VECTOR(n)___ALLOC(___WORDS(n<<1)+1);
5790#define ___GET_S16VECTOR(n)___GET_SUBTYPED(___WORDS(n<<1))
5791
5792#define ___BEGIN_ALLOC_U16VECTOR(n) \
5793___BEGIN_ALLOC_SUBTYPED(___MAKE_HD_BYTES(n<<1,___sU16VECTOR));
5794#define ___ADD_U16VECTOR_ELEM(i,val)___STORE_U16(___BODY0_FROM_HP(),i,___INT(val));
5795#define ___END_ALLOC_U16VECTOR(n)___ALLOC(___WORDS(n<<1)+1);
5796#define ___GET_U16VECTOR(n)___GET_SUBTYPED(___WORDS(n<<1))
5797
5798#define ___BEGIN_ALLOC_S32VECTOR(n) \
5799___BEGIN_ALLOC_SUBTYPED(___MAKE_HD_BYTES(n<<2,___sS32VECTOR));
5800#define ___ADD_S32VECTOR_ELEM(i,val)___STORE_S32(___BODY0_FROM_HP(),i,___S32UNBOX(val));
5801#define ___END_ALLOC_S32VECTOR(n)___ALLOC(___WORDS(n<<2)+1);
5802#define ___GET_S32VECTOR(n)___GET_SUBTYPED(___WORDS(n<<2))
5803
5804#define ___BEGIN_ALLOC_U32VECTOR(n) \
5805___BEGIN_ALLOC_SUBTYPED(___MAKE_HD_BYTES(n<<2,___sU32VECTOR));
5806#define ___ADD_U32VECTOR_ELEM(i,val)___STORE_U32(___BODY0_FROM_HP(),i,___U32UNBOX(val));
5807#define ___END_ALLOC_U32VECTOR(n)___ALLOC(___WORDS(n<<2)+1);
5808#define ___GET_U32VECTOR(n)___GET_SUBTYPED(___WORDS(n<<2))
5809
5810#if ___SCMOBJ_WIDTH == 32
5811
5812#define ___BEGIN_ALLOC_S64VECTOR(n) \
5813{___WORD *___ptr = (___WORD*)((___WORD)(___hp+2)&~7); \
5814___ptr[-1]=___MAKE_HD_BYTES(n<<3,___sS64VECTOR);
5815#define ___ADD_S64VECTOR_ELEM(i,val)___STORE_S64(___ptr,i,___S64UNBOX(val));
5816#define ___END_ALLOC_S64VECTOR(n)___ALLOC(___WORDS(n<<3)+2);}
5817#define ___GET_S64VECTOR(n)___TAG((((___WORD*)((___WORD)(___hp-___WORDS(n<<3))&~7))-___REFERENCE_TO_BODY),___tSUBTYPED)
5818
5819#define ___BEGIN_ALLOC_U64VECTOR(n) \
5820{___WORD *___ptr = (___WORD*)((___WORD)(___hp+2)&~7); \
5821___ptr[-1]=___MAKE_HD_BYTES(n<<3,___sU64VECTOR);
5822#define ___ADD_U64VECTOR_ELEM(i,val)___STORE_U64(___ptr,i,___U64UNBOX(val));
5823#define ___END_ALLOC_U64VECTOR(n)___ALLOC(___WORDS(n<<3)+2);}
5824#define ___GET_U64VECTOR(n)___TAG((((___WORD*)((___WORD)(___hp-___WORDS(n<<3))&~7))-___REFERENCE_TO_BODY),___tSUBTYPED)
5825
5826#else
5827
5828#define ___BEGIN_ALLOC_S64VECTOR(n) \
5829___BEGIN_ALLOC_SUBTYPED(___MAKE_HD_BYTES(n<<3,___sS64VECTOR));
5830#define ___ADD_S64VECTOR_ELEM(i,val)___STORE_S64(___BODY0_FROM_HP(),i,___S64UNBOX(val));
5831#define ___END_ALLOC_S64VECTOR(n)___ALLOC(___WORDS(n<<3)+1);
5832#define ___GET_S64VECTOR(n)___GET_SUBTYPED(___WORDS(n<<3))
5833
5834#define ___BEGIN_ALLOC_U64VECTOR(n) \
5835___BEGIN_ALLOC_SUBTYPED(___MAKE_HD_BYTES(n<<3,___sU64VECTOR));
5836#define ___ADD_U64VECTOR_ELEM(i,val)___STORE_U64(___BODY0_FROM_HP(),i,___U64UNBOX(val));
5837#define ___END_ALLOC_U64VECTOR(n)___ALLOC(___WORDS(n<<3)+1);
5838#define ___GET_U64VECTOR(n)___GET_SUBTYPED(___WORDS(n<<3))
5839
5840#endif
5841
5842#define ___BEGIN_ALLOC_F32VECTOR(n) \
5843___BEGIN_ALLOC_SUBTYPED(___MAKE_HD_BYTES(n<<2,___sF32VECTOR));
5844#ifdef ___F32
5845#define ___ADD_F32VECTOR_ELEM(i,val)((___F32*)___BODY0_FROM_HP())[i]=(val);
5846#else
5847#define ___ADD_F32VECTOR_ELEM(i,val);
5848#endif
5849#define ___END_ALLOC_F32VECTOR(n)___ALLOC(___WORDS(n<<2)+1);
5850#define ___GET_F32VECTOR(n)___GET_SUBTYPED(___WORDS(n<<2))
5851
5852#if ___SCMOBJ_WIDTH == 32
5853
5854#define ___BEGIN_ALLOC_F64VECTOR(n) \
5855{___WORD *___ptr = (___WORD*)((___WORD)(___hp+2)&~7); \
5856___ptr[-1]=___MAKE_HD_BYTES(n<<3,___sF64VECTOR);
5857#define ___ADD_F64VECTOR_ELEM(i,val)((___F64*)___ptr)[i]=(val);
5858#define ___END_ALLOC_F64VECTOR(n)___ALLOC(___WORDS(n<<3)+2);}
5859#define ___GET_F64VECTOR(n)___TAG((((___WORD*)((___WORD)(___hp-___WORDS(n<<3))&~7))-___REFERENCE_TO_BODY),___tSUBTYPED)
5860
5861#else
5862
5863#define ___BEGIN_ALLOC_F64VECTOR(n) \
5864___BEGIN_ALLOC_SUBTYPED(___MAKE_HD_BYTES(n<<3,___sF64VECTOR));
5865#define ___ADD_F64VECTOR_ELEM(i,val)((___F64*)___BODY0_FROM_HP())[i]=(val);
5866#define ___END_ALLOC_F64VECTOR(n)___ALLOC(___WORDS(n<<3)+1);
5867#define ___GET_F64VECTOR(n)___GET_SUBTYPED(___WORDS(n<<3))
5868
5869#endif
5870
5871#define ___BEGIN_ALLOC_VECTOR(n) \
5872___BEGIN_ALLOC_SUBTYPED(___MAKE_HD_WORDS(n,___sVECTOR));
5873#define ___ADD_VECTOR_ELEM(i,val)___ADD_SUBTYPED_ELEM(i,val);
5874#define ___END_ALLOC_VECTOR(n)___END_ALLOC_SUBTYPED(n);
5875#define ___GET_VECTOR(n)___GET_SUBTYPED(n)
5876
5877#define ___BEGIN_ALLOC_STRUCTURE(n) \
5878___BEGIN_ALLOC_SUBTYPED(___MAKE_HD_WORDS(n,___sSTRUCTURE));
5879#define ___ADD_STRUCTURE_ELEM(i,val)___ADD_SUBTYPED_ELEM(i,val);
5880#define ___END_ALLOC_STRUCTURE(n)___END_ALLOC_SUBTYPED(n);
5881#define ___GET_STRUCTURE(n)___GET_SUBTYPED(n)
5882
5883#define ___BEGIN_ALLOC_VALUES(n) \
5884___BEGIN_ALLOC_SUBTYPED(___MAKE_HD_WORDS(n,___sBOXVALUES));
5885#define ___ADD_VALUES_ELEM(i,val)___ADD_SUBTYPED_ELEM(i,val);
5886#define ___END_ALLOC_VALUES(n)___END_ALLOC_SUBTYPED(n);
5887#define ___GET_VALUES(n)___GET_SUBTYPED(n)
5888
5889#define ___NB_INTRS 6
5890#define ___INTR_SYNC_OP    0
5891#define ___INTR_TERMINATE  1
5892#define ___INTR_HEARTBEAT  2
5893#define ___INTR_USER       3
5894#define ___INTR_GC         4
5895#define ___INTR_HIGH_LEVEL 5
5896
5897#define ___INTERRUPT_FLAGS() (___ps->intr_flag[0]|___ps->intr_flag[1]|___ps->intr_flag[2]|___ps->intr_flag[3]|___ps->intr_flag[4]|___ps->intr_flag[5])
5898
5899#define ___INTERRUPT_REQ(x, mask) (((x) & ___ps->intr_enabled & ~mask) != ___FIX(0))
5900
5901#define ___INTERRUPT_MASK_SET(mask) \
5902if (___INTERRUPT_REQ(___INTERRUPT_FLAGS(), (___ps->intr_mask = mask))) \
5903  ___STACK_TRIP_ON()
5904
5905#define ___STACK_TRIP_ON()___ps->stack_trip = ___ps->stack_start
5906#define ___STACK_TRIP_OFF()___ps->stack_trip = ___ps->stack_limit
5907#define ___STACK_TRIPPED (___fp < ___ps->stack_trip)
5908
5909#ifdef ___HEARTBEAT_USING_POLL_COUNTDOWN
5910#define ___HEARTBEAT_INTERVAL_ENDED (___ps->heartbeat_countdown-- <= 0)
5911#define ___POLL_TRIGGER ___HEARTBEAT_INTERVAL_ENDED || ___STACK_TRIPPED
5912#else
5913#define ___POLL_TRIGGER ___STACK_TRIPPED
5914#endif
5915
5916#ifdef ___DEBUG_STACK_LIMIT
5917
5918#define ___POLL(n)                    \
5919if (___EXPECT_FALSE(___POLL_TRIGGER)) \
5920{___ps->temp1=___LBL(n); \
5921___ps->poll_location.file=__FILE__; \
5922___ps->poll_location.line=__LINE__; \
5923___JUMPEXTPRM(___NOTHING,___ps->handler_stack_limit) \
5924}
5925
5926#else
5927
5928#define ___POLL(n)                    \
5929if (___EXPECT_FALSE(___POLL_TRIGGER)) \
5930{___ps->temp1=___LBL(n); \
5931___JUMPEXTPRM(___NOTHING,___ps->handler_stack_limit) \
5932}
5933
5934#endif
5935
5936#define ___TASK_PUSH(i)
5937#define ___TASK_POP(n)
5938
5939#ifdef ___DEBUG_HEAP_LIMIT
5940
5941#define ___CHECK_HEAP(n,m)                    \
5942if (___EXPECT_FALSE(___hp>___ps->heap_limit)) \
5943{___ps->temp1=___LBL(n); \
5944___ps->check_heap_location.file=__FILE__; \
5945___ps->check_heap_location.line=__LINE__; \
5946___JUMPEXTPRM(___NOTHING,___ps->handler_heap_limit) \
5947}
5948
5949#else
5950
5951#define ___CHECK_HEAP(n,m)                    \
5952if (___EXPECT_FALSE(___hp>___ps->heap_limit)) \
5953{___ps->temp1=___LBL(n); \
5954___JUMPEXTPRM(___NOTHING,___ps->handler_heap_limit) \
5955}
5956
5957#endif
5958
5959#define ___FORCE1(n,src) \
5960if (___TYP((___temp=(src)))==___tSUBTYPED&&___SUBTYPE(___temp)==___FIX(___sPROMISE)){___ps->temp2=___temp;___pc=___FIELD(___temp,0);___temp=___FIELD(___pc,0); if (___temp==___pc){___ps->temp1=___LBL(n);___JUMPEXTPRM(___NOTHING,___ps->handler_force);
5961#define ___FORCE2 ___temp=___ps->temp2;}}
5962#define ___FORCE3 ___temp
5963
5964#define ___MODULE_KIND 0
5965#define ___LINKFILE_KIND 1
5966
5967#define ___CLIBEXT(f)f
5968#define ___SETJMP(jmpbuf)setjmp (jmpbuf)
5969#define ___LONGJMP(jmpbuf,val)longjmp (jmpbuf,val)
5970#define ___EXT(f)f
5971
5972#ifdef ___BIND_LATE
5973
5974#ifndef ___CAN_IMPORT_CLIB_DYNAMICALLY
5975#undef ___CLIBEXT
5976#define ___CLIBEXT(f)(___GSTATE->f)
5977#undef ___LOCAL_GSTATE
5978#define ___LOCAL_GSTATE
5979#endif
5980
5981#ifndef ___CAN_IMPORT_SETJMP_DYNAMICALLY
5982#undef ___SETJMP
5983#define ___SETJMP(x)(___GSTATE->setjmp) (x)
5984#endif
5985
5986#ifndef ___CAN_IMPORT_DYNAMICALLY
5987#undef ___EXT
5988#define ___EXT(f)(___GSTATE->f)
5989#undef ___LOCAL_GSTATE
5990#define ___LOCAL_GSTATE
5991#endif
5992
5993#endif
5994
5995#ifdef ___LOCAL_GSTATE
5996
5997#define ___GSTATE ___local_gstate
5998
5999#define ___GSTATEDECL ___LOCAL ___global_state ___local_gstate;
6000#define ___SET_LOCAL_GSTATE(gs) ___local_gstate = gs;
6001
6002#else
6003
6004#ifdef ___PSTATE_ALIGN_MULTIPLIER
6005#define ___GSTATE ___CAST(___global_state,___ALIGNUP(&___gstate0,___PSTATE_ALIGN_MULTIPLIER))
6006#else
6007#define ___GSTATE (&___gstate0)
6008#endif
6009
6010#define ___GSTATEDECL ___IMP_DATA(___global_state_struct,___gstate0);
6011#define ___SET_LOCAL_GSTATE(gs)
6012
6013#endif
6014
6015#ifdef ___USE_NO_THREAD_SYSTEM
6016
6017/* Use direct access to the only pstate */
6018
6019#define ___GET_PSTATE() (&___GSTATE->vmstate0.aligned_pstate[0].pstate)
6020#define ___SET_PSTATE(ps)
6021
6022#else
6023
6024/*
6025 * Some target platforms have linkers that don't allow referencing a
6026 * thread local storage variable from another dynamically linked file.
6027 * This happens on OS X when using clang (but not when using FSF gcc).
6028 * This issue can be avoided by having the dynamically linked file
6029 * call the ___get_tls_ptr in the Gambit runtime system which accesses
6030 * the thread local storage.  However, doing this slows down access to
6031 * the processor state, which needs to be as fast as possible.
6032 *
6033 * The presence of this issue for the C compiler being used could be
6034 * determined by ifdefs or the configure script.  However, this would
6035 * prevent dynamically loading code compiled by a different C
6036 * compiler.  For example, the Gambit runtime system and interpreter
6037 * could have been compiled by FSF gcc and a file dynamically loaded by
6038 * the interpreter could have been compiled by clang.  This situation
6039 * is common when Gambit is installed using a prebuilt installer
6040 * (typically built with FSF gcc) and the user's platform is
6041 * configured with a different C compiler (for example Xcode's clang
6042 * on OS X).
6043 *
6044 * The current solution is to assume that thread local storage
6045 * variables cannot be referenced from another dynamically linked
6046 * file.  If it is known that the C compilers being used don't have
6047 * this issue, then the --enable-dynamic-tls option should be passed
6048 * to the configure script, i.e.:
6049 *
6050 *   ./configure --enable-dynamic-tls
6051 */
6052
6053#ifdef ___THREAD_LOCAL_STORAGE_CLASS
6054
6055extern ___THREAD_LOCAL_STORAGE_CLASS void *___tls_ptr;
6056
6057#ifndef ___DYNAMIC_TLS
6058
6059#undef ___DEFINE_THREAD_LOCAL_STORAGE_GETTER_SETTER
6060#define ___DEFINE_THREAD_LOCAL_STORAGE_GETTER_SETTER
6061
6062#ifdef ___SHARED
6063#ifndef ___PRIMAL
6064#undef ___USE_THREAD_LOCAL_STORAGE_GETTER_SETTER
6065#define ___USE_THREAD_LOCAL_STORAGE_GETTER_SETTER
6066#endif
6067#endif
6068
6069#endif
6070
6071#else
6072
6073#undef ___DEFINE_THREAD_LOCAL_STORAGE_GETTER_SETTER
6074#define ___DEFINE_THREAD_LOCAL_STORAGE_GETTER_SETTER
6075
6076#undef ___USE_THREAD_LOCAL_STORAGE_GETTER_SETTER
6077#define ___USE_THREAD_LOCAL_STORAGE_GETTER_SETTER
6078
6079#endif
6080
6081#ifdef ___USE_THREAD_LOCAL_STORAGE_GETTER_SETTER
6082
6083/* Use thread local storage getter/setter */
6084
6085#define ___GET_PSTATE() ___CAST(___processor_state,___EXT(___get_tls_ptr) ())
6086#define ___SET_PSTATE(ps) ___set_tls_ptr(___CAST(void*,ps))
6087
6088#else
6089
6090/* Use thread local storage class */
6091
6092#define ___GET_PSTATE() ___CAST(___processor_state,___tls_ptr)
6093#define ___SET_PSTATE(ps) ___tls_ptr = ___CAST(void*,ps)
6094
6095#endif
6096
6097#endif
6098
6099#ifndef ___DEFINE_THREAD_LOCAL_STORAGE_GETTER_SETTER
6100
6101/*
6102 * ___GET_PSTATE is probably fast, so it is acceptable to get the processor
6103 * state pointer at the top of every function that needs to access the
6104 * processor state.
6105 */
6106
6107#define ___PSGET ___processor_state ___ps = ___PSTATE;
6108
6109#define ___PSDNC
6110#define ___PSVNC
6111
6112#define ___PSD
6113#define ___PSV
6114#define ___PSDKR
6115
6116#define ___PSANC(ps)
6117#define ___PSA(ps)
6118#else
6119
6120/*
6121 * ___GET_PSTATE is probably slow, so the processor state pointer will be
6122 * propagated from one function to its callees when possible.
6123 */
6124
6125#define ___PSGET
6126
6127#define ___PSDNC ___processor_state ___ps
6128#define ___PSVNC ___ps
6129
6130#define ___PSD ___PSDNC,
6131#define ___PSV ___PSVNC,
6132#define ___PSDKR ___PSDNC;
6133
6134#define ___PSANC(ps) ps
6135#define ___PSA(ps) ps,
6136
6137#endif
6138
6139#define ___PSPNC ___PSANC(___PSVNC)
6140#define ___PSP ___PSA(___PSVNC)
6141
6142#ifdef ___SINGLE_THREADED_VMS
6143#ifdef ___SUPPORT_LOWLEVEL_EXEC
6144#define ___VMSTATE_FROM_PSTATE(ps) \
6145  ___CAST(___virtual_machine_state,___CAST(___aligned_lowlevel_processor_state_struct*,ps)-1)
6146#else
6147#define ___VMSTATE_FROM_PSTATE(ps) \
6148___CAST(___virtual_machine_state,ps)
6149#endif
6150#else
6151#define ___VMSTATE_FROM_PSTATE(ps) ps->vmstate
6152#endif
6153
6154#define ___PSTATE ___GET_PSTATE()
6155
6156#ifdef ___SINGLE_VM
6157#define ___VMSTATE (&___GSTATE->vmstate0)
6158#else
6159#define ___VMSTATE ___VMSTATE_FROM_PSTATE(___PSTATE)
6160#endif
6161
6162#ifdef ___BIND_LATE
6163
6164#define ___NEED_SYM(sym)
6165#define ___NEED_KEY(key)
6166#define ___NEED_GLO(glo)
6167
6168#define ___BEGIN_SYM ___LOCAL ___UTF_8STRING ___sym_names[]={
6169#define ___DEF_SYM(i,sym,str)str,
6170#define ___END_SYM 0};
6171
6172#define ___DEF_MOD_SYM(i,sym,str)
6173
6174#define ___BEGIN_KEY ___LOCAL ___UTF_8STRING ___key_names[]={
6175#define ___DEF_KEY(i,key,str)str,
6176#define ___END_KEY 0};
6177
6178#define ___DEF_MOD_KEY(i,key,str)
6179
6180#define ___BEGIN_GLO ___LOCAL ___UTF_8STRING ___glo_names[]={
6181#define ___DEF_GLO(i,str)str,
6182#define ___END_GLO 0};
6183
6184#define ___BEGIN_OLD_KEY
6185#define ___DEF_OLD_KEY(key)
6186#define ___END_OLD_KEY
6187
6188#define ___BEGIN_OLD_SYM_GLO
6189#define ___DEF_OLD_SYM_GLO(sym,glo)
6190#define ___END_OLD_SYM_GLO
6191
6192#define ___BEGIN_NEW_KEY
6193#define ___DEF_NEW_KEY(prevkey,key,str,hash)
6194#define ___END_NEW_KEY
6195
6196#define ___BEGIN_NEW_SYM_GLO
6197#define ___DEF_NEW_SYM_GLO_SUP(prevsym,sym,str,hash,glo)
6198#define ___DEF_NEW_SYM_GLO(prevsym,sym,str,hash,glo)
6199#define ___END_NEW_SYM_GLO(prevsym,prevkey)___LINKFILE_DESCR(0,0)
6200
6201#define ___DEF_SUB_NSTR(id,n)
6202#define ___NSTR0
6203#define ___NSTR1(a)
6204#define ___NSTR2(a,b)
6205#define ___NSTR3(a,b,c)
6206#define ___NSTR4(a,b,c,d)
6207#define ___NSTR5(a,b,c,d,e)
6208#define ___NSTR6(a,b,c,d,e,f)
6209#define ___NSTR7(a,b,c,d,e,f,g)
6210#define ___NSTR8(a,b,c,d,e,f,g,h)
6211
6212#else
6213
6214#define ___NEED_SYM(sym)___IMP_DATA(___symkey_struct,sym);
6215#define ___NEED_KEY(key)___IMP_DATA(___symkey_struct,key);
6216#define ___NEED_GLO(glo)___IMP_DATA(___glo_struct,glo);
6217
6218#ifndef ___IMPORTED_ADR_IS_CONST
6219
6220#define ___BEGIN_SYM ___LOCAL ___FAKEWORD ___symtbl[___SYMCOUNT];
6221#define ___DEF_SYM(i,sym,str)
6222#define ___END_SYM
6223
6224#define ___DEF_MOD_SYM(i,sym,str)___symtbl[i]=(___FAKEWORD)(sym);
6225
6226#define ___BEGIN_KEY ___LOCAL ___FAKEWORD ___keytbl[___KEYCOUNT];
6227#define ___DEF_KEY(i,key,str)
6228#define ___END_KEY
6229
6230#define ___DEF_MOD_KEY(i,key,str)___keytbl[i]=(___FAKEWORD)(key);
6231
6232#else
6233
6234#define ___BEGIN_SYM ___LOCAL ___FAKEWORD ___symtbl[]={
6235#define ___DEF_SYM(i,sym,str)(___FAKEWORD)(sym),
6236#define ___END_SYM 0};
6237
6238#define ___DEF_MOD_SYM(i,sym,str)
6239
6240#define ___BEGIN_KEY ___LOCAL ___FAKEWORD ___keytbl[]={
6241#define ___DEF_KEY(i,key,str)(___FAKEWORD)(key),
6242#define ___END_KEY 0};
6243
6244#define ___DEF_MOD_KEY(i,key,str)
6245
6246#endif
6247
6248#define ___BEGIN_GLO
6249#define ___DEF_GLO(i,str)
6250#define ___END_GLO
6251
6252#define ___BEGIN_OLD_KEY
6253#define ___DEF_OLD_KEY(key)
6254#define ___END_OLD_KEY
6255
6256#define ___BEGIN_OLD_SYM_GLO
6257#define ___DEF_OLD_SYM_GLO(sym,glo)
6258#define ___END_OLD_SYM_GLO
6259
6260#define ___BEGIN_NEW_KEY
6261#define ___DEF_NEW_KEY(prevkey,key,str,hash) \
6262___EXP_DATA(___symkey_struct,key)={(___FAKEWORD)prevkey,(___FAKEWORD)str,0,0,0 ___PADDING};
6263#define ___END_NEW_KEY
6264
6265#define ___BEGIN_NEW_SYM_GLO
6266#define ___DEF_NEW_SYM_GLO_SUP(prevsym,sym,str,hash,glo) \
6267___EXP_DATA(___glo_struct,glo) = {___UNB2, ___FIX(hash), 0}; \
6268___EXP_DATA(___symkey_struct,sym)={(___FAKEWORD)prevsym,(___FAKEWORD)str,0,0,(___FAKEWORD)&glo ___PADDING};
6269#define ___DEF_NEW_SYM_GLO(prevsym,sym,str,hash,glo) \
6270___EXP_DATA(___glo_struct,glo) = {___UNB1, ___FIX(hash), 0}; \
6271___EXP_DATA(___symkey_struct,sym)={(___FAKEWORD)prevsym,(___FAKEWORD)str,0,0,(___FAKEWORD)&glo ___PADDING};
6272#define ___END_NEW_SYM_GLO(prevsym,prevkey)___LINKFILE_DESCR(prevsym,prevkey)
6273
6274#define ___DEF_SUB_NSTR(id,n) ___DEF_SUB_STR(id,n)
6275#define ___NSTR0 ___STR0
6276#define ___NSTR1(a) ___STR1(a)
6277#define ___NSTR2(a,b) ___STR2(a,b)
6278#define ___NSTR3(a,b,c) ___STR3(a,b,c)
6279#define ___NSTR4(a,b,c,d) ___STR4(a,b,c,d)
6280#define ___NSTR5(a,b,c,d,e) ___STR5(a,b,c,d,e)
6281#define ___NSTR6(a,b,c,d,e,f) ___STR6(a,b,c,d,e,f)
6282#define ___NSTR7(a,b,c,d,e,f,g) ___STR7(a,b,c,d,e,f,g)
6283#define ___NSTR8(a,b,c,d,e,f,g,h) ___STR8(a,b,c,d,e,f,g,h)
6284
6285#endif
6286
6287#define ___BEGIN_CNS \
6288___LOCAL ___WORD ___cnstbl[]={
6289#define ___DEF_CNS(car,cdr)___MAKE_HD((___PAIR_SIZE<<___LWS),___sPAIR,___PERM),cdr,car
6290#define ___END_CNS ___PADDING};
6291
6292#define ___BEGIN_SUB \
6293___LOCAL ___FAKEWORD ___subtbl[]={
6294#define ___DEF_SUB(id)___CAST_WORDSTAR_TO_FAKEWORD(id)
6295#define ___END_SUB };
6296
6297#define ___DEF_SUB_VEC(id,n) \
6298___LOCAL ___WORD id[]={___MAKE_HD((n<<___LWS),___sVECTOR,___PERM)
6299
6300#define ___DEF_SUB_STRUCT(id,n) \
6301___LOCAL ___WORD id[]={___MAKE_HD((n<<___LWS),___sSTRUCTURE,___PERM)/*****************/
6302
6303#define ___DEF_SUB_STRUCTURE(id,n) \
6304___LOCAL ___WORD id[]={___MAKE_HD((n<<___LWS),___sSTRUCTURE,___PERM)
6305
6306#define ___DEF_SUB_BOX(id,n) \
6307___LOCAL ___WORD id[]={___MAKE_HD((n<<___LWS),___sBOXVALUES,___PERM)
6308
6309#define ___DEF_SUB_SYM(id,name,hash) \
6310___LOCAL ___WORD id[]={___MAKE_HD((___SYMBOL_SIZE<<___LWS),___sSYMBOL,___PERM),name,hash,___FAL,0 ___PADDING};
6311
6312#define ___DEF_SUB_KEY(id,name,hash) \
6313___LOCAL ___WORD id[]={___MAKE_HD((___KEYWORD_SIZE<<___LWS),___sKEYWORD,___PERM),name,hash,___FAL ___PADDING};
6314
6315#define ___DEF_SUB_STR(id,n) \
6316___LOCAL ___WORD id[]={___MAKE_HD((n<<___LCS),___sSTRING,___PERM)
6317
6318#define ___DEF_SUB_RAT(id,num,den) \
6319___LOCAL ___WORD id[]={___MAKE_HD((___RATNUM_SIZE<<___LWS),___sRATNUM,___PERM),num,den ___PADDING};
6320
6321#define ___DEF_SUB_FLO(id,hi,lo) \
6322___LOCAL ___WORD id[]={___MAKE_HD((___FLONUM_SIZE<<___LWS),___sFLONUM,___PERM) \
6323___F64VEC1(hi,lo)___F64VEC0
6324
6325#define ___DEF_SUB_CPX(id,real,imag) \
6326___LOCAL ___WORD id[]={___MAKE_HD((___CPXNUM_SIZE<<___LWS),___sCPXNUM,___PERM),real,imag ___PADDING};
6327
6328#define ___DEF_SUB_S8VEC(id,n) \
6329___LOCAL ___WORD id[]={___MAKE_HD(n,___sS8VECTOR,___PERM)
6330
6331#define ___DEF_SUB_U8VEC(id,n) \
6332___LOCAL ___WORD id[]={___MAKE_HD(n,___sU8VECTOR,___PERM)
6333
6334#define ___DEF_SUB_S16VEC(id,n) \
6335___LOCAL ___WORD id[]={___MAKE_HD((n<<1),___sS16VECTOR,___PERM)
6336
6337#define ___DEF_SUB_U16VEC(id,n) \
6338___LOCAL ___WORD id[]={___MAKE_HD((n<<1),___sU16VECTOR,___PERM)
6339
6340#define ___DEF_SUB_S32VEC(id,n) \
6341___LOCAL ___WORD id[]={___MAKE_HD((n<<2),___sS32VECTOR,___PERM)
6342
6343#define ___DEF_SUB_U32VEC(id,n) \
6344___LOCAL ___WORD id[]={___MAKE_HD((n<<2),___sU32VECTOR,___PERM)
6345
6346#define ___DEF_SUB_S64VEC(id,n) \
6347___LOCAL ___WORD id[]={___MAKE_HD((n<<3),___sS64VECTOR,___PERM)
6348
6349#define ___DEF_SUB_U64VEC(id,n) \
6350___LOCAL ___WORD id[]={___MAKE_HD((n<<3),___sU64VECTOR,___PERM)
6351
6352#define ___DEF_SUB_F32VEC(id,n) \
6353___LOCAL ___WORD id[]={___MAKE_HD((n<<2),___sF32VECTOR,___PERM)
6354
6355#define ___DEF_SUB_F64VEC(id,n) \
6356___LOCAL ___WORD id[]={___MAKE_HD((n<<3),___sF64VECTOR,___PERM)
6357
6358#if ___SCMOBJ_WIDTH == 32
6359
6360#ifdef ___BIG_ENDIAN
6361
6362#define ___P4U8(a,b,c,d)((((((___UWORD)___CAST_U8(a)<<8)+(___UWORD)___CAST_U8(b))<<8)+(___UWORD)___CAST_U8(c))<<8)+(___WORD)___CAST_U8(d)
6363
6364#define ___P2U16(a,b)((___UWORD)___CAST_U16(a)<<16)+(___WORD)___CAST_U16(b)
6365
6366#define ___P1U32(a)a
6367
6368#define ___P1U64(hi,lo)hi,lo
6369
6370#else
6371
6372#define ___P4U8(d,c,b,a)((((((___UWORD)___CAST_U8(a)<<8)+(___UWORD)___CAST_U8(b))<<8)+(___UWORD)___CAST_U8(c))<<8)+(___WORD)___CAST_U8(d)
6373
6374#define ___P2U16(b,a)((___UWORD)___CAST_U16(a)<<16)+(___WORD)___CAST_U16(b)
6375
6376#define ___P1U32(a)a
6377
6378#define ___P1U64(hi,lo)lo,hi
6379
6380#endif
6381
6382#define ___S8VEC0 ___PADDING};
6383#define ___S8VEC1(a),___P4U8(a,0,0,0) ___PADDING};
6384#define ___S8VEC2(a,b),___P4U8(a,b,0,0) ___PADDING};
6385#define ___S8VEC3(a,b,c),___P4U8(a,b,c,0) ___PADDING};
6386#define ___S8VEC4(a,b,c,d),___P4U8(a,b,c,d) ___PADDING};
6387#define ___S8VEC5(a,b,c,d,e),___P4U8(a,b,c,d),___P4U8(e,0,0,0) ___PADDING};
6388#define ___S8VEC6(a,b,c,d,e,f),___P4U8(a,b,c,d),___P4U8(e,f,0,0) ___PADDING};
6389#define ___S8VEC7(a,b,c,d,e,f,g),___P4U8(a,b,c,d),___P4U8(e,f,g,0) ___PADDING};
6390#define ___S8VEC8(a,b,c,d,e,f,g,h),___P4U8(a,b,c,d),___P4U8(e,f,g,h)
6391
6392#define ___U8VEC0 ___PADDING};
6393#define ___U8VEC1(a),___P4U8(a,0,0,0) ___PADDING};
6394#define ___U8VEC2(a,b),___P4U8(a,b,0,0) ___PADDING};
6395#define ___U8VEC3(a,b,c),___P4U8(a,b,c,0) ___PADDING};
6396#define ___U8VEC4(a,b,c,d),___P4U8(a,b,c,d) ___PADDING};
6397#define ___U8VEC5(a,b,c,d,e),___P4U8(a,b,c,d),___P4U8(e,0,0,0) ___PADDING};
6398#define ___U8VEC6(a,b,c,d,e,f),___P4U8(a,b,c,d),___P4U8(e,f,0,0) ___PADDING};
6399#define ___U8VEC7(a,b,c,d,e,f,g),___P4U8(a,b,c,d),___P4U8(e,f,g,0) ___PADDING};
6400#define ___U8VEC8(a,b,c,d,e,f,g,h),___P4U8(a,b,c,d),___P4U8(e,f,g,h)
6401
6402#define ___S16VEC0 ___PADDING};
6403#define ___S16VEC1(a),___P2U16(a,0) ___PADDING};
6404#define ___S16VEC2(a,b),___P2U16(a,b) ___PADDING};
6405#define ___S16VEC3(a,b,c),___P2U16(a,b),___P2U16(c,0) ___PADDING};
6406#define ___S16VEC4(a,b,c,d),___P2U16(a,b),___P2U16(c,d)
6407
6408#define ___U16VEC0 ___PADDING};
6409#define ___U16VEC1(a),___P2U16(a,0) ___PADDING};
6410#define ___U16VEC2(a,b),___P2U16(a,b) ___PADDING};
6411#define ___U16VEC3(a,b,c),___P2U16(a,b),___P2U16(c,0) ___PADDING};
6412#define ___U16VEC4(a,b,c,d),___P2U16(a,b),___P2U16(c,d)
6413
6414#define ___S32VEC0 ___PADDING};
6415#define ___S32VEC1(a),___P1U32(a) ___PADDING};
6416#define ___S32VEC2(a,b),___P1U32(a),___P1U32(b)
6417
6418#define ___U32VEC0 ___PADDING};
6419#define ___U32VEC1(a),___P1U32(a) ___PADDING};
6420#define ___U32VEC2(a,b),___P1U32(a),___P1U32(b)
6421
6422#else
6423
6424#ifdef ___BIG_ENDIAN
6425
6426#define ___P8U8(a,b,c,d,e,f,g,h)___CAST(___WORD,(((((((((((((___CAST(___UWORD,___CAST_U8(a))<<8)+___CAST(___UWORD,___CAST_U8(b)))<<8)+___CAST(___UWORD,___CAST_U8(c)))<<8)+___CAST(___UWORD,___CAST_U8(d)))<<8)+___CAST(___UWORD,___CAST_U8(e)))<<8)+___CAST(___UWORD,___CAST_U8(f)))<<8)+___CAST(___UWORD,___CAST_U8(g)))<<8)+___CAST(___UWORD,___CAST_U8(h)))
6427
6428#define ___P4U16(a,b,c,d)___CAST(___WORD,(((((___CAST(___UWORD,___CAST_U16(a))<<16)+___CAST(___UWORD,___CAST_U16(b)))<<16)+___CAST(___UWORD,___CAST_U16(c)))<<16)+___CAST(___UWORD,___CAST_U16(d)))
6429
6430#define ___P2U32(a,b)___CAST(___WORD,(___CAST(___UWORD,___CAST_U32(a))<<32)+___CAST(___UWORD,___CAST_U32(b)))
6431
6432#else
6433
6434#define ___P8U8(h,g,f,e,d,c,b,a)___CAST(___WORD,(((((((((((((___CAST(___UWORD,___CAST_U8(a))<<8)+___CAST(___UWORD,___CAST_U8(b)))<<8)+___CAST(___UWORD,___CAST_U8(c)))<<8)+___CAST(___UWORD,___CAST_U8(d)))<<8)+___CAST(___UWORD,___CAST_U8(e)))<<8)+___CAST(___UWORD,___CAST_U8(f)))<<8)+___CAST(___UWORD,___CAST_U8(g)))<<8)+___CAST(___UWORD,___CAST_U8(h)))
6435
6436#define ___P4U16(d,c,b,a)___CAST(___WORD,(((((___CAST(___UWORD,___CAST_U16(a))<<16)+___CAST(___UWORD,___CAST_U16(b)))<<16)+___CAST(___UWORD,___CAST_U16(c)))<<16)+___CAST(___UWORD,___CAST_U16(d)))
6437
6438#define ___P2U32(b,a)___CAST(___WORD,(___CAST(___UWORD,___CAST_U32(a))<<32)+___CAST(___UWORD,___CAST_U32(b)))
6439
6440#endif
6441
6442#define ___P1U64(hi,lo)___CAST(___WORD,(___CAST(___UWORD,hi)<<32)+___CAST(___UWORD,___CAST_U32(lo)))
6443
6444#define ___S8VEC0 ___PADDING};
6445#define ___S8VEC1(a),___P8U8(a,0,0,0,0,0,0,0) ___PADDING};
6446#define ___S8VEC2(a,b),___P8U8(a,b,0,0,0,0,0,0) ___PADDING};
6447#define ___S8VEC3(a,b,c),___P8U8(a,b,c,0,0,0,0,0) ___PADDING};
6448#define ___S8VEC4(a,b,c,d),___P8U8(a,b,c,d,0,0,0,0) ___PADDING};
6449#define ___S8VEC5(a,b,c,d,e),___P8U8(a,b,c,d,e,0,0,0) ___PADDING};
6450#define ___S8VEC6(a,b,c,d,e,f),___P8U8(a,b,c,d,e,f,0,0) ___PADDING};
6451#define ___S8VEC7(a,b,c,d,e,f,g),___P8U8(a,b,c,d,e,f,g,0) ___PADDING};
6452#define ___S8VEC8(a,b,c,d,e,f,g,h),___P8U8(a,b,c,d,e,f,g,h)
6453
6454#define ___U8VEC0 ___PADDING};
6455#define ___U8VEC1(a),___P8U8(a,0,0,0,0,0,0,0) ___PADDING};
6456#define ___U8VEC2(a,b),___P8U8(a,b,0,0,0,0,0,0) ___PADDING};
6457#define ___U8VEC3(a,b,c),___P8U8(a,b,c,0,0,0,0,0) ___PADDING};
6458#define ___U8VEC4(a,b,c,d),___P8U8(a,b,c,d,0,0,0,0) ___PADDING};
6459#define ___U8VEC5(a,b,c,d,e),___P8U8(a,b,c,d,e,0,0,0) ___PADDING};
6460#define ___U8VEC6(a,b,c,d,e,f),___P8U8(a,b,c,d,e,f,0,0) ___PADDING};
6461#define ___U8VEC7(a,b,c,d,e,f,g),___P8U8(a,b,c,d,e,f,g,0) ___PADDING};
6462#define ___U8VEC8(a,b,c,d,e,f,g,h),___P8U8(a,b,c,d,e,f,g,h)
6463
6464#define ___S16VEC0 ___PADDING};
6465#define ___S16VEC1(a),___P4U16(a,0,0,0) ___PADDING};
6466#define ___S16VEC2(a,b),___P4U16(a,b,0,0) ___PADDING};
6467#define ___S16VEC3(a,b,c),___P4U16(a,b,c,0) ___PADDING};
6468#define ___S16VEC4(a,b,c,d),___P4U16(a,b,c,d)
6469
6470#define ___U16VEC0 ___PADDING};
6471#define ___U16VEC1(a),___P4U16(a,0,0,0) ___PADDING};
6472#define ___U16VEC2(a,b),___P4U16(a,b,0,0) ___PADDING};
6473#define ___U16VEC3(a,b,c),___P4U16(a,b,c,0) ___PADDING};
6474#define ___U16VEC4(a,b,c,d),___P4U16(a,b,c,d)
6475
6476#define ___S32VEC0 ___PADDING};
6477#define ___S32VEC1(a),___P2U32(a,0) ___PADDING};
6478#define ___S32VEC2(a,b),___P2U32(a,b)
6479
6480#define ___U32VEC0 ___PADDING};
6481#define ___U32VEC1(a),___P2U32(a,0) ___PADDING};
6482#define ___U32VEC2(a,b),___P2U32(a,b)
6483
6484#endif
6485
6486#define ___S64VEC0 ___PADDING_64};
6487#define ___S64VEC1(hi,lo),___P1U64(hi,lo)
6488
6489#define ___U64VEC0 ___PADDING_64};
6490#define ___U64VEC1(hi,lo),___P1U64(hi,lo)
6491
6492#define ___STR0 ___CS_SELECT( \
6493___U8VEC0, \
6494___U16VEC0, \
6495___U32VEC0)
6496
6497#define ___STR1(a)___CS_SELECT( \
6498___U8VEC1(a), \
6499___U16VEC1(a), \
6500___U32VEC1(a))
6501
6502#define ___STR2(a,b)___CS_SELECT( \
6503___U8VEC2(a,b), \
6504___U16VEC2(a,b), \
6505___U32VEC2(a,b)___U32VEC0)
6506
6507#define ___STR3(a,b,c)___CS_SELECT( \
6508___U8VEC3(a,b,c), \
6509___U16VEC3(a,b,c), \
6510___U32VEC2(a,b)___U32VEC1(c))
6511
6512#define ___STR4(a,b,c,d)___CS_SELECT( \
6513___U8VEC4(a,b,c,d), \
6514___U16VEC4(a,b,c,d)___U16VEC0, \
6515___U32VEC2(a,b)___U32VEC2(c,d)___U32VEC0)
6516
6517#define ___STR5(a,b,c,d,e)___CS_SELECT( \
6518___U8VEC5(a,b,c,d,e), \
6519___U16VEC4(a,b,c,d)___U16VEC1(e), \
6520___U32VEC2(a,b)___U32VEC2(c,d)___U32VEC1(e))
6521
6522#define ___STR6(a,b,c,d,e,f)___CS_SELECT( \
6523___U8VEC6(a,b,c,d,e,f), \
6524___U16VEC4(a,b,c,d)___U16VEC2(e,f), \
6525___U32VEC2(a,b)___U32VEC2(c,d)___U32VEC2(e,f)___U32VEC0)
6526
6527#define ___STR7(a,b,c,d,e,f,g)___CS_SELECT( \
6528___U8VEC7(a,b,c,d,e,f,g), \
6529___U16VEC4(a,b,c,d)___U16VEC3(e,f,g), \
6530___U32VEC2(a,b)___U32VEC2(c,d)___U32VEC2(e,f)___U32VEC1(g))
6531
6532#define ___STR8(a,b,c,d,e,f,g,h)___CS_SELECT( \
6533___U8VEC8(a,b,c,d,e,f,g,h), \
6534___U16VEC4(a,b,c,d)___U16VEC4(e,f,g,h), \
6535___U32VEC2(a,b)___U32VEC2(c,d)___U32VEC2(e,f)___U32VEC2(g,h))
6536
6537#if ___BIG_ABASE_WIDTH == 32
6538
6539#define ___DEF_SUB_BIG(id,n) \
6540___LOCAL ___WORD id[]={___MAKE_HD((n<<2),___sBIGNUM,___PERM)
6541
6542#define ___BIG0 ___U32VEC0
6543#define ___BIG1(a)___U32VEC1(a)
6544#define ___BIG2(a,b)___U32VEC2(a,b)
6545
6546#else
6547
6548#define ___DEF_SUB_BIG(id,n) \
6549___LOCAL ___WORD id[]={___MAKE_HD((((n+1)>>1)<<3),___sBIGNUM,___PERM)
6550
6551#define ___BIG0 ___U64VEC0
6552#define ___BIG1(a)___BIG2(a,(___WORD)((a) & -0x80000000)?-1:0)___U64VEC0
6553#define ___BIG2(a,b)___U64VEC1(b,a)
6554
6555#endif
6556
6557#define ___DEF_SUB_BIGFIX(id,n)___DEF_SUB_BIG(id,n)
6558
6559#define ___BIGFIX0 ___BIG0
6560#define ___BIGFIX1(a)___BIG1(a)
6561#define ___BIGFIX2(a,b)___BIG2(a,b)
6562
6563#define ___F32VEC0 ___U32VEC0
6564#define ___F32VEC1(a)___U32VEC1(a)
6565#define ___F32VEC2(a,b)___U32VEC2(a,b)
6566
6567#define ___F64VEC0 ___U64VEC0
6568#ifdef ___CRAY_FP_FORMAT
6569#define ___F64VEC1(hi,lo)___U64VEC1( \
6570((hi&0x7ff00000==0)?hi: \
6571((hi&0x80000000)+((hi>>4)&0x7ff0000)+0x3c028000+((hi>>5)&0x7fff))), \
6572((hi&0x7ff00000==0)?0: \
6573(((hi<<27)&0xf8000000)|((lo>>5)&0x7ffffff))))
6574#else
6575#define ___F64VEC1(hi,lo)___U64VEC1(hi,lo)
6576#endif
6577
6578#define ___VEC0 ___PADDING};
6579#define ___VEC1(a),a
6580
6581#define ___CEILING_DIV(n,m)(((n)+(m)-1)/(m))
6582#define ___ROUND_TO_MULT(n,m)(___CEILING_DIV(n,m)*(m))
6583#define ___BREAK_FRAME_NEXT 1
6584#define ___BREAK_FRAME_SPACE ___ROUND_TO_MULT(1,___FRAME_ALIGN)
6585#define ___FIRST_BREAK_FRAME_STACK_MSECTION 2
6586#define ___FIRST_BREAK_FRAME_STACK_BREAK    3
6587#define ___FIRST_BREAK_FRAME_SPACE ___ROUND_TO_MULT(3,___FRAME_ALIGN)
6588
6589#define ___FRAME_SPACE(n)___ROUND_TO_MULT((n)+___FRAME_RESERVE,___FRAME_ALIGN)
6590#define ___FRAME_RESERVE 3
6591#define ___FRAME_ALIGN 4
6592
6593#ifdef ___OFDCOUNT
6594#define ___OFDTBL ___ofdtbl,sizeof(___ofdtbl)/sizeof(___WORD)
6595#else
6596#define ___OFDTBL 0,0
6597#endif
6598
6599#define ___BEGIN_OFD \
6600___LOCAL ___WORD ___ofdtbl[]={
6601#define ___END_OFD ___PADDING};
6602
6603#define ___DEF_OFD(kind,fs,link)(link<<16)+(fs<<2)+kind
6604#define ___OFD_KIND(x)((x)&((1<<2)-1))
6605#define ___OFD_FS(x)(((x)>>2)&((1<<14)-1))
6606#define ___OFD_LINK(x)(((x)>>16)&((1<<14)-1))
6607
6608#define ___GCMAP0
6609#define ___GCMAP1(a),a
6610#if ___SCMOBJ_WIDTH == 32
6611#define ___GCMAP2(a,b),a,b
6612#else
6613#define ___GCMAP2(a,b),___CAST(___WORD,(___CAST(___UWORD,b)<<32)+___CAST(___UWORD,___CAST_U32(a)))
6614#endif
6615
6616#define ___U64VEC0 ___PADDING_64};
6617#define ___U64VEC1(hi,lo),___P1U64(hi,lo)
6618
6619#define ___PRD(nbparms,nbclosed) \
6620___MAKE_HD(((nbclosed+1)<<12)+nbparms,___sPROCEDURE,___PERM)
6621#define ___PRD_NBPARMS(x)(((x)>>(___SB+___HTB))&((1<<12)-1))
6622#define ___PRD_NBCLOSED(x)((((x)>>(___SB+___HTB+12))&((1<<12)-1))-1)
6623
6624#define ___IFD(kind,fs,link,gcmap)(gcmap<<12)+(link<<7)+(fs<<2)+kind
6625#define ___OFD(kind,fs,link,gcmap)___IFD(kind,0,0,0)
6626#define ___IS_IFD(x)((x)&3)
6627
6628#define ___IFD_KIND(x)((x)&((1<<2)-1))
6629#define ___IFD_FS(x)(((x)>>2)&((1<<5)-1))
6630#define ___IFD_LINK(x)(((x)>>7)&((1<<5)-1))
6631#define ___IFD_GCMAP(x)(((x)>>12)&((1<<20)-1))
6632
6633
6634#define ___RETI_CFS_TO_FS(fs) \
6635___ROUND_TO_MULT(fs,___FRAME_ALIGN)+___FRAME_SPACE(___NB_GVM_REGS+1)-___FRAME_RESERVE
6636
6637#define ___RETI_GET_CFS(ra,fs) \
6638{ ___WORD descr = ___LABEL_DESCR_GET(ra); \
6639if (___IS_IFD(descr)) \
6640fs = ___IFD_FS(descr); \
6641else \
6642fs = ___OFD_FS(*(___WORD*)descr); }
6643
6644#define ___RETI_GET_FS(ra,fs) \
6645{ ___WORD descr = ___LABEL_DESCR_GET(ra); \
6646if (___IS_IFD(descr)) \
6647fs = ___RETI_CFS_TO_FS(___IFD_FS(descr)); \
6648else \
6649fs = ___RETI_CFS_TO_FS(___OFD_FS(*(___WORD*)descr)); }
6650
6651#define ___RETN_GET_FS(ra,fs) \
6652{ ___WORD descr = ___LABEL_DESCR_GET(ra); \
6653if (___IS_IFD(descr)) \
6654fs = ___IFD_FS(descr); \
6655else \
6656fs = ___OFD_FS(*(___WORD*)descr); }
6657
6658#define ___RETI_GET_FS_LINK(ra,fs,link) \
6659{ ___WORD descr = ___LABEL_DESCR_GET(ra); \
6660if (___IS_IFD(descr)) \
6661{ fs = ___RETI_CFS_TO_FS(___IFD_FS(descr)); link = ___IFD_LINK(descr); } \
6662else \
6663{ descr = *(___WORD*)descr; \
6664fs = ___RETI_CFS_TO_FS(___OFD_FS(descr)); link = ___OFD_LINK(descr); } }
6665
6666#define ___RETN_GET_FS_LINK(ra,fs,link) \
6667{ ___WORD descr = ___LABEL_DESCR_GET(ra); \
6668if (___IS_IFD(descr)) \
6669{ fs = ___IFD_FS(descr); link = ___IFD_LINK(descr); } \
6670else \
6671{ descr = *(___WORD*)descr; \
6672fs = ___OFD_FS(descr); link = ___OFD_LINK(descr); } }
6673
6674#define ___RETI_GET_FS_LINK_GCMAP(ra,fs,link,firstgcmap,nextgcmap) \
6675{ ___WORD descr = ___LABEL_DESCR_GET(ra); \
6676if (___IS_IFD(descr)) \
6677{ fs = ___RETI_CFS_TO_FS(___IFD_FS(descr)); link = ___IFD_LINK(descr); \
6678firstgcmap = ___IFD_GCMAP(descr); } \
6679else \
6680{ nextgcmap = (___WORD*)descr; descr = *nextgcmap++; firstgcmap = *nextgcmap++; \
6681fs = ___RETI_CFS_TO_FS(___OFD_FS(descr)); link = ___OFD_LINK(descr); } }
6682
6683#define ___RETN_GET_FS_LINK_GCMAP(ra,fs,link,firstgcmap,nextgcmap) \
6684{ ___WORD descr = ___LABEL_DESCR_GET(ra); \
6685if (___IS_IFD(descr)) \
6686{ firstgcmap = ___IFD_GCMAP(descr); \
6687fs = ___IFD_FS(descr); link = ___IFD_LINK(descr); } \
6688else \
6689{ nextgcmap = (___WORD*)descr; descr = *nextgcmap++; firstgcmap = *nextgcmap++; \
6690fs = ___OFD_FS(descr); link = ___OFD_LINK(descr); } }
6691
6692
6693
6694
6695#define ___RETN 1
6696#define ___RETI 2
6697#define ___RETT 3
6698
6699#ifdef ___GLOCOUNT
6700#ifdef ___BIND_LATE
6701#define ___GLODECL ___LOCAL ___FAKEWORD ___glotbl[___GLOCOUNT];
6702#define ___GLOTBL ___glotbl,___GLOCOUNT,___SUPCOUNT,___glo_names
6703#else
6704#define ___GLODECL
6705#define ___GLOTBL 0,0,0,0
6706#endif
6707#else
6708#define ___GLODECL
6709#define ___GLOTBL 0,0,0,0
6710#endif
6711
6712#ifdef ___SYMCOUNT
6713#ifdef ___BIND_LATE
6714#define ___SYMDECL ___LOCAL ___FAKEWORD ___symtbl[___SYMCOUNT];
6715#define ___SYMTBL ___symtbl,___SYMCOUNT,___sym_names
6716#else
6717#define ___SYMDECL
6718#define ___SYMTBL ___symtbl,___SYMCOUNT,0
6719#endif
6720#else
6721#define ___SYMDECL
6722#define ___SYMTBL 0,0,0
6723#endif
6724
6725#ifdef ___KEYCOUNT
6726#ifdef ___BIND_LATE
6727#define ___KEYDECL ___LOCAL ___FAKEWORD ___keytbl[___KEYCOUNT];
6728#define ___KEYTBL ___keytbl,___KEYCOUNT,___key_names
6729#else
6730#define ___KEYDECL
6731#define ___KEYTBL ___keytbl,___KEYCOUNT,0
6732#endif
6733#else
6734#define ___KEYDECL
6735#define ___KEYTBL 0,0,0
6736#endif
6737
6738#ifdef ___LBLCOUNT
6739#define ___LBLTBL &___lp,___lbltbl,___LBLCOUNT
6740#else
6741#define ___LBLTBL 0,0,0
6742#endif
6743
6744#ifdef ___CNSCOUNT
6745#define ___CNSTBL ___cnstbl,___CNSCOUNT
6746#else
6747#define ___CNSTBL 0,0
6748#endif
6749
6750#ifdef ___SUBCOUNT
6751#define ___SUBTBL ___subtbl,___SUBCOUNT
6752#else
6753#define ___SUBTBL 0,0
6754#endif
6755
6756#define ___BEGIN_MOD_PRM ___LOCAL ___WORD ___setup_mod ___PVOID {
6757#define ___DEF_MOD_PRM(i,glo,n)___PRM(i,glo)=___MLBL(n);
6758#define ___END_MOD_PRM return ___FIX(___NO_ERR); }
6759
6760#define ___BEGIN_MOD_C_INIT ___LOCAL ___WORD ___init_mod \
6761   ___P((___PSDNC), \
6762        (___PSVNC) \
6763___PSDKR) { ___PSGET
6764#define ___END_MOD_C_INIT
6765
6766#define ___BEGIN_MOD_GLO
6767#define ___DEF_MOD_GLO(i,glo,n)___GLO(i,glo)=___MLBL(n);
6768#define ___END_MOD_GLO return ___FIX(___NO_ERR); }
6769
6770#define ___BEGIN_MOD_SYM_KEY ___LOCAL ___module_struct ___module_descr = { \
6771  ___VERSION, \
6772  ___MODULE_KIND, \
6773  ___MODULE_NAME, \
6774  ___MODULE_FLAGS, \
6775  ___GLOTBL, \
6776  ___SYMTBL, \
6777  ___KEYTBL, \
6778  ___LBLTBL, \
6779  ___OFDTBL, \
6780  ___CNSTBL, \
6781  ___SUBTBL, \
6782  ___setup_mod, \
6783  ___init_mod, \
6784  ___SCRIPT_LINE, \
6785  0,\
6786  ___MODDESCR \
6787}; \
6788___BEGIN_C_LINKAGE \
6789___EXP_FUNC(___mod_or_lnk,___LINKER_ID) \
6790   ___P((___global_state ___gs), \
6791        (___gs) \
6792___global_state ___gs;) \
6793{ \
6794  ___SET_LOCAL_GSTATE(___gs)
6795#define ___END_MOD_SYM_KEY \
6796  return (___mod_or_lnk)&___module_descr; \
6797} \
6798___END_C_LINKAGE
6799
6800#ifdef ___LIBRARY
6801
6802#define ___MAIN_PROC
6803
6804#else
6805
6806#ifdef ___OS_WIN32
6807#ifdef _WINDOWS
6808
6809#define ___MAIN_PROC \
6810___IMP_FUNC(int,___winmain) \
6811  ___P((HINSTANCE hInstance, \
6812        HINSTANCE hPrevInstance, \
6813        LPSTR lpCmdLine, \
6814        int nCmdShow, \
6815        ___mod_or_lnk (*linker)(___global_state), \
6816        char *script_line), \
6817       ()); \
6818int WINAPI WinMain ___P((HINSTANCE hInstance, \
6819                         HINSTANCE hPrevInstance, \
6820                         LPSTR lpCmdLine, \
6821                         int nCmdShow), \
6822                        (hInstance, \
6823                         hPrevInstance, \
6824                         lpCmdLine, \
6825                         nCmdShow) \
6826HINSTANCE hInstance; \
6827HINSTANCE hPrevInstance; \
6828LPSTR lpCmdLine; \
6829int nCmdShow;) \
6830{ \
6831  return ___winmain \
6832           (hInstance, \
6833            hPrevInstance, \
6834            lpCmdLine, \
6835            nCmdShow, \
6836            ___LINKER_ID, \
6837            ___SCRIPT_LINE); \
6838}
6839
6840#endif
6841#endif
6842
6843#ifndef ___MAIN_PROC
6844#ifdef _UNICODE
6845
6846#define ___MAIN_PROC \
6847___IMP_FUNC(int,___main_UCS_2) \
6848  ___P((int argc, \
6849        ___UCS_2STRING argv[], \
6850        ___mod_or_lnk (*linker)(___global_state), \
6851        char *script_line), \
6852       ()); \
6853int wmain ___P((int argc, \
6854                wchar_t *argv[]), \
6855               (argc, \
6856                argv) \
6857int argc; \
6858wchar_t *argv[];) \
6859{ \
6860  return ___main_UCS_2 \
6861           (argc, \
6862            argv, \
6863            ___LINKER_ID, \
6864            ___SCRIPT_LINE); \
6865}
6866
6867#else
6868
6869#define ___MAIN_PROC \
6870___IMP_FUNC(int,___main_char) \
6871  ___P((int argc, \
6872        char *argv[], \
6873        ___mod_or_lnk (*linker)(___global_state), \
6874        char *script_line), \
6875       ()); \
6876int main ___P((int argc, \
6877               char *argv[]), \
6878              (argc, \
6879               argv) \
6880int argc; \
6881char *argv[];) \
6882{ \
6883  return ___main_char \
6884           (argc, \
6885            argv, \
6886            ___LINKER_ID, \
6887            ___SCRIPT_LINE); \
6888}
6889
6890#endif
6891#endif
6892
6893#endif
6894
6895#define ___LINKFILE_DESCR(sym_list,key_list) \
6896___LOCAL ___linkfile_struct ___linkfile_descr = { \
6897  ___VERSION, \
6898  ___LINKFILE_KIND, \
6899  ___LINKFILE_NAME, \
6900  sym_list, \
6901  key_list, \
6902  ___linkertbl, \
6903}; \
6904___BEGIN_C_LINKAGE \
6905___EXP_FUNC(___mod_or_lnk,___LINKER_ID) \
6906   ___P((___global_state ___gs), \
6907        (___gs) \
6908___global_state ___gs;) \
6909{ \
6910  ___SET_LOCAL_GSTATE(___gs) \
6911  return (___mod_or_lnk)&___linkfile_descr; \
6912} \
6913___END_C_LINKAGE \
6914___MAIN_PROC
6915
6916#define ___BEGIN_OLD_LNK
6917#define ___DEF_OLD_LNK(id)___BEGIN_C_LINKAGE ___IMP_FUNC(___mod_or_lnk,id) \
6918___P((___global_state ___gs),()); ___END_C_LINKAGE
6919#define ___END_OLD_LNK
6920
6921#define ___BEGIN_NEW_LNK
6922#define ___DEF_NEW_LNK(id)___BEGIN_C_LINKAGE ___mod_or_lnk id \
6923___P((___global_state ___gs),()); ___END_C_LINKAGE
6924#define ___END_NEW_LNK
6925
6926#define ___BEGIN_LNK ___LOCAL ___linkinfo ___linkertbl[]={
6927#define ___DEF_LNK(id){ ___CAST(___mod_or_lnk,id), ___FIX(1) }
6928#define ___DEF_LNK_NOPRELOAD(id){ ___CAST(___mod_or_lnk,id), ___FIX(0) }
6929#define ___END_LNK , { 0, ___FIX(0) }};
6930
6931/*---------------------------------------------------------------------------*/
6932
6933/*
6934 * ___ERR_CODE is a type which represents the union of error codes
6935 * from various subsystems.  Currently 6 types of error codes are
6936 * supported: Windows HRESULT, MACOS errors, ANSI-C errno, netdb
6937 * h_errno, getaddrinfo error codes, and system specific error codes.
6938 * A Windows HRESULT error code is a 32 bit signed integer value
6939 * composed of (starting with the low bits) a 16 bit status code, a 11
6940 * bit facility code, a 4 bit reserved facility code and a 1 bit
6941 * severity code (negative means error).  It seems that only the 4
6942 * lower bits of the facility code are really used, the remaining 7
6943 * bits are zero.  This allows us to compact this 32 bit integer value
6944 * to a 30 bit integer value (which fits in a fixnum) by dropping the
6945 * top 2 bits of the facility code.  Of the 512 possible facility
6946 * codes, the codes 448 to 511 are assigned to Gambit specific error
6947 * codes, the codes 384 to 447 are assigned to MACOS errors, the codes
6948 * 320 to 382 are assigned to ANSI-C errno error codes, the code 319
6949 * is assigned to netdb h_errno error codes, and the code 318 is
6950 * assigned to getaddrinfo error codes.  The ``no error'' error code
6951 * of each subsystem is always mapped to ___NO_ERR which is equal to
6952 * 0, all other error codes are thus negative values.
6953 */
6954
6955#define ___ERR_CODE int
6956
6957#define ___ERR_CODE_FACILITY_SYSTEM   448
6958#define ___ERR_CODE_FACILITY_MACOS    384
6959#define ___ERR_CODE_FACILITY_ERRNO    320
6960#define ___ERR_CODE_FACILITY_H_ERRNO  319
6961#define ___ERR_CODE_FACILITY_GAI_CODE 318
6962#define ___ERR_CODE_FACILITY_TLS      317
6963
6964#define ___ERR_CODE_BUILD(facility,code) \
6965(~___MASK(___ERR_CODE,29)+(___CAST(___ERR_CODE,facility)<<16)+(code))
6966
6967#define ___ERR_CODE_FACILITY(err)(((err)>>16)&___MASK(___ERR_CODE,9))
6968
6969#define ___HRESULT_ERR(hresult) \
6970(((hresult)&___MASK(___ERR_CODE,25)) | \
6971(((hresult)&~___MASK(___ERR_CODE,27))>>2))
6972
6973#define ___HRESULT_FROM_ERR_CODE(err) \
6974(((err)&___MASK(___ERR_CODE,25)) | \
6975(((err)&~___MASK(unsigned ___ERR_CODE,25))<<2))
6976
6977#define ___WIN32_ERR(win32err) \
6978___HRESULT_ERR(HRESULT_FROM_WIN32(win32err))
6979
6980#define ___WIN32_FROM_ERR_CODE(err) \
6981HRESULT_CODE(___HRESULT_FROM_ERR_CODE(err))
6982
6983#define ___MACOS_ERR(oserr) \
6984((oserr)==0?___NO_ERR:___ERR_CODE_BUILD(___ERR_CODE_FACILITY_MACOS,oserr))
6985
6986#define ___MACOS_FROM_ERR_CODE(err) \
6987((err)==___NO_ERR?0:((err)-___ERR_CODE_BUILD(___ERR_CODE_FACILITY_MACOS,0)))
6988
6989#define ___ERRNO_ERR(errno) \
6990((errno)==0?___NO_ERR:___ERR_CODE_BUILD(___ERR_CODE_FACILITY_ERRNO,errno))
6991
6992#define ___ERRNO_FROM_ERR_CODE(err) \
6993((err)==___NO_ERR?0:((err)-___ERR_CODE_BUILD(___ERR_CODE_FACILITY_ERRNO,0)))
6994
6995#define ___H_ERRNO_ERR(h_errno) \
6996((h_errno)==0?___NO_ERR:___ERR_CODE_BUILD(___ERR_CODE_FACILITY_H_ERRNO,(h_errno)))
6997
6998#define ___H_ERRNO_FROM_ERR_CODE(err) \
6999((err)==___NO_ERR?0:((err)-___ERR_CODE_BUILD(___ERR_CODE_FACILITY_H_ERRNO,0)))
7000
7001#define ___GAI_CODE_ERR(gai_code) \
7002((gai_code)==0?___NO_ERR:___ERR_CODE_BUILD(___ERR_CODE_FACILITY_GAI_CODE,(gai_code)))
7003
7004#define ___GAI_CODE_FROM_ERR_CODE(err) \
7005((err)==___NO_ERR?0:((err)-___ERR_CODE_BUILD(___ERR_CODE_FACILITY_GAI_CODE,0)))
7006
7007#define ___ERR_BASE ___ERR_CODE_BUILD(___ERR_CODE_FACILITY_SYSTEM,0)
7008
7009#define ___NO_ERR                               0
7010#define ___UNWIND_C_STACK                       (___ERR_BASE+0)
7011#define ___SFUN_HEAP_OVERFLOW_ERR               (___ERR_BASE+1)
7012#define ___IMPL_LIMIT_ERR                       (___ERR_BASE+2)
7013#define ___UNKNOWN_ERR                          (___ERR_BASE+3)
7014#define ___UNIMPL_ERR                           (___ERR_BASE+4)
7015#define ___HEAP_OVERFLOW_ERR                    (___ERR_BASE+5)
7016#define ___CLOSED_DEVICE_ERR                    (___ERR_BASE+6)
7017#define ___INVALID_OP_ERR                       (___ERR_BASE+7)
7018#define ___MODULE_VERSION_TOO_OLD_ERR           (___ERR_BASE+8)
7019#define ___MODULE_VERSION_TOO_NEW_ERR           (___ERR_BASE+9)
7020#define ___MODULE_ALREADY_LOADED_ERR            (___ERR_BASE+10)
7021#define ___DYNAMIC_LOADING_NOT_AVAILABLE_ERR    (___ERR_BASE+11)
7022#define ___DYNAMIC_LOADING_LOOKUP_ERR           (___ERR_BASE+12)
7023#define ___KILL_PUMP                            (___ERR_BASE+13)
7024#define ___SELECT_SETUP_DONE                    (___ERR_BASE+14)
7025#define ___STOC_BASE ___STOC_S8_ERR
7026#define ___STOC_S8_ERR                          (___ERR_BASE+(1<<7))
7027#define ___STOC_U8_ERR                          (___ERR_BASE+(2<<7))
7028#define ___STOC_S16_ERR                         (___ERR_BASE+(3<<7))
7029#define ___STOC_U16_ERR                         (___ERR_BASE+(4<<7))
7030#define ___STOC_S32_ERR                         (___ERR_BASE+(5<<7))
7031#define ___STOC_U32_ERR                         (___ERR_BASE+(6<<7))
7032#define ___STOC_S64_ERR                         (___ERR_BASE+(7<<7))
7033#define ___STOC_U64_ERR                         (___ERR_BASE+(8<<7))
7034#define ___STOC_F32_ERR                         (___ERR_BASE+(9<<7))
7035#define ___STOC_F64_ERR                         (___ERR_BASE+(10<<7))
7036#define ___STOC_CHAR_ERR                        (___ERR_BASE+(11<<7))
7037#define ___STOC_SCHAR_ERR                       (___ERR_BASE+(12<<7))
7038#define ___STOC_UCHAR_ERR                       (___ERR_BASE+(13<<7))
7039#define ___STOC_ISO_8859_1_ERR                  (___ERR_BASE+(14<<7))
7040#define ___STOC_UCS_2_ERR                       (___ERR_BASE+(15<<7))
7041#define ___STOC_UCS_4_ERR                       (___ERR_BASE+(16<<7))
7042#define ___STOC_WCHAR_ERR                       (___ERR_BASE+(17<<7))
7043#define ___STOC_SIZE_T_ERR                      (___ERR_BASE+(18<<7))
7044#define ___STOC_SSIZE_T_ERR                     (___ERR_BASE+(19<<7))
7045#define ___STOC_PTRDIFF_T_ERR                   (___ERR_BASE+(20<<7))
7046#define ___STOC_SHORT_ERR                       (___ERR_BASE+(21<<7))
7047#define ___STOC_USHORT_ERR                      (___ERR_BASE+(22<<7))
7048#define ___STOC_INT_ERR                         (___ERR_BASE+(23<<7))
7049#define ___STOC_UINT_ERR                        (___ERR_BASE+(24<<7))
7050#define ___STOC_LONG_ERR                        (___ERR_BASE+(25<<7))
7051#define ___STOC_ULONG_ERR                       (___ERR_BASE+(26<<7))
7052#define ___STOC_LONGLONG_ERR                    (___ERR_BASE+(27<<7))
7053#define ___STOC_ULONGLONG_ERR                   (___ERR_BASE+(28<<7))
7054#define ___STOC_FLOAT_ERR                       (___ERR_BASE+(29<<7))
7055#define ___STOC_DOUBLE_ERR                      (___ERR_BASE+(30<<7))
7056#define ___STOC_STRUCT_ERR                      (___ERR_BASE+(31<<7))
7057#define ___STOC_UNION_ERR                       (___ERR_BASE+(32<<7))
7058#define ___STOC_TYPE_ERR                        (___ERR_BASE+(33<<7))
7059#define ___STOC_POINTER_ERR                     (___ERR_BASE+(34<<7))
7060#define ___STOC_NONNULLPOINTER_ERR              (___ERR_BASE+(35<<7))
7061#define ___STOC_FUNCTION_ERR                    (___ERR_BASE+(36<<7))
7062#define ___STOC_NONNULLFUNCTION_ERR             (___ERR_BASE+(37<<7))
7063#define ___STOC_BOOL_ERR                        (___ERR_BASE+(38<<7))
7064#define ___STOC_CHARSTRING_ERR                  (___ERR_BASE+(39<<7))
7065#define ___STOC_NONNULLCHARSTRING_ERR           (___ERR_BASE+(40<<7))
7066#define ___STOC_NONNULLCHARSTRINGLIST_ERR       (___ERR_BASE+(41<<7))
7067#define ___STOC_ISO_8859_1STRING_ERR            (___ERR_BASE+(42<<7))
7068#define ___STOC_NONNULLISO_8859_1STRING_ERR     (___ERR_BASE+(43<<7))
7069#define ___STOC_NONNULLISO_8859_1STRINGLIST_ERR (___ERR_BASE+(44<<7))
7070#define ___STOC_UTF_8STRING_ERR                 (___ERR_BASE+(45<<7))
7071#define ___STOC_NONNULLUTF_8STRING_ERR          (___ERR_BASE+(46<<7))
7072#define ___STOC_NONNULLUTF_8STRINGLIST_ERR      (___ERR_BASE+(47<<7))
7073#define ___STOC_UTF_16STRING_ERR                (___ERR_BASE+(48<<7))
7074#define ___STOC_NONNULLUTF_16STRING_ERR         (___ERR_BASE+(49<<7))
7075#define ___STOC_NONNULLUTF_16STRINGLIST_ERR     (___ERR_BASE+(50<<7))
7076#define ___STOC_UCS_2STRING_ERR                 (___ERR_BASE+(51<<7))
7077#define ___STOC_NONNULLUCS_2STRING_ERR          (___ERR_BASE+(52<<7))
7078#define ___STOC_NONNULLUCS_2STRINGLIST_ERR      (___ERR_BASE+(53<<7))
7079#define ___STOC_UCS_4STRING_ERR                 (___ERR_BASE+(54<<7))
7080#define ___STOC_NONNULLUCS_4STRING_ERR          (___ERR_BASE+(55<<7))
7081#define ___STOC_NONNULLUCS_4STRINGLIST_ERR      (___ERR_BASE+(56<<7))
7082#define ___STOC_WCHARSTRING_ERR                 (___ERR_BASE+(57<<7))
7083#define ___STOC_NONNULLWCHARSTRING_ERR          (___ERR_BASE+(58<<7))
7084#define ___STOC_NONNULLWCHARSTRINGLIST_ERR      (___ERR_BASE+(59<<7))
7085#define ___STOC_VARIANT_ERR                     (___ERR_BASE+(60<<7))
7086#define ___STOC_HEAP_OVERFLOW_ERR               (___ERR_BASE+(61<<7))
7087#define ___STOC_MAX                             (___ERR_BASE+(62<<7)-1)
7088#define ___CTOS_BASE ___CTOS_S8_ERR
7089#define ___CTOS_S8_ERR                          (___ERR_BASE+(65<<7))
7090#define ___CTOS_U8_ERR                          (___ERR_BASE+(66<<7))
7091#define ___CTOS_S16_ERR                         (___ERR_BASE+(67<<7))
7092#define ___CTOS_U16_ERR                         (___ERR_BASE+(68<<7))
7093#define ___CTOS_S32_ERR                         (___ERR_BASE+(69<<7))
7094#define ___CTOS_U32_ERR                         (___ERR_BASE+(70<<7))
7095#define ___CTOS_S64_ERR                         (___ERR_BASE+(71<<7))
7096#define ___CTOS_U64_ERR                         (___ERR_BASE+(72<<7))
7097#define ___CTOS_F32_ERR                         (___ERR_BASE+(73<<7))
7098#define ___CTOS_F64_ERR                         (___ERR_BASE+(74<<7))
7099#define ___CTOS_CHAR_ERR                        (___ERR_BASE+(75<<7))
7100#define ___CTOS_SCHAR_ERR                       (___ERR_BASE+(76<<7))
7101#define ___CTOS_UCHAR_ERR                       (___ERR_BASE+(77<<7))
7102#define ___CTOS_ISO_8859_1_ERR                  (___ERR_BASE+(78<<7))
7103#define ___CTOS_UCS_2_ERR                       (___ERR_BASE+(79<<7))
7104#define ___CTOS_UCS_4_ERR                       (___ERR_BASE+(80<<7))
7105#define ___CTOS_WCHAR_ERR                       (___ERR_BASE+(81<<7))
7106#define ___CTOS_SIZE_T_ERR                      (___ERR_BASE+(82<<7))
7107#define ___CTOS_SSIZE_T_ERR                     (___ERR_BASE+(83<<7))
7108#define ___CTOS_PTRDIFF_T_ERR                   (___ERR_BASE+(84<<7))
7109#define ___CTOS_SHORT_ERR                       (___ERR_BASE+(85<<7))
7110#define ___CTOS_USHORT_ERR                      (___ERR_BASE+(86<<7))
7111#define ___CTOS_INT_ERR                         (___ERR_BASE+(87<<7))
7112#define ___CTOS_UINT_ERR                        (___ERR_BASE+(88<<7))
7113#define ___CTOS_LONG_ERR                        (___ERR_BASE+(89<<7))
7114#define ___CTOS_ULONG_ERR                       (___ERR_BASE+(90<<7))
7115#define ___CTOS_LONGLONG_ERR                    (___ERR_BASE+(91<<7))
7116#define ___CTOS_ULONGLONG_ERR                   (___ERR_BASE+(92<<7))
7117#define ___CTOS_FLOAT_ERR                       (___ERR_BASE+(93<<7))
7118#define ___CTOS_DOUBLE_ERR                      (___ERR_BASE+(94<<7))
7119#define ___CTOS_STRUCT_ERR                      (___ERR_BASE+(95<<7))
7120#define ___CTOS_UNION_ERR                       (___ERR_BASE+(96<<7))
7121#define ___CTOS_TYPE_ERR                        (___ERR_BASE+(97<<7))
7122#define ___CTOS_POINTER_ERR                     (___ERR_BASE+(98<<7))
7123#define ___CTOS_NONNULLPOINTER_ERR              (___ERR_BASE+(99<<7))
7124#define ___CTOS_FUNCTION_ERR                    (___ERR_BASE+(100<<7))
7125#define ___CTOS_NONNULLFUNCTION_ERR             (___ERR_BASE+(101<<7))
7126#define ___CTOS_BOOL_ERR                        (___ERR_BASE+(102<<7))
7127#define ___CTOS_CHARSTRING_ERR                  (___ERR_BASE+(103<<7))
7128#define ___CTOS_NONNULLCHARSTRING_ERR           (___ERR_BASE+(104<<7))
7129#define ___CTOS_NONNULLCHARSTRINGLIST_ERR       (___ERR_BASE+(105<<7))
7130#define ___CTOS_ISO_8859_1STRING_ERR            (___ERR_BASE+(106<<7))
7131#define ___CTOS_NONNULLISO_8859_1STRING_ERR     (___ERR_BASE+(107<<7))
7132#define ___CTOS_NONNULLISO_8859_1STRINGLIST_ERR (___ERR_BASE+(108<<7))
7133#define ___CTOS_UTF_8STRING_ERR                 (___ERR_BASE+(109<<7))
7134#define ___CTOS_NONNULLUTF_8STRING_ERR          (___ERR_BASE+(110<<7))
7135#define ___CTOS_NONNULLUTF_8STRINGLIST_ERR      (___ERR_BASE+(111<<7))
7136#define ___CTOS_UTF_16STRING_ERR                (___ERR_BASE+(112<<7))
7137#define ___CTOS_NONNULLUTF_16STRING_ERR         (___ERR_BASE+(113<<7))
7138#define ___CTOS_NONNULLUTF_16STRINGLIST_ERR     (___ERR_BASE+(114<<7))
7139#define ___CTOS_UCS_2STRING_ERR                 (___ERR_BASE+(115<<7))
7140#define ___CTOS_NONNULLUCS_2STRING_ERR          (___ERR_BASE+(116<<7))
7141#define ___CTOS_NONNULLUCS_2STRINGLIST_ERR      (___ERR_BASE+(117<<7))
7142#define ___CTOS_UCS_4STRING_ERR                 (___ERR_BASE+(118<<7))
7143#define ___CTOS_NONNULLUCS_4STRING_ERR          (___ERR_BASE+(119<<7))
7144#define ___CTOS_NONNULLUCS_4STRINGLIST_ERR      (___ERR_BASE+(120<<7))
7145#define ___CTOS_WCHARSTRING_ERR                 (___ERR_BASE+(121<<7))
7146#define ___CTOS_NONNULLWCHARSTRING_ERR          (___ERR_BASE+(122<<7))
7147#define ___CTOS_NONNULLWCHARSTRINGLIST_ERR      (___ERR_BASE+(123<<7))
7148#define ___CTOS_VARIANT_ERR                     (___ERR_BASE+(124<<7))
7149#define ___CTOS_HEAP_OVERFLOW_ERR               (___ERR_BASE+(125<<7))
7150#define ___CTOS_MAX                             (___ERR_BASE+(126<<7)-1)
7151
7152#define ___RETURN_POS 127
7153
7154
7155#define ___TLS_ERR(tls_err) \
7156((tls_err)==SSL_ERROR_NONE?___NO_ERR:___ERR_CODE_BUILD(___ERR_CODE_FACILITY_TLS,tls_err))
7157
7158#define ___TLS_ERR_FROM_ERR_CODE(err) \
7159((err)==___NO_ERR?0:((err)-___ERR_CODE_BUILD(___ERR_CODE_FACILITY_TLS,0)))
7160
7161#define ___TLS_ERR_BASE ___ERR_CODE_BUILD(___ERR_CODE_FACILITY_TLS,0)
7162
7163/* Custom high-level TLS error codes are encoded above 65000 */
7164#define ___TLS_LIBRARY_VERSION_ERR              (___TLS_ERR_BASE+65000)
7165#define ___TLS_LIBRARY_INIT_ERR                 (___TLS_ERR_BASE+65001)
7166#define ___TLS_WRONG_TLS_VERSION_ERR            (___TLS_ERR_BASE+65002)
7167#define ___TLS_ALERT_ERR                        (___TLS_ERR_BASE+65003)
7168#define ___TLS_NOT_ENOUGH_ENTROPY_ERR           (___TLS_ERR_BASE+65004)
7169#define ___TLS_SERVER_CONTEXT_EXPECTED_ERR      (___TLS_ERR_BASE+65005)
7170#define ___TLS_UNSUPPORTED_EMPTY_FRAGS_ERR      (___TLS_ERR_BASE+65006)
7171#define ___TLS_UNSUPPORTED_DH_ERR               (___TLS_ERR_BASE+65007)
7172#define ___TLS_UNSUPPORTED_ELLIPTIC_CURVES_ERR  (___TLS_ERR_BASE+65008)
7173#define ___TLS_DH_PARAMS_ERR                    (___TLS_ERR_BASE+65009)
7174#define ___TLS_READ_DH_PARAMS_ERR               (___TLS_ERR_BASE+65010)
7175#define ___TLS_ELLIPTIC_CURVE_ERR               (___TLS_ERR_BASE+65011)
7176#define ___TLS_UNKNOWN_ELLIPTIC_CURVE_ERR       (___TLS_ERR_BASE+65012)
7177#define ___TLS_READ_CA_FILE_ERR                 (___TLS_ERR_BASE+65013)
7178#define ___TLS_CERTIFICATE_FILE_ERR             (___TLS_ERR_BASE+65014)
7179#define ___TLS_PRIVATE_KEY_FILE_ERR             (___TLS_ERR_BASE+65015)
7180#define ___TLS_PRIVATE_KEY_CERT_MISMATCH_ERR    (___TLS_ERR_BASE+65016)
7181
7182
7183
7184/*---------------------------------------------------------------------------*/
7185
7186#define ___USE_RC_ALLOCATION_FOR_FOREIGN
7187
7188#ifdef ___USE_RC_ALLOCATION_FOR_FOREIGN
7189
7190#define ___CPLUSPLUS_ASSIGN_NEW(var,type) \
7191do { \
7192     void *___ptr = ___EXT(___alloc_rc) (___PSP sizeof (type)); \
7193     if (___ptr == 0) \
7194       var = 0; \
7195     else \
7196       var = new (___ptr) type; \
7197   } while (0)
7198#define ___CPLUSPLUS_ASSIGN_NEW_WITH_INIT(var,type,init) \
7199do { \
7200     void *___ptr = ___EXT(___alloc_rc) (___PSP sizeof (type)); \
7201     if (___ptr == 0) \
7202       var = 0; \
7203     else \
7204       var = new (___ptr) type (init); \
7205   } while (0)
7206#define ___CPLUSPLUS_DELETE_STRUCT(name,ptr) \
7207do { \
7208     ___EXT(___release_rc) (ptr); \
7209   } while (0)
7210#define ___CPLUSPLUS_DELETE_UNION(name,ptr) \
7211do { \
7212     ___EXT(___release_rc) (ptr); \
7213   } while (0)
7214#define ___CPLUSPLUS_DELETE_TYPE(name,ptr) \
7215do { \
7216     ___CAST(name*,ptr)->~name (); \
7217     ___EXT(___release_rc) (ptr); \
7218   } while (0)
7219
7220#define ___C_ASSIGN_NEW(var,type) \
7221do { \
7222     var = ___CAST(type*,___EXT(___alloc_rc) (___PSP sizeof (type))); \
7223   } while (0)
7224#define ___C_ASSIGN_NEW_WITH_INIT(var,type,init) \
7225do { \
7226     if ((var = ___CAST(type*,___EXT(___alloc_rc) (___PSP sizeof (type)))) != 0) \
7227       *___CAST(type*,var) = init; \
7228   } while (0)
7229#define ___C_DELETE_STRUCT(name,ptr) \
7230do { \
7231     ___EXT(___release_rc) (ptr); \
7232   } while (0)
7233#define ___C_DELETE_UNION(name,ptr) \
7234do { \
7235     ___EXT(___release_rc) (ptr); \
7236   } while (0)
7237#define ___C_DELETE_TYPE(name,ptr) \
7238do { \
7239     ___EXT(___release_rc) (ptr); \
7240   } while (0)
7241
7242#else
7243
7244#define ___CPLUSPLUS_ASSIGN_NEW(var,type) \
7245do { \
7246     try { var = new type; } catch (std::bad_alloc) { var = 0; } \
7247   } while (0)
7248#define ___CPLUSPLUS_ASSIGN_NEW_WITH_INIT(var,type,init) \
7249do { \
7250     try { var = new type (init); } catch (std::bad_alloc) { var = 0; } \
7251   } while (0)
7252#define ___CPLUSPLUS_DELETE_STRUCT(name,ptr) \
7253do { \
7254     delete ___CAST(struct name*,ptr); \
7255   } while (0)
7256#define ___CPLUSPLUS_DELETE_UNION(name,ptr) \
7257do { \
7258     delete ___CAST(union name*,ptr); \
7259   } while (0)
7260#define ___CPLUSPLUS_DELETE_TYPE(name,ptr) \
7261do { \
7262     delete ___CAST(name*,ptr); \
7263   } while (0)
7264
7265#define ___C_ASSIGN_NEW(var,type) \
7266do { \
7267     var = ___CAST(type*,___ALLOC_MEM(sizeof (type))); \
7268   } while (0)
7269#define ___C_ASSIGN_NEW_WITH_INIT(var,type,init) \
7270do { \
7271     if ((var = ___CAST(type*,___ALLOC_MEM(sizeof (type)))) != 0) \
7272       *___CAST(type*,var) = init; \
7273   } while (0)
7274#define ___C_DELETE_STRUCT(name,ptr) \
7275do { \
7276     ___FREE_MEM(ptr); \
7277   } while (0)
7278#define ___C_DELETE_UNION(name,ptr) \
7279do { \
7280     ___FREE_MEM(ptr); \
7281   } while (0)
7282#define ___C_DELETE_TYPE(name,ptr) \
7283do { \
7284     ___FREE_MEM(ptr); \
7285   } while (0)
7286
7287#endif
7288
7289#ifdef ___USE_CPLUSPLUS_NEW_DELETE
7290
7291#define ___ASSIGN_NEW(var,type) \
7292___CPLUSPLUS_ASSIGN_NEW(var,type)
7293#define ___ASSIGN_NEW_WITH_INIT(var,type,init) \
7294___CPLUSPLUS_ASSIGN_NEW_WITH_INIT(var,type,init)
7295#define ___DELETE_STRUCT(name,ptr) ___CPLUSPLUS_DELETE_STRUCT(name,ptr)
7296#define ___DELETE_UNION(name,ptr) ___CPLUSPLUS_DELETE_UNION(name,ptr)
7297#define ___DELETE_TYPE(name,ptr) ___CPLUSPLUS_DELETE_TYPE(name,ptr)
7298
7299#else
7300
7301#define ___ASSIGN_NEW(var,type) \
7302___C_ASSIGN_NEW(var,type)
7303#define ___ASSIGN_NEW_WITH_INIT(var,type,init) \
7304___C_ASSIGN_NEW_WITH_INIT(var,type,init)
7305#define ___DELETE_STRUCT(name,ptr) ___C_DELETE_STRUCT(name,ptr)
7306#define ___DELETE_UNION(name,ptr) ___C_DELETE_UNION(name,ptr)
7307#define ___DELETE_TYPE(name,ptr) ___C_DELETE_TYPE(name,ptr)
7308
7309#endif
7310
7311#ifdef ___USE_CPLUSPLUS_CLEANUP
7312
7313#define ___BEGIN_CLEANUP(cleanup) \
7314{ struct ___cleanup { ~___cleanup () { cleanup; } } ___cleanup_object;
7315#define ___END_CLEANUP(cleanup) \
7316}
7317
7318#else
7319
7320#define ___BEGIN_CLEANUP(cleanup) \
7321{
7322#define ___END_CLEANUP(cleanup) \
7323cleanup; }
7324
7325#endif
7326
7327#ifdef ___USE_SETJMP
7328
7329#define ___BEGIN_TRY \
7330{ ___jmpbuf_struct ___jbuf, *___old_catcher = ___ps->catcher; \
7331___ps->catcher = &___jbuf; ___err = ___SETJMP(___jbuf.buf); \
7332if (___err==___FIX(___NO_ERR)) {
7333#define ___END_TRY } ___ps->catcher = ___old_catcher; }
7334#define ___THROW(e)___LONGJMP(___ps->catcher->buf, e)
7335#define ___ON_THROW(stat1,stat2) \
7336___ON_THROW_AUX(___processor_state ___ps=___PSTATE;,stat1,stat2)
7337
7338#else
7339
7340#define ___BEGIN_TRY { ___err = ___FIX(___NO_ERR); try {
7341#define ___END_TRY } catch (___throw_struct ts) { ___err = ts.err; } }
7342#define ___THROW(e)do { ___throw_struct ts; ts.err = e; throw (ts); } while (0)
7343#define ___ON_THROW(stat1,stat2) \
7344___ON_THROW_AUX(,stat1,stat2)
7345
7346#endif
7347
7348#define ___ON_THROW_AUX(decl,stat1,stat2) \
7349do { \
7350     ___SCMOBJ ___err; decl \
7351     ___BEGIN_TRY stat1; ___END_TRY \
7352     if (___err != ___FIX(___NO_ERR)) stat2; \
7353   } while (0)
7354
7355#define ___RELEASE_POINTER ___EXT(___release_pointer)
7356
7357#define ___DEF_RELEASE_FN_STRUCT(name,id) \
7358___HIDDEN ___SCMOBJ id \
7359   ___P((void *___x), \
7360        (___x) \
7361void *___x;) \
7362{ ___DELETE_STRUCT(name,___x); return ___FIX(___NO_ERR); }
7363
7364#define ___DEF_RELEASE_FN_UNION(name,id) \
7365___HIDDEN ___SCMOBJ id \
7366   ___P((void *___x), \
7367        (___x) \
7368void *___x;) \
7369{ ___DELETE_UNION(name,___x); return ___FIX(___NO_ERR); }
7370
7371#define ___DEF_RELEASE_FN_TYPE(name,id) \
7372___HIDDEN ___SCMOBJ id \
7373   ___P((void *___x), \
7374        (___x) \
7375void *___x;) \
7376{ ___DELETE_TYPE(name,___x); return ___FIX(___NO_ERR); }
7377
7378#define ___CFUN_CONV_ERROR if ((___err!=___FIX(___NO_ERR))&&(___err!=___FIX(___UNWIND_C_STACK))) {___ps->temp1=___err;___ps->temp2=___errmsg;___ps->temp3=___LBL(0);___JUMPEXTPRM(___SET_NARGS(___NARGS),___ps->handler_cfun_conv_error;)}
7379
7380#define ___STOC3(f,s,c,i)___err=___EXT(f)(___PSP s,c,i)
7381#define ___STOC4(f,s,c,t,i)___err=___EXT(f)(___PSP s,c,t,i)
7382#define ___CTOS3(f,c,s,i)___err=___EXT(f)(___ps,c,s,i)
7383#define ___CTOS5(f,c,t,r,s,i)___err=___EXT(f)(___ps,c,t,r,s,i)
7384#define ___IF_STOC3(f,s,c,i)if ((___STOC3(f,s,c,i))==___FIX(___NO_ERR))
7385#define ___IF_STOC4(f,s,c,t,i)if ((___STOC4(f,s,c,t,i))==___FIX(___NO_ERR))
7386#define ___IF_CTOS3(f,c,s,i)if ((___CTOS3(f,c,s,i))==___FIX(___NO_ERR))
7387#define ___IF_CTOS5(f,c,t,r,s,i)if ((___CTOS5(f,c,t,r,s,i))==___FIX(___NO_ERR))
7388
7389#define ___BEGIN_SFUN_BODY
7390#define ___END_SFUN_BODY
7391
7392#define ___BEGIN_SFUN_VOID(proc) ___processor_state ___ps=___PSTATE;___SCMOBJ ___marker;___SCMOBJ ___err;___SCMOBJ ___errmsg=___FAL;if ((___err=___EXT(___make_sfun_stack_marker) (___ps,&___marker,proc))==___FIX(___NO_ERR)) {
7393#define ___SFUN_CALL_VOID ___err=___EXT(___call) (___PSP ___NARGS,___FIELD(___marker,0),___marker);
7394#define ___SFUN_SET_RESULT_VOID /* no result to set */
7395#define ___SFUN_ERROR_VOID while ((___err!=___FIX(___NO_ERR))&&(___err!=___FIX(___UNWIND_C_STACK))) {___ps->temp1=___err;___ps->temp2=___errmsg;___ps->temp3=___marker;___err=___EXT(___call) (___PSP 0,___ps->handler_sfun_conv_error,___marker);
7396#define ___END_SFUN_VOID } ___EXT(___kill_sfun_stack_marker) (___marker); } ___EXT(___propagate_error) (___PSP ___err);
7397
7398#define ___BEGIN_SFUN_SCMOBJ(proc) ___processor_state ___ps=___PSTATE;___SCMOBJ ___marker;___SCMOBJ ___result;___SCMOBJ ___err;___SCMOBJ ___errmsg=___FAL;if ((___err=___EXT(___make_sfun_stack_marker) (___ps,&___marker,proc))==___FIX(___NO_ERR)) {
7399#define ___SFUN_CALL_SCMOBJ ___err=___EXT(___call) (___PSP ___NARGS,___FIELD(___marker,0),___marker);
7400#define ___SFUN_SET_RESULT_SCMOBJ ___result = ___SFUN_RESULT;
7401#define ___SFUN_ERROR_SCMOBJ while ((___err!=___FIX(___NO_ERR))&&(___err!=___FIX(___UNWIND_C_STACK))) {___ps->temp1=___err;___ps->temp2=___errmsg;___ps->temp3=___marker;___err=___EXT(___call) (___PSP 0,___ps->handler_sfun_conv_error,___marker);
7402#define ___END_SFUN_SCMOBJ } ___EXT(___kill_sfun_stack_marker) (___marker); } ___EXT(___propagate_error) (___PSP ___err);
7403
7404#define ___BEGIN_SFUN(proc,decl)___processor_state ___ps=___PSTATE;___SCMOBJ ___marker;decl;___SCMOBJ ___err;___SCMOBJ ___errmsg=___FAL;if ((___err=___EXT(___make_sfun_stack_marker) (___ps,&___marker,proc))==___FIX(___NO_ERR)) {
7405#define ___SFUN_CALL if ((___err=___EXT(___call) (___PSP ___NARGS,___FIELD(___marker,0),___marker))==___FIX(___NO_ERR))
7406#define ___SFUN_SET_RESULT /* done in conversion function */
7407#define ___SFUN_ERROR while ((___err!=___FIX(___NO_ERR))&&(___err!=___FIX(___UNWIND_C_STACK))) {___ps->temp1=___err;___ps->temp2=___errmsg;___ps->temp3=___marker;if ((___err=___EXT(___call) (___PSP 0,___ps->handler_sfun_conv_error,___marker))==___FIX(___NO_ERR))
7408#define ___END_SFUN } ___EXT(___kill_sfun_stack_marker) (___marker); } ___EXT(___propagate_error) (___PSP ___err);
7409
7410#define ___BEGIN_SFUN_ARG(i,arg)___SCMOBJ arg;
7411#define ___END_SFUN_ARG(i)
7412#define ___BEGIN_SFUN_ARG_SCMOBJ(i)
7413#define ___END_SFUN_ARG_SCMOBJ(i)
7414#define ___SFUN_ARG(i,arg)___PSSTK(___FRAME_SPACE(2)+i)=arg;
7415#define ___SFUN_RESULT ___PSR1
7416
7417#define ___BEGIN_SFUN_SCMOBJ_TO_S8(s,c)___STOC3(___SCMOBJ_to_S8,s,&c,___RETURN_POS);
7418#define ___END_SFUN_SCMOBJ_TO_S8(s,c)
7419#define ___BEGIN_SFUN_SCMOBJ_TO_U8(s,c)___STOC3(___SCMOBJ_to_U8,s,&c,___RETURN_POS);
7420#define ___END_SFUN_SCMOBJ_TO_U8(s,c)
7421#define ___BEGIN_SFUN_SCMOBJ_TO_S16(s,c)___STOC3(___SCMOBJ_to_S16,s,&c,___RETURN_POS);
7422#define ___END_SFUN_SCMOBJ_TO_S16(s,c)
7423#define ___BEGIN_SFUN_SCMOBJ_TO_U16(s,c)___STOC3(___SCMOBJ_to_U16,s,&c,___RETURN_POS);
7424#define ___END_SFUN_SCMOBJ_TO_U16(s,c)
7425#define ___BEGIN_SFUN_SCMOBJ_TO_S32(s,c)___STOC3(___SCMOBJ_to_S32,s,&c,___RETURN_POS);
7426#define ___END_SFUN_SCMOBJ_TO_S32(s,c)
7427#define ___BEGIN_SFUN_SCMOBJ_TO_U32(s,c)___STOC3(___SCMOBJ_to_U32,s,&c,___RETURN_POS);
7428#define ___END_SFUN_SCMOBJ_TO_U32(s,c)
7429#define ___BEGIN_SFUN_SCMOBJ_TO_S64(s,c)___STOC3(___SCMOBJ_to_S64,s,&c,___RETURN_POS);
7430#define ___END_SFUN_SCMOBJ_TO_S64(s,c)
7431#define ___BEGIN_SFUN_SCMOBJ_TO_U64(s,c)___STOC3(___SCMOBJ_to_U64,s,&c,___RETURN_POS);
7432#define ___END_SFUN_SCMOBJ_TO_U64(s,c)
7433#define ___BEGIN_SFUN_SCMOBJ_TO_F32(s,c)___STOC3(___SCMOBJ_to_F32,s,&c,___RETURN_POS);
7434#define ___END_SFUN_SCMOBJ_TO_F32(s,c)
7435#define ___BEGIN_SFUN_SCMOBJ_TO_F64(s,c)___STOC3(___SCMOBJ_to_F64,s,&c,___RETURN_POS);
7436#define ___END_SFUN_SCMOBJ_TO_F64(s,c)
7437#define ___BEGIN_SFUN_SCMOBJ_TO_CHAR(s,c)___STOC3(___SCMOBJ_to_CHAR,s,&c,___RETURN_POS);
7438#define ___END_SFUN_SCMOBJ_TO_CHAR(s,c)
7439#define ___BEGIN_SFUN_SCMOBJ_TO_SCHAR(s,c)___STOC3(___SCMOBJ_to_SCHAR,s,&c,___RETURN_POS);
7440#define ___END_SFUN_SCMOBJ_TO_SCHAR(s,c)
7441#define ___BEGIN_SFUN_SCMOBJ_TO_UCHAR(s,c)___STOC3(___SCMOBJ_to_UCHAR,s,&c,___RETURN_POS);
7442#define ___END_SFUN_SCMOBJ_TO_UCHAR(s,c)
7443#define ___BEGIN_SFUN_SCMOBJ_TO_ISO_8859_1(s,c)___STOC3(___SCMOBJ_to_ISO_8859_1,s,&c,___RETURN_POS);
7444#define ___END_SFUN_SCMOBJ_TO_ISO_8859_1(s,c)
7445#define ___BEGIN_SFUN_SCMOBJ_TO_UCS_2(s,c)___STOC3(___SCMOBJ_to_UCS_2,s,&c,___RETURN_POS);
7446#define ___END_SFUN_SCMOBJ_TO_UCS_2(s,c)
7447#define ___BEGIN_SFUN_SCMOBJ_TO_UCS_4(s,c)___STOC3(___SCMOBJ_to_UCS_4,s,&c,___RETURN_POS);
7448#define ___END_SFUN_SCMOBJ_TO_UCS_4(s,c)
7449#define ___BEGIN_SFUN_SCMOBJ_TO_WCHAR(s,c)___STOC3(___SCMOBJ_to_WCHAR,s,&c,___RETURN_POS);
7450#define ___END_SFUN_SCMOBJ_TO_WCHAR(s,c)
7451#define ___BEGIN_SFUN_SCMOBJ_TO_SIZE_T(s,c)___STOC3(___SCMOBJ_to_SIZE_T,s,&c,___RETURN_POS);
7452#define ___END_SFUN_SCMOBJ_TO_SIZE_T(s,c)
7453#define ___BEGIN_SFUN_SCMOBJ_TO_SSIZE_T(s,c)___STOC3(___SCMOBJ_to_SSIZE_T,s,&c,___RETURN_POS);
7454#define ___END_SFUN_SCMOBJ_TO_SSIZE_T(s,c)
7455#define ___BEGIN_SFUN_SCMOBJ_TO_PTRDIFF_T(s,c)___STOC3(___SCMOBJ_to_PTRDIFF_T,s,&c,___RETURN_POS);
7456#define ___END_SFUN_SCMOBJ_TO_PTRDIFF_T(s,c)
7457#define ___BEGIN_SFUN_SCMOBJ_TO_SHORT(s,c)___STOC3(___SCMOBJ_to_SHORT,s,&c,___RETURN_POS);
7458#define ___END_SFUN_SCMOBJ_TO_SHORT(s,c)
7459#define ___BEGIN_SFUN_SCMOBJ_TO_USHORT(s,c)___STOC3(___SCMOBJ_to_USHORT,s,&c,___RETURN_POS);
7460#define ___END_SFUN_SCMOBJ_TO_USHORT(s,c)
7461#define ___BEGIN_SFUN_SCMOBJ_TO_INT(s,c)___STOC3(___SCMOBJ_to_INT,s,&c,___RETURN_POS);
7462#define ___END_SFUN_SCMOBJ_TO_INT(s,c)
7463#define ___BEGIN_SFUN_SCMOBJ_TO_UINT(s,c)___STOC3(___SCMOBJ_to_UINT,s,&c,___RETURN_POS);
7464#define ___END_SFUN_SCMOBJ_TO_UINT(s,c)
7465#define ___BEGIN_SFUN_SCMOBJ_TO_LONG(s,c)___STOC3(___SCMOBJ_to_LONG,s,&c,___RETURN_POS);
7466#define ___END_SFUN_SCMOBJ_TO_LONG(s,c)
7467#define ___BEGIN_SFUN_SCMOBJ_TO_ULONG(s,c)___STOC3(___SCMOBJ_to_ULONG,s,&c,___RETURN_POS);
7468#define ___END_SFUN_SCMOBJ_TO_ULONG(s,c)
7469#define ___BEGIN_SFUN_SCMOBJ_TO_FLOAT(s,c)___STOC3(___SCMOBJ_to_FLOAT,s,&c,___RETURN_POS);
7470#define ___END_SFUN_SCMOBJ_TO_FLOAT(s,c)
7471#define ___BEGIN_SFUN_SCMOBJ_TO_DOUBLE(s,c)___STOC3(___SCMOBJ_to_DOUBLE,s,&c,___RETURN_POS);
7472#define ___END_SFUN_SCMOBJ_TO_DOUBLE(s,c)
7473#define ___BEGIN_SFUN_SCMOBJ_TO_STRUCT(n,s,c,t)___STOC4(___SCMOBJ_to_STRUCT,s,&c,t,___RETURN_POS);
7474#define ___END_SFUN_SCMOBJ_TO_STRUCT(n,s,c,t)
7475#define ___BEGIN_SFUN_SCMOBJ_TO_UNION(n,s,c,t)___STOC4(___SCMOBJ_to_UNION,s,&c,t,___RETURN_POS);
7476#define ___END_SFUN_SCMOBJ_TO_UNION(n,s,c,t)
7477#define ___BEGIN_SFUN_SCMOBJ_TO_TYPE(n,s,c,t)___STOC4(___SCMOBJ_to_TYPE,s,&c,t,___RETURN_POS);
7478#define ___END_SFUN_SCMOBJ_TO_TYPE(n,s,c,t)
7479#define ___BEGIN_SFUN_SCMOBJ_TO_POINTER(s,c,t)___STOC4(___SCMOBJ_to_POINTER,s,&c,t,___RETURN_POS);
7480#define ___END_SFUN_SCMOBJ_TO_POINTER(s,c,t)
7481#define ___BEGIN_SFUN_SCMOBJ_TO_NONNULLPOINTER(s,c,t)___STOC4(___SCMOBJ_to_NONNULLPOINTER,s,&c,t,___RETURN_POS);
7482#define ___END_SFUN_SCMOBJ_TO_NONNULLPOINTER(s,c,t)
7483#define ___BEGIN_SFUN_SCMOBJ_TO_FUNCTION(s,cnv,c)___STOC4(___SCMOBJ_to_FUNCTION,s,___CAST(void*,cnv),&c,___RETURN_POS);
7484#define ___END_SFUN_SCMOBJ_TO_FUNCTION(s,cnv,c)
7485#define ___BEGIN_SFUN_SCMOBJ_TO_NONNULLFUNCTION(s,cnv,c)___STOC4(___SCMOBJ_to_NONNULLFUNCTION,s,___CAST(void*,cnv),&c,___RETURN_POS);
7486#define ___END_SFUN_SCMOBJ_TO_NONNULLFUNCTION(s,cnv,c)
7487#define ___BEGIN_SFUN_SCMOBJ_TO_BOOL(s,c)___STOC3(___SCMOBJ_to_BOOL,s,&c,___RETURN_POS);
7488#define ___END_SFUN_SCMOBJ_TO_BOOL(s,c)
7489#define ___BEGIN_SFUN_SCMOBJ_TO_CHARSTRING(s,c)___STOC3(___SCMOBJ_to_CHARSTRING,s,&c,___RETURN_POS);
7490#define ___END_SFUN_SCMOBJ_TO_CHARSTRING(s,c)
7491#define ___BEGIN_SFUN_SCMOBJ_TO_NONNULLCHARSTRING(s,c)___STOC3(___SCMOBJ_to_NONNULLCHARSTRING,s,&c,___RETURN_POS);
7492#define ___END_SFUN_SCMOBJ_TO_NONNULLCHARSTRING(s,c)
7493#define ___BEGIN_SFUN_SCMOBJ_TO_NONNULLCHARSTRINGLIST(s,c)___STOC3(___SCMOBJ_to_NONNULLCHARSTRINGLIST,s,&c,___RETURN_POS);
7494#define ___END_SFUN_SCMOBJ_TO_NONNULLCHARSTRINGLIST(s,c)
7495#define ___BEGIN_SFUN_SCMOBJ_TO_ISO_8859_1STRING(s,c)___STOC3(___SCMOBJ_to_ISO_8859_1STRING,s,&c,___RETURN_POS);
7496#define ___END_SFUN_SCMOBJ_TO_ISO_8859_1STRING(s,c)
7497#define ___BEGIN_SFUN_SCMOBJ_TO_NONNULLISO_8859_1STRING(s,c)___STOC3(___SCMOBJ_to_NONNULLISO_8859_1STRING,s,&c,___RETURN_POS);
7498#define ___END_SFUN_SCMOBJ_TO_NONNULLISO_8859_1STRING(s,c)
7499#define ___BEGIN_SFUN_SCMOBJ_TO_NONNULLISO_8859_1STRINGLIST(s,c)___STOC3(___SCMOBJ_to_NONNULLISO_8859_1STRINGLIST,s,&c,___RETURN_POS);
7500#define ___END_SFUN_SCMOBJ_TO_NONNULLISO_8859_1STRINGLIST(s,c)
7501#define ___BEGIN_SFUN_SCMOBJ_TO_UTF_8STRING(s,c)___STOC3(___SCMOBJ_to_UTF_8STRING,s,&c,___RETURN_POS);
7502#define ___END_SFUN_SCMOBJ_TO_UTF_8STRING(s,c)
7503#define ___BEGIN_SFUN_SCMOBJ_TO_NONNULLUTF_8STRING(s,c)___STOC3(___SCMOBJ_to_NONNULLUTF_8STRING,s,&c,___RETURN_POS);
7504#define ___END_SFUN_SCMOBJ_TO_NONNULLUTF_8STRING(s,c)
7505#define ___BEGIN_SFUN_SCMOBJ_TO_NONNULLUTF_8STRINGLIST(s,c)___STOC3(___SCMOBJ_to_NONNULLUTF_8STRINGLIST,s,&c,___RETURN_POS);
7506#define ___END_SFUN_SCMOBJ_TO_NONNULLUTF_8STRINGLIST(s,c)
7507#define ___BEGIN_SFUN_SCMOBJ_TO_UTF_16STRING(s,c)___STOC3(___SCMOBJ_to_UTF_16STRING,s,&c,___RETURN_POS);
7508#define ___END_SFUN_SCMOBJ_TO_UTF_16STRING(s,c)
7509#define ___BEGIN_SFUN_SCMOBJ_TO_NONNULLUTF_16STRING(s,c)___STOC3(___SCMOBJ_to_NONNULLUTF_16STRING,s,&c,___RETURN_POS);
7510#define ___END_SFUN_SCMOBJ_TO_NONNULLUTF_16STRING(s,c)
7511#define ___BEGIN_SFUN_SCMOBJ_TO_NONNULLUTF_16STRINGLIST(s,c)___STOC3(___SCMOBJ_to_NONNULLUTF_16STRINGLIST,s,&c,___RETURN_POS);
7512#define ___END_SFUN_SCMOBJ_TO_NONNULLUTF_16STRINGLIST(s,c)
7513#define ___BEGIN_SFUN_SCMOBJ_TO_UCS_2STRING(s,c)___STOC3(___SCMOBJ_to_UCS_2STRING,s,&c,___RETURN_POS);
7514#define ___END_SFUN_SCMOBJ_TO_UCS_2STRING(s,c)
7515#define ___BEGIN_SFUN_SCMOBJ_TO_NONNULLUCS_2STRING(s,c)___STOC3(___SCMOBJ_to_NONNULLUCS_2STRING,s,&c,___RETURN_POS);
7516#define ___END_SFUN_SCMOBJ_TO_NONNULLUCS_2STRING(s,c)
7517#define ___BEGIN_SFUN_SCMOBJ_TO_NONNULLUCS_2STRINGLIST(s,c)___STOC3(___SCMOBJ_to_NONNULLUCS_2STRINGLIST,s,&c,___RETURN_POS);
7518#define ___END_SFUN_SCMOBJ_TO_NONNULLUCS_2STRINGLIST(s,c)
7519#define ___BEGIN_SFUN_SCMOBJ_TO_UCS_4STRING(s,c)___STOC3(___SCMOBJ_to_UCS_4STRING,s,&c,___RETURN_POS);
7520#define ___END_SFUN_SCMOBJ_TO_UCS_4STRING(s,c)
7521#define ___BEGIN_SFUN_SCMOBJ_TO_NONNULLUCS_4STRING(s,c)___STOC3(___SCMOBJ_to_NONNULLUCS_4STRING,s,&c,___RETURN_POS);
7522#define ___END_SFUN_SCMOBJ_TO_NONNULLUCS_4STRING(s,c)
7523#define ___BEGIN_SFUN_SCMOBJ_TO_NONNULLUCS_4STRINGLIST(s,c)___STOC3(___SCMOBJ_to_NONNULLUCS_4STRINGLIST,s,&c,___RETURN_POS);
7524#define ___END_SFUN_SCMOBJ_TO_NONNULLUCS_4STRINGLIST(s,c)
7525#define ___BEGIN_SFUN_SCMOBJ_TO_WCHARSTRING(s,c)___STOC3(___SCMOBJ_to_WCHARSTRING,s,&c,___RETURN_POS);
7526#define ___END_SFUN_SCMOBJ_TO_WCHARSTRING(s,c)
7527#define ___BEGIN_SFUN_SCMOBJ_TO_NONNULLWCHARSTRING(s,c)___STOC3(___SCMOBJ_to_NONNULLWCHARSTRING,s,&c,___RETURN_POS);
7528#define ___END_SFUN_SCMOBJ_TO_NONNULLWCHARSTRING(s,c)
7529#define ___BEGIN_SFUN_SCMOBJ_TO_NONNULLWCHARSTRINGLIST(s,c)___STOC3(___SCMOBJ_to_NONNULLWCHARSTRINGLIST,s,&c,___RETURN_POS);
7530#define ___END_SFUN_SCMOBJ_TO_NONNULLWCHARSTRINGLIST(s,c)
7531#define ___BEGIN_SFUN_SCMOBJ_TO_VARIANT(s,c)___STOC3(___SCMOBJ_to_VARIANT,s,&c,___RETURN_POS);
7532#define ___END_SFUN_SCMOBJ_TO_VARIANT(s,c)
7533
7534#define ___BEGIN_SFUN_S8_TO_SCMOBJ(c,s,i)___IF_CTOS3(___S8_to_SCMOBJ,c,&s,i){
7535#define ___END_SFUN_S8_TO_SCMOBJ(c,s,i)}
7536#define ___BEGIN_SFUN_U8_TO_SCMOBJ(c,s,i)___IF_CTOS3(___U8_to_SCMOBJ,c,&s,i){
7537#define ___END_SFUN_U8_TO_SCMOBJ(c,s,i)}
7538#define ___BEGIN_SFUN_S16_TO_SCMOBJ(c,s,i)___IF_CTOS3(___S16_to_SCMOBJ,c,&s,i){
7539#define ___END_SFUN_S16_TO_SCMOBJ(c,s,i)}
7540#define ___BEGIN_SFUN_U16_TO_SCMOBJ(c,s,i)___IF_CTOS3(___U16_to_SCMOBJ,c,&s,i){
7541#define ___END_SFUN_U16_TO_SCMOBJ(c,s,i)}
7542#define ___BEGIN_SFUN_S32_TO_SCMOBJ(c,s,i)___IF_CTOS3(___S32_to_SCMOBJ,c,&s,i){
7543#define ___END_SFUN_S32_TO_SCMOBJ(c,s,i)___EXT(___release_scmobj)(s);}
7544#define ___BEGIN_SFUN_U32_TO_SCMOBJ(c,s,i)___IF_CTOS3(___U32_to_SCMOBJ,c,&s,i){
7545#define ___END_SFUN_U32_TO_SCMOBJ(c,s,i)___EXT(___release_scmobj)(s);}
7546#define ___BEGIN_SFUN_S64_TO_SCMOBJ(c,s,i)___IF_CTOS3(___S64_to_SCMOBJ,c,&s,i){
7547#define ___END_SFUN_S64_TO_SCMOBJ(c,s,i)___EXT(___release_scmobj)(s);}
7548#define ___BEGIN_SFUN_U64_TO_SCMOBJ(c,s,i)___IF_CTOS3(___U64_to_SCMOBJ,c,&s,i){
7549#define ___END_SFUN_U64_TO_SCMOBJ(c,s,i)___EXT(___release_scmobj)(s);}
7550#define ___BEGIN_SFUN_F32_TO_SCMOBJ(c,s,i)___IF_CTOS3(___F32_to_SCMOBJ,c,&s,i){
7551#define ___END_SFUN_F32_TO_SCMOBJ(c,s,i)___EXT(___release_scmobj)(s);}
7552#define ___BEGIN_SFUN_F64_TO_SCMOBJ(c,s,i)___IF_CTOS3(___F64_to_SCMOBJ,c,&s,i){
7553#define ___END_SFUN_F64_TO_SCMOBJ(c,s,i)___EXT(___release_scmobj)(s);}
7554#define ___BEGIN_SFUN_CHAR_TO_SCMOBJ(c,s,i)___IF_CTOS3(___CHAR_to_SCMOBJ,c,&s,i){
7555#define ___END_SFUN_CHAR_TO_SCMOBJ(c,s,i)}
7556#define ___BEGIN_SFUN_SCHAR_TO_SCMOBJ(c,s,i)___IF_CTOS3(___SCHAR_to_SCMOBJ,c,&s,i){
7557#define ___END_SFUN_SCHAR_TO_SCMOBJ(c,s,i)}
7558#define ___BEGIN_SFUN_UCHAR_TO_SCMOBJ(c,s,i)___IF_CTOS3(___UCHAR_to_SCMOBJ,c,&s,i){
7559#define ___END_SFUN_UCHAR_TO_SCMOBJ(c,s,i)}
7560#define ___BEGIN_SFUN_ISO_8859_1_TO_SCMOBJ(c,s,i)___IF_CTOS3(___ISO_8859_1_to_SCMOBJ,c,&s,i){
7561#define ___END_SFUN_ISO_8859_1_TO_SCMOBJ(c,s,i)}
7562#define ___BEGIN_SFUN_UCS_2_TO_SCMOBJ(c,s,i)___IF_CTOS3(___UCS_2_to_SCMOBJ,c,&s,i){
7563#define ___END_SFUN_UCS_2_TO_SCMOBJ(c,s,i)}
7564#define ___BEGIN_SFUN_UCS_4_TO_SCMOBJ(c,s,i)___IF_CTOS3(___UCS_4_to_SCMOBJ,c,&s,i){
7565#define ___END_SFUN_UCS_4_TO_SCMOBJ(c,s,i)}
7566#define ___BEGIN_SFUN_WCHAR_TO_SCMOBJ(c,s,i)___IF_CTOS3(___WCHAR_to_SCMOBJ,c,&s,i){
7567#define ___END_SFUN_WCHAR_TO_SCMOBJ(c,s,i)}
7568#define ___BEGIN_SFUN_SIZE_T_TO_SCMOBJ(c,s,i)___IF_CTOS3(___SIZE_T_to_SCMOBJ,c,&s,i){
7569#define ___END_SFUN_SIZE_T_TO_SCMOBJ(c,s,i)}
7570#define ___BEGIN_SFUN_SSIZE_T_TO_SCMOBJ(c,s,i)___IF_CTOS3(___SSIZE_T_to_SCMOBJ,c,&s,i){
7571#define ___END_SFUN_SSIZE_T_TO_SCMOBJ(c,s,i)}
7572#define ___BEGIN_SFUN_PTRDIFF_T_TO_SCMOBJ(c,s,i)___IF_CTOS3(___PTRDIFF_T_to_SCMOBJ,c,&s,i){
7573#define ___END_SFUN_PTRDIFF_T_TO_SCMOBJ(c,s,i)}
7574#define ___BEGIN_SFUN_SHORT_TO_SCMOBJ(c,s,i)___IF_CTOS3(___SHORT_to_SCMOBJ,c,&s,i){
7575#define ___END_SFUN_SHORT_TO_SCMOBJ(c,s,i)___EXT(___release_scmobj)(s);}
7576#define ___BEGIN_SFUN_USHORT_TO_SCMOBJ(c,s,i)___IF_CTOS3(___USHORT_to_SCMOBJ,c,&s,i){
7577#define ___END_SFUN_USHORT_TO_SCMOBJ(c,s,i)___EXT(___release_scmobj)(s);}
7578#define ___BEGIN_SFUN_INT_TO_SCMOBJ(c,s,i)___IF_CTOS3(___INT_to_SCMOBJ,c,&s,i){
7579#define ___END_SFUN_INT_TO_SCMOBJ(c,s,i)___EXT(___release_scmobj)(s);}
7580#define ___BEGIN_SFUN_UINT_TO_SCMOBJ(c,s,i)___IF_CTOS3(___UINT_to_SCMOBJ,c,&s,i){
7581#define ___END_SFUN_UINT_TO_SCMOBJ(c,s,i)___EXT(___release_scmobj)(s);}
7582#define ___BEGIN_SFUN_LONG_TO_SCMOBJ(c,s,i)___IF_CTOS3(___LONG_to_SCMOBJ,c,&s,i){
7583#define ___END_SFUN_LONG_TO_SCMOBJ(c,s,i)___EXT(___release_scmobj)(s);}
7584#define ___BEGIN_SFUN_ULONG_TO_SCMOBJ(c,s,i)___IF_CTOS3(___ULONG_to_SCMOBJ,c,&s,i){
7585#define ___END_SFUN_ULONG_TO_SCMOBJ(c,s,i)___EXT(___release_scmobj)(s);}
7586#define ___BEGIN_SFUN_FLOAT_TO_SCMOBJ(c,s,i)___IF_CTOS3(___FLOAT_to_SCMOBJ,c,&s,i){
7587#define ___END_SFUN_FLOAT_TO_SCMOBJ(c,s,i)___EXT(___release_scmobj)(s);}
7588#define ___BEGIN_SFUN_DOUBLE_TO_SCMOBJ(c,s,i)___IF_CTOS3(___DOUBLE_to_SCMOBJ,c,&s,i){
7589#define ___END_SFUN_DOUBLE_TO_SCMOBJ(c,s,i)___EXT(___release_scmobj)(s);}
7590#define ___BEGIN_SFUN_STRUCT_TO_SCMOBJ(n,c,t,r,s,i)___IF_CTOS5(___STRUCT_to_SCMOBJ,(void*)c,t,r,&s,i){
7591#define ___END_SFUN_STRUCT_TO_SCMOBJ(n,c,t,r,s,i)___EXT(___release_scmobj)(s);}
7592#define ___BEGIN_SFUN_UNION_TO_SCMOBJ(n,c,t,r,s,i)___IF_CTOS5(___UNION_to_SCMOBJ,(void*)c,t,r,&s,i){
7593#define ___END_SFUN_UNION_TO_SCMOBJ(n,c,t,r,s,i)___EXT(___release_scmobj)(s);}
7594#define ___BEGIN_SFUN_TYPE_TO_SCMOBJ(n,c,t,r,s,i)___IF_CTOS5(___TYPE_to_SCMOBJ,(void*)c,t,r,&s,i){
7595#define ___END_SFUN_TYPE_TO_SCMOBJ(n,c,t,r,s,i)___EXT(___release_scmobj)(s);}
7596#define ___BEGIN_SFUN_POINTER_TO_SCMOBJ(c,t,r,s,i)___IF_CTOS5(___POINTER_to_SCMOBJ,(void*)c,t,r,&s,i){
7597#define ___END_SFUN_POINTER_TO_SCMOBJ(c,t,r,s,i)___EXT(___release_scmobj)(s);}
7598#define ___BEGIN_SFUN_NONNULLPOINTER_TO_SCMOBJ(c,t,r,s,i)___IF_CTOS5(___NONNULLPOINTER_to_SCMOBJ,(void*)c,t,r,&s,i){
7599#define ___END_SFUN_NONNULLPOINTER_TO_SCMOBJ(c,t,r,s,i)___EXT(___release_scmobj)(s);}
7600#define ___BEGIN_SFUN_FUNCTION_TO_SCMOBJ(c,s,i)___IF_CTOS3(___FUNCTION_to_SCMOBJ,___CAST(void*,c),&s,i){
7601#define ___END_SFUN_FUNCTION_TO_SCMOBJ(c,s,i)___EXT(___release_scmobj)(s);}
7602#define ___BEGIN_SFUN_NONNULLFUNCTION_TO_SCMOBJ(c,s,i)___IF_CTOS3(___NONNULLFUNCTION_to_SCMOBJ,___CAST(void*,c),&s,i){
7603#define ___END_SFUN_NONNULLFUNCTION_TO_SCMOBJ(c,s,i)___EXT(___release_scmobj)(s);}
7604#define ___BEGIN_SFUN_BOOL_TO_SCMOBJ(c,s,i)___IF_CTOS3(___BOOL_to_SCMOBJ,c,&s,i){
7605#define ___END_SFUN_BOOL_TO_SCMOBJ(c,s,i)}
7606#define ___BEGIN_SFUN_CHARSTRING_TO_SCMOBJ(c,s,i)___IF_CTOS3(___CHARSTRING_to_SCMOBJ,c,&s,i){
7607#define ___END_SFUN_CHARSTRING_TO_SCMOBJ(c,s,i)___EXT(___release_scmobj)(s);}
7608#define ___BEGIN_SFUN_NONNULLCHARSTRING_TO_SCMOBJ(c,s,i)___IF_CTOS3(___NONNULLCHARSTRING_to_SCMOBJ,c,&s,i){
7609#define ___END_SFUN_NONNULLCHARSTRING_TO_SCMOBJ(c,s,i)___EXT(___release_scmobj)(s);}
7610#define ___BEGIN_SFUN_NONNULLCHARSTRINGLIST_TO_SCMOBJ(c,s,i)___IF_CTOS3(___NONNULLCHARSTRINGLIST_to_SCMOBJ,c,&s,i){
7611#define ___END_SFUN_NONNULLCHARSTRINGLIST_TO_SCMOBJ(c,s,i)___EXT(___release_scmobj)(s);}
7612#define ___BEGIN_SFUN_ISO_8859_1STRING_TO_SCMOBJ(c,s,i)___IF_CTOS3(___ISO_8859_1STRING_to_SCMOBJ,c,&s,i){
7613#define ___END_SFUN_ISO_8859_1STRING_TO_SCMOBJ(c,s,i)___EXT(___release_scmobj)(s);}
7614#define ___BEGIN_SFUN_NONNULLISO_8859_1STRING_TO_SCMOBJ(c,s,i)___IF_CTOS3(___NONNULLISO_8859_1STRING_to_SCMOBJ,c,&s,i){
7615#define ___END_SFUN_NONNULLISO_8859_1STRING_TO_SCMOBJ(c,s,i)___EXT(___release_scmobj)(s);}
7616#define ___BEGIN_SFUN_NONNULLISO_8859_1STRINGLIST_TO_SCMOBJ(c,s,i)___IF_CTOS3(___NONNULLISO_8859_1STRINGLIST_to_SCMOBJ,c,&s,i){
7617#define ___END_SFUN_NONNULLISO_8859_1STRINGLIST_TO_SCMOBJ(c,s,i)___EXT(___release_scmobj)(s);}
7618#define ___BEGIN_SFUN_UTF_8STRING_TO_SCMOBJ(c,s,i)___IF_CTOS3(___UTF_8STRING_to_SCMOBJ,c,&s,i){
7619#define ___END_SFUN_UTF_8STRING_TO_SCMOBJ(c,s,i)___EXT(___release_scmobj)(s);}
7620#define ___BEGIN_SFUN_NONNULLUTF_8STRING_TO_SCMOBJ(c,s,i)___IF_CTOS3(___NONNULLUTF_8STRING_to_SCMOBJ,c,&s,i){
7621#define ___END_SFUN_NONNULLUTF_8STRING_TO_SCMOBJ(c,s,i)___EXT(___release_scmobj)(s);}
7622#define ___BEGIN_SFUN_NONNULLUTF_8STRINGLIST_TO_SCMOBJ(c,s,i)___IF_CTOS3(___NONNULLUTF_8STRINGLIST_to_SCMOBJ,c,&s,i){
7623#define ___END_SFUN_NONNULLUTF_8STRINGLIST_TO_SCMOBJ(c,s,i)___EXT(___release_scmobj)(s);}
7624#define ___BEGIN_SFUN_UTF_16STRING_TO_SCMOBJ(c,s,i)___IF_CTOS3(___UTF_16STRING_to_SCMOBJ,c,&s,i){
7625#define ___END_SFUN_UTF_16STRING_TO_SCMOBJ(c,s,i)___EXT(___release_scmobj)(s);}
7626#define ___BEGIN_SFUN_NONNULLUTF_16STRING_TO_SCMOBJ(c,s,i)___IF_CTOS3(___NONNULLUTF_16STRING_to_SCMOBJ,c,&s,i){
7627#define ___END_SFUN_NONNULLUTF_16STRING_TO_SCMOBJ(c,s,i)___EXT(___release_scmobj)(s);}
7628#define ___BEGIN_SFUN_NONNULLUTF_16STRINGLIST_TO_SCMOBJ(c,s,i)___IF_CTOS3(___NONNULLUTF_16STRINGLIST_to_SCMOBJ,c,&s,i){
7629#define ___END_SFUN_NONNULLUTF_16STRINGLIST_TO_SCMOBJ(c,s,i)___EXT(___release_scmobj)(s);}
7630#define ___BEGIN_SFUN_UCS_2STRING_TO_SCMOBJ(c,s,i)___IF_CTOS3(___UCS_2STRING_to_SCMOBJ,c,&s,i){
7631#define ___END_SFUN_UCS_2STRING_TO_SCMOBJ(c,s,i)___EXT(___release_scmobj)(s);}
7632#define ___BEGIN_SFUN_NONNULLUCS_2STRING_TO_SCMOBJ(c,s,i)___IF_CTOS3(___NONNULLUCS_2STRING_to_SCMOBJ,c,&s,i){
7633#define ___END_SFUN_NONNULLUCS_2STRING_TO_SCMOBJ(c,s,i)___EXT(___release_scmobj)(s);}
7634#define ___BEGIN_SFUN_NONNULLUCS_2STRINGLIST_TO_SCMOBJ(c,s,i)___IF_CTOS3(___NONNULLUCS_2STRINGLIST_to_SCMOBJ,c,&s,i){
7635#define ___END_SFUN_NONNULLUCS_2STRINGLIST_TO_SCMOBJ(c,s,i)___EXT(___release_scmobj)(s);}
7636#define ___BEGIN_SFUN_UCS_4STRING_TO_SCMOBJ(c,s,i)___IF_CTOS3(___UCS_4STRING_to_SCMOBJ,c,&s,i){
7637#define ___END_SFUN_UCS_4STRING_TO_SCMOBJ(c,s,i)___EXT(___release_scmobj)(s);}
7638#define ___BEGIN_SFUN_NONNULLUCS_4STRING_TO_SCMOBJ(c,s,i)___IF_CTOS3(___NONNULLUCS_4STRING_to_SCMOBJ,c,&s,i){
7639#define ___END_SFUN_NONNULLUCS_4STRING_TO_SCMOBJ(c,s,i)___EXT(___release_scmobj)(s);}
7640#define ___BEGIN_SFUN_NONNULLUCS_4STRINGLIST_TO_SCMOBJ(c,s,i)___IF_CTOS3(___NONNULLUCS_4STRINGLIST_to_SCMOBJ,c,&s,i){
7641#define ___END_SFUN_NONNULLUCS_4STRINGLIST_TO_SCMOBJ(c,s,i)___EXT(___release_scmobj)(s);}
7642#define ___BEGIN_SFUN_WCHARSTRING_TO_SCMOBJ(c,s,i)___IF_CTOS3(___WCHARSTRING_to_SCMOBJ,c,&s,i){
7643#define ___END_SFUN_WCHARSTRING_TO_SCMOBJ(c,s,i)___EXT(___release_scmobj)(s);}
7644#define ___BEGIN_SFUN_NONNULLWCHARSTRING_TO_SCMOBJ(c,s,i)___IF_CTOS3(___NONNULLWCHARSTRING_to_SCMOBJ,c,&s,i){
7645#define ___END_SFUN_NONNULLWCHARSTRING_TO_SCMOBJ(c,s,i)___EXT(___release_scmobj)(s);}
7646#define ___BEGIN_SFUN_NONNULLWCHARSTRINGLIST_TO_SCMOBJ(c,s,i)___IF_CTOS3(___NONNULLWCHARSTRINGLIST_to_SCMOBJ,c,&s,i){
7647#define ___END_SFUN_NONNULLWCHARSTRINGLIST_TO_SCMOBJ(c,s,i)___EXT(___release_scmobj)(s);}
7648#define ___BEGIN_SFUN_VARIANT_TO_SCMOBJ(c,s,i)___IF_CTOS3(___VARIANT_to_SCMOBJ,c,&s,i){
7649#define ___END_SFUN_VARIANT_TO_SCMOBJ(c,s,i)___EXT(___release_scmobj)(s);}
7650
7651
7652#define ___SFUN_CAST_AND_DEREF(type,arg)(*___CAST(type,arg))
7653#define ___SFUN_CAST(type,arg)___CAST(type,arg)
7654
7655#define ___BEGIN_SFUN_COPY_STRUCT(n,r,arg){ void *r; ___ASSIGN_NEW_WITH_INIT(r,struct n,arg);
7656#define ___END_SFUN_COPY_STRUCT(n,r,arg)}
7657#define ___BEGIN_SFUN_COPY_UNION(n,r,arg){ void *r; ___ASSIGN_NEW_WITH_INIT(r,union n,arg);
7658#define ___END_SFUN_COPY_UNION(n,r,arg)}
7659#define ___BEGIN_SFUN_COPY_TYPE(n,r,arg){ void *r; ___ASSIGN_NEW_WITH_INIT(r,n,arg);
7660#define ___END_SFUN_COPY_TYPE(n,r,arg)}
7661
7662#define ___CFUN_CAST_AND_DEREF(type,arg)(*___CAST(type,arg))
7663#define ___CFUN_CAST(type,arg)___CAST(type,arg)
7664
7665/* TODO: remove these obsolete definitions after bootstrap */
7666#define ___CFUN_CALL_VOID(call)call;
7667#define ___CFUN_CALL(r,call)r = call;
7668#define ___CFUN_CALL_STRUCT(n,r,call)___ASSIGN_NEW_WITH_INIT(r,struct n,call);
7669#define ___CFUN_CALL_UNION(n,r,call)___ASSIGN_NEW_WITH_INIT(r,union n,call);
7670#define ___CFUN_CALL_TYPE(n,r,call)___ASSIGN_NEW_WITH_INIT(r,n,call);
7671#define ___CFUN_CALL_POINTER(r,call)r = call;
7672#define ___CFUN_CALL_NONNULLPOINTER(r,call)r = call;
7673#define ___CFUN_CALL_FUNCTION(r,call)r = call;
7674#define ___CFUN_CALL_NONNULLFUNCTION(r,call)r = call;
7675
7676#define ___CFUN_ASSIGN(r,val)r = val;
7677#define ___CFUN_ASSIGN_STRUCT(n,r,val)___ASSIGN_NEW_WITH_INIT(r,struct n,val);
7678#define ___CFUN_ASSIGN_UNION(n,r,val)___ASSIGN_NEW_WITH_INIT(r,union n,val);
7679#define ___CFUN_ASSIGN_TYPE(n,r,val)___ASSIGN_NEW_WITH_INIT(r,n,val);
7680#define ___CFUN_ASSIGN_POINTER(r,val)r = val;
7681#define ___CFUN_ASSIGN_NONNULLPOINTER(r,val)r = val;
7682#define ___CFUN_ASSIGN_FUNCTION(r,val)r = val;
7683#define ___CFUN_ASSIGN_NONNULLFUNCTION(r,val)r = val;
7684
7685#define ___BEGIN_CFUN_BODY
7686#define ___END_CFUN_BODY ___AT_END
7687#define ___BEGIN_CFUN_BODY_CLEANUP ___W_ALL ___BEGIN_TRY
7688#define ___END_CFUN_BODY_CLEANUP ___AT_END ___END_TRY ___R_ALL
7689
7690#define ___BEGIN_CFUN_VOID ___SET_STK(-___FRAME_STACK_RA,___R0) ___W_ALL {___SCMOBJ ___err=___FIX(___NO_ERR);___SCMOBJ ___errmsg=___FAL;
7691#define ___CFUN_SET_RESULT_VOID ___CFUN_RESULT = ___VOID;
7692#define ___CFUN_ERROR_VOID ___CFUN_CONV_ERROR
7693#define ___CFUN_ERROR_CLEANUP_VOID ___CFUN_CONV_ERROR ___EXT(___propagate_error) (___PSP ___err);
7694#define ___END_CFUN_VOID } ___R_ALL
7695
7696#define ___BEGIN_CFUN_SCMOBJ ___SET_STK(-___FRAME_STACK_RA,___R0) ___W_ALL {___SCMOBJ ___err=___FIX(___NO_ERR);___SCMOBJ ___result;___SCMOBJ ___errmsg=___FAL;
7697#define ___CFUN_SET_RESULT_SCMOBJ ___CFUN_RESULT = ___result;
7698#define ___CFUN_ERROR_SCMOBJ ___CFUN_CONV_ERROR
7699#define ___CFUN_ERROR_CLEANUP_SCMOBJ ___CFUN_CONV_ERROR ___EXT(___propagate_error) (___PSP ___err);
7700#define ___END_CFUN_SCMOBJ } ___R_ALL
7701
7702#define ___BEGIN_CFUN(decl)___SET_STK(-___FRAME_STACK_RA,___R0) ___W_ALL {___SCMOBJ ___err=___FIX(___NO_ERR);___SCMOBJ ___errmsg=___FAL;decl;
7703#define ___CFUN_SET_RESULT /* done in conversion function */
7704#define ___CFUN_ERROR ___CFUN_CONV_ERROR
7705#define ___CFUN_ERROR_CLEANUP ___CFUN_CONV_ERROR ___EXT(___propagate_error) (___PSP ___err);
7706#define ___END_CFUN } ___R_ALL
7707
7708#define ___BEGIN_CFUN_ARG(i,decl)decl;
7709#define ___END_CFUN_ARG(i)
7710#define ___BEGIN_CFUN_ARG_SCMOBJ(i)
7711#define ___END_CFUN_ARG_SCMOBJ(i)
7712#define ___CFUN_ARG(i)___PSSTK((i-___FRAME_SPACE(___NARGS+1)))
7713#define ___CFUN_RESULT ___PSR1
7714
7715#define ___BEGIN_CFUN_SCMOBJ_TO_S8(s,c,i)___IF_STOC3(___SCMOBJ_to_S8,s,&c,i){
7716#define ___END_CFUN_SCMOBJ_TO_S8(s,c,i)}
7717#define ___BEGIN_CFUN_SCMOBJ_TO_U8(s,c,i)___IF_STOC3(___SCMOBJ_to_U8,s,&c,i){
7718#define ___END_CFUN_SCMOBJ_TO_U8(s,c,i)}
7719#define ___BEGIN_CFUN_SCMOBJ_TO_S16(s,c,i)___IF_STOC3(___SCMOBJ_to_S16,s,&c,i){
7720#define ___END_CFUN_SCMOBJ_TO_S16(s,c,i)}
7721#define ___BEGIN_CFUN_SCMOBJ_TO_U16(s,c,i)___IF_STOC3(___SCMOBJ_to_U16,s,&c,i){
7722#define ___END_CFUN_SCMOBJ_TO_U16(s,c,i)}
7723#define ___BEGIN_CFUN_SCMOBJ_TO_S32(s,c,i)___IF_STOC3(___SCMOBJ_to_S32,s,&c,i){
7724#define ___END_CFUN_SCMOBJ_TO_S32(s,c,i)}
7725#define ___BEGIN_CFUN_SCMOBJ_TO_U32(s,c,i)___IF_STOC3(___SCMOBJ_to_U32,s,&c,i){
7726#define ___END_CFUN_SCMOBJ_TO_U32(s,c,i)}
7727#define ___BEGIN_CFUN_SCMOBJ_TO_S64(s,c,i)___IF_STOC3(___SCMOBJ_to_S64,s,&c,i){
7728#define ___END_CFUN_SCMOBJ_TO_S64(s,c,i)}
7729#define ___BEGIN_CFUN_SCMOBJ_TO_U64(s,c,i)___IF_STOC3(___SCMOBJ_to_U64,s,&c,i){
7730#define ___END_CFUN_SCMOBJ_TO_U64(s,c,i)}
7731#define ___BEGIN_CFUN_SCMOBJ_TO_F32(s,c,i)___IF_STOC3(___SCMOBJ_to_F32,s,&c,i){
7732#define ___END_CFUN_SCMOBJ_TO_F32(s,c,i)}
7733#define ___BEGIN_CFUN_SCMOBJ_TO_F64(s,c,i)___IF_STOC3(___SCMOBJ_to_F64,s,&c,i){
7734#define ___END_CFUN_SCMOBJ_TO_F64(s,c,i)}
7735#define ___BEGIN_CFUN_SCMOBJ_TO_CHAR(s,c,i)___IF_STOC3(___SCMOBJ_to_CHAR,s,&c,i){
7736#define ___END_CFUN_SCMOBJ_TO_CHAR(s,c,i)}
7737#define ___BEGIN_CFUN_SCMOBJ_TO_SCHAR(s,c,i)___IF_STOC3(___SCMOBJ_to_SCHAR,s,&c,i){
7738#define ___END_CFUN_SCMOBJ_TO_SCHAR(s,c,i)}
7739#define ___BEGIN_CFUN_SCMOBJ_TO_UCHAR(s,c,i)___IF_STOC3(___SCMOBJ_to_UCHAR,s,&c,i){
7740#define ___END_CFUN_SCMOBJ_TO_UCHAR(s,c,i)}
7741#define ___BEGIN_CFUN_SCMOBJ_TO_ISO_8859_1(s,c,i)___IF_STOC3(___SCMOBJ_to_ISO_8859_1,s,&c,i){
7742#define ___END_CFUN_SCMOBJ_TO_ISO_8859_1(s,c,i)}
7743#define ___BEGIN_CFUN_SCMOBJ_TO_UCS_2(s,c,i)___IF_STOC3(___SCMOBJ_to_UCS_2,s,&c,i){
7744#define ___END_CFUN_SCMOBJ_TO_UCS_2(s,c,i)}
7745#define ___BEGIN_CFUN_SCMOBJ_TO_UCS_4(s,c,i)___IF_STOC3(___SCMOBJ_to_UCS_4,s,&c,i){
7746#define ___END_CFUN_SCMOBJ_TO_UCS_4(s,c,i)}
7747#define ___BEGIN_CFUN_SCMOBJ_TO_WCHAR(s,c,i)___IF_STOC3(___SCMOBJ_to_WCHAR,s,&c,i){
7748#define ___END_CFUN_SCMOBJ_TO_WCHAR(s,c,i)}
7749#define ___BEGIN_CFUN_SCMOBJ_TO_SIZE_T(s,c,i)___IF_STOC3(___SCMOBJ_to_SIZE_T,s,&c,i){
7750#define ___END_CFUN_SCMOBJ_TO_SIZE_T(s,c,i)}
7751#define ___BEGIN_CFUN_SCMOBJ_TO_SSIZE_T(s,c,i)___IF_STOC3(___SCMOBJ_to_SSIZE_T,s,&c,i){
7752#define ___END_CFUN_SCMOBJ_TO_SSIZE_T(s,c,i)}
7753#define ___BEGIN_CFUN_SCMOBJ_TO_PTRDIFF_T(s,c,i)___IF_STOC3(___SCMOBJ_to_PTRDIFF_T,s,&c,i){
7754#define ___END_CFUN_SCMOBJ_TO_PTRDIFF_T(s,c,i)}
7755#define ___BEGIN_CFUN_SCMOBJ_TO_SHORT(s,c,i)___IF_STOC3(___SCMOBJ_to_SHORT,s,&c,i){
7756#define ___END_CFUN_SCMOBJ_TO_SHORT(s,c,i)}
7757#define ___BEGIN_CFUN_SCMOBJ_TO_USHORT(s,c,i)___IF_STOC3(___SCMOBJ_to_USHORT,s,&c,i){
7758#define ___END_CFUN_SCMOBJ_TO_USHORT(s,c,i)}
7759#define ___BEGIN_CFUN_SCMOBJ_TO_INT(s,c,i)___IF_STOC3(___SCMOBJ_to_INT,s,&c,i){
7760#define ___END_CFUN_SCMOBJ_TO_INT(s,c,i)}
7761#define ___BEGIN_CFUN_SCMOBJ_TO_UINT(s,c,i)___IF_STOC3(___SCMOBJ_to_UINT,s,&c,i){
7762#define ___END_CFUN_SCMOBJ_TO_UINT(s,c,i)}
7763#define ___BEGIN_CFUN_SCMOBJ_TO_LONG(s,c,i)___IF_STOC3(___SCMOBJ_to_LONG,s,&c,i){
7764#define ___END_CFUN_SCMOBJ_TO_LONG(s,c,i)}
7765#define ___BEGIN_CFUN_SCMOBJ_TO_ULONG(s,c,i)___IF_STOC3(___SCMOBJ_to_ULONG,s,&c,i){
7766#define ___END_CFUN_SCMOBJ_TO_ULONG(s,c,i)}
7767#define ___BEGIN_CFUN_SCMOBJ_TO_LONGLONG(s,c,i)___IF_STOC3(___SCMOBJ_to_LONGLONG,s,&c,i){
7768#define ___END_CFUN_SCMOBJ_TO_LONGLONG(s,c,i)}
7769#define ___BEGIN_CFUN_SCMOBJ_TO_ULONGLONG(s,c,i)___IF_STOC3(___SCMOBJ_to_ULONGLONG,s,&c,i){
7770#define ___END_CFUN_SCMOBJ_TO_ULONGLONG(s,c,i)}
7771#define ___BEGIN_CFUN_SCMOBJ_TO_FLOAT(s,c,i)___IF_STOC3(___SCMOBJ_to_FLOAT,s,&c,i){
7772#define ___END_CFUN_SCMOBJ_TO_FLOAT(s,c,i)}
7773#define ___BEGIN_CFUN_SCMOBJ_TO_DOUBLE(s,c,i)___IF_STOC3(___SCMOBJ_to_DOUBLE,s,&c,i){
7774#define ___END_CFUN_SCMOBJ_TO_DOUBLE(s,c,i)}
7775#define ___BEGIN_CFUN_SCMOBJ_TO_STRUCT(n,s,c,t,i)___IF_STOC4(___SCMOBJ_to_STRUCT,s,(void**)&c,t,i){
7776#define ___END_CFUN_SCMOBJ_TO_STRUCT(n,s,c,t,i)}
7777#define ___BEGIN_CFUN_SCMOBJ_TO_UNION(n,s,c,t,i)___IF_STOC4(___SCMOBJ_to_UNION,s,(void**)&c,t,i){
7778#define ___END_CFUN_SCMOBJ_TO_UNION(n,s,c,t,i)}
7779#define ___BEGIN_CFUN_SCMOBJ_TO_TYPE(n,s,c,t,i)___IF_STOC4(___SCMOBJ_to_TYPE,s,(void**)&c,t,i){
7780#define ___END_CFUN_SCMOBJ_TO_TYPE(n,s,c,t,i)}
7781#define ___BEGIN_CFUN_SCMOBJ_TO_POINTER(s,c,t,i)___IF_STOC4(___SCMOBJ_to_POINTER,s,(void**)&c,t,i){
7782#define ___END_CFUN_SCMOBJ_TO_POINTER(s,c,t,i)}
7783#define ___BEGIN_CFUN_SCMOBJ_TO_NONNULLPOINTER(s,c,t,i)___IF_STOC4(___SCMOBJ_to_NONNULLPOINTER,s,(void**)&c,t,i){
7784#define ___END_CFUN_SCMOBJ_TO_NONNULLPOINTER(s,c,t,i)}
7785#define ___BEGIN_CFUN_SCMOBJ_TO_FUNCTION(s,cnv,c,i)___IF_STOC4(___SCMOBJ_to_FUNCTION,s,(void*)cnv,(void**)&c,i){
7786#define ___END_CFUN_SCMOBJ_TO_FUNCTION(s,cnv,c,i)___EXT(___release_function)(c);}
7787#define ___BEGIN_CFUN_SCMOBJ_TO_NONNULLFUNCTION(s,cnv,c,i)___IF_STOC4(___SCMOBJ_to_NONNULLFUNCTION,s,(void*)cnv,(void**)&c,i){
7788#define ___END_CFUN_SCMOBJ_TO_NONNULLFUNCTION(s,cnv,c,i)___EXT(___release_function)(c);}
7789#define ___BEGIN_CFUN_SCMOBJ_TO_BOOL(s,c,i)___IF_STOC3(___SCMOBJ_to_BOOL,s,&c,i){
7790#define ___END_CFUN_SCMOBJ_TO_BOOL(s,c,i)}
7791#define ___BEGIN_CFUN_SCMOBJ_TO_CHARSTRING(s,c,i)___IF_STOC3(___SCMOBJ_to_CHARSTRING,s,&c,i){
7792#define ___END_CFUN_SCMOBJ_TO_CHARSTRING(s,c,i)___EXT(___release_string)(c);}
7793#define ___BEGIN_CFUN_SCMOBJ_TO_NONNULLCHARSTRING(s,c,i)___IF_STOC3(___SCMOBJ_to_NONNULLCHARSTRING,s,&c,i){
7794#define ___END_CFUN_SCMOBJ_TO_NONNULLCHARSTRING(s,c,i)___EXT(___release_string)(c);}
7795#define ___BEGIN_CFUN_SCMOBJ_TO_NONNULLCHARSTRINGLIST(s,c,i)___IF_STOC3(___SCMOBJ_to_NONNULLCHARSTRINGLIST,s,&c,i){
7796#define ___END_CFUN_SCMOBJ_TO_NONNULLCHARSTRINGLIST(s,c,i)___EXT(___release_string_list)(c);}
7797#define ___BEGIN_CFUN_SCMOBJ_TO_ISO_8859_1STRING(s,c,i)___IF_STOC3(___SCMOBJ_to_ISO_8859_1STRING,s,&c,i){
7798#define ___END_CFUN_SCMOBJ_TO_ISO_8859_1STRING(s,c,i)___EXT(___release_string)(c);}
7799#define ___BEGIN_CFUN_SCMOBJ_TO_NONNULLISO_8859_1STRING(s,c,i)___IF_STOC3(___SCMOBJ_to_NONNULLISO_8859_1STRING,s,&c,i){
7800#define ___END_CFUN_SCMOBJ_TO_NONNULLISO_8859_1STRING(s,c,i)___EXT(___release_string)(c);}
7801#define ___BEGIN_CFUN_SCMOBJ_TO_NONNULLISO_8859_1STRINGLIST(s,c,i)___IF_STOC3(___SCMOBJ_to_NONNULLISO_8859_1STRINGLIST,s,&c,i){
7802#define ___END_CFUN_SCMOBJ_TO_NONNULLISO_8859_1STRINGLIST(s,c,i)___EXT(___release_string_list)(c);}
7803#define ___BEGIN_CFUN_SCMOBJ_TO_UTF_8STRING(s,c,i)___IF_STOC3(___SCMOBJ_to_UTF_8STRING,s,&c,i){
7804#define ___END_CFUN_SCMOBJ_TO_UTF_8STRING(s,c,i)___EXT(___release_string)(c);}
7805#define ___BEGIN_CFUN_SCMOBJ_TO_NONNULLUTF_8STRING(s,c,i)___IF_STOC3(___SCMOBJ_to_NONNULLUTF_8STRING,s,&c,i){
7806#define ___END_CFUN_SCMOBJ_TO_NONNULLUTF_8STRING(s,c,i)___EXT(___release_string)(c);}
7807#define ___BEGIN_CFUN_SCMOBJ_TO_NONNULLUTF_8STRINGLIST(s,c,i)___IF_STOC3(___SCMOBJ_to_NONNULLUTF_8STRINGLIST,s,&c,i){
7808#define ___END_CFUN_SCMOBJ_TO_NONNULLUTF_8STRINGLIST(s,c,i)___EXT(___release_string_list)(c);}
7809#define ___BEGIN_CFUN_SCMOBJ_TO_UTF_16STRING(s,c,i)___IF_STOC3(___SCMOBJ_to_UTF_16STRING,s,&c,i){
7810#define ___END_CFUN_SCMOBJ_TO_UTF_16STRING(s,c,i)___EXT(___release_string)(c);}
7811#define ___BEGIN_CFUN_SCMOBJ_TO_NONNULLUTF_16STRING(s,c,i)___IF_STOC3(___SCMOBJ_to_NONNULLUTF_16STRING,s,&c,i){
7812#define ___END_CFUN_SCMOBJ_TO_NONNULLUTF_16STRING(s,c,i)___EXT(___release_string)(c);}
7813#define ___BEGIN_CFUN_SCMOBJ_TO_NONNULLUTF_16STRINGLIST(s,c,i)___IF_STOC3(___SCMOBJ_to_NONNULLUTF_16STRINGLIST,s,&c,i){
7814#define ___END_CFUN_SCMOBJ_TO_NONNULLUTF_16STRINGLIST(s,c,i)___EXT(___release_string_list)(c);}
7815#define ___BEGIN_CFUN_SCMOBJ_TO_UCS_2STRING(s,c,i)___IF_STOC3(___SCMOBJ_to_UCS_2STRING,s,&c,i){
7816#define ___END_CFUN_SCMOBJ_TO_UCS_2STRING(s,c,i)___EXT(___release_string)(c);}
7817#define ___BEGIN_CFUN_SCMOBJ_TO_NONNULLUCS_2STRING(s,c,i)___IF_STOC3(___SCMOBJ_to_NONNULLUCS_2STRING,s,&c,i){
7818#define ___END_CFUN_SCMOBJ_TO_NONNULLUCS_2STRING(s,c,i)___EXT(___release_string)(c);}
7819#define ___BEGIN_CFUN_SCMOBJ_TO_NONNULLUCS_2STRINGLIST(s,c,i)___IF_STOC3(___SCMOBJ_to_NONNULLUCS_2STRINGLIST,s,&c,i){
7820#define ___END_CFUN_SCMOBJ_TO_NONNULLUCS_2STRINGLIST(s,c,i)___EXT(___release_string_list)(c);}
7821#define ___BEGIN_CFUN_SCMOBJ_TO_UCS_4STRING(s,c,i)___IF_STOC3(___SCMOBJ_to_UCS_4STRING,s,&c,i){
7822#define ___END_CFUN_SCMOBJ_TO_UCS_4STRING(s,c,i)___EXT(___release_string)(c);}
7823#define ___BEGIN_CFUN_SCMOBJ_TO_NONNULLUCS_4STRING(s,c,i)___IF_STOC3(___SCMOBJ_to_NONNULLUCS_4STRING,s,&c,i){
7824#define ___END_CFUN_SCMOBJ_TO_NONNULLUCS_4STRING(s,c,i)___EXT(___release_string)(c);}
7825#define ___BEGIN_CFUN_SCMOBJ_TO_NONNULLUCS_4STRINGLIST(s,c,i)___IF_STOC3(___SCMOBJ_to_NONNULLUCS_4STRINGLIST,s,&c,i){
7826#define ___END_CFUN_SCMOBJ_TO_NONNULLUCS_4STRINGLIST(s,c,i)___EXT(___release_string_list)(c);}
7827#define ___BEGIN_CFUN_SCMOBJ_TO_WCHARSTRING(s,c,i)___IF_STOC3(___SCMOBJ_to_WCHARSTRING,s,&c,i){
7828#define ___END_CFUN_SCMOBJ_TO_WCHARSTRING(s,c,i)___EXT(___release_string)(c);}
7829#define ___BEGIN_CFUN_SCMOBJ_TO_NONNULLWCHARSTRING(s,c,i)___IF_STOC3(___SCMOBJ_to_NONNULLWCHARSTRING,s,&c,i){
7830#define ___END_CFUN_SCMOBJ_TO_NONNULLWCHARSTRING(s,c,i)___EXT(___release_string)(c);}
7831#define ___BEGIN_CFUN_SCMOBJ_TO_NONNULLWCHARSTRINGLIST(s,c,i)___IF_STOC3(___SCMOBJ_to_NONNULLWCHARSTRINGLIST,s,&c,i){
7832#define ___END_CFUN_SCMOBJ_TO_NONNULLWCHARSTRINGLIST(s,c,i)___EXT(___release_string_list)(c);}
7833#define ___BEGIN_CFUN_SCMOBJ_TO_VARIANT(s,c,i)___IF_STOC3(___SCMOBJ_to_VARIANT,s,&c,i){
7834#define ___END_CFUN_SCMOBJ_TO_VARIANT(s,c,i)___EXT(___release_variant)(c);}
7835
7836#define ___BEGIN_CFUN_S8_TO_SCMOBJ(c,s)___CTOS3(___S8_to_SCMOBJ,c,&s,___RETURN_POS);
7837#define ___END_CFUN_S8_TO_SCMOBJ(c,s)
7838#define ___BEGIN_CFUN_U8_TO_SCMOBJ(c,s)___CTOS3(___U8_to_SCMOBJ,c,&s,___RETURN_POS);
7839#define ___END_CFUN_U8_TO_SCMOBJ(c,s)
7840#define ___BEGIN_CFUN_S16_TO_SCMOBJ(c,s)___CTOS3(___S16_to_SCMOBJ,c,&s,___RETURN_POS);
7841#define ___END_CFUN_S16_TO_SCMOBJ(c,s)
7842#define ___BEGIN_CFUN_U16_TO_SCMOBJ(c,s)___CTOS3(___U16_to_SCMOBJ,c,&s,___RETURN_POS);
7843#define ___END_CFUN_U16_TO_SCMOBJ(c,s)
7844#define ___BEGIN_CFUN_S32_TO_SCMOBJ(c,s)___IF_CTOS3(___S32_to_SCMOBJ,c,&s,___RETURN_POS){
7845#define ___END_CFUN_S32_TO_SCMOBJ(c,s)___EXT(___release_scmobj)(s);}
7846#define ___BEGIN_CFUN_U32_TO_SCMOBJ(c,s)___IF_CTOS3(___U32_to_SCMOBJ,c,&s,___RETURN_POS){
7847#define ___END_CFUN_U32_TO_SCMOBJ(c,s)___EXT(___release_scmobj)(s);}
7848#define ___BEGIN_CFUN_S64_TO_SCMOBJ(c,s)___IF_CTOS3(___S64_to_SCMOBJ,c,&s,___RETURN_POS){
7849#define ___END_CFUN_S64_TO_SCMOBJ(c,s)___EXT(___release_scmobj)(s);}
7850#define ___BEGIN_CFUN_U64_TO_SCMOBJ(c,s)___IF_CTOS3(___U64_to_SCMOBJ,c,&s,___RETURN_POS){
7851#define ___END_CFUN_U64_TO_SCMOBJ(c,s)___EXT(___release_scmobj)(s);}
7852#define ___BEGIN_CFUN_F32_TO_SCMOBJ(c,s)___IF_CTOS3(___F32_to_SCMOBJ,c,&s,___RETURN_POS){
7853#define ___END_CFUN_F32_TO_SCMOBJ(c,s)___EXT(___release_scmobj)(s);}
7854#define ___BEGIN_CFUN_F64_TO_SCMOBJ(c,s)___IF_CTOS3(___F64_to_SCMOBJ,c,&s,___RETURN_POS){
7855#define ___END_CFUN_F64_TO_SCMOBJ(c,s)___EXT(___release_scmobj)(s);}
7856#define ___BEGIN_CFUN_CHAR_TO_SCMOBJ(c,s)___CTOS3(___CHAR_to_SCMOBJ,c,&s,___RETURN_POS);
7857#define ___END_CFUN_CHAR_TO_SCMOBJ(c,s)
7858#define ___BEGIN_CFUN_SCHAR_TO_SCMOBJ(c,s)___CTOS3(___SCHAR_to_SCMOBJ,c,&s,___RETURN_POS);
7859#define ___END_CFUN_SCHAR_TO_SCMOBJ(c,s)
7860#define ___BEGIN_CFUN_UCHAR_TO_SCMOBJ(c,s)___CTOS3(___UCHAR_to_SCMOBJ,c,&s,___RETURN_POS);
7861#define ___END_CFUN_UCHAR_TO_SCMOBJ(c,s)
7862#define ___BEGIN_CFUN_ISO_8859_1_TO_SCMOBJ(c,s)___CTOS3(___ISO_8859_1_to_SCMOBJ,c,&s,___RETURN_POS);
7863#define ___END_CFUN_ISO_8859_1_TO_SCMOBJ(c,s)
7864#define ___BEGIN_CFUN_UCS_2_TO_SCMOBJ(c,s)___CTOS3(___UCS_2_to_SCMOBJ,c,&s,___RETURN_POS);
7865#define ___END_CFUN_UCS_2_TO_SCMOBJ(c,s)
7866#define ___BEGIN_CFUN_UCS_4_TO_SCMOBJ(c,s)___CTOS3(___UCS_4_to_SCMOBJ,c,&s,___RETURN_POS);
7867#define ___END_CFUN_UCS_4_TO_SCMOBJ(c,s)
7868#define ___BEGIN_CFUN_WCHAR_TO_SCMOBJ(c,s)___CTOS3(___WCHAR_to_SCMOBJ,c,&s,___RETURN_POS);
7869#define ___END_CFUN_WCHAR_TO_SCMOBJ(c,s)
7870#define ___BEGIN_CFUN_SIZE_T_TO_SCMOBJ(c,s)___CTOS3(___SIZE_T_to_SCMOBJ,c,&s,___RETURN_POS);
7871#define ___END_CFUN_SIZE_T_TO_SCMOBJ(c,s)
7872#define ___BEGIN_CFUN_SSIZE_T_TO_SCMOBJ(c,s)___CTOS3(___SSIZE_T_to_SCMOBJ,c,&s,___RETURN_POS);
7873#define ___END_CFUN_SSIZE_T_TO_SCMOBJ(c,s)
7874#define ___BEGIN_CFUN_PTRDIFF_T_TO_SCMOBJ(c,s)___CTOS3(___PTRDIFF_T_to_SCMOBJ,c,&s,___RETURN_POS);
7875#define ___END_CFUN_PTRDIFF_T_TO_SCMOBJ(c,s)
7876#define ___BEGIN_CFUN_SHORT_TO_SCMOBJ(c,s)___IF_CTOS3(___SHORT_to_SCMOBJ,c,&s,___RETURN_POS){
7877#define ___END_CFUN_SHORT_TO_SCMOBJ(c,s)___EXT(___release_scmobj)(s);}
7878#define ___BEGIN_CFUN_USHORT_TO_SCMOBJ(c,s)___IF_CTOS3(___USHORT_to_SCMOBJ,c,&s,___RETURN_POS){
7879#define ___END_CFUN_USHORT_TO_SCMOBJ(c,s)___EXT(___release_scmobj)(s);}
7880#define ___BEGIN_CFUN_INT_TO_SCMOBJ(c,s)___IF_CTOS3(___INT_to_SCMOBJ,c,&s,___RETURN_POS){
7881#define ___END_CFUN_INT_TO_SCMOBJ(c,s)___EXT(___release_scmobj)(s);}
7882#define ___BEGIN_CFUN_UINT_TO_SCMOBJ(c,s)___IF_CTOS3(___UINT_to_SCMOBJ,c,&s,___RETURN_POS){
7883#define ___END_CFUN_UINT_TO_SCMOBJ(c,s)___EXT(___release_scmobj)(s);}
7884#define ___BEGIN_CFUN_LONG_TO_SCMOBJ(c,s)___IF_CTOS3(___LONG_to_SCMOBJ,c,&s,___RETURN_POS){
7885#define ___END_CFUN_LONG_TO_SCMOBJ(c,s)___EXT(___release_scmobj)(s);}
7886#define ___BEGIN_CFUN_ULONG_TO_SCMOBJ(c,s)___IF_CTOS3(___ULONG_to_SCMOBJ,c,&s,___RETURN_POS){
7887#define ___END_CFUN_ULONG_TO_SCMOBJ(c,s)___EXT(___release_scmobj)(s);}
7888#define ___BEGIN_CFUN_LONGLONG_TO_SCMOBJ(c,s)___IF_CTOS3(___LONGLONG_to_SCMOBJ,c,&s,___RETURN_POS){
7889#define ___END_CFUN_LONGLONG_TO_SCMOBJ(c,s)___EXT(___release_scmobj)(s);}
7890#define ___BEGIN_CFUN_ULONGLONG_TO_SCMOBJ(c,s)___IF_CTOS3(___ULONGLONG_to_SCMOBJ,c,&s,___RETURN_POS){
7891#define ___END_CFUN_ULONGLONG_TO_SCMOBJ(c,s)___EXT(___release_scmobj)(s);}
7892#define ___BEGIN_CFUN_FLOAT_TO_SCMOBJ(c,s)___IF_CTOS3(___FLOAT_to_SCMOBJ,c,&s,___RETURN_POS){
7893#define ___END_CFUN_FLOAT_TO_SCMOBJ(c,s)___EXT(___release_scmobj)(s);}
7894#define ___BEGIN_CFUN_DOUBLE_TO_SCMOBJ(c,s)___IF_CTOS3(___DOUBLE_to_SCMOBJ,c,&s,___RETURN_POS){
7895#define ___END_CFUN_DOUBLE_TO_SCMOBJ(c,s)___EXT(___release_scmobj)(s);}
7896#define ___BEGIN_CFUN_STRUCT_TO_SCMOBJ(n,c,t,r,s)___IF_CTOS5(___STRUCT_to_SCMOBJ,(void*)c,t,r,&s,___RETURN_POS){
7897#define ___END_CFUN_STRUCT_TO_SCMOBJ(n,c,t,r,s)___EXT(___release_scmobj)(s);}
7898#define ___BEGIN_CFUN_UNION_TO_SCMOBJ(n,c,t,r,s)___IF_CTOS5(___UNION_to_SCMOBJ,(void*)c,t,r,&s,___RETURN_POS){
7899#define ___END_CFUN_UNION_TO_SCMOBJ(n,c,t,r,s)___EXT(___release_scmobj)(s);}
7900#define ___BEGIN_CFUN_TYPE_TO_SCMOBJ(n,c,t,r,s)___IF_CTOS5(___TYPE_to_SCMOBJ,(void*)c,t,r,&s,___RETURN_POS){
7901#define ___END_CFUN_TYPE_TO_SCMOBJ(n,c,t,r,s)___EXT(___release_scmobj)(s);}
7902#define ___BEGIN_CFUN_POINTER_TO_SCMOBJ(c,t,r,s)___IF_CTOS5(___POINTER_to_SCMOBJ,(void*)c,t,r,&s,___RETURN_POS){
7903#define ___END_CFUN_POINTER_TO_SCMOBJ(c,t,r,s)___EXT(___release_scmobj)(s);}
7904#define ___BEGIN_CFUN_NONNULLPOINTER_TO_SCMOBJ(c,t,r,s)___IF_CTOS5(___NONNULLPOINTER_to_SCMOBJ,(void*)c,t,r,&s,___RETURN_POS){
7905#define ___END_CFUN_NONNULLPOINTER_TO_SCMOBJ(c,t,r,s)___EXT(___release_scmobj)(s);}
7906#define ___BEGIN_CFUN_FUNCTION_TO_SCMOBJ(c,s)___IF_CTOS3(___FUNCTION_to_SCMOBJ,___CAST(void*,c),&s,___RETURN_POS){
7907#define ___END_CFUN_FUNCTION_TO_SCMOBJ(c,s)___EXT(___release_scmobj)(s);}
7908#define ___BEGIN_CFUN_NONNULLFUNCTION_TO_SCMOBJ(c,s)___IF_CTOS3(___NONNULLFUNCTION_to_SCMOBJ,___CAST(void*,c),&s,___RETURN_POS){
7909#define ___END_CFUN_NONNULLFUNCTION_TO_SCMOBJ(c,s)___EXT(___release_scmobj)(s);}
7910#define ___BEGIN_CFUN_BOOL_TO_SCMOBJ(c,s)___CTOS3(___BOOL_to_SCMOBJ,c,&s,___RETURN_POS);
7911#define ___END_CFUN_BOOL_TO_SCMOBJ(c,s)
7912#define ___BEGIN_CFUN_CHARSTRING_TO_SCMOBJ(c,s)___IF_CTOS3(___CHARSTRING_to_SCMOBJ,c,&s,___RETURN_POS){
7913#define ___END_CFUN_CHARSTRING_TO_SCMOBJ(c,s)___EXT(___release_scmobj)(s);}
7914#define ___BEGIN_CFUN_NONNULLCHARSTRING_TO_SCMOBJ(c,s)___IF_CTOS3(___NONNULLCHARSTRING_to_SCMOBJ,c,&s,___RETURN_POS){
7915#define ___END_CFUN_NONNULLCHARSTRING_TO_SCMOBJ(c,s)___EXT(___release_scmobj)(s);}
7916#define ___BEGIN_CFUN_NONNULLCHARSTRINGLIST_TO_SCMOBJ(c,s)___IF_CTOS3(___NONNULLCHARSTRINGLIST_to_SCMOBJ,c,&s,___RETURN_POS){
7917#define ___END_CFUN_NONNULLCHARSTRINGLIST_TO_SCMOBJ(c,s)___EXT(___release_scmobj)(s);}
7918#define ___BEGIN_CFUN_ISO_8859_1STRING_TO_SCMOBJ(c,s)___IF_CTOS3(___ISO_8859_1STRING_to_SCMOBJ,c,&s,___RETURN_POS){
7919#define ___END_CFUN_ISO_8859_1STRING_TO_SCMOBJ(c,s)___EXT(___release_scmobj)(s);}
7920#define ___BEGIN_CFUN_NONNULLISO_8859_1STRING_TO_SCMOBJ(c,s)___IF_CTOS3(___NONNULLISO_8859_1STRING_to_SCMOBJ,c,&s,___RETURN_POS){
7921#define ___END_CFUN_NONNULLISO_8859_1STRING_TO_SCMOBJ(c,s)___EXT(___release_scmobj)(s);}
7922#define ___BEGIN_CFUN_NONNULLISO_8859_1STRINGLIST_TO_SCMOBJ(c,s)___IF_CTOS3(___NONNULLISO_8859_1STRINGLIST_to_SCMOBJ,c,&s,___RETURN_POS){
7923#define ___END_CFUN_NONNULLISO_8859_1STRINGLIST_TO_SCMOBJ(c,s)___EXT(___release_scmobj)(s);}
7924#define ___BEGIN_CFUN_UTF_8STRING_TO_SCMOBJ(c,s)___IF_CTOS3(___UTF_8STRING_to_SCMOBJ,c,&s,___RETURN_POS){
7925#define ___END_CFUN_UTF_8STRING_TO_SCMOBJ(c,s)___EXT(___release_scmobj)(s);}
7926#define ___BEGIN_CFUN_NONNULLUTF_8STRING_TO_SCMOBJ(c,s)___IF_CTOS3(___NONNULLUTF_8STRING_to_SCMOBJ,c,&s,___RETURN_POS){
7927#define ___END_CFUN_NONNULLUTF_8STRING_TO_SCMOBJ(c,s)___EXT(___release_scmobj)(s);}
7928#define ___BEGIN_CFUN_NONNULLUTF_8STRINGLIST_TO_SCMOBJ(c,s)___IF_CTOS3(___NONNULLUTF_8STRINGLIST_to_SCMOBJ,c,&s,___RETURN_POS){
7929#define ___END_CFUN_NONNULLUTF_8STRINGLIST_TO_SCMOBJ(c,s)___EXT(___release_scmobj)(s);}
7930#define ___BEGIN_CFUN_UTF_16STRING_TO_SCMOBJ(c,s)___IF_CTOS3(___UTF_16STRING_to_SCMOBJ,c,&s,___RETURN_POS){
7931#define ___END_CFUN_UTF_16STRING_TO_SCMOBJ(c,s)___EXT(___release_scmobj)(s);}
7932#define ___BEGIN_CFUN_NONNULLUTF_16STRING_TO_SCMOBJ(c,s)___IF_CTOS3(___NONNULLUTF_16STRING_to_SCMOBJ,c,&s,___RETURN_POS){
7933#define ___END_CFUN_NONNULLUTF_16STRING_TO_SCMOBJ(c,s)___EXT(___release_scmobj)(s);}
7934#define ___BEGIN_CFUN_NONNULLUTF_16STRINGLIST_TO_SCMOBJ(c,s)___IF_CTOS3(___NONNULLUTF_16STRINGLIST_to_SCMOBJ,c,&s,___RETURN_POS){
7935#define ___END_CFUN_NONNULLUTF_16STRINGLIST_TO_SCMOBJ(c,s)___EXT(___release_scmobj)(s);}
7936#define ___BEGIN_CFUN_UCS_2STRING_TO_SCMOBJ(c,s)___IF_CTOS3(___UCS_2STRING_to_SCMOBJ,c,&s,___RETURN_POS){
7937#define ___END_CFUN_UCS_2STRING_TO_SCMOBJ(c,s)___EXT(___release_scmobj)(s);}
7938#define ___BEGIN_CFUN_NONNULLUCS_2STRING_TO_SCMOBJ(c,s)___IF_CTOS3(___NONNULLUCS_2STRING_to_SCMOBJ,c,&s,___RETURN_POS){
7939#define ___END_CFUN_NONNULLUCS_2STRING_TO_SCMOBJ(c,s)___EXT(___release_scmobj)(s);}
7940#define ___BEGIN_CFUN_NONNULLUCS_2STRINGLIST_TO_SCMOBJ(c,s)___IF_CTOS3(___NONNULLUCS_2STRINGLIST_to_SCMOBJ,c,&s,___RETURN_POS){
7941#define ___END_CFUN_NONNULLUCS_2STRINGLIST_TO_SCMOBJ(c,s)___EXT(___release_scmobj)(s);}
7942#define ___BEGIN_CFUN_UCS_4STRING_TO_SCMOBJ(c,s)___IF_CTOS3(___UCS_4STRING_to_SCMOBJ,c,&s,___RETURN_POS){
7943#define ___END_CFUN_UCS_4STRING_TO_SCMOBJ(c,s)___EXT(___release_scmobj)(s);}
7944#define ___BEGIN_CFUN_NONNULLUCS_4STRING_TO_SCMOBJ(c,s)___IF_CTOS3(___NONNULLUCS_4STRING_to_SCMOBJ,c,&s,___RETURN_POS){
7945#define ___END_CFUN_NONNULLUCS_4STRING_TO_SCMOBJ(c,s)___EXT(___release_scmobj)(s);}
7946#define ___BEGIN_CFUN_NONNULLUCS_4STRINGLIST_TO_SCMOBJ(c,s)___IF_CTOS3(___NONNULLUCS_4STRINGLIST_to_SCMOBJ,c,&s,___RETURN_POS){
7947#define ___END_CFUN_NONNULLUCS_4STRINGLIST_TO_SCMOBJ(c,s)___EXT(___release_scmobj)(s);}
7948#define ___BEGIN_CFUN_WCHARSTRING_TO_SCMOBJ(c,s)___IF_CTOS3(___WCHARSTRING_to_SCMOBJ,c,&s,___RETURN_POS){
7949#define ___END_CFUN_WCHARSTRING_TO_SCMOBJ(c,s)___EXT(___release_scmobj)(s);}
7950#define ___BEGIN_CFUN_NONNULLWCHARSTRING_TO_SCMOBJ(c,s)___IF_CTOS3(___NONNULLWCHARSTRING_to_SCMOBJ,c,&s,___RETURN_POS){
7951#define ___END_CFUN_NONNULLWCHARSTRING_TO_SCMOBJ(c,s)___EXT(___release_scmobj)(s);}
7952#define ___BEGIN_CFUN_NONNULLWCHARSTRINGLIST_TO_SCMOBJ(c,s)___IF_CTOS3(___NONNULLWCHARSTRINGLIST_to_SCMOBJ,c,&s,___RETURN_POS){
7953#define ___END_CFUN_NONNULLWCHARSTRINGLIST_TO_SCMOBJ(c,s)___EXT(___release_scmobj)(s);}
7954#define ___BEGIN_CFUN_VARIANT_TO_SCMOBJ(c,s)___IF_CTOS3(___VARIANT_to_SCMOBJ,c,&s,___RETURN_POS){
7955#define ___END_CFUN_VARIANT_TO_SCMOBJ(c,s)___EXT(___release_scmobj)(s);}
7956
7957/*---------------------------------------------------------------------------*/
7958
7959#ifndef ___DEFINES_ONLY
7960
7961#ifdef _MSC_VER
7962#ifdef ___DYNAMIC
7963int _fltused; /* needed if floating-point used. */
7964#endif
7965#endif
7966
7967#ifdef __BORLANDC__
7968#ifdef __WIN32__
7969#ifndef ___OS_WIN32
7970#define ___OS_WIN32
7971#endif
7972#endif
7973#ifdef ___SHARED
7974#define _RTLDLL
7975#endif
7976#endif
7977
7978#ifdef ___OS_WIN32
7979
7980#ifndef _WIN32_WINNT
7981#define _WIN32_WINNT 0x0600
7982#endif
7983
7984#ifndef ___DONT_HAVE_WINSOCK2_H
7985#include <winsock2.h>
7986#endif
7987
7988#ifndef ___DONT_HAVE_WINDOWS_H
7989#include <windows.h>
7990#endif
7991
7992#endif
7993
7994#ifdef ___USE_CPLUSPLUS_NEW_DELETE
7995
7996#ifndef ___DONT_HAVE_NEW
7997#include <new>
7998#endif
7999
8000#endif
8001
8002typedef struct ___source_location
8003  {
8004    int line;
8005    char *file;
8006  } ___source_location;
8007
8008#ifdef ___USE_SETJMP
8009
8010typedef struct ___jmpbuf_struct
8011  {
8012    jmp_buf buf;
8013  } ___jmpbuf_struct;
8014
8015#else
8016
8017typedef struct ___throw_struct
8018  {
8019    ___SCMOBJ err;
8020  } ___throw_struct;
8021
8022#endif
8023
8024typedef void *___VARIANT; /* not yet implemented */
8025
8026#ifdef ___BUILTIN_64BIT_INT_TYPE
8027
8028/*
8029 * If the symbol ___BUILTIN_64BIT_INT_TYPE is defined then the data
8030 * types ___S64 and ___U64 are builtin integer types.
8031 */
8032
8033#define ___S64_from_SM32(val) \
8034___CAST_S64(___CAST_S32(val))
8035
8036#define ___S64_from_SM32_UM32(hi32,lo32) \
8037((___CAST_S64(___CAST_S32(hi32)) << 32) + ___CAST_S64(___CAST_U32(lo32)))
8038
8039#define ___S64_from_LONGLONG(val) \
8040___CAST_S64(val)
8041
8042#define ___S64_to_LONGLONG(val) \
8043___CAST(___LONGLONG,val)
8044
8045#define ___S64_fits_in_width(val,width) \
8046((((val) >> ((width)-1)) == 0) || (((val) >> ((width)-1)) == -1))
8047
8048#define ___S64_hi32(val)___CAST_S32((val) >> 32)
8049#define ___S64_lo32(val)___CAST_U32(val)
8050
8051#define ___U64_from_UM32(val) \
8052___CAST_U64(___CAST_U32(val))
8053
8054#define ___U64_from_UM32_UM32(hi32,lo32) \
8055((___CAST_U64(___CAST_U32(hi32)) << 32) + ___CAST_U64(___CAST_U32(lo32)))
8056
8057#define ___U64_from_ULONGLONG(val) \
8058___CAST_U64(val)
8059
8060#define ___U64_to_ULONGLONG(val) \
8061___CAST(___ULONGLONG,val)
8062
8063#define ___U64_fits_in_width(val,width) \
8064(((val) >> (width)) == 0)
8065
8066#define ___U64_mul_UM32_UM32(x,y) \
8067(___CAST_U64(___CAST_U32(x)) * ___CAST_U32(y))
8068
8069#define ___U64_add_U64_U64(x,y) \
8070(___CAST_U64(x) + ___CAST_U64(y))
8071
8072#define ___U64_hi32(val)___CAST_U32((val) >> 32)
8073#define ___U64_lo32(val)___CAST_U32(val)
8074
8075#else
8076
8077/*
8078 * If the symbol ___BUILTIN_64BIT_INT_TYPE is not defined then the
8079 * data types ___S64 and ___U64 are structures.
8080 */
8081
8082typedef struct
8083  {
8084#ifdef ___BIG_ENDIAN
8085    ___S32 hi32;
8086    ___U32 lo32;
8087#else
8088    ___U32 lo32;
8089    ___S32 hi32;
8090#endif
8091  } ___S64;
8092
8093typedef struct
8094  {
8095#ifdef ___BIG_ENDIAN
8096    ___U32 hi32;
8097    ___U32 lo32;
8098#else
8099    ___U32 lo32;
8100    ___U32 hi32;
8101#endif
8102  } ___U64;
8103
8104#define ___S64_from_SM32(val) \
8105___EXT(___S64_from_SM32_fn) (val)
8106
8107#define ___S64_from_SM32_UM32(hi32,lo32) \
8108___EXT(___S64_from_SM32_UM32_fn) (hi32,lo32)
8109
8110#define ___S64_from_LONGLONG(val) \
8111___EXT(___S64_from_LONGLONG_fn) (val)
8112
8113#define ___S64_to_LONGLONG(val) \
8114___EXT(___S64_to_LONGLONG_fn) (val)
8115
8116#define ___S64_fits_in_width(val,width) \
8117___EXT(___S64_fits_in_width_fn) (val,width)
8118
8119#define ___S64_hi32(val)val.hi32
8120#define ___S64_lo32(val)val.lo32
8121
8122#define ___U64_from_UM32(val) \
8123___EXT(___U64_from_UM32_fn) (val)
8124
8125#define ___U64_from_UM32_UM32(hi32,lo32) \
8126___EXT(___U64_from_UM32_UM32_fn) (hi32,lo32)
8127
8128#define ___U64_from_ULONGLONG(val) \
8129___EXT(___U64_from_ULONGLONG_fn) (val)
8130
8131#define ___U64_to_ULONGLONG(val) \
8132___EXT(___U64_to_ULONGLONG_fn) (val)
8133
8134#define ___U64_fits_in_width(val,width) \
8135___EXT(___U64_fits_in_width_fn) (val,width)
8136
8137#define ___U64_mul_UM32_UM32(x,y) \
8138___EXT(___U64_mul_UM32_UM32_fn) (x,y)
8139
8140#define ___U64_add_U64_U64(x,y) \
8141___EXT(___U64_add_U64_U64_fn) (x,y)
8142
8143#define ___U64_hi32(val)val.hi32
8144#define ___U64_lo32(val)val.lo32
8145
8146#endif
8147
8148/* Symbol/keyword structure */
8149
8150typedef ___FAKEWORD ___symkey_struct[5+___PADDING_SIZE];
8151
8152/* Global variable structure */
8153
8154#if ___MAX_PROCESSORS <= 2
8155#define ___GLO_SUBLIST_COUNT ___MAX_PROCESSORS
8156#else
8157#define ___GLO_SUBLIST_COUNT (___MAX_PROCESSORS*4)
8158#endif
8159
8160typedef struct ___glo_struct
8161  {
8162    ___WORD val;
8163    ___WORD prm;
8164    struct ___glo_struct* next;
8165  } ___glo_struct;
8166
8167typedef struct ___glo_sublist_struct
8168  {
8169    ___glo_struct* head;
8170    ___glo_struct* tail;
8171  } ___glo_sublist_struct;
8172
8173typedef struct ___glo_list_struct
8174  {
8175    ___SIZE_T count;    /* number of global variables */
8176    ___glo_sublist_struct sublist[___GLO_SUBLIST_COUNT];
8177  } ___glo_list_struct;
8178
8179/*---------------------------------------------------------------------------*/
8180
8181/*
8182 * Structures for half and full duplex pipes on POSIX.
8183 */
8184
8185typedef struct ___half_duplex_pipe
8186  {
8187    int reading_fd;
8188    int writing_fd;
8189  } ___half_duplex_pipe;
8190
8191typedef struct ___full_duplex_pipe
8192  {
8193    ___half_duplex_pipe input;
8194    ___half_duplex_pipe output;
8195  } ___full_duplex_pipe;
8196
8197/*---------------------------------------------------------------------------*/
8198
8199/*
8200 * Thread system inlined operations.
8201 */
8202
8203#ifdef ___USE_POSIX_THREAD_SYSTEM
8204
8205#ifndef ___DONT_HAVE_PTHREAD_H
8206#include <pthread.h>
8207#endif
8208
8209#define ___MUTEX pthread_mutex_t
8210#define ___MUTEX_DECL(id) ___MUTEX id;
8211#define ___MUTEX_INIT(mut) (pthread_mutex_init (&mut, NULL) == 0)
8212#define ___MUTEX_DESTROY(mut) (pthread_mutex_destroy (&mut) == 0)
8213#define ___MUTEX_LOCK(mut) (pthread_mutex_lock (&mut) == 0)
8214#define ___MUTEX_UNLOCK(mut) (pthread_mutex_unlock (&mut) == 0)
8215
8216#define ___CONDVAR pthread_cond_t
8217#define ___CONDVAR_DECL(id) ___CONDVAR id;
8218#define ___CONDVAR_INIT(cv) (pthread_cond_init (&cv, NULL) == 0)
8219#define ___CONDVAR_DESTROY(cv) (pthread_cond_destroy (&cv) == 0)
8220#define ___CONDVAR_WAIT(cv,mut) (pthread_cond_wait (&cv, &mut) == 0)
8221#define ___CONDVAR_SIGNAL(cv) (pthread_cond_signal (&cv) == 0)
8222
8223#define ___THREAD_ID (pthread_self())
8224
8225#endif
8226
8227
8228#ifdef ___USE_WIN32_THREAD_SYSTEM
8229
8230#define ___MUTEX CRITICAL_SECTION
8231#define ___MUTEX_DECL(id) ___MUTEX id;
8232#define ___MUTEX_INIT(mut) InitializeCriticalSection (&mut)
8233#define ___MUTEX_DESTROY(mut) DeleteCriticalSection (&mut)
8234#define ___MUTEX_LOCK(mut) EnterCriticalSection (&mut)
8235#define ___MUTEX_UNLOCK(mut) LeaveCriticalSection (&mut)
8236
8237#ifdef ___HAVE_CONDITION_VARIABLE
8238
8239#define ___CONDVAR CONDITION_VARIABLE
8240#define ___CONDVAR_DECL(id) ___CONDVAR id;
8241#define ___CONDVAR_INIT(cv) InitializeConditionVariable (&cv)
8242#define ___CONDVAR_DESTROY(cv)
8243#define ___CONDVAR_WAIT(cv,mut) SleepConditionVariableCS (&cv, &mut, INFINITE)
8244#define ___CONDVAR_SIGNAL(cv) WakeConditionVariable (&cv)
8245#define ___CONDVAR_BROADCAST(cv) WakeAllConditionVariable (&cv)
8246
8247#else
8248
8249/*
8250 * The type CONDITION_VARIABLE is not available. Use busy waiting.
8251 */
8252
8253#define ___CONDVAR int
8254#define ___CONDVAR_DECL(id) ___CONDVAR id;
8255#define ___CONDVAR_INIT(cv) cv = 0
8256#define ___CONDVAR_DESTROY(cv)
8257#define ___CONDVAR_WAIT(cv,mut) do { ___MUTEX_UNLOCK(mut); ___MUTEX_LOCK(mut); } while (0)
8258#define ___CONDVAR_SIGNAL(cv)
8259#define ___CONDVAR_BROADCAST(cv)
8260
8261#endif
8262
8263#define ___THREAD_ID (GetCurrentThreadId())
8264
8265#endif
8266
8267
8268#ifndef ___USE_POSIX_THREAD_SYSTEM
8269#ifndef ___USE_WIN32_THREAD_SYSTEM
8270
8271#define ___MUTEX int
8272#define ___MUTEX_DECL(id)
8273#define ___MUTEX_INIT(mut)
8274#define ___MUTEX_DESTROY(mut)
8275#define ___MUTEX_LOCK(mut)
8276#define ___MUTEX_UNLOCK(mut)
8277
8278#define ___CONDVAR int
8279#define ___CONDVAR_DECL(id)
8280#define ___CONDVAR_INIT(cv)
8281#define ___CONDVAR_DESTROY(cv)
8282#define ___CONDVAR_WAIT(cv,mut)
8283#define ___CONDVAR_SIGNAL(cv)
8284
8285#define ___THREAD_ID 0
8286
8287#endif
8288#endif
8289
8290
8291#if ___WS == 4
8292#ifdef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4
8293#define ___USE_sync_builtins
8294#endif
8295#else
8296#if ___WS == 8
8297#ifdef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8
8298#define ___USE_sync_builtins
8299#endif
8300#endif
8301#endif
8302
8303
8304#ifndef ___USE_sync_builtins
8305#ifdef ___USE_WIN32_THREAD_SYSTEM
8306#define ___USE_WIN32_sync
8307#else
8308#ifdef ___USE_POSIX_THREAD_SYSTEM
8309#define ___USE_emulated_sync
8310#else
8311#define ___USE_sequential_sync
8312#endif
8313#endif
8314#endif
8315
8316
8317#ifdef ___USE_sync_builtins
8318
8319#define ___COMPARE_AND_SWAP_WORD(p,oldval,newval) \
8320__sync_val_compare_and_swap(p,oldval,newval)
8321
8322#define ___FETCH_AND_ADD_WORD(p,val) \
8323__sync_fetch_and_add(p,val)
8324
8325#define ___FETCH_AND_CLEAR_WORD(p) \
8326__sync_fetch_and_and(p,0)
8327
8328#define ___SHARED_MEMORY_BARRIER() \
8329__sync_synchronize()
8330
8331#endif
8332
8333
8334#ifdef ___USE_WIN32_sync
8335
8336#define ___COMPARE_AND_SWAP_WORD(p,oldval,newval) \
8337___CAST(___WORD,InterlockedCompareExchangePointer(___CAST(void**,p),___CAST(void*,newval),___CAST(void*,oldval)))
8338
8339#if ___WS == 4
8340#define ___FETCH_AND_ADD_WORD(p,val) \
8341(InterlockedAdd(___CAST(volatile LONG*,p),val)-(val))
8342#define ___FETCH_AND_CLEAR_WORD(p) \
8343InterlockedAnd(___CAST(volatile LONG*,p),0)
8344#else
8345#define ___FETCH_AND_ADD_WORD(p,val) \
8346(InterlockedAdd64(___CAST(volatile LONGLONG*,p),val)-(val))
8347#define ___FETCH_AND_CLEAR_WORD(p) \
8348InterlockedAnd64(___CAST(volatile LONGLONG*,p),0)
8349#endif
8350
8351#define ___SHARED_MEMORY_BARRIER() \
8352MemoryBarrier()
8353
8354#endif
8355
8356
8357#ifdef ___USE_emulated_sync
8358
8359#define ___COMPARE_AND_SWAP_WORD(p,oldval,newval) \
8360___EXT(___emulated_compare_and_swap_word)(p,oldval,newval)
8361
8362#define ___FETCH_AND_ADD_WORD(p,val) \
8363___EXT(___emulated_fetch_and_add_word)(p,val)
8364
8365#define ___FETCH_AND_CLEAR_WORD(p) \
8366___EXT(___emulated_fetch_and_clear_word)(p)
8367
8368#define ___SHARED_MEMORY_BARRIER() \
8369___EXT(___emulated_shared_memory_barrier)()
8370
8371#endif
8372
8373
8374#ifdef ___USE_sequential_sync
8375
8376#define ___COMPARE_AND_SWAP_WORD(p,oldval,newval) \
8377((___ps->temp1 = *(p)) == (oldval) && (*(p) = (newval)), ___ps->temp1)
8378
8379#define ___FETCH_AND_ADD_WORD(p,val) \
8380(___ps->temp1 = *(p), *(p) += (val), ___ps->temp1)
8381
8382#define ___FETCH_AND_CLEAR_WORD(p) \
8383(___ps->temp1 = *(p), *(p) = 0, ___ps->temp1)
8384
8385#define ___SHARED_MEMORY_BARRIER()
8386
8387#endif
8388
8389
8390#ifdef ___CPU_x86
8391#ifdef __GNUC__
8392#ifndef ___CPU_RELAX
8393#define ___CPU_RELAX() __asm__ __volatile__ ("rep;nop")
8394#endif
8395#endif
8396#endif
8397
8398#ifndef ___CPU_RELAX
8399#define ___CPU_RELAX()
8400#endif
8401
8402
8403typedef struct ___thread_struct
8404  {
8405    void (*start_fn) ___P((struct ___thread_struct *self),());
8406
8407    void *data_ptr;
8408    ___SCMOBJ data_scmobj;
8409
8410#ifdef ___USE_POSIX_THREAD_SYSTEM
8411
8412    pthread_t thread_id;
8413
8414#endif
8415
8416#ifdef ___USE_WIN32_THREAD_SYSTEM
8417
8418    HANDLE thread_handle;
8419    DWORD thread_id;
8420
8421#endif
8422  } ___thread;
8423
8424
8425typedef struct ___ticketlock_struct
8426  {
8427    ___VOLATILE ___WORD current_ticket;
8428    ___VOLATILE ___WORD next_ticket;
8429  } ___ticketlock_struct;
8430
8431
8432#define ___TICKETLOCK_HISTORY_LENGTH 65536
8433
8434typedef struct ___ticketlock_location
8435  {
8436    ___VOLATILE ___WORD *id;
8437    ___VOLATILE int lock_op;
8438    ___VOLATILE ___source_location location;
8439  } ___ticketlock_location;
8440
8441
8442typedef struct ___mask_interrupts_state_struct
8443  {
8444    ___sigset_type sigset[3]; /* increase if other interrupts are added */
8445  } ___mask_interrupts_state;
8446
8447
8448typedef ___mask_interrupts_state ___mask_all_interrupts_state;
8449typedef ___mask_interrupts_state ___mask_user_interrupts_state;
8450typedef ___mask_interrupts_state ___mask_heartbeat_interrupts_state;
8451typedef ___mask_interrupts_state ___mask_child_interrupts_state;
8452
8453
8454/*---------------------------------------------------------------------------*/
8455
8456/*
8457 * Activity log structures.
8458 */
8459
8460#ifdef ___ACTIVITY_LOG
8461
8462typedef struct ___actlog_activity
8463  {
8464    ___U8 group;  /* group this activity belongs to */
8465    ___U32 color; /* RGB color of this activity when shown visually */
8466    char *name;   /* name of this activity */
8467  } ___actlog_activity;
8468
8469typedef struct ___actlog_transition
8470  {
8471    ___U16 type;  /* activity type */
8472    ___U64 stamp; /* time stamp when activity started */
8473  } ___actlog_transition;
8474
8475typedef struct ___vmstate_actlog
8476  {
8477    ___MUTEX_DECL(mut)
8478    ___actlog_activity *activities;
8479    int nb_activities;
8480    ___BOOL auto_dump;
8481    int max_processor_count;
8482  } ___vmstate_actlog;
8483
8484typedef struct ___pstate_actlog
8485  {
8486    ___actlog_transition *transitions; /* array of transitions */
8487    ___actlog_transition *last;        /* pointer to last transition */
8488    ___U16 *stack;
8489    int sp;
8490  } ___pstate_actlog;
8491
8492#define ___ACTLOG_COLOR_black     0x000000
8493#define ___ACTLOG_COLOR_white     0xFFFFFF
8494#define ___ACTLOG_COLOR_red       0xFF0000
8495#define ___ACTLOG_COLOR_green     0x00FF00
8496#define ___ACTLOG_COLOR_blue      0x0000FF
8497#define ___ACTLOG_COLOR_yellow    0xFFFF00
8498#define ___ACTLOG_COLOR_magenta   0xFF00FF
8499#define ___ACTLOG_COLOR_pink      0xFF8080
8500#define ___ACTLOG_COLOR_gray      0x808080
8501#define ___ACTLOG_COLOR_lightgray 0xb0b0b0
8502#define ___ACTLOG_COLOR_darkgray  0x505050
8503#define ___ACTLOG_COLOR_brown     0x800000
8504#define ___ACTLOG_COLOR_orange    0xFF8000
8505#define ___ACTLOG_COLOR_purple    0x803E75
8506#define ___ACTLOG_COLOR_lightblue 0xA6BDD7
8507#define ___ACTLOG_COLOR_violet    0x53377A
8508
8509#define ___ACTLOG_COLOR__         0x1000000
8510
8511#define ___ACTLOG_COLOR_rgb(r,g,b) (((___U32)(r)<<16)+((g)<<8)+(b))
8512
8513#define ___ACTLOG_COLOR(color)___ACTLOG_COLOR_##color
8514
8515#define ___ACTIVITY_START_STOP 0xffff
8516
8517#define ___ACTLOG(name,color) \
8518do { \
8519  ___processor_state ___ps = ___PSTATE; \
8520  ___ACTLOG_PS(name,color); \
8521} while (0)
8522
8523#define ___ACTLOG_PS(name,color) \
8524do { \
8525  static ___U16 ___actlog_activity_##name = ___ACTIVITY_START_STOP; \
8526  ___EXT(___actlog_add_pstate)(___ps,&___actlog_activity_##name,#name,___ACTLOG_COLOR(color)); \
8527} while (0)
8528
8529#define ___ACTLOG_BEGIN(name,color) \
8530do { \
8531  ___processor_state ___ps = ___PSTATE; \
8532  ___ACTLOG_BEGIN_PS(name,color); \
8533} while (0)
8534
8535#define ___ACTLOG_BEGIN_PS(name,color) \
8536do { \
8537  static ___U16 ___actlog_activity_##name = ___ACTIVITY_START_STOP; \
8538  ___EXT(___actlog_begin_pstate)(___ps,&___actlog_activity_##name,#name,___ACTLOG_COLOR(color)); \
8539} while (0)
8540
8541#define ___ACTLOG_END() \
8542do { \
8543  ___processor_state ___ps = ___PSTATE; \
8544  ___ACTLOG_END_PS(); \
8545} while (0)
8546
8547#define ___ACTLOG_END_PS() \
8548do { \
8549  ___EXT(___actlog_end_pstate)(___ps); \
8550} while (0)
8551
8552#else
8553
8554#define ___ACTLOG(name,color)
8555
8556#define ___ACTLOG_PS(name,color)
8557
8558#define ___ACTLOG_BEGIN(name,color)
8559
8560#define ___ACTLOG_BEGIN_PS(name,color)
8561
8562#define ___ACTLOG_END()
8563
8564#define ___ACTLOG_END_PS()
8565
8566#endif
8567
8568
8569/*---------------------------------------------------------------------------*/
8570
8571/* TODO: where to put this? */
8572
8573/* Memory management */
8574
8575/*
8576 * Movable Scheme objects are allocated in an area of memory
8577 * distributed in multiple noncontiguous sections (collectively
8578 * called the "msections").  All sections are of the same size and are
8579 * allocated through the '___alloc_mem' function.  The number of
8580 * sections can expand and contract to accommodate the needs of the
8581 * program.
8582 */
8583
8584typedef struct ___msect
8585  {
8586    int index;             /* index in list of sections */
8587    int pos;               /* position in msections's 'sections' array */
8588    struct ___msect *prev; /* previous section in list of sections */
8589    struct ___msect *next; /* next section in list of sections */
8590    ___WORD base[1];       /* content of section */
8591  } ___msection;
8592
8593#define ___sizeof_msection(n) (sizeof (___msection) + ((n)-1) * ___WS)
8594
8595typedef struct
8596  {
8597    int max_nb_sections;      /* actual size of 'sections' array */
8598    int nb_sections;          /* number of sections */
8599    ___msection *head;        /* head of doubly-linked list of sections */
8600    ___msection *tail;        /* tail of doubly-linked list of sections */
8601    ___msection *sections[1]; /* each section ordered by address */
8602                              /* (increasing order if ___ALLOC_MEM_UP */
8603                              /* is defined otherwise decreasing order) */
8604  } ___msections;
8605
8606#define ___sizeof_msections(n) (sizeof (___msections) + ((n)-1) * sizeof (___msection*))
8607
8608/*
8609 * Header structure of reference counted blocks of memory.
8610 */
8611
8612typedef struct ___rc_header_struct
8613  {
8614    struct ___rc_header_struct *prev;
8615    struct ___rc_header_struct *next;
8616    ___SCMOBJ refcount; /* integer but declared ___SCMOBJ for alignment */
8617    ___SCMOBJ data; /* needed for C closures */
8618  } ___rc_header;
8619
8620/* fdset state */
8621#ifndef ___OS_WIN32
8622typedef struct ___fdset_struct {
8623  int size;
8624  void *readfds;
8625  void *writefds;
8626  void *exceptfds;
8627} ___fdset;
8628#endif
8629
8630typedef struct ___pstate_os_struct {
8631
8632  /*
8633   * for implementation of asynchronous interrupting the following
8634   * structures are needed to force ___device_select to abort wait
8635   */
8636#ifdef ___OS_WIN32
8637  HANDLE select_abort; /* WIN32 event */
8638#else
8639  ___half_duplex_pipe select_abort; /* POSIX self-pipe */
8640  ___fdset fdset; /* Dynamic fdsets for unlimited file descriptors */
8641#endif
8642
8643} ___pstate_os;
8644
8645typedef struct ___pstate_mem_struct {
8646
8647/* location of tospace in each msection */
8648___SIZE_TS tospace_offset_;
8649
8650/* msection free list */
8651___msection *msection_free_list_;
8652
8653/* msection where continuation frames are currently being allocated */
8654___msection *stack_msection_;
8655
8656/* start of allocation of continuation frames in stack_msection */
8657___WORD *alloc_stack_start_;
8658
8659/* allocation pointer for continuation frames in stack_msection */
8660___WORD *alloc_stack_ptr_;
8661
8662/* allocation limit for continuation frames in stack_msection */
8663___WORD *alloc_stack_limit_;
8664
8665/* msection where movable objects are currently being allocated */
8666___msection *heap_msection_;
8667
8668/* start of allocation of movable objects in heap_msection */
8669___WORD *alloc_heap_start_;
8670
8671/* allocation pointer for movable objects in heap_msection */
8672___WORD *alloc_heap_ptr_;
8673
8674/* allocation limit for movable objects in heap_msection */
8675___WORD *alloc_heap_limit_;
8676
8677/* start of current group of movable objects being copied by mark_array */
8678___WORD *alloc_heap_chunk_start_;
8679
8680/* allocation limit for movable objects in current chunk */
8681___WORD *alloc_heap_chunk_limit_;
8682
8683#ifndef ___SINGLE_THREADED_VMS
8684
8685/* spinlock for accessing the movable object chunks remaining to scan */
8686___SPINLOCK_DECL(heap_chunks_to_scan_lock_)
8687
8688#endif
8689
8690/* list of complete movable object chunks to scan */
8691___VOLATILE ___WORD heap_chunks_to_scan_;
8692
8693/* fifo of complete movable object chunks remaining to scan */
8694___VOLATILE ___WORD * ___VOLATILE heap_chunks_to_scan_head_;
8695___VOLATILE ___WORD * ___VOLATILE heap_chunks_to_scan_tail_;
8696
8697/* scan pointer in currently scanned (possibly incomplete) chunk */
8698___WORD *scan_ptr_;
8699
8700/* still objects remaining to scan */
8701___WORD still_objs_to_scan_;
8702
8703/* list of still objects */
8704___WORD still_objs_;
8705
8706/* words occupied by still objects */
8707___SIZE_TS words_still_objs_;
8708
8709/* words occupied by still objects not yet accounted for at the VM level */
8710___SIZE_TS words_still_objs_deferred_;
8711
8712/* bytes allocated minus occupied */
8713___F64 bytes_allocated_minus_occupied_;
8714
8715/* head of list of reference counted blocks of memory */
8716___rc_header rc_head_;
8717
8718/* indicates if weak references must be traversed */
8719___BOOL traverse_weak_refs_;
8720
8721/* list of nonexecutable wills */
8722___WORD nonexecutable_wills_;
8723
8724/* list of executable wills */
8725___WORD executable_wills_;
8726
8727/* GC hash tables reached by GC */
8728___WORD reached_gc_hash_tables_;
8729
8730/* words occupied in msections of this processor excluding current msections */
8731___SIZE_TS words_prev_msections_;
8732
8733/* space used in msection stack fudge */
8734___SIZE_TS stack_fudge_used_;
8735
8736/* space used in msection heap fudge */
8737___SIZE_TS heap_fudge_used_;
8738
8739#ifdef ___DEBUG_GARBAGE_COLLECT
8740
8741/* GC state used for debugging */
8742int reference_location_; /* where is offending reference located */
8743___WORD *container_body_; /* body of object containing offending reference */
8744int mark_array_call_line_; /* where was mark_array called */
8745
8746#endif
8747
8748#ifdef ___CALL_GC_FREQUENTLY
8749int gc_calls_to_punt_;
8750#endif
8751} ___pstate_mem;
8752
8753#ifndef ___OS_WIN32
8754typedef struct ___vmstate_fdset_struct {
8755  int size;
8756  ___VOLATILE int overflow;
8757} ___vmstate_fdset;
8758#endif
8759
8760typedef struct ___vmstate_os_struct {
8761#ifdef ___OS_WIN32
8762  int dummy; /* avoid empty struct error raised by MSVC */
8763#else
8764  ___vmstate_fdset fdset;
8765#endif
8766} ___vmstate_os;
8767
8768typedef struct ___vmstate_mem_struct {
8769
8770/* size of heap in words (number of words that can be occupied) */
8771___SIZE_TS heap_size_;
8772
8773/*
8774 * 'normal_overflow_reserve' is the number of words reserved in the
8775 * heap in normal circumstances for handling heap overflows.
8776 */
8777___SIZE_TS normal_overflow_reserve_;
8778
8779/*
8780 * 'overflow_reserve' is the number of words currently reserved in the
8781 * heap for handling heap overflows.  Initially 'overflow_reserve' is
8782 * set to 'normal_overflow_reserve'.  When a heap overflow occurs,
8783 * some fraction of the 'overflow_reserve' is made available to the
8784 * heap overflow handler.  When a GC makes at least
8785 * 'normal_overflow_reserve' free, then 'overflow_reserve' is reset to
8786 * 'normal_overflow_reserve'.
8787 */
8788___SIZE_TS overflow_reserve_;
8789
8790/* words occupied by movable objects (only updated at end of GC) */
8791___SIZE_TS occupied_words_movable_;
8792
8793/* words occupied by still objects (excluding deferred ones) */
8794___SIZE_TS occupied_words_still_;
8795
8796/* the msections */
8797___msections *the_msections_;
8798
8799/* last msection allocated */
8800___msection *alloc_msection_;
8801
8802/* number of msections assigned to processors */
8803int nb_msections_assigned_;
8804
8805/* Used for resizing VM (number of processors after the resize operation) */
8806___VOLATILE int target_processor_count_;
8807
8808#ifndef ___SINGLE_THREADED_VMS
8809
8810/* spinlock for miscellaneous memory operations at the VM level */
8811___SPINLOCK_DECL(misc_mem_lock_)
8812
8813/* spinlock for allocation of memory at the VM level */
8814___SPINLOCK_DECL(alloc_mem_lock_)
8815
8816/* mutex and condition variable to determine termination of GC scan */
8817___MUTEX_DECL(scan_termination_mutex_)
8818___CONDVAR_DECL(scan_termination_condvar_)
8819
8820/* number of processors currently doing GC scan work (for each phase) */
8821___VOLATILE ___WORD scan_workers_count_[2];
8822
8823#endif
8824
8825/*
8826 * Garbage collection statistics.
8827 */
8828
8829___F64 nb_gcs_;
8830___F64 gc_user_time_;
8831___F64 gc_sys_time_;
8832___F64 gc_real_time_;
8833
8834___F64 latest_gc_user_time_;
8835___F64 latest_gc_sys_time_;
8836___F64 latest_gc_real_time_;
8837___F64 latest_gc_heap_size_;
8838___F64 latest_gc_alloc_;
8839___F64 latest_gc_live_;
8840___F64 latest_gc_movable_;
8841___F64 latest_gc_still_;
8842
8843} ___vmstate_mem;
8844
8845typedef struct ___gstate_mem_struct {
8846
8847  /*
8848   * Permanent objects are allocated in sections called "psections".
8849   * Each section contains multiple objects.  The sections are kept in a
8850   * list so that the storage they occupy can be reclaimed when the
8851   * program terminates.
8852   */
8853
8854  void *psections;       /* list of psections */
8855  ___WORD *palloc_ptr;   /* allocation pointer in current psection */
8856  ___WORD *palloc_limit; /* allocation limit in current psection */
8857
8858  /*
8859   * Global variable list.
8860   */
8861
8862  ___glo_list_struct glo_list;
8863
8864} ___gstate_mem;
8865
8866/*---------------------------------------------------------------------------*/
8867
8868typedef struct ___processor_state_struct *___processor_state;
8869typedef struct ___virtual_machine_state_struct *___virtual_machine_state;
8870typedef struct ___global_state_struct *___global_state;
8871
8872/* For implementation of on_all_processors */
8873
8874typedef struct ___sync_op_struct
8875  {
8876    ___VOLATILE unsigned char op; /* operation requested */
8877    ___VOLATILE ___WORD arg[2];   /* arguments of the operation */
8878  } ___sync_op_struct;
8879
8880/* Processor structure */
8881
8882typedef struct ___processor_state_struct
8883  {
8884    ___WORD * ___VOLATILE stack_trip;
8885    ___WORD *stack_limit;
8886    ___WORD *fp;
8887    ___WORD *stack_start;
8888    ___WORD *stack_break;
8889
8890    ___WORD *heap_limit;
8891    ___WORD *hp;
8892
8893    ___WORD r[___NB_GVM_REGS]; /* GVM registers */
8894
8895    ___WORD pc;
8896    ___WORD na;
8897
8898    ___WORD saved[3]; /* Scheme objects protected from GC */
8899
8900    /* these handlers are duplicated from the global state for quick access */
8901
8902    ___WORD handler_sfun_conv_error;
8903    ___WORD handler_cfun_conv_error;
8904    ___WORD handler_stack_limit;
8905    ___WORD handler_heap_limit;
8906    ___WORD handler_not_proc;
8907    ___WORD handler_not_proc_glo;
8908    ___WORD handler_wrong_nargs;
8909    ___WORD handler_get_rest;
8910    ___WORD handler_get_key;
8911    ___WORD handler_get_key_rest;
8912    ___WORD handler_force;
8913    ___WORD handler_return_to_c;
8914    ___WORD handler_break;
8915    ___WORD internal_return;
8916    ___WORD dynamic_env_bind_return;
8917
8918    ___WORD temp1;
8919    ___WORD temp2;
8920    ___WORD temp3;
8921    ___WORD temp4;
8922
8923    ___F64 f64_temp1;
8924    ___F64 f64_temp2;
8925
8926    ___WORD intr_enabled; /* global interrupt enable */
8927    ___WORD intr_mask; /* 1 bit means interrupt disabled */
8928    ___VOLATILE ___WORD intr_flag[___NB_INTRS];
8929
8930    ___WORD processor_scmobj[___SUBTYPED_BODY+___PROCESSOR_SIZE+___PADDING_SIZE]; /* Scheme processor object */
8931
8932#ifdef ___ACTIVITY_LOG
8933    ___pstate_actlog actlog; /* activity log state */
8934#endif
8935
8936    ___pstate_os os; /* OS specific state */
8937
8938    ___pstate_mem mem; /* memory management state */
8939
8940#ifdef ___DEBUG_CTRL_FLOW_HISTORY
8941    unsigned int ctrl_flow_history_index;
8942    ___source_location ctrl_flow_history[___CTRL_FLOW_HISTORY_LENGTH];
8943#endif
8944
8945#ifdef ___DEBUG_STACK_LIMIT
8946    ___source_location poll_location;
8947    ___source_location stack_limit_location;
8948#endif
8949
8950#ifdef ___DEBUG_HEAP_LIMIT
8951    ___source_location check_heap_location;
8952    ___source_location heap_limit_location;
8953#endif
8954
8955#ifdef ___HEARTBEAT_USING_POLL_COUNTDOWN
8956    int heartbeat_interval;
8957    int heartbeat_countdown;
8958#endif
8959
8960#ifdef ___USE_SETJMP
8961    ___jmpbuf_struct *catcher;
8962#endif
8963
8964#ifndef ___SINGLE_THREADED_VMS
8965
8966    /* this processor's VM */
8967    ___virtual_machine_state vmstate;
8968
8969    /* this processor's OS thread */
8970    ___thread os_thread;
8971
8972    /* for implementation of on_all_processors */
8973    ___VOLATILE int sync_id0;
8974    ___sync_op_struct sync_op0;
8975    ___VOLATILE int sync_id1;
8976    ___sync_op_struct sync_op1;
8977    ___VOLATILE int sync_id2;
8978    ___sync_op_struct sync_op2;
8979    ___MUTEX_DECL(sync_mut)
8980    ___CONDVAR_DECL(sync_cv)
8981
8982#endif
8983  } ___processor_state_struct;
8984
8985#ifdef ___SUPPORT_LOWLEVEL_EXEC
8986
8987typedef struct ___lowlevel_processor_state_struct
8988  {
8989    ___WORD *return_sp;
8990    ___WORD *return_handler;
8991  } ___lowlevel_processor_state_struct;
8992
8993typedef struct ___aligned_lowlevel_processor_state_struct
8994  {
8995#ifdef ___PSTATE_ALIGN_MODULUS
8996    /*
8997     * pad so that the structure will be of a size that is a multiple
8998     * of ___PSTATE_ALIGN_MODULUS
8999     */
9000    ___WORD padding[(___PSTATE_ALIGN_MODULUS
9001#ifdef ___SUPPORT_LOWLEVEL_EXEC
9002                     - sizeof(___lowlevel_processor_state_struct)
9003#endif
9004                    ) >> ___LWS];
9005#endif
9006    ___lowlevel_processor_state_struct llpstate;
9007  } ___aligned_lowlevel_processor_state_struct;
9008
9009#endif
9010
9011typedef struct ___aligned_processor_state_struct
9012  {
9013#ifdef ___SUPPORT_LOWLEVEL_EXEC
9014    ___aligned_lowlevel_processor_state_struct aligned_llpstate;
9015#endif
9016
9017    ___processor_state_struct pstate;
9018
9019#if ___MAX_PROCESSORS > 1
9020#ifdef ___PSTATE_ALIGN_MULTIPLIER
9021    /*
9022     * pad so that ___aligned_processor_state_struct is a size that is
9023     * a multiple of ___PSTATE_ALIGN_MULTIPLIER
9024     */
9025    char padding[___PSTATE_ALIGN_MULTIPLIER -
9026                 (___PSTATE_ALIGN_MODULUS + sizeof(___processor_state_struct))
9027                 % ___PSTATE_ALIGN_MULTIPLIER];
9028#endif
9029#endif
9030  } ___aligned_processor_state_struct;
9031
9032typedef ___WORD (*___host) ___P((___processor_state ___ps),());
9033
9034typedef struct ___label_struct
9035  {
9036#ifdef ___SUPPORT_LABEL_VALUES
9037    ___FAKEVOIDSTAR host_label;
9038#define ___LABEL_HOST_LABEL (-3)
9039#define ___LABEL_HOST_LABEL_GET(lbl) \
9040*___CAST(___FAKEVOIDSTAR*,___SUBTYPED_TO(lbl,___LABEL_HOST_LABEL))
9041#define ___LABEL_HOST_LABEL_SET(lbl,hlbl) \
9042___LABEL_HOST_LABEL_GET(lbl) = hlbl
9043#define ___LABEL_PLACEHOLDER1(x) x,
9044#define ___LABEL_PLACEHOLDER2(x)
9045#define ___LABEL_NAME ___LABEL_HOST_LABEL
9046#define ___LABEL_START_TO_BODY 3
9047#else
9048#define ___LABEL_PLACEHOLDER1(x)
9049#define ___LABEL_PLACEHOLDER2(x) ,x
9050#define ___LABEL_NAME (___LABEL_ENTRY_OR_DESCR+1)
9051#define ___LABEL_START_TO_BODY 2
9052#endif
9053#define ___LABEL_NAME_GET(lbl) *___SUBTYPED_TO(lbl,___LABEL_NAME)
9054#define ___LABEL_NAME_SET(lbl, val) ___LABEL_NAME_GET(lbl) = val
9055
9056    ___FAKEHOST host;
9057#define ___LABEL_HOST (-2)
9058#define ___LABEL_HOST_GET(lbl) \
9059(*___CAST(___FAKEHOST*,___SUBTYPED_TO(lbl,___LABEL_HOST)))
9060
9061    ___WORD header;
9062
9063    ___WORD entry_or_descr;
9064#define ___LABEL_ENTRY_OR_DESCR 0
9065#define ___LABEL_INFO ___LABEL_ENTRY_OR_DESCR
9066#define ___LABEL_ENTRY_GET(lbl) *___SUBTYPED_TO(lbl,___LABEL_ENTRY_OR_DESCR)
9067#define ___LABEL_ENTRY_SET(lbl, val) ___LABEL_ENTRY_GET(lbl) = val
9068#define ___LABEL_DESCR_GET(lbl) ___LABEL_ENTRY_GET(lbl)
9069#define ___LABEL_DESCR_SET(lbl, val) ___LABEL_ENTRY_SET(lbl, val)
9070#define ___LABEL_INFO_GET(lbl) ___LABEL_ENTRY_GET(lbl)
9071#define ___LABEL_INFO_SET(lbl, val) ___LABEL_ENTRY_SET(lbl, val)
9072
9073#if ___LABEL_SIZE - ___LABEL_START_TO_BODY - 1 > 0
9074    ___FAKEVOIDSTAR padding[___LABEL_SIZE - ___LABEL_START_TO_BODY - 1];
9075#endif
9076  } ___label_struct;
9077
9078#if ___LABEL_SIZE == 4
9079#define ___LABEL_ZERO_FILL
9080#else
9081#if ___LABEL_SIZE == 5
9082#define ___LABEL_ZERO_FILL ,0
9083#else
9084#if ___LABEL_SIZE == 6
9085#define ___LABEL_ZERO_FILL ,0,0
9086#else
9087#if ___LABEL_SIZE == 7
9088#define ___LABEL_ZERO_FILL ,0,0,0
9089#else
9090#define ___LABEL_ZERO_FILL ,0,0,0,0
9091#endif
9092#endif
9093#endif
9094#endif
9095
9096#define ___BEGIN_LBL \
9097___LOCAL ___label_struct ___lbltbl[]={
9098
9099#define ___DEF_LBL_INTRO(id,name,info,nlbls,cproc) \
9100{ ___LABEL_PLACEHOLDER1(___CAST_VOIDSTAR_TO_FAKEVOIDSTAR(name)) \
9101  ___CAST_HOST_TO_FAKEHOST(___CAST(___host,cproc)), \
9102  ___MAKE_HD((nlbls<<___LWS),___sVECTOR,___PERM), \
9103  info \
9104  ___LABEL_PLACEHOLDER2(___CAST_VOIDSTAR_TO_FAKEVOIDSTAR(name)) \
9105  ___LABEL_ZERO_FILL \
9106}
9107
9108#define ___DEF_LBL_PROC(id,nbp,nbc) \
9109{ ___LABEL_PLACEHOLDER1(0) \
9110  ___CAST_HOST_TO_FAKEHOST(___SM(___MH_PROC,id)), \
9111  ___PRD(nbp,nbc), \
9112  0 \
9113  ___LABEL_PLACEHOLDER2(0) \
9114  ___LABEL_ZERO_FILL \
9115}
9116
9117#define ___DEF_LBL_RET(id,frm) \
9118{ ___LABEL_PLACEHOLDER1(0) \
9119  ___CAST_HOST_TO_FAKEHOST(___SM(___MH_PROC,id)), \
9120  ___MAKE_HD(0,___sRETURN,___PERM), \
9121  frm \
9122  ___LABEL_PLACEHOLDER2(0) \
9123  ___LABEL_ZERO_FILL \
9124}
9125
9126#define ___END_LBL \
9127___PADDING_LBL};
9128
9129/* Module structure */
9130
9131typedef struct ___module_struct
9132  {
9133    int version;
9134    int kind;
9135    ___UTF_8STRING name;
9136    int flags;
9137    ___FAKEWORD *glotbl; int glocount; int supcount;
9138    ___UTF_8STRING *glo_names;
9139    ___FAKEWORD *symtbl; int symcount;
9140    ___UTF_8STRING *sym_names;
9141    ___FAKEWORD *keytbl; int keycount;
9142    ___UTF_8STRING *key_names;
9143    ___WORD *lp;
9144    ___label_struct *lbltbl; int lblcount;
9145    ___WORD *ofdtbl; int ofd_length;
9146    ___WORD *cnstbl; int cnscount;
9147    ___FAKEWORD *subtbl; int subcount;
9148    ___WORD (*setup_mod) ___PVOID;
9149    ___WORD (*init_mod) ___P((___PSDNC),());
9150    ___UTF_8STRING script_line;
9151    struct ___module_struct *next;
9152    ___SCMOBJ moddescr; /* module descriptor */
9153  } ___module_struct;
9154
9155/* Linkfile structure */
9156
9157typedef struct ___linkinfo_struct
9158  {
9159    union ___mod_or_lnk_union *mol;
9160    ___SCMOBJ flags;
9161  } ___linkinfo;
9162
9163typedef struct ___linkfile_struct
9164  {
9165    int version;
9166    int kind;
9167    ___UTF_8STRING name;
9168    ___FAKEWORD *sym_list;
9169    ___FAKEWORD *key_list;
9170    ___linkinfo *linkertbl;
9171  } ___linkfile_struct;
9172
9173/* Module or linkfile structure */
9174
9175typedef union ___mod_or_lnk_union
9176  {
9177    ___module_struct module;
9178    ___linkfile_struct linkfile;
9179  } *___mod_or_lnk;
9180
9181/* Program startup information structure */
9182
9183typedef struct ___program_startup_info_struct
9184  {
9185    ___UCS_2STRING *argv;
9186    ___UCS_2STRING script_line;
9187
9188#ifdef ___OS_WIN32
9189
9190    HINSTANCE hInstance;
9191    HINSTANCE hPrevInstance;
9192    LPSTR lpCmdLine;
9193    int nCmdShow;
9194
9195#endif
9196  } ___program_startup_info_struct;
9197
9198/* Virtual machine state structure */
9199
9200typedef struct ___virtual_machine_state_struct
9201  {
9202    ___aligned_processor_state_struct aligned_pstate[___MAX_PROCESSORS]; /* VM's processors */
9203
9204    ___VOLATILE int processor_count; /* number of processors in this VM */
9205
9206    ___WORD vm_scmobj[___SUBTYPED_BODY+___VM_SIZE+___PADDING_SIZE]; /* Scheme vm object */
9207
9208#ifdef ___ACTIVITY_LOG
9209    ___vmstate_actlog actlog; /* activity log state */
9210#endif
9211
9212#ifdef ___DEBUG_TICKETLOCK
9213    ___VOLATILE ___WORD ticketlock_history_index;
9214    ___ticketlock_location ticketlock_history[___TICKETLOCK_HISTORY_LENGTH];
9215#endif
9216
9217    ___vmstate_os os; /* OS specific state */
9218
9219    ___vmstate_mem mem; /* memory management state */
9220
9221    ___SCMOBJ main_module_id; /* symbol identifying the VM's main module */
9222
9223#ifndef ___SINGLE_VM
9224
9225    ___VOLATILE ___virtual_machine_state prev; /* circular list links */
9226    ___VOLATILE ___virtual_machine_state next;
9227
9228    ___SCMOBJ *glos; /* Scheme global variables */
9229
9230#endif
9231
9232  } ___virtual_machine_state_struct;
9233
9234#define ___PROCESSOR_ID(ps,vms) \
9235(___CAST(___aligned_processor_state_struct*,ps) - \
9236 ___CAST(___aligned_processor_state_struct*,&(vms)->aligned_pstate[0].pstate))
9237
9238
9239#define ___PSTATE_FROM_PROCESSOR_ID(id,vms) \
9240(&(vms)->aligned_pstate[id].pstate)
9241
9242/* Setup parameters structure */
9243
9244typedef struct ___setup_params_struct
9245  {
9246    int version;
9247    ___UCS_2STRING *argv;
9248    ___SIZE_T min_heap;
9249    ___SIZE_T max_heap;
9250    int live_percent;
9251    int parallelism_level;
9252    ___SIZE_TS (*adjust_heap_hook) ___P((___SIZE_TS live),());
9253    void (*display_error) ___P((char **msgs),());
9254    void (*fatal_error) ___P((char **msgs),());
9255    int standard_level;
9256    int debug_settings;
9257    int file_settings;
9258    int terminal_settings;
9259    int stdio_settings;
9260    ___UCS_2STRING gambitdir;
9261    ___UCS_2STRING *gambitdir_map;
9262    ___UCS_2STRING remote_dbg_addr;
9263    ___UCS_2STRING rpc_server_addr;
9264    ___mod_or_lnk (*linker) ___P((___global_state),());
9265
9266    ___UCS_2 reset_argv0[1]; /* defaults for argv */
9267    ___UCS_2STRING reset_argv[2];
9268  } ___setup_params_struct;
9269
9270#define ___DEBUG_SETTINGS_LEVEL_MASK          15
9271#define ___DEBUG_SETTINGS_LEVEL_SHIFT         0
9272#define ___DEBUG_SETTINGS_UNCAUGHT_MASK       (1<<4)
9273#define ___DEBUG_SETTINGS_UNCAUGHT_PRIMORDIAL 0
9274#define ___DEBUG_SETTINGS_UNCAUGHT_ALL        1
9275#define ___DEBUG_SETTINGS_UNCAUGHT_SHIFT      4
9276#define ___DEBUG_SETTINGS_ERROR_MASK          (3<<5)
9277#define ___DEBUG_SETTINGS_ERROR_REPL          0
9278#define ___DEBUG_SETTINGS_ERROR_SINGLE_STEP   1
9279#define ___DEBUG_SETTINGS_ERROR_QUIT          2
9280#define ___DEBUG_SETTINGS_ERROR_SHIFT         5
9281#define ___DEBUG_SETTINGS_REPL_MASK           (3<<7)
9282#define ___DEBUG_SETTINGS_REPL_IDE            0
9283#define ___DEBUG_SETTINGS_REPL_CONSOLE        1
9284#define ___DEBUG_SETTINGS_REPL_STDIO          2
9285#define ___DEBUG_SETTINGS_REPL_REMOTE         3
9286#define ___DEBUG_SETTINGS_REPL_SHIFT          7
9287#define ___DEBUG_SETTINGS_USER_INTR_MASK      (3<<9)
9288#define ___DEBUG_SETTINGS_USER_INTR_REPL      0
9289#define ___DEBUG_SETTINGS_USER_INTR_DEFER     1
9290#define ___DEBUG_SETTINGS_USER_INTR_QUIT      2
9291#define ___DEBUG_SETTINGS_USER_INTR_SHIFT     9
9292
9293#define ___DEBUG_SETTINGS_LEVEL(settings) \
9294(((settings) & ___DEBUG_SETTINGS_LEVEL_MASK) \
9295 >> ___DEBUG_SETTINGS_LEVEL_SHIFT)
9296
9297#define ___DEBUG_SETTINGS_UNCAUGHT(settings) \
9298(((settings) & ___DEBUG_SETTINGS_UNCAUGHT_MASK) \
9299 >> ___DEBUG_SETTINGS_LEVEL_SHIFT)
9300
9301#define ___DEBUG_SETTINGS_ERROR(settings) \
9302(((settings) & ___DEBUG_SETTINGS_ERROR_MASK) \
9303 >> ___DEBUG_SETTINGS_LEVEL_SHIFT)
9304
9305#define ___DEBUG_SETTINGS_REPL(settings) \
9306(((settings) & ___DEBUG_SETTINGS_REPL_MASK) \
9307 >> ___DEBUG_SETTINGS_LEVEL_SHIFT)
9308
9309#define ___DEBUG_SETTINGS_USER_INTR(settings) \
9310(((settings) & ___DEBUG_SETTINGS_USER_INTR_MASK) \
9311 >> ___DEBUG_SETTINGS_LEVEL_SHIFT)
9312
9313#define ___DEBUG_SETTINGS_INITIAL \
9314((1 << ___DEBUG_SETTINGS_LEVEL_SHIFT) | \
9315 (___DEBUG_SETTINGS_UNCAUGHT_PRIMORDIAL \
9316  << ___DEBUG_SETTINGS_UNCAUGHT_SHIFT) | \
9317 (___DEBUG_SETTINGS_ERROR_QUIT \
9318  << ___DEBUG_SETTINGS_ERROR_SHIFT) | \
9319 (___DEBUG_SETTINGS_REPL_IDE \
9320  << ___DEBUG_SETTINGS_REPL_SHIFT) | \
9321 (___DEBUG_SETTINGS_USER_INTR_QUIT \
9322  << ___DEBUG_SETTINGS_USER_INTR_SHIFT))
9323
9324#define ___DEBUG_SETTINGS_DEFAULT \
9325((1 << ___DEBUG_SETTINGS_LEVEL_SHIFT) | \
9326 (___DEBUG_SETTINGS_UNCAUGHT_PRIMORDIAL \
9327  << ___DEBUG_SETTINGS_UNCAUGHT_SHIFT) | \
9328 (___DEBUG_SETTINGS_ERROR_REPL \
9329  << ___DEBUG_SETTINGS_ERROR_SHIFT) | \
9330 (___DEBUG_SETTINGS_REPL_IDE \
9331  << ___DEBUG_SETTINGS_REPL_SHIFT) | \
9332 (___DEBUG_SETTINGS_USER_INTR_REPL \
9333  << ___DEBUG_SETTINGS_USER_INTR_SHIFT))
9334
9335/* Global state structure */
9336
9337typedef struct ___global_state_struct
9338  {
9339    ___virtual_machine_state_struct vmstate0; /* first VM */
9340
9341#ifndef ___SINGLE_VM
9342    ___MUTEX_DECL(vm_list_mut) /* mutex for accessing VM list */
9343#endif
9344
9345    int setup_state; /* 0=pre-setup, 1=post-setup, 2=post-cleanup */
9346
9347    ___setup_params_struct setup_params; /* params received by ___setup */
9348
9349    /* these handlers are duplicated in the processor state for quick access */
9350
9351    ___WORD handler_sfun_conv_error;
9352    ___WORD handler_cfun_conv_error;
9353    ___WORD handler_stack_limit;
9354    ___WORD handler_heap_limit;
9355    ___WORD handler_not_proc;
9356    ___WORD handler_not_proc_glo;
9357    ___WORD handler_wrong_nargs;
9358    ___WORD handler_get_rest;
9359    ___WORD handler_get_key;
9360    ___WORD handler_get_key_rest;
9361    ___WORD handler_force;
9362    ___WORD handler_return_to_c;
9363    ___WORD handler_break;
9364    ___WORD internal_return;
9365    ___WORD dynamic_env_bind_return;
9366
9367    ___SCMOBJ symbol_table;   /* Hash table of all interned symbols.  */
9368    ___SCMOBJ keyword_table;  /* Hash table of all interned keywords. */
9369    ___SCMOBJ command_line;   /* List of command line arguments.      */
9370    ___SCMOBJ program_descr;  /* Program descriptor.                  */
9371
9372    ___gstate_mem mem; /* memory management state */
9373
9374#ifndef ___CAN_IMPORT_CLIB_DYNAMICALLY
9375    double (*fabs)
9376       ___P((double x),
9377            ());
9378    double (*floor)
9379       ___P((double x),
9380            ());
9381    double (*ceil)
9382       ___P((double x),
9383            ());
9384    double (*scalbn)
9385       ___P((double x,
9386             int n),
9387            ());
9388    int (*ilogb)
9389       ___P((double x),
9390            ());
9391    double (*exp)
9392       ___P((double x),
9393            ());
9394    double (*expm1)
9395       ___P((double x),
9396            ());
9397    double (*log)
9398       ___P((double x),
9399            ());
9400    double (*log1p)
9401       ___P((double x),
9402            ());
9403    double (*sin)
9404       ___P((double x),
9405            ());
9406    double (*cos)
9407       ___P((double x),
9408            ());
9409    double (*tan)
9410       ___P((double x),
9411            ());
9412    double (*asin)
9413       ___P((double x),
9414            ());
9415    double (*acos)
9416       ___P((double x),
9417            ());
9418    double (*atan)
9419       ___P((double x),
9420            ());
9421    double (*sinh)
9422       ___P((double x),
9423            ());
9424    double (*cosh)
9425       ___P((double x),
9426            ());
9427    double (*tanh)
9428       ___P((double x),
9429            ());
9430    double (*asinh)
9431       ___P((double x),
9432            ());
9433    double (*acosh)
9434       ___P((double x),
9435            ());
9436    double (*atanh)
9437       ___P((double x),
9438            ());
9439    double (*atan2)
9440       ___P((double y,
9441             double x),
9442            ());
9443    double (*pow)
9444       ___P((double x,
9445             double y),
9446            ());
9447    double (*sqrt)
9448       ___P((double x),
9449            ());
9450#endif
9451
9452#ifndef ___CAN_IMPORT_DYNAMICALLY
9453    ___BOOL (*___iswalpha)
9454       ___P((___UCS_4 x),
9455            ());
9456    ___BOOL (*___iswdigit)
9457       ___P((___UCS_4 x),
9458            ());
9459    ___BOOL (*___iswspace)
9460       ___P((___UCS_4 x),
9461            ());
9462    ___BOOL (*___iswupper)
9463       ___P((___UCS_4 x),
9464            ());
9465    ___BOOL (*___iswlower)
9466       ___P((___UCS_4 x),
9467            ());
9468    ___UCS_4 (*___towupper)
9469       ___P((___UCS_4 x),
9470            ());
9471    ___UCS_4 (*___towlower)
9472       ___P((___UCS_4 x),
9473            ());
9474    ___SCMOBJ (*___string_collate)
9475       ___P((___SCMOBJ s1,
9476             ___SCMOBJ s2),
9477            ());
9478    ___SCMOBJ (*___string_collate_ci)
9479       ___P((___SCMOBJ s1,
9480             ___SCMOBJ s2),
9481            ());
9482    double (*___copysign)
9483       ___P((double x,
9484             double y),
9485            ());
9486    ___BOOL (*___isfinite)
9487       ___P((double x),
9488            ());
9489    ___BOOL (*___isnan)
9490       ___P((double x),
9491            ());
9492    double (*___trunc)
9493       ___P((double x),
9494            ());
9495    double (*___round)
9496       ___P((double x),
9497            ());
9498#ifdef ___DEFINE_SCALBN
9499    double (*___scalbn)
9500       ___P((double x,
9501             int n),
9502            ());
9503#endif
9504#ifdef ___DEFINE_ILOGB
9505    int (*___ilogb)
9506       ___P((double x),
9507            ());
9508#endif
9509#ifdef ___DEFINE_EXPM1
9510    double (*___expm1)
9511       ___P((double x),
9512            ());
9513#endif
9514#ifdef ___DEFINE_LOG1P
9515    double (*___log1p)
9516       ___P((double x),
9517            ());
9518#endif
9519#ifdef ___DEFINE_SINH
9520    double (*___sinh)
9521       ___P((double x),
9522            ());
9523#endif
9524#ifdef ___DEFINE_COSH
9525    double (*___cosh)
9526       ___P((double x),
9527            ());
9528#endif
9529#ifdef ___DEFINE_TANH
9530    double (*___tanh)
9531       ___P((double x),
9532            ());
9533#endif
9534#ifdef ___DEFINE_ASINH
9535    double (*___asinh)
9536       ___P((double x),
9537            ());
9538#endif
9539#ifdef ___DEFINE_ACOSH
9540    double (*___acosh)
9541       ___P((double x),
9542            ());
9543#endif
9544#ifdef ___DEFINE_ATANH
9545    double (*___atanh)
9546       ___P((double x),
9547            ());
9548#endif
9549#ifdef ___DEFINE_ATAN2
9550    double (*___atan2)
9551       ___P((double y,
9552             double x),
9553            ());
9554#endif
9555#ifdef ___DEFINE_POW
9556    double (*___pow)
9557       ___P((double x,
9558             double y),
9559            ());
9560#endif
9561    ___SCMOBJ (*___F64_to_STRING)
9562       ___P((___PSD
9563             double x),
9564            ());
9565    ___S64 (*___S64_from_SM32_fn)
9566       ___P((___SM32 val),
9567            ());
9568    ___S64 (*___S64_from_SM32_UM32_fn)
9569       ___P((___SM32 hi32,
9570             ___UM32 lo32),
9571            ());
9572    ___S64 (*___S64_from_LONGLONG_fn)
9573       ___P((___LONGLONG val),
9574            ());
9575    ___LONGLONG (*___S64_to_LONGLONG_fn)
9576       ___P((___S64 val),
9577            ());
9578    ___BOOL (*___S64_fits_in_width_fn)
9579       ___P((___S64 val,
9580             int width),
9581            ());
9582    ___U64 (*___U64_from_UM32_fn)
9583       ___P((___UM32 val),
9584            ());
9585    ___U64 (*___U64_from_UM32_UM32_fn)
9586       ___P((___UM32 hi32,
9587             ___UM32 lo32),
9588            ());
9589    ___U64 (*___U64_from_ULONGLONG_fn)
9590       ___P((___ULONGLONG val),
9591            ());
9592    ___ULONGLONG (*___U64_to_ULONGLONG_fn)
9593       ___P((___U64 val),
9594            ());
9595    ___BOOL (*___U64_fits_in_width_fn)
9596       ___P((___U64 val,
9597             int width),
9598            ());
9599    ___U64 (*___U64_mul_UM32_UM32_fn)
9600       ___P((___UM32 x,
9601             ___UM32 y),
9602            ());
9603    ___U64 (*___U64_add_U64_U64_fn)
9604       ___P((___U64 x,
9605             ___U64 y),
9606            ());
9607    ___SCMOBJ (*___SCMOBJ_to_S8)
9608       ___P((___PSD
9609             ___SCMOBJ obj,
9610             ___S8 *x,
9611             int arg_num),
9612            ());
9613    ___SCMOBJ (*___SCMOBJ_to_U8)
9614       ___P((___PSD
9615             ___SCMOBJ obj,
9616             ___U8 *x,
9617             int arg_num),
9618            ());
9619    ___SCMOBJ (*___SCMOBJ_to_S16)
9620       ___P((___PSD
9621             ___SCMOBJ obj,
9622             ___S16 *x,
9623             int arg_num),
9624            ());
9625    ___SCMOBJ (*___SCMOBJ_to_U16)
9626       ___P((___PSD
9627             ___SCMOBJ obj,
9628             ___U16 *x,
9629             int arg_num),
9630            ());
9631    ___SCMOBJ (*___SCMOBJ_to_S32)
9632       ___P((___PSD
9633             ___SCMOBJ obj,
9634             ___S32 *x,
9635             int arg_num),
9636            ());
9637    ___SCMOBJ (*___SCMOBJ_to_U32)
9638       ___P((___PSD
9639             ___SCMOBJ obj,
9640             ___U32 *x,
9641             int arg_num),
9642            ());
9643    ___SCMOBJ (*___SCMOBJ_to_S64)
9644       ___P((___PSD
9645             ___SCMOBJ obj,
9646             ___S64 *x,
9647             int arg_num),
9648            ());
9649    ___SCMOBJ (*___SCMOBJ_to_U64)
9650       ___P((___PSD
9651             ___SCMOBJ obj,
9652             ___U64 *x,
9653             int arg_num),
9654            ());
9655    ___SCMOBJ (*___SCMOBJ_to_F32)
9656       ___P((___PSD
9657             ___SCMOBJ obj,
9658             ___F32 *x,
9659             int arg_num),
9660            ());
9661    ___SCMOBJ (*___SCMOBJ_to_F64)
9662       ___P((___PSD
9663             ___SCMOBJ obj,
9664             ___F64 *x,
9665             int arg_num),
9666            ());
9667    ___SCMOBJ (*___SCMOBJ_to_CHAR)
9668       ___P((___PSD
9669             ___SCMOBJ obj,
9670             char *x,
9671             int arg_num),
9672            ());
9673    ___SCMOBJ (*___SCMOBJ_to_SCHAR)
9674       ___P((___PSD
9675             ___SCMOBJ obj,
9676             ___SCHAR *x,
9677             int arg_num),
9678            ());
9679    ___SCMOBJ (*___SCMOBJ_to_UCHAR)
9680       ___P((___PSD
9681             ___SCMOBJ obj,
9682             unsigned char *x,
9683             int arg_num),
9684            ());
9685    ___SCMOBJ (*___SCMOBJ_to_ISO_8859_1)
9686       ___P((___PSD
9687             ___SCMOBJ obj,
9688             ___ISO_8859_1 *x,
9689             int arg_num),
9690            ());
9691    ___SCMOBJ (*___SCMOBJ_to_UCS_2)
9692       ___P((___PSD
9693             ___SCMOBJ obj,
9694             ___UCS_2 *x,
9695             int arg_num),
9696            ());
9697    ___SCMOBJ (*___SCMOBJ_to_UCS_4)
9698       ___P((___PSD
9699             ___SCMOBJ obj,
9700             ___UCS_4 *x,
9701             int arg_num),
9702            ());
9703    ___SCMOBJ (*___SCMOBJ_to_WCHAR)
9704       ___P((___PSD
9705             ___SCMOBJ obj,
9706             ___WCHAR *x,
9707             int arg_num),
9708            ());
9709    ___SCMOBJ (*___SCMOBJ_to_SIZE_T)
9710       ___P((___PSD
9711             ___SCMOBJ obj,
9712             ___SIZE_T *x,
9713             int arg_num),
9714            ());
9715    ___SCMOBJ (*___SCMOBJ_to_SSIZE_T)
9716       ___P((___PSD
9717             ___SCMOBJ obj,
9718             ___SSIZE_T *x,
9719             int arg_num),
9720            ());
9721    ___SCMOBJ (*___SCMOBJ_to_PTRDIFF_T)
9722       ___P((___PSD
9723             ___SCMOBJ obj,
9724             ___PTRDIFF_T *x,
9725             int arg_num),
9726            ());
9727    ___SCMOBJ (*___SCMOBJ_to_SHORT)
9728       ___P((___PSD
9729             ___SCMOBJ obj,
9730             short *x,
9731             int arg_num),
9732            ());
9733    ___SCMOBJ (*___SCMOBJ_to_USHORT)
9734       ___P((___PSD
9735             ___SCMOBJ obj,
9736             unsigned short *x,
9737             int arg_num),
9738            ());
9739    ___SCMOBJ (*___SCMOBJ_to_INT)
9740       ___P((___PSD
9741             ___SCMOBJ obj,
9742             int *x,
9743             int arg_num),
9744            ());
9745    ___SCMOBJ (*___SCMOBJ_to_UINT)
9746       ___P((___PSD
9747             ___SCMOBJ obj,
9748             unsigned int *x,
9749             int arg_num),
9750            ());
9751    ___SCMOBJ (*___SCMOBJ_to_LONG)
9752       ___P((___PSD
9753             ___SCMOBJ obj,
9754             long *x,
9755             int arg_num),
9756            ());
9757    ___SCMOBJ (*___SCMOBJ_to_ULONG)
9758       ___P((___PSD
9759             ___SCMOBJ obj,
9760             unsigned long *x,
9761             int arg_num),
9762            ());
9763    ___SCMOBJ (*___SCMOBJ_to_LONGLONG)
9764       ___P((___PSD
9765             ___SCMOBJ obj,
9766             ___LONGLONG *x,
9767             int arg_num),
9768            ());
9769    ___SCMOBJ (*___SCMOBJ_to_ULONGLONG)
9770       ___P((___PSD
9771             ___SCMOBJ obj,
9772             ___ULONGLONG *x,
9773             int arg_num),
9774            ());
9775    ___SCMOBJ (*___SCMOBJ_to_FLOAT)
9776       ___P((___PSD
9777             ___SCMOBJ obj,
9778             float *x,
9779             int arg_num),
9780            ());
9781    ___SCMOBJ (*___SCMOBJ_to_DOUBLE)
9782       ___P((___PSD
9783             ___SCMOBJ obj,
9784             double *x,
9785             int arg_num),
9786            ());
9787    ___SCMOBJ (*___SCMOBJ_to_STRUCT)
9788       ___P((___PSD
9789             ___SCMOBJ obj,
9790             void **x,
9791             ___SCMOBJ tags,
9792             int arg_num),
9793            ());
9794    ___SCMOBJ (*___SCMOBJ_to_UNION)
9795       ___P((___PSD
9796             ___SCMOBJ obj,
9797             void **x,
9798             ___SCMOBJ tags,
9799             int arg_num),
9800            ());
9801    ___SCMOBJ (*___SCMOBJ_to_TYPE)
9802       ___P((___PSD
9803             ___SCMOBJ obj,
9804             void **x,
9805             ___SCMOBJ tags,
9806             int arg_num),
9807            ());
9808    ___SCMOBJ (*___SCMOBJ_to_POINTER)
9809       ___P((___PSD
9810             ___SCMOBJ obj,
9811             void **x,
9812             ___SCMOBJ tags,
9813             int arg_num),
9814            ());
9815    ___SCMOBJ (*___SCMOBJ_to_NONNULLPOINTER)
9816       ___P((___PSD
9817             ___SCMOBJ obj,
9818             void **x,
9819             ___SCMOBJ tags,
9820             int arg_num),
9821            ());
9822    ___SCMOBJ (*___SCMOBJ_to_FUNCTION)
9823       ___P((___PSD
9824             ___SCMOBJ obj,
9825             void *converter,
9826             void **x,
9827             int arg_num),
9828            ());
9829    ___SCMOBJ (*___SCMOBJ_to_NONNULLFUNCTION)
9830       ___P((___PSD
9831             ___SCMOBJ obj,
9832             void *converter,
9833             void **x,
9834             int arg_num),
9835            ());
9836    ___SCMOBJ (*___SCMOBJ_to_BOOL)
9837       ___P((___PSD
9838             ___SCMOBJ obj,
9839             ___BOOL *x,
9840             int arg_num),
9841            ());
9842    ___SCMOBJ (*___SCMOBJ_to_STRING)
9843       ___P((___PSD
9844             ___SCMOBJ obj,
9845             void **x,
9846             int arg_num,
9847             int char_encoding,
9848             int fudge),
9849            ());
9850    ___SCMOBJ (*___SCMOBJ_to_NONNULLSTRING)
9851       ___P((___PSD
9852             ___SCMOBJ obj,
9853             void **x,
9854             int arg_num,
9855             int char_encoding,
9856             int fudge),
9857            ());
9858    ___SCMOBJ (*___SCMOBJ_to_NONNULLSTRINGLIST)
9859       ___P((___PSD
9860             ___SCMOBJ obj,
9861             void **x,
9862             int arg_num,
9863             int char_encoding),
9864            ());
9865    ___SCMOBJ (*___SCMOBJ_to_CHARSTRING)
9866       ___P((___PSD
9867             ___SCMOBJ obj,
9868             char **x,
9869             int arg_num),
9870            ());
9871    ___SCMOBJ (*___SCMOBJ_to_NONNULLCHARSTRING)
9872       ___P((___PSD
9873             ___SCMOBJ obj,
9874             char **x,
9875             int arg_num),
9876            ());
9877    ___SCMOBJ (*___SCMOBJ_to_NONNULLCHARSTRINGLIST)
9878       ___P((___PSD
9879             ___SCMOBJ obj,
9880             char ***x,
9881             int arg_num),
9882            ());
9883    ___SCMOBJ (*___SCMOBJ_to_ISO_8859_1STRING)
9884       ___P((___PSD
9885             ___SCMOBJ obj,
9886             ___ISO_8859_1STRING *x,
9887             int arg_num),
9888            ());
9889    ___SCMOBJ (*___SCMOBJ_to_NONNULLISO_8859_1STRING)
9890       ___P((___PSD
9891             ___SCMOBJ obj,
9892             ___ISO_8859_1STRING *x,
9893             int arg_num),
9894            ());
9895    ___SCMOBJ (*___SCMOBJ_to_NONNULLISO_8859_1STRINGLIST)
9896       ___P((___PSD
9897             ___SCMOBJ obj,
9898             ___ISO_8859_1STRING **x,
9899             int arg_num),
9900            ());
9901    ___SCMOBJ (*___SCMOBJ_to_UTF_8STRING)
9902       ___P((___PSD
9903             ___SCMOBJ obj,
9904             ___UTF_8STRING *x,
9905             int arg_num),
9906            ());
9907    ___SCMOBJ (*___SCMOBJ_to_NONNULLUTF_8STRING)
9908       ___P((___PSD
9909             ___SCMOBJ obj,
9910             ___UTF_8STRING *x,
9911             int arg_num),
9912            ());
9913    ___SCMOBJ (*___SCMOBJ_to_NONNULLUTF_8STRINGLIST)
9914       ___P((___PSD
9915             ___SCMOBJ obj,
9916             ___UTF_8STRING **x,
9917             int arg_num),
9918            ());
9919    ___SCMOBJ (*___SCMOBJ_to_UTF_16STRING)
9920       ___P((___PSD
9921             ___SCMOBJ obj,
9922             ___UTF_16STRING *x,
9923             int arg_num),
9924            ());
9925    ___SCMOBJ (*___SCMOBJ_to_NONNULLUTF_16STRING)
9926       ___P((___PSD
9927             ___SCMOBJ obj,
9928             ___UTF_16STRING *x,
9929             int arg_num),
9930            ());
9931    ___SCMOBJ (*___SCMOBJ_to_NONNULLUTF_16STRINGLIST)
9932       ___P((___PSD
9933             ___SCMOBJ obj,
9934             ___UTF_16STRING **x,
9935             int arg_num),
9936            ());
9937    ___SCMOBJ (*___SCMOBJ_to_UCS_2STRING)
9938       ___P((___PSD
9939             ___SCMOBJ obj,
9940             ___UCS_2STRING *x,
9941             int arg_num),
9942            ());
9943    ___SCMOBJ (*___SCMOBJ_to_NONNULLUCS_2STRING)
9944       ___P((___PSD
9945             ___SCMOBJ obj,
9946             ___UCS_2STRING *x,
9947             int arg_num),
9948            ());
9949    ___SCMOBJ (*___SCMOBJ_to_NONNULLUCS_2STRINGLIST)
9950       ___P((___PSD
9951             ___SCMOBJ obj,
9952             ___UCS_2STRING **x,
9953             int arg_num),
9954            ());
9955    ___SCMOBJ (*___SCMOBJ_to_UCS_4STRING)
9956       ___P((___PSD
9957             ___SCMOBJ obj,
9958             ___UCS_4STRING *x,
9959             int arg_num),
9960            ());
9961    ___SCMOBJ (*___SCMOBJ_to_NONNULLUCS_4STRING)
9962       ___P((___PSD
9963             ___SCMOBJ obj,
9964             ___UCS_4STRING *x,
9965             int arg_num),
9966            ());
9967    ___SCMOBJ (*___SCMOBJ_to_NONNULLUCS_4STRINGLIST)
9968       ___P((___PSD
9969             ___SCMOBJ obj,
9970             ___UCS_4STRING **x,
9971             int arg_num),
9972            ());
9973    ___SCMOBJ (*___SCMOBJ_to_WCHARSTRING)
9974       ___P((___PSD
9975             ___SCMOBJ obj,
9976             ___WCHARSTRING *x,
9977             int arg_num),
9978            ());
9979    ___SCMOBJ (*___SCMOBJ_to_NONNULLWCHARSTRING)
9980       ___P((___PSD
9981             ___SCMOBJ obj,
9982             ___WCHARSTRING *x,
9983             int arg_num),
9984            ());
9985    ___SCMOBJ (*___SCMOBJ_to_NONNULLWCHARSTRINGLIST)
9986       ___P((___PSD
9987             ___SCMOBJ obj,
9988             ___WCHARSTRING **x,
9989             int arg_num),
9990            ());
9991    ___SCMOBJ (*___SCMOBJ_to_VARIANT)
9992       ___P((___PSD
9993             ___SCMOBJ obj,
9994             ___VARIANT *x,
9995             int arg_num),
9996            ());
9997    ___SCMOBJ (*___release_foreign)
9998       ___P((___SCMOBJ obj),
9999            ());
10000    ___SCMOBJ (*___release_pointer)
10001       ___P((void *x),
10002            ());
10003    ___SCMOBJ (*___release_function)
10004       ___P((void *x),
10005            ());
10006    void (*___addref_function)
10007       ___P((void *x),
10008            ());
10009    void (*___release_string)
10010       ___P((void *x),
10011            ());
10012    void (*___addref_string)
10013       ___P((void *x),
10014            ());
10015    void (*___release_string_list)
10016       ___P((void *x),
10017            ());
10018    void (*___addref_string_list)
10019       ___P((void *x),
10020            ());
10021    void (*___release_variant)
10022       ___P((___VARIANT x),
10023            ());
10024    void (*___addref_variant)
10025       ___P((___VARIANT x),
10026            ());
10027    ___SCMOBJ (*___S8_to_SCMOBJ)
10028       ___P((___processor_state ___ps,
10029             ___S8 x,
10030             ___SCMOBJ *obj,
10031             int arg_num),
10032            ());
10033    ___SCMOBJ (*___U8_to_SCMOBJ)
10034       ___P((___processor_state ___ps,
10035             ___U8 x,
10036             ___SCMOBJ *obj,
10037             int arg_num),
10038            ());
10039    ___SCMOBJ (*___S16_to_SCMOBJ)
10040       ___P((___processor_state ___ps,
10041             ___S16 x,
10042             ___SCMOBJ *obj,
10043             int arg_num),
10044            ());
10045    ___SCMOBJ (*___U16_to_SCMOBJ)
10046       ___P((___processor_state ___ps,
10047             ___U16 x,
10048             ___SCMOBJ *obj,
10049             int arg_num),
10050            ());
10051    ___SCMOBJ (*___S32_to_SCMOBJ)
10052       ___P((___processor_state ___ps,
10053             ___S32 x,
10054             ___SCMOBJ *obj,
10055             int arg_num),
10056            ());
10057    ___SCMOBJ (*___U32_to_SCMOBJ)
10058       ___P((___processor_state ___ps,
10059             ___U32 x,
10060             ___SCMOBJ *obj,
10061             int arg_num),
10062            ());
10063    ___SCMOBJ (*___S64_to_SCMOBJ)
10064       ___P((___processor_state ___ps,
10065             ___S64 x,
10066             ___SCMOBJ *obj,
10067             int arg_num),
10068            ());
10069    ___SCMOBJ (*___U64_to_SCMOBJ)
10070       ___P((___processor_state ___ps,
10071             ___U64 x,
10072             ___SCMOBJ *obj,
10073             int arg_num),
10074            ());
10075    ___SCMOBJ (*___F32_to_SCMOBJ)
10076       ___P((___processor_state ___ps,
10077             ___F32 x,
10078             ___SCMOBJ *obj,
10079             int arg_num),
10080            ());
10081    ___SCMOBJ (*___F64_to_SCMOBJ)
10082       ___P((___processor_state ___ps,
10083             ___F64 x,
10084             ___SCMOBJ *obj,
10085             int arg_num),
10086            ());
10087    ___SCMOBJ (*___CHAR_to_SCMOBJ)
10088       ___P((___processor_state ___ps,
10089             char x,
10090             ___SCMOBJ *obj,
10091             int arg_num),
10092            ());
10093    ___SCMOBJ (*___SCHAR_to_SCMOBJ)
10094       ___P((___processor_state ___ps,
10095             ___SCHAR x,
10096             ___SCMOBJ *obj,
10097             int arg_num),
10098            ());
10099    ___SCMOBJ (*___UCHAR_to_SCMOBJ)
10100       ___P((___processor_state ___ps,
10101             unsigned char x,
10102             ___SCMOBJ *obj,
10103             int arg_num),
10104            ());
10105    ___SCMOBJ (*___ISO_8859_1_to_SCMOBJ)
10106       ___P((___processor_state ___ps,
10107             ___ISO_8859_1 x,
10108             ___SCMOBJ *obj,
10109             int arg_num),
10110            ());
10111    ___SCMOBJ (*___UCS_2_to_SCMOBJ)
10112       ___P((___processor_state ___ps,
10113             ___UCS_2 x,
10114             ___SCMOBJ *obj,
10115             int arg_num),
10116            ());
10117    ___SCMOBJ (*___UCS_4_to_SCMOBJ)
10118       ___P((___processor_state ___ps,
10119             ___UCS_4 x,
10120             ___SCMOBJ *obj,
10121             int arg_num),
10122            ());
10123    ___SCMOBJ (*___WCHAR_to_SCMOBJ)
10124       ___P((___processor_state ___ps,
10125             ___WCHAR x,
10126             ___SCMOBJ *obj,
10127             int arg_num),
10128            ());
10129    ___SCMOBJ (*___SIZE_T_to_SCMOBJ)
10130       ___P((___processor_state ___ps,
10131             ___SIZE_T x,
10132             ___SCMOBJ *obj,
10133             int arg_num),
10134            ());
10135    ___SCMOBJ (*___SSIZE_T_to_SCMOBJ)
10136       ___P((___processor_state ___ps,
10137             ___SSIZE_T x,
10138             ___SCMOBJ *obj,
10139             int arg_num),
10140            ());
10141    ___SCMOBJ (*___PTRDIFF_T_to_SCMOBJ)
10142       ___P((___processor_state ___ps,
10143             ___PTRDIFF_T x,
10144             ___SCMOBJ *obj,
10145             int arg_num),
10146            ());
10147    ___SCMOBJ (*___SHORT_to_SCMOBJ)
10148       ___P((___processor_state ___ps,
10149             short x,
10150             ___SCMOBJ *obj,
10151             int arg_num),
10152            ());
10153    ___SCMOBJ (*___USHORT_to_SCMOBJ)
10154       ___P((___processor_state ___ps,
10155             unsigned short x,
10156             ___SCMOBJ *obj,
10157             int arg_num),
10158            ());
10159    ___SCMOBJ (*___INT_to_SCMOBJ)
10160       ___P((___processor_state ___ps,
10161             int x,
10162             ___SCMOBJ *obj,
10163             int arg_num),
10164            ());
10165    ___SCMOBJ (*___UINT_to_SCMOBJ)
10166       ___P((___processor_state ___ps,
10167             unsigned int x,
10168             ___SCMOBJ *obj,
10169             int arg_num),
10170            ());
10171    ___SCMOBJ (*___LONG_to_SCMOBJ)
10172       ___P((___processor_state ___ps,
10173             long x,
10174             ___SCMOBJ *obj,
10175             int arg_num),
10176            ());
10177    ___SCMOBJ (*___ULONG_to_SCMOBJ)
10178       ___P((___processor_state ___ps,
10179             unsigned long x,
10180             ___SCMOBJ *obj,
10181             int arg_num),
10182            ());
10183    ___SCMOBJ (*___LONGLONG_to_SCMOBJ)
10184       ___P((___processor_state ___ps,
10185             ___LONGLONG x,
10186             ___SCMOBJ *obj,
10187             int arg_num),
10188            ());
10189    ___SCMOBJ (*___ULONGLONG_to_SCMOBJ)
10190       ___P((___processor_state ___ps,
10191             ___ULONGLONG x,
10192             ___SCMOBJ *obj,
10193             int arg_num),
10194            ());
10195    ___SCMOBJ (*___FLOAT_to_SCMOBJ)
10196       ___P((___processor_state ___ps,
10197             float x,
10198             ___SCMOBJ *obj,
10199             int arg_num),
10200            ());
10201    ___SCMOBJ (*___DOUBLE_to_SCMOBJ)
10202       ___P((___processor_state ___ps,
10203             double x,
10204             ___SCMOBJ *obj,
10205             int arg_num),
10206            ());
10207    ___SCMOBJ (*___STRUCT_to_SCMOBJ)
10208       ___P((___processor_state ___ps,
10209             void *x,
10210             ___SCMOBJ tags,
10211             ___SCMOBJ (*release_fn) ___P((void *ptr),()),
10212             ___SCMOBJ *obj,
10213             int arg_num),
10214            ());
10215    ___SCMOBJ (*___UNION_to_SCMOBJ)
10216       ___P((___processor_state ___ps,
10217             void *x,
10218             ___SCMOBJ tags,
10219             ___SCMOBJ (*release_fn) ___P((void *ptr),()),
10220             ___SCMOBJ *obj,
10221             int arg_num),
10222            ());
10223    ___SCMOBJ (*___TYPE_to_SCMOBJ)
10224       ___P((___processor_state ___ps,
10225             void *x,
10226             ___SCMOBJ tags,
10227             ___SCMOBJ (*release_fn) ___P((void *ptr),()),
10228             ___SCMOBJ *obj,
10229             int arg_num),
10230            ());
10231    ___SCMOBJ (*___POINTER_to_SCMOBJ)
10232       ___P((___processor_state ___ps,
10233             void *x,
10234             ___SCMOBJ tags,
10235             ___SCMOBJ (*release_fn) ___P((void *ptr),()),
10236             ___SCMOBJ *obj,
10237             int arg_num),
10238            ());
10239    ___SCMOBJ (*___NONNULLPOINTER_to_SCMOBJ)
10240       ___P((___processor_state ___ps,
10241             void *x,
10242             ___SCMOBJ tags,
10243             ___SCMOBJ (*release_fn) ___P((void *ptr),()),
10244             ___SCMOBJ *obj,
10245             int arg_num),
10246            ());
10247    ___SCMOBJ (*___FUNCTION_to_SCMOBJ)
10248       ___P((___processor_state ___ps,
10249             void *x,
10250             ___SCMOBJ *obj,
10251             int arg_num),
10252            ());
10253    ___SCMOBJ (*___NONNULLFUNCTION_to_SCMOBJ)
10254       ___P((___processor_state ___ps,
10255             void *x,
10256             ___SCMOBJ *obj,
10257             int arg_num),
10258            ());
10259    ___SCMOBJ (*___BOOL_to_SCMOBJ)
10260       ___P((___processor_state ___ps,
10261             ___BOOL x,
10262             ___SCMOBJ *obj,
10263             int arg_num),
10264            ());
10265    ___SCMOBJ (*___STRING_to_SCMOBJ)
10266       ___P((___processor_state ___ps,
10267             void *x,
10268             ___SCMOBJ *obj,
10269             int arg_num,
10270             int char_encoding),
10271            ());
10272    ___SCMOBJ (*___NONNULLSTRING_to_SCMOBJ)
10273       ___P((___processor_state ___ps,
10274             void *x,
10275             ___SCMOBJ *obj,
10276             int arg_num,
10277             int char_encoding),
10278            ());
10279    ___SCMOBJ (*___NONNULLSTRINGLIST_to_SCMOBJ)
10280       ___P((___processor_state ___ps,
10281             void *x,
10282             ___SCMOBJ *obj,
10283             int arg_num,
10284             int char_encoding),
10285            ());
10286    ___SCMOBJ (*___CHARSTRING_to_SCMOBJ)
10287       ___P((___processor_state ___ps,
10288             char *x,
10289             ___SCMOBJ *obj,
10290             int arg_num),
10291            ());
10292    ___SCMOBJ (*___NONNULLCHARSTRING_to_SCMOBJ)
10293       ___P((___processor_state ___ps,
10294             char *x,
10295             ___SCMOBJ *obj,
10296             int arg_num),
10297            ());
10298    ___SCMOBJ (*___NONNULLCHARSTRINGLIST_to_SCMOBJ)
10299       ___P((___processor_state ___ps,
10300             char **x,
10301             ___SCMOBJ *obj,
10302             int arg_num),
10303            ());
10304    ___SCMOBJ (*___ISO_8859_1STRING_to_SCMOBJ)
10305       ___P((___processor_state ___ps,
10306             ___ISO_8859_1STRING x,
10307             ___SCMOBJ *obj,
10308             int arg_num),
10309            ());
10310    ___SCMOBJ (*___NONNULLISO_8859_1STRING_to_SCMOBJ)
10311       ___P((___processor_state ___ps,
10312             ___ISO_8859_1STRING x,
10313             ___SCMOBJ *obj,
10314             int arg_num),
10315            ());
10316    ___SCMOBJ (*___NONNULLISO_8859_1STRINGLIST_to_SCMOBJ)
10317       ___P((___processor_state ___ps,
10318             ___ISO_8859_1STRING *x,
10319             ___SCMOBJ *obj,
10320             int arg_num),
10321            ());
10322    ___SCMOBJ (*___UTF_8STRING_to_SCMOBJ)
10323       ___P((___processor_state ___ps,
10324             ___UTF_8STRING x,
10325             ___SCMOBJ *obj,
10326             int arg_num),
10327            ());
10328    ___SCMOBJ (*___NONNULLUTF_8STRING_to_SCMOBJ)
10329       ___P((___processor_state ___ps,
10330             ___UTF_8STRING x,
10331             ___SCMOBJ *obj,
10332             int arg_num),
10333            ());
10334    ___SCMOBJ (*___NONNULLUTF_8STRINGLIST_to_SCMOBJ)
10335       ___P((___processor_state ___ps,
10336             ___UTF_8STRING *x,
10337             ___SCMOBJ *obj,
10338             int arg_num),
10339            ());
10340    ___SCMOBJ (*___UTF_16STRING_to_SCMOBJ)
10341       ___P((___processor_state ___ps,
10342             ___UTF_16STRING x,
10343             ___SCMOBJ *obj,
10344             int arg_num),
10345            ());
10346    ___SCMOBJ (*___NONNULLUTF_16STRING_to_SCMOBJ)
10347       ___P((___processor_state ___ps,
10348             ___UTF_16STRING x,
10349             ___SCMOBJ *obj,
10350             int arg_num),
10351            ());
10352    ___SCMOBJ (*___NONNULLUTF_16STRINGLIST_to_SCMOBJ)
10353       ___P((___processor_state ___ps,
10354             ___UTF_16STRING *x,
10355             ___SCMOBJ *obj,
10356             int arg_num),
10357            ());
10358    ___SCMOBJ (*___UCS_2STRING_to_SCMOBJ)
10359       ___P((___processor_state ___ps,
10360             ___UCS_2STRING x,
10361             ___SCMOBJ *obj,
10362             int arg_num),
10363            ());
10364    ___SCMOBJ (*___NONNULLUCS_2STRING_to_SCMOBJ)
10365       ___P((___processor_state ___ps,
10366             ___UCS_2STRING x,
10367             ___SCMOBJ *obj,
10368             int arg_num),
10369            ());
10370    ___SCMOBJ (*___NONNULLUCS_2STRINGLIST_to_SCMOBJ)
10371       ___P((___processor_state ___ps,
10372             ___UCS_2STRING *x,
10373             ___SCMOBJ *obj,
10374             int arg_num),
10375            ());
10376    ___SCMOBJ (*___UCS_4STRING_to_SCMOBJ)
10377       ___P((___processor_state ___ps,
10378             ___UCS_4STRING x,
10379             ___SCMOBJ *obj,
10380             int arg_num),
10381            ());
10382    ___SCMOBJ (*___NONNULLUCS_4STRING_to_SCMOBJ)
10383       ___P((___processor_state ___ps,
10384             ___UCS_4STRING x,
10385             ___SCMOBJ *obj,
10386             int arg_num),
10387            ());
10388    ___SCMOBJ (*___NONNULLUCS_4STRINGLIST_to_SCMOBJ)
10389       ___P((___processor_state ___ps,
10390             ___UCS_4STRING *x,
10391             ___SCMOBJ *obj,
10392             int arg_num),
10393            ());
10394    ___SCMOBJ (*___WCHARSTRING_to_SCMOBJ)
10395       ___P((___processor_state ___ps,
10396             ___WCHARSTRING x,
10397             ___SCMOBJ *obj,
10398             int arg_num),
10399            ());
10400    ___SCMOBJ (*___NONNULLWCHARSTRING_to_SCMOBJ)
10401       ___P((___processor_state ___ps,
10402             ___WCHARSTRING x,
10403             ___SCMOBJ *obj,
10404             int arg_num),
10405            ());
10406    ___SCMOBJ (*___NONNULLWCHARSTRINGLIST_to_SCMOBJ)
10407       ___P((___processor_state ___ps,
10408             ___WCHARSTRING *x,
10409             ___SCMOBJ *obj,
10410             int arg_num),
10411            ());
10412    ___SCMOBJ (*___VARIANT_to_SCMOBJ)
10413       ___P((___processor_state ___ps,
10414             ___VARIANT x,
10415             ___SCMOBJ *obj,
10416             int arg_num),
10417            ());
10418    ___SCMOBJ (*___STRING_to_UCS_2STRING)
10419       ___P((char *str_char,
10420             ___UCS_2STRING *str_UCS_2,
10421             int char_encoding),
10422            ());
10423    void (*___free_UCS_2STRING)
10424       ___P((___UCS_2STRING str_UCS_2),
10425            ());
10426    ___SCMOBJ (*___NONNULLSTRINGLIST_to_NONNULLUCS_2STRINGLIST)
10427       ___P((char **str_list_char,
10428             ___UCS_2STRING **str_list_UCS_2,
10429             int char_encoding),
10430            ());
10431    void (*___free_NONNULLUCS_2STRINGLIST)
10432       ___P((___UCS_2STRING *str_list_UCS_2),
10433            ());
10434    ___SCMOBJ (*___make_sfun_stack_marker)
10435       ___P((___processor_state ___ps,
10436             ___SCMOBJ *marker,
10437             ___SCMOBJ proc_or_false),
10438            ());
10439    void (*___kill_sfun_stack_marker)
10440       ___P((___SCMOBJ marker),
10441            ());
10442    void *(*___alloc_rc)
10443       ___P((___PSD
10444             ___SIZE_T bytes),
10445            ());
10446    void (*___release_rc)
10447       ___P((void *ptr),
10448            ());
10449    void (*___addref_rc)
10450       ___P((void *ptr),
10451            ());
10452    ___SCMOBJ (*___data_rc)
10453       ___P((void *ptr),
10454            ());
10455    void (*___set_data_rc)
10456       ___P((void *ptr,
10457             ___SCMOBJ val),
10458            ());
10459    ___SCMOBJ (*___alloc_scmobj)
10460       ___P((___processor_state ___ps,
10461             int subtype,
10462             ___SIZE_TS bytes),
10463            ());
10464    ___SCMOBJ (*___release_scmobj)
10465       ___P((___SCMOBJ obj),
10466            ());
10467    ___SCMOBJ (*___make_pair)
10468       ___P((___processor_state ___ps,
10469             ___SCMOBJ car,
10470             ___SCMOBJ cdr),
10471            ());
10472    ___SCMOBJ (*___make_vector)
10473       ___P((___processor_state ___ps,
10474             ___SIZE_TS length,
10475             ___SCMOBJ init),
10476            ());
10477    void (*___still_obj_refcount_inc)
10478       ___P((___SCMOBJ obj),
10479            ());
10480    void (*___still_obj_refcount_dec)
10481       ___P((___SCMOBJ obj),
10482            ());
10483    ___SCMOBJ (*___gc_hash_table_ref)
10484       ___P((___SCMOBJ ht,
10485             ___SCMOBJ key),
10486            ());
10487    ___SCMOBJ (*___gc_hash_table_set)
10488       ___P((___SCMOBJ ht,
10489             ___SCMOBJ key,
10490             ___SCMOBJ val),
10491            ());
10492    ___SCMOBJ (*___gc_hash_table_union_find)
10493       ___P((___SCMOBJ ht,
10494             ___SCMOBJ key1,
10495             ___SCMOBJ key2,
10496             ___BOOL find),
10497            ());
10498    ___SCMOBJ (*___gc_hash_table_rehash)
10499       ___P((___SCMOBJ ht_src,
10500             ___SCMOBJ ht_dst),
10501            ());
10502    void (*___cleanup) ___PVOID;
10503    void (*___cleanup_and_exit_process)
10504       ___P((int status),
10505            ());
10506    ___SCMOBJ (*___current_vm_resize)
10507       ___P((___PSD
10508            ___SCMOBJ thunk,
10509            int target_processor_count),
10510           ());
10511    ___BOOL (*___garbage_collect)
10512       ___P((___PSD
10513             ___SIZE_TS requested_words_still),
10514            ());
10515    ___SCMOBJ (*___setup_vmstate)
10516       ___P((___virtual_machine_state ___vms),
10517            ());
10518    void (*___cleanup_vmstate)
10519       ___P((___virtual_machine_state ___vms),
10520            ());
10521    ___SCMOBJ (*___setup_pstate)
10522       ___P((___processor_state ___ps,
10523             ___virtual_machine_state ___vms),
10524            ());
10525    void (*___cleanup_pstate)
10526       ___P((___processor_state ___ps),
10527            ());
10528    ___SIZE_T (*___get_min_heap) ___PVOID;
10529    void (*___set_min_heap)
10530       ___P((___SIZE_T bytes),
10531            ());
10532    ___SIZE_T (*___get_max_heap) ___PVOID;
10533    void (*___set_max_heap)
10534       ___P((___SIZE_T bytes),
10535            ());
10536    int (*___get_live_percent) ___PVOID;
10537    void (*___set_live_percent)
10538       ___P((int percent),
10539            ());
10540    int (*___get_parallelism_level) ___PVOID;
10541    void (*___set_parallelism_level)
10542       ___P((int level),
10543            ());
10544    int (*___get_standard_level) ___PVOID;
10545    void (*___set_standard_level)
10546       ___P((int level),
10547            ());
10548    void (*___set_gambitdir)
10549       ___P((___UCS_2STRING gambitdir),
10550            ());
10551    int (*___set_debug_settings)
10552       ___P((int mask,
10553             int new_settings),
10554            ());
10555    ___program_startup_info_struct *(*___get_program_startup_info) ___PVOID;
10556    ___SCMOBJ (*___call)
10557       ___P((___PSD
10558             ___WORD nargs,
10559             ___SCMOBJ proc,
10560             ___SCMOBJ marker),
10561            ());
10562    ___SCMOBJ (*___run)
10563       ___P((___PSD
10564             ___SCMOBJ thunk),
10565            ());
10566#ifdef ___SUPPORT_LOWLEVEL_EXEC
10567    ___WORD (*___lowlevel_exec)
10568       ___P((___processor_state ___ps),
10569            ());
10570#endif
10571    ___SCMOBJ (*___machine_code_block_fixup)
10572       ___P((___processor_state ___ps,
10573             void *mcb,
10574             ___SCMOBJ fixup_locs,
10575             ___SCMOBJ fixup_objs),
10576            ());
10577    void (*___throw_error)
10578       ___P((___PSD
10579             ___SCMOBJ err),
10580            ());
10581    void (*___propagate_error)
10582       ___P((___PSD
10583             ___SCMOBJ err),
10584            ());
10585#ifdef ___DEBUG_HOST_CHANGES
10586    void (*___register_host_entry)
10587       ___P((___PSD
10588             ___WORD start,
10589             char *module_name,
10590             char *file,
10591             int line),
10592            ());
10593#endif
10594#ifdef ___ACTIVITY_LOG
10595    void (*___actlog_add_pstate)
10596       ___P((___processor_state ___ps,
10597             ___U16 *type,
10598             char *name,
10599             ___U32 color),
10600            ());
10601    void (*___actlog_begin_pstate)
10602       ___P((___processor_state ___ps,
10603             ___U16 *type,
10604             char *name,
10605             ___U32 color),
10606            ());
10607    void (*___actlog_end_pstate)
10608       ___P((___processor_state ___ps),
10609            ());
10610    void (*___actlog_start)
10611       ___P((___processor_state ___ps),
10612            ());
10613    void (*___actlog_stop)
10614       ___P((___processor_state ___ps),
10615            ());
10616    void (*___actlog_dump)
10617       ___P((___virtual_machine_state ___vms,
10618             char *filename),
10619           ());
10620#endif
10621    void (*___raise_interrupt_pstate)
10622       ___P((___processor_state ___ps,
10623             int code),
10624            ());
10625    void (*___raise_interrupt_vmstate)
10626       ___P((___virtual_machine_state ___vms,
10627             int code),
10628            ());
10629    void (*___raise_interrupt)
10630       ___P((int code),
10631            ());
10632    void (*___begin_interrupt_service_pstate)
10633       ___P((___processor_state ___ps),
10634            ());
10635    ___BOOL (*___check_interrupt_pstate)
10636       ___P((___processor_state ___ps,
10637             int code),
10638            ());
10639    void (*___end_interrupt_service_pstate)
10640       ___P((___processor_state ___ps,
10641             int code),
10642            ());
10643    void (*___disable_interrupts_pstate)
10644       ___P((___processor_state ___ps),
10645            ());
10646    void (*___enable_interrupts_pstate)
10647       ___P((___processor_state ___ps),
10648            ());
10649    void (*___mask_all_interrupts_begin)
10650       ___P((___mask_all_interrupts_state *state),
10651            ());
10652    void (*___mask_all_interrupts_end)
10653       ___P((___mask_all_interrupts_state *state),
10654            ());
10655    void (*___mask_user_interrupts_begin)
10656       ___P((___mask_user_interrupts_state *state),
10657            ());
10658    void (*___mask_user_interrupts_end)
10659       ___P((___mask_user_interrupts_state *state),
10660            ());
10661    void (*___mask_heartbeat_interrupts_begin)
10662       ___P((___mask_heartbeat_interrupts_state *state),
10663            ());
10664    void (*___mask_heartbeat_interrupts_end)
10665       ___P((___mask_heartbeat_interrupts_state *state),
10666            ());
10667    void (*___mask_child_interrupts_begin)
10668       ___P((___mask_child_interrupts_state *state),
10669            ());
10670    void (*___mask_child_interrupts_end)
10671       ___P((___mask_child_interrupts_state *state),
10672            ());
10673#ifndef ___DEBUG_ALLOC_MEM
10674    void *(*___alloc_mem)
10675       ___P((___SIZE_T bytes),
10676            ());
10677#define ___ALLOC_MEM(bytes)___EXT(___alloc_mem) (bytes)
10678    void (*___free_mem)
10679       ___P((void *ptr),
10680            ());
10681#define ___FREE_MEM(ptr)___EXT(___free_mem) (ptr)
10682    void *(*___alloc_mem_heap)
10683       ___P((___SIZE_T bytes),
10684            ());
10685#define ___ALLOC_MEM_HEAP(bytes)___EXT(___alloc_mem_heap) (bytes)
10686    void (*___free_mem_heap)
10687       ___P((void *ptr),
10688            ());
10689#define ___FREE_MEM_HEAP(ptr)___EXT(___free_mem_heap) (ptr)
10690#else
10691    void *(*___alloc_mem)
10692       ___P((___SIZE_T bytes,
10693             int lineno,
10694             char *file),
10695            ());
10696#define ___ALLOC_MEM(bytes)___EXT(___alloc_mem) (bytes,__LINE__,__FILE__)
10697    void (*___free_mem)
10698       ___P((void *ptr,
10699             int lineno,
10700             char *file),
10701            ());
10702#define ___FREE_MEM(ptr)___EXT(___free_mem) (ptr,__LINE__,__FILE__)
10703    void *(*___alloc_mem_heap)
10704       ___P((___SIZE_T bytes,
10705             int lineno,
10706             char *file),
10707            ());
10708#define ___ALLOC_MEM_HEAP(bytes)___EXT(___alloc_mem_heap) (bytes,__LINE__,__FILE__)
10709    void (*___free_mem_heap)
10710       ___P((void *ptr,
10711             int lineno,
10712             char *file),
10713            ());
10714#define ___FREE_MEM_HEAP(ptr)___EXT(___free_mem_heap) (ptr,__LINE__,__FILE__)
10715#endif
10716    void *(*___alloc_mem_code)
10717       ___P((___SIZE_T bytes),
10718            ());
10719    void (*___free_mem_code)
10720       ___P((void *ptr),
10721            ());
10722#ifdef ___USE_emulated_sync
10723    ___WORD (*___emulated_compare_and_swap_word)
10724       ___P((___VOLATILE ___WORD *ptr,
10725             ___WORD oldval,
10726             ___WORD newval),
10727            ());
10728    ___WORD (*___emulated_fetch_and_add_word)
10729       ___P((___VOLATILE ___WORD *ptr,
10730             ___WORD val),
10731            ());
10732    ___WORD (*___emulated_fetch_and_clear_word)
10733       ___P((___VOLATILE ___WORD *ptr),
10734            ());
10735    void (*___emulated_shared_memory_barrier) ___PVOID;
10736#endif
10737#ifdef ___DEFINE_THREAD_LOCAL_STORAGE_GETTER_SETTER
10738    void *(*___get_tls_ptr) ___PVOID;
10739    void (*___set_tls_ptr)
10740       ___P((void *ptr),
10741            ());
10742#endif
10743#endif
10744
10745#ifdef ___USE_SETJMP
10746#ifndef ___CAN_IMPORT_SETJMP_DYNAMICALLY
10747    int (*setjmp)
10748       ___P((jmp_buf env),
10749            ());
10750#endif
10751#endif
10752
10753#ifdef ___PSTATE_ALIGN_MULTIPLIER
10754    /*
10755     * pad the global state so that it can be aligned to a multiple
10756     * of ___PSTATE_ALIGN_MULTIPLIER
10757     */
10758    char padding[___PSTATE_ALIGN_MULTIPLIER];
10759#endif
10760  } ___global_state_struct;
10761
10762#ifdef ___LBLCOUNT
10763___LOCAL ___WORD ___lp; /* Module's label table pointer */
10764#endif
10765
10766___GLODECL
10767___SYMDECL
10768___KEYDECL
10769
10770#define ___CHAR_ENCODING(x)                       ((x)&(31<<0))
10771#define ___CHAR_ENCODING_MASK(x)                  ((x)&~(31<<0))
10772#define ___CHAR_ENCODING_ASCII                    (1<<0)
10773#define ___CHAR_ENCODING_ISO_8859_1               (2<<0)
10774#define ___CHAR_ENCODING_UTF_8                    (3<<0)
10775#define ___CHAR_ENCODING_UTF_16                   (4<<0)
10776#define ___CHAR_ENCODING_UTF_16BE                 (5<<0)
10777#define ___CHAR_ENCODING_UTF_16LE                 (6<<0)
10778#define ___CHAR_ENCODING_UTF_FALLBACK_ASCII       (7<<0)
10779#define ___CHAR_ENCODING_UTF_FALLBACK_ISO_8859_1  (8<<0)
10780#define ___CHAR_ENCODING_UTF_FALLBACK_UTF_8       (9<<0)
10781#define ___CHAR_ENCODING_UTF_FALLBACK_UTF_16      (10<<0)
10782#define ___CHAR_ENCODING_UTF_FALLBACK_UTF_16BE    (11<<0)
10783#define ___CHAR_ENCODING_UTF_FALLBACK_UTF_16LE    (12<<0)
10784#define ___CHAR_ENCODING_UCS_2                    (13<<0)
10785#define ___CHAR_ENCODING_UCS_2BE                  (14<<0)
10786#define ___CHAR_ENCODING_UCS_2LE                  (15<<0)
10787#define ___CHAR_ENCODING_UCS_4                    (16<<0)
10788#define ___CHAR_ENCODING_UCS_4BE                  (17<<0)
10789#define ___CHAR_ENCODING_UCS_4LE                  (18<<0)
10790#define ___CHAR_ENCODING_WCHAR                    (19<<0)
10791#define ___CHAR_ENCODING_NATIVE                   (20<<0)
10792
10793#define ___CHAR_ENCODING_UTF ___CHAR_ENCODING_UTF_FALLBACK_UTF_8
10794
10795#define ___CHAR_ENCODING_SUPPORTS_BMP(x) \
10796((x) >= ___CHAR_ENCODING_UTF_8 && \
10797 (x) <= ___CHAR_ENCODING_UCS_4LE)
10798
10799#ifdef ___BIG_ENDIAN
10800#define ___CHAR_ENCODING_U8  ___CHAR_ENCODING_ISO_8859_1
10801#define ___CHAR_ENCODING_U16 ___CHAR_ENCODING_UCS_2BE
10802#define ___CHAR_ENCODING_U32 ___CHAR_ENCODING_UCS_4BE
10803#else
10804#define ___CHAR_ENCODING_U8  ___CHAR_ENCODING_ISO_8859_1
10805#define ___CHAR_ENCODING_U16 ___CHAR_ENCODING_UCS_2LE
10806#define ___CHAR_ENCODING_U32 ___CHAR_ENCODING_UCS_4LE
10807#endif
10808
10809#define ___CHAR_ENCODING_ERRORS(x)      ((x)&(3<<5))
10810#define ___CHAR_ENCODING_ERRORS_MASK(x) ((x)&~(3<<5))
10811#define ___CHAR_ENCODING_ERRORS_ON      (1<<5)
10812#define ___CHAR_ENCODING_ERRORS_OFF     (2<<5)
10813
10814#define ___EOL_ENCODING(x)      ((x)&(3<<7))
10815#define ___EOL_ENCODING_MASK(x) ((x)&~(3<<7))
10816#define ___EOL_ENCODING_LF      (1<<7)
10817#define ___EOL_ENCODING_CR      (2<<7)
10818#define ___EOL_ENCODING_CRLF    (3<<7)
10819
10820#define ___BUFFERING(x)      ((x)&(3<<9))
10821#define ___BUFFERING_MASK(x) ((x)&~(3<<9))
10822#define ___NO_BUFFERING      (1<<9)
10823#define ___LINE_BUFFERING    (2<<9)
10824#define ___FULL_BUFFERING    (3<<9)
10825#define ___FULLY_BUFFERED(x)  (___BUFFERING(x)>=___FULL_BUFFERING)
10826
10827#define ___DECODE_STATE(x)      ((x)&(3<<11))
10828#define ___DECODE_STATE_MASK(x) ((x)&~(3<<11))
10829#define ___DECODE_STATE_NONE    (0<<11)
10830#define ___DECODE_STATE_LF      (1<<11)
10831#define ___DECODE_STATE_CR      (2<<11)
10832
10833#define ___TERMINAL_LINE_EDITING(x)      ((x)&(3<<16))
10834#define ___TERMINAL_LINE_EDITING_MASK(x) ((x)&~(3<<16))
10835#define ___TERMINAL_LINE_EDITING_ON      (1<<16)
10836#define ___TERMINAL_LINE_EDITING_OFF     (2<<16)
10837
10838#define ___FILE_SETTINGS_INITIAL 0
10839#define ___TERMINAL_SETTINGS_INITIAL 0
10840#define ___STDIO_SETTINGS_INITIAL 0
10841
10842#ifndef ___INCLUDED_FROM_C_INTF
10843___IMP_FUNC(___S64,___S64_from_SM32_fn)
10844   ___P((___SM32 val),
10845        ());
10846___IMP_FUNC(___S64,___S64_from_SM32_UM32_fn)
10847   ___P((___SM32 hi32,
10848         ___UM32 lo32),
10849        ());
10850___IMP_FUNC(___S64,___S64_from_LONGLONG_fn)
10851   ___P((___LONGLONG val),
10852        ());
10853___IMP_FUNC(___LONGLONG,___S64_to_LONGLONG_fn)
10854   ___P((___S64 val),
10855        ());
10856___IMP_FUNC(___BOOL,___S64_fits_in_width_fn)
10857   ___P((___S64 val,
10858         int width),
10859        ());
10860___IMP_FUNC(___U64,___U64_from_UM32_fn)
10861   ___P((___UM32 val),
10862        ());
10863___IMP_FUNC(___U64,___U64_from_UM32_UM32_fn)
10864   ___P((___UM32 hi32,
10865         ___UM32 lo32),
10866        ());
10867___IMP_FUNC(___U64,___U64_from_ULONGLONG_fn)
10868   ___P((___ULONGLONG val),
10869        ());
10870___IMP_FUNC(___ULONGLONG,___U64_to_ULONGLONG_fn)
10871   ___P((___U64 val),
10872        ());
10873___IMP_FUNC(___BOOL,___U64_fits_in_width_fn)
10874   ___P((___U64 val,
10875         int width),
10876        ());
10877___IMP_FUNC(___U64,___U64_mul_UM32_UM32_fn)
10878   ___P((___UM32 x,
10879         ___UM32 y),
10880        ());
10881___IMP_FUNC(___U64,___U64_add_U64_U64_fn)
10882   ___P((___U64 x,
10883         ___U64 y),
10884        ());
10885___IMP_FUNC(___SCMOBJ,___SCMOBJ_to_S8)
10886   ___P((___PSD
10887         ___SCMOBJ obj,
10888         ___S8 *x,
10889         int arg_num),
10890        ());
10891___IMP_FUNC(___SCMOBJ,___SCMOBJ_to_U8)
10892   ___P((___PSD
10893         ___SCMOBJ obj,
10894         ___U8 *x,
10895         int arg_num),
10896        ());
10897___IMP_FUNC(___SCMOBJ,___SCMOBJ_to_S16)
10898   ___P((___PSD
10899         ___SCMOBJ obj,
10900         ___S16 *x,
10901         int arg_num),
10902        ());
10903___IMP_FUNC(___SCMOBJ,___SCMOBJ_to_U16)
10904   ___P((___PSD
10905         ___SCMOBJ obj,
10906         ___U16 *x,
10907         int arg_num),
10908        ());
10909___IMP_FUNC(___SCMOBJ,___SCMOBJ_to_S32)
10910   ___P((___PSD
10911         ___SCMOBJ obj,
10912         ___S32 *x,
10913         int arg_num),
10914        ());
10915___IMP_FUNC(___SCMOBJ,___SCMOBJ_to_U32)
10916   ___P((___PSD
10917         ___SCMOBJ obj,
10918         ___U32 *x,
10919         int arg_num),
10920        ());
10921___IMP_FUNC(___SCMOBJ,___SCMOBJ_to_S64)
10922   ___P((___PSD
10923         ___SCMOBJ obj,
10924         ___S64 *x,
10925         int arg_num),
10926        ());
10927___IMP_FUNC(___SCMOBJ,___SCMOBJ_to_U64)
10928   ___P((___PSD
10929         ___SCMOBJ obj,
10930         ___U64 *x,
10931         int arg_num),
10932        ());
10933___IMP_FUNC(___SCMOBJ,___SCMOBJ_to_F32)
10934   ___P((___PSD
10935         ___SCMOBJ obj,
10936         ___F32 *x,
10937         int arg_num),
10938        ());
10939___IMP_FUNC(___SCMOBJ,___SCMOBJ_to_F64)
10940   ___P((___PSD
10941         ___SCMOBJ obj,
10942         ___F64 *x,
10943         int arg_num),
10944        ());
10945___IMP_FUNC(___SCMOBJ,___SCMOBJ_to_CHAR)
10946   ___P((___PSD
10947         ___SCMOBJ obj,
10948         char *x,
10949         int arg_num),
10950        ());
10951___IMP_FUNC(___SCMOBJ,___SCMOBJ_to_SCHAR)
10952   ___P((___PSD
10953         ___SCMOBJ obj,
10954         ___SCHAR *x,
10955         int arg_num),
10956        ());
10957___IMP_FUNC(___SCMOBJ,___SCMOBJ_to_UCHAR)
10958   ___P((___PSD
10959         ___SCMOBJ obj,
10960         unsigned char *x,
10961         int arg_num),
10962        ());
10963___IMP_FUNC(___SCMOBJ,___SCMOBJ_to_ISO_8859_1)
10964   ___P((___PSD
10965         ___SCMOBJ obj,
10966         ___ISO_8859_1 *x,
10967         int arg_num),
10968        ());
10969___IMP_FUNC(___SCMOBJ,___SCMOBJ_to_UCS_2)
10970   ___P((___PSD
10971         ___SCMOBJ obj,
10972         ___UCS_2 *x,
10973         int arg_num),
10974        ());
10975___IMP_FUNC(___SCMOBJ,___SCMOBJ_to_UCS_4)
10976   ___P((___PSD
10977         ___SCMOBJ obj,
10978         ___UCS_4 *x,
10979         int arg_num),
10980        ());
10981___IMP_FUNC(___SCMOBJ,___SCMOBJ_to_WCHAR)
10982   ___P((___PSD
10983         ___SCMOBJ obj,
10984         ___WCHAR *x,
10985         int arg_num),
10986        ());
10987___IMP_FUNC(___SCMOBJ,___SCMOBJ_to_SIZE_T)
10988   ___P((___PSD
10989         ___SCMOBJ obj,
10990         ___SIZE_T *x,
10991         int arg_num),
10992        ());
10993___IMP_FUNC(___SCMOBJ,___SCMOBJ_to_SSIZE_T)
10994   ___P((___PSD
10995         ___SCMOBJ obj,
10996         ___SSIZE_T *x,
10997         int arg_num),
10998        ());
10999___IMP_FUNC(___SCMOBJ,___SCMOBJ_to_PTRDIFF_T)
11000   ___P((___PSD
11001         ___SCMOBJ obj,
11002         ___PTRDIFF_T *x,
11003         int arg_num),
11004        ());
11005___IMP_FUNC(___SCMOBJ,___SCMOBJ_to_SHORT)
11006   ___P((___PSD
11007         ___SCMOBJ obj,
11008         short *x,
11009         int arg_num),
11010        ());
11011___IMP_FUNC(___SCMOBJ,___SCMOBJ_to_USHORT)
11012   ___P((___PSD
11013         ___SCMOBJ obj,
11014         unsigned short *x,
11015         int arg_num),
11016        ());
11017___IMP_FUNC(___SCMOBJ,___SCMOBJ_to_INT)
11018   ___P((___PSD
11019         ___SCMOBJ obj,
11020         int *x,
11021         int arg_num),
11022        ());
11023___IMP_FUNC(___SCMOBJ,___SCMOBJ_to_UINT)
11024   ___P((___PSD
11025         ___SCMOBJ obj,
11026         unsigned int *x,
11027         int arg_num),
11028        ());
11029___IMP_FUNC(___SCMOBJ,___SCMOBJ_to_LONG)
11030   ___P((___PSD
11031         ___SCMOBJ obj,
11032         long *x,
11033         int arg_num),
11034        ());
11035___IMP_FUNC(___SCMOBJ,___SCMOBJ_to_ULONG)
11036   ___P((___PSD
11037         ___SCMOBJ obj,
11038         unsigned long *x,
11039         int arg_num),
11040        ());
11041___IMP_FUNC(___SCMOBJ,___SCMOBJ_to_LONGLONG)
11042   ___P((___PSD
11043         ___SCMOBJ obj,
11044         ___LONGLONG *x,
11045         int arg_num),
11046        ());
11047___IMP_FUNC(___SCMOBJ,___SCMOBJ_to_ULONGLONG)
11048   ___P((___PSD
11049         ___SCMOBJ obj,
11050         ___ULONGLONG *x,
11051         int arg_num),
11052        ());
11053___IMP_FUNC(___SCMOBJ,___SCMOBJ_to_FLOAT)
11054   ___P((___PSD
11055         ___SCMOBJ obj,
11056         float *x,
11057         int arg_num),
11058        ());
11059___IMP_FUNC(___SCMOBJ,___SCMOBJ_to_DOUBLE)
11060   ___P((___PSD
11061         ___SCMOBJ obj,
11062         double *x,
11063         int arg_num),
11064        ());
11065___IMP_FUNC(___SCMOBJ,___SCMOBJ_to_STRUCT)
11066   ___P((___PSD
11067         ___SCMOBJ obj,
11068         void **x,
11069         ___SCMOBJ tags,
11070         int arg_num),
11071        ());
11072___IMP_FUNC(___SCMOBJ,___SCMOBJ_to_UNION)
11073   ___P((___PSD
11074         ___SCMOBJ obj,
11075         void **x,
11076         ___SCMOBJ tags,
11077         int arg_num),
11078        ());
11079___IMP_FUNC(___SCMOBJ,___SCMOBJ_to_TYPE)
11080   ___P((___PSD
11081         ___SCMOBJ obj,
11082         void **x,
11083         ___SCMOBJ tags,
11084         int arg_num),
11085        ());
11086___IMP_FUNC(___SCMOBJ,___SCMOBJ_to_POINTER)
11087   ___P((___PSD
11088         ___SCMOBJ obj,
11089         void **x,
11090         ___SCMOBJ tags,
11091         int arg_num),
11092        ());
11093___IMP_FUNC(___SCMOBJ,___SCMOBJ_to_NONNULLPOINTER)
11094   ___P((___PSD
11095         ___SCMOBJ obj,
11096         void **x,
11097         ___SCMOBJ tags,
11098         int arg_num),
11099        ());
11100___IMP_FUNC(___SCMOBJ,___SCMOBJ_to_FUNCTION)
11101   ___P((___PSD
11102         ___SCMOBJ obj,
11103         void *converter,
11104         void **x,
11105         int arg_num),
11106        ());
11107___IMP_FUNC(___SCMOBJ,___SCMOBJ_to_NONNULLFUNCTION)
11108   ___P((___PSD
11109         ___SCMOBJ obj,
11110         void *converter,
11111         void **x,
11112         int arg_num),
11113        ());
11114___IMP_FUNC(___SCMOBJ,___SCMOBJ_to_BOOL)
11115   ___P((___PSD
11116         ___SCMOBJ obj,
11117         ___BOOL *x,
11118         int arg_num),
11119        ());
11120___IMP_FUNC(___SCMOBJ,___SCMOBJ_to_STRING)
11121   ___P((___PSD
11122         ___SCMOBJ obj,
11123         void **x,
11124         int arg_num,
11125         int char_encoding,
11126         int fudge),
11127        ());
11128___IMP_FUNC(___SCMOBJ,___SCMOBJ_to_NONNULLSTRING)
11129   ___P((___PSD
11130         ___SCMOBJ obj,
11131         void **x,
11132         int arg_num,
11133         int char_encoding,
11134         int fudge),
11135        ());
11136___IMP_FUNC(___SCMOBJ,___SCMOBJ_to_NONNULLSTRINGLIST)
11137   ___P((___PSD
11138         ___SCMOBJ obj,
11139         void **x,
11140         int arg_num,
11141         int char_encoding),
11142        ());
11143___IMP_FUNC(___SCMOBJ,___SCMOBJ_to_CHARSTRING)
11144   ___P((___PSD
11145         ___SCMOBJ obj,
11146         char **x,
11147         int arg_num),
11148        ());
11149___IMP_FUNC(___SCMOBJ,___SCMOBJ_to_NONNULLCHARSTRING)
11150   ___P((___PSD
11151         ___SCMOBJ obj,
11152         char **x,
11153         int arg_num),
11154        ());
11155___IMP_FUNC(___SCMOBJ,___SCMOBJ_to_NONNULLCHARSTRINGLIST)
11156   ___P((___PSD
11157         ___SCMOBJ obj,
11158         char ***x,
11159         int arg_num),
11160        ());
11161___IMP_FUNC(___SCMOBJ,___SCMOBJ_to_ISO_8859_1STRING)
11162   ___P((___PSD
11163         ___SCMOBJ obj,
11164         ___ISO_8859_1STRING *x,
11165         int arg_num),
11166        ());
11167___IMP_FUNC(___SCMOBJ,___SCMOBJ_to_NONNULLISO_8859_1STRING)
11168   ___P((___PSD
11169         ___SCMOBJ obj,
11170         ___ISO_8859_1STRING *x,
11171         int arg_num),
11172        ());
11173___IMP_FUNC(___SCMOBJ,___SCMOBJ_to_NONNULLISO_8859_1STRINGLIST)
11174   ___P((___PSD
11175         ___SCMOBJ obj,
11176         ___ISO_8859_1STRING **x,
11177         int arg_num),
11178        ());
11179___IMP_FUNC(___SCMOBJ,___SCMOBJ_to_UTF_8STRING)
11180   ___P((___PSD
11181         ___SCMOBJ obj,
11182         ___UTF_8STRING *x,
11183         int arg_num),
11184        ());
11185___IMP_FUNC(___SCMOBJ,___SCMOBJ_to_NONNULLUTF_8STRING)
11186   ___P((___PSD
11187         ___SCMOBJ obj,
11188         ___UTF_8STRING *x,
11189         int arg_num),
11190        ());
11191___IMP_FUNC(___SCMOBJ,___SCMOBJ_to_NONNULLUTF_8STRINGLIST)
11192   ___P((___PSD
11193         ___SCMOBJ obj,
11194         ___UTF_8STRING **x,
11195         int arg_num),
11196        ());
11197___IMP_FUNC(___SCMOBJ,___SCMOBJ_to_UTF_16STRING)
11198   ___P((___PSD
11199         ___SCMOBJ obj,
11200         ___UTF_16STRING *x,
11201         int arg_num),
11202        ());
11203___IMP_FUNC(___SCMOBJ,___SCMOBJ_to_NONNULLUTF_16STRING)
11204   ___P((___PSD
11205         ___SCMOBJ obj,
11206         ___UTF_16STRING *x,
11207         int arg_num),
11208        ());
11209___IMP_FUNC(___SCMOBJ,___SCMOBJ_to_NONNULLUTF_16STRINGLIST)
11210   ___P((___PSD
11211         ___SCMOBJ obj,
11212         ___UTF_16STRING **x,
11213         int arg_num),
11214        ());
11215___IMP_FUNC(___SCMOBJ,___SCMOBJ_to_UCS_2STRING)
11216   ___P((___PSD
11217         ___SCMOBJ obj,
11218         ___UCS_2STRING *x,
11219         int arg_num),
11220        ());
11221___IMP_FUNC(___SCMOBJ,___SCMOBJ_to_NONNULLUCS_2STRING)
11222   ___P((___PSD
11223         ___SCMOBJ obj,
11224         ___UCS_2STRING *x,
11225         int arg_num),
11226        ());
11227___IMP_FUNC(___SCMOBJ,___SCMOBJ_to_NONNULLUCS_2STRINGLIST)
11228   ___P((___PSD
11229         ___SCMOBJ obj,
11230         ___UCS_2STRING **x,
11231         int arg_num),
11232        ());
11233___IMP_FUNC(___SCMOBJ,___SCMOBJ_to_UCS_4STRING)
11234   ___P((___PSD
11235         ___SCMOBJ obj,
11236         ___UCS_4STRING *x,
11237         int arg_num),
11238        ());
11239___IMP_FUNC(___SCMOBJ,___SCMOBJ_to_NONNULLUCS_4STRING)
11240   ___P((___PSD
11241         ___SCMOBJ obj,
11242         ___UCS_4STRING *x,
11243         int arg_num),
11244        ());
11245___IMP_FUNC(___SCMOBJ,___SCMOBJ_to_NONNULLUCS_4STRINGLIST)
11246   ___P((___PSD
11247         ___SCMOBJ obj,
11248         ___UCS_4STRING **x,
11249         int arg_num),
11250        ());
11251___IMP_FUNC(___SCMOBJ,___SCMOBJ_to_WCHARSTRING)
11252   ___P((___PSD
11253         ___SCMOBJ obj,
11254         ___WCHARSTRING *x,
11255         int arg_num),
11256        ());
11257___IMP_FUNC(___SCMOBJ,___SCMOBJ_to_NONNULLWCHARSTRING)
11258   ___P((___PSD
11259         ___SCMOBJ obj,
11260         ___WCHARSTRING *x,
11261         int arg_num),
11262        ());
11263___IMP_FUNC(___SCMOBJ,___SCMOBJ_to_NONNULLWCHARSTRINGLIST)
11264   ___P((___PSD
11265         ___SCMOBJ obj,
11266         ___WCHARSTRING **x,
11267         int arg_num),
11268        ());
11269___IMP_FUNC(___SCMOBJ,___SCMOBJ_to_VARIANT)
11270   ___P((___PSD
11271         ___SCMOBJ obj,
11272         ___VARIANT *x,
11273         int arg_num),
11274        ());
11275___IMP_FUNC(___SCMOBJ,___release_foreign)
11276   ___P((___SCMOBJ obj),
11277        ());
11278___IMP_FUNC(___SCMOBJ,___release_pointer)
11279   ___P((void *x),
11280        ());
11281___IMP_FUNC(___SCMOBJ,___release_function)
11282   ___P((void *x),
11283        ());
11284___IMP_FUNC(void,___addref_function)
11285   ___P((void *x),
11286        ());
11287___IMP_FUNC(void,___release_string)
11288   ___P((void *x),
11289        ());
11290___IMP_FUNC(void,___addref_string)
11291   ___P((void *x),
11292        ());
11293___IMP_FUNC(void,___release_string_list)
11294   ___P((void *x),
11295        ());
11296___IMP_FUNC(void,___addref_string_list)
11297   ___P((void *x),
11298        ());
11299___IMP_FUNC(void,___release_variant)
11300   ___P((___VARIANT x),
11301        ());
11302___IMP_FUNC(void,___addref_variant)
11303   ___P((___VARIANT x),
11304        ());
11305___IMP_FUNC(___SCMOBJ,___S8_to_SCMOBJ)
11306   ___P((___processor_state ___ps,
11307         ___S8 x,
11308         ___SCMOBJ *obj,
11309         int arg_num),
11310        ());
11311___IMP_FUNC(___SCMOBJ,___U8_to_SCMOBJ)
11312   ___P((___processor_state ___ps,
11313         ___U8 x,
11314         ___SCMOBJ *obj,
11315         int arg_num),
11316        ());
11317___IMP_FUNC(___SCMOBJ,___S16_to_SCMOBJ)
11318   ___P((___processor_state ___ps,
11319         ___S16 x,
11320         ___SCMOBJ *obj,
11321         int arg_num),
11322        ());
11323___IMP_FUNC(___SCMOBJ,___U16_to_SCMOBJ)
11324   ___P((___processor_state ___ps,
11325         ___U16 x,
11326         ___SCMOBJ *obj,
11327         int arg_num),
11328        ());
11329___IMP_FUNC(___SCMOBJ,___S32_to_SCMOBJ)
11330   ___P((___processor_state ___ps,
11331         ___S32 x,
11332         ___SCMOBJ *obj,
11333         int arg_num),
11334        ());
11335___IMP_FUNC(___SCMOBJ,___U32_to_SCMOBJ)
11336   ___P((___processor_state ___ps,
11337         ___U32 x,
11338         ___SCMOBJ *obj,
11339         int arg_num),
11340        ());
11341___IMP_FUNC(___SCMOBJ,___S64_to_SCMOBJ)
11342   ___P((___processor_state ___ps,
11343         ___S64 x,
11344         ___SCMOBJ *obj,
11345         int arg_num),
11346        ());
11347___IMP_FUNC(___SCMOBJ,___U64_to_SCMOBJ)
11348   ___P((___processor_state ___ps,
11349         ___U64 x,
11350         ___SCMOBJ *obj,
11351         int arg_num),
11352        ());
11353___IMP_FUNC(___SCMOBJ,___F32_to_SCMOBJ)
11354   ___P((___processor_state ___ps,
11355         ___F32 x,
11356         ___SCMOBJ *obj,
11357         int arg_num),
11358        ());
11359___IMP_FUNC(___SCMOBJ,___F64_to_SCMOBJ)
11360   ___P((___processor_state ___ps,
11361         ___F64 x,
11362         ___SCMOBJ *obj,
11363         int arg_num),
11364        ());
11365___IMP_FUNC(___SCMOBJ,___CHAR_to_SCMOBJ)
11366   ___P((___processor_state ___ps,
11367         char x,
11368         ___SCMOBJ *obj,
11369         int arg_num),
11370        ());
11371___IMP_FUNC(___SCMOBJ,___SCHAR_to_SCMOBJ)
11372   ___P((___processor_state ___ps,
11373         ___SCHAR x,
11374         ___SCMOBJ *obj,
11375         int arg_num),
11376        ());
11377___IMP_FUNC(___SCMOBJ,___UCHAR_to_SCMOBJ)
11378   ___P((___processor_state ___ps,
11379         unsigned char x,
11380         ___SCMOBJ *obj,
11381         int arg_num),
11382        ());
11383___IMP_FUNC(___SCMOBJ,___ISO_8859_1_to_SCMOBJ)
11384   ___P((___processor_state ___ps,
11385         ___ISO_8859_1 x,
11386         ___SCMOBJ *obj,
11387         int arg_num),
11388        ());
11389___IMP_FUNC(___SCMOBJ,___UCS_2_to_SCMOBJ)
11390   ___P((___processor_state ___ps,
11391         ___UCS_2 x,
11392         ___SCMOBJ *obj,
11393         int arg_num),
11394        ());
11395___IMP_FUNC(___SCMOBJ,___UCS_4_to_SCMOBJ)
11396   ___P((___processor_state ___ps,
11397         ___UCS_4 x,
11398         ___SCMOBJ *obj,
11399         int arg_num),
11400        ());
11401___IMP_FUNC(___SCMOBJ,___WCHAR_to_SCMOBJ)
11402   ___P((___processor_state ___ps,
11403         ___WCHAR x,
11404         ___SCMOBJ *obj,
11405         int arg_num),
11406        ());
11407___IMP_FUNC(___SCMOBJ,___SIZE_T_to_SCMOBJ)
11408   ___P((___processor_state ___ps,
11409         ___SIZE_T x,
11410         ___SCMOBJ *obj,
11411         int arg_num),
11412        ());
11413___IMP_FUNC(___SCMOBJ,___SSIZE_T_to_SCMOBJ)
11414   ___P((___processor_state ___ps,
11415         ___SSIZE_T x,
11416         ___SCMOBJ *obj,
11417         int arg_num),
11418        ());
11419___IMP_FUNC(___SCMOBJ,___PTRDIFF_T_to_SCMOBJ)
11420   ___P((___processor_state ___ps,
11421         ___PTRDIFF_T x,
11422         ___SCMOBJ *obj,
11423         int arg_num),
11424        ());
11425___IMP_FUNC(___SCMOBJ,___SHORT_to_SCMOBJ)
11426   ___P((___processor_state ___ps,
11427         short x,
11428         ___SCMOBJ *obj,
11429         int arg_num),
11430        ());
11431___IMP_FUNC(___SCMOBJ,___USHORT_to_SCMOBJ)
11432   ___P((___processor_state ___ps,
11433         unsigned short x,
11434         ___SCMOBJ *obj,
11435         int arg_num),
11436        ());
11437___IMP_FUNC(___SCMOBJ,___INT_to_SCMOBJ)
11438   ___P((___processor_state ___ps,
11439         int x,
11440         ___SCMOBJ *obj,
11441         int arg_num),
11442        ());
11443___IMP_FUNC(___SCMOBJ,___UINT_to_SCMOBJ)
11444   ___P((___processor_state ___ps,
11445         unsigned int x,
11446         ___SCMOBJ *obj,
11447         int arg_num),
11448        ());
11449___IMP_FUNC(___SCMOBJ,___LONG_to_SCMOBJ)
11450   ___P((___processor_state ___ps,
11451         long x,
11452         ___SCMOBJ *obj,
11453         int arg_num),
11454        ());
11455___IMP_FUNC(___SCMOBJ,___ULONG_to_SCMOBJ)
11456   ___P((___processor_state ___ps,
11457         unsigned long x,
11458         ___SCMOBJ *obj,
11459         int arg_num),
11460        ());
11461___IMP_FUNC(___SCMOBJ,___LONGLONG_to_SCMOBJ)
11462   ___P((___processor_state ___ps,
11463         ___LONGLONG x,
11464         ___SCMOBJ *obj,
11465         int arg_num),
11466        ());
11467___IMP_FUNC(___SCMOBJ,___ULONGLONG_to_SCMOBJ)
11468   ___P((___processor_state ___ps,
11469         ___ULONGLONG x,
11470         ___SCMOBJ *obj,
11471         int arg_num),
11472        ());
11473___IMP_FUNC(___SCMOBJ,___FLOAT_to_SCMOBJ)
11474   ___P((___processor_state ___ps,
11475         float x,
11476         ___SCMOBJ *obj,
11477         int arg_num),
11478        ());
11479___IMP_FUNC(___SCMOBJ,___DOUBLE_to_SCMOBJ)
11480   ___P((___processor_state ___ps,
11481         double x,
11482         ___SCMOBJ *obj,
11483         int arg_num),
11484        ());
11485___IMP_FUNC(___SCMOBJ,___STRUCT_to_SCMOBJ)
11486   ___P((___processor_state ___ps,
11487         void *x,
11488         ___SCMOBJ tags,
11489         ___SCMOBJ (*release_fn) ___P((void *ptr),()),
11490         ___SCMOBJ *obj,
11491         int arg_num),
11492        ());
11493___IMP_FUNC(___SCMOBJ,___UNION_to_SCMOBJ)
11494   ___P((___processor_state ___ps,
11495         void *x,
11496         ___SCMOBJ tags,
11497         ___SCMOBJ (*release_fn) ___P((void *ptr),()),
11498         ___SCMOBJ *obj,
11499         int arg_num),
11500        ());
11501___IMP_FUNC(___SCMOBJ,___TYPE_to_SCMOBJ)
11502   ___P((___processor_state ___ps,
11503         void *x,
11504         ___SCMOBJ tags,
11505         ___SCMOBJ (*release_fn) ___P((void *ptr),()),
11506         ___SCMOBJ *obj,
11507         int arg_num),
11508        ());
11509___IMP_FUNC(___SCMOBJ,___POINTER_to_SCMOBJ)
11510   ___P((___processor_state ___ps,
11511         void *x,
11512         ___SCMOBJ tags,
11513         ___SCMOBJ (*release_fn) ___P((void *ptr),()),
11514         ___SCMOBJ *obj,
11515         int arg_num),
11516        ());
11517___IMP_FUNC(___SCMOBJ,___NONNULLPOINTER_to_SCMOBJ)
11518   ___P((___processor_state ___ps,
11519         void *x,
11520         ___SCMOBJ tags,
11521         ___SCMOBJ (*release_fn) ___P((void *ptr),()),
11522         ___SCMOBJ *obj,
11523         int arg_num),
11524        ());
11525___IMP_FUNC(___SCMOBJ,___FUNCTION_to_SCMOBJ)
11526   ___P((___processor_state ___ps,
11527         void *x,
11528         ___SCMOBJ *obj,
11529         int arg_num),
11530        ());
11531___IMP_FUNC(___SCMOBJ,___NONNULLFUNCTION_to_SCMOBJ)
11532   ___P((___processor_state ___ps,
11533         void *x,
11534         ___SCMOBJ *obj,
11535         int arg_num),
11536        ());
11537___IMP_FUNC(___SCMOBJ,___BOOL_to_SCMOBJ)
11538   ___P((___processor_state ___ps,
11539         ___BOOL x,
11540         ___SCMOBJ *obj,
11541         int arg_num),
11542        ());
11543___IMP_FUNC(___SCMOBJ,___STRING_to_SCMOBJ)
11544   ___P((___processor_state ___ps,
11545         void *x,
11546         ___SCMOBJ *obj,
11547         int arg_num,
11548         int char_encoding),
11549        ());
11550___IMP_FUNC(___SCMOBJ,___NONNULLSTRING_to_SCMOBJ)
11551   ___P((___processor_state ___ps,
11552         void *x,
11553         ___SCMOBJ *obj,
11554         int arg_num,
11555         int char_encoding),
11556        ());
11557___IMP_FUNC(___SCMOBJ,___NONNULLSTRINGLIST_to_SCMOBJ)
11558   ___P((___processor_state ___ps,
11559         void *x,
11560         ___SCMOBJ *obj,
11561         int arg_num,
11562         int char_encoding),
11563        ());
11564___IMP_FUNC(___SCMOBJ,___CHARSTRING_to_SCMOBJ)
11565   ___P((___processor_state ___ps,
11566         char *x,
11567         ___SCMOBJ *obj,
11568         int arg_num),
11569        ());
11570___IMP_FUNC(___SCMOBJ,___NONNULLCHARSTRING_to_SCMOBJ)
11571   ___P((___processor_state ___ps,
11572         char *x,
11573         ___SCMOBJ *obj,
11574         int arg_num),
11575        ());
11576___IMP_FUNC(___SCMOBJ,___NONNULLCHARSTRINGLIST_to_SCMOBJ)
11577   ___P((___processor_state ___ps,
11578         char **x,
11579         ___SCMOBJ *obj,
11580         int arg_num),
11581        ());
11582___IMP_FUNC(___SCMOBJ,___ISO_8859_1STRING_to_SCMOBJ)
11583   ___P((___processor_state ___ps,
11584         ___ISO_8859_1STRING x,
11585         ___SCMOBJ *obj,
11586         int arg_num),
11587        ());
11588___IMP_FUNC(___SCMOBJ,___NONNULLISO_8859_1STRING_to_SCMOBJ)
11589   ___P((___processor_state ___ps,
11590         ___ISO_8859_1STRING x,
11591         ___SCMOBJ *obj,
11592         int arg_num),
11593        ());
11594___IMP_FUNC(___SCMOBJ,___NONNULLISO_8859_1STRINGLIST_to_SCMOBJ)
11595   ___P((___processor_state ___ps,
11596         ___ISO_8859_1STRING *x,
11597         ___SCMOBJ *obj,
11598         int arg_num),
11599        ());
11600___IMP_FUNC(___SCMOBJ,___UTF_8STRING_to_SCMOBJ)
11601   ___P((___processor_state ___ps,
11602         ___UTF_8STRING x,
11603         ___SCMOBJ *obj,
11604         int arg_num),
11605        ());
11606___IMP_FUNC(___SCMOBJ,___NONNULLUTF_8STRING_to_SCMOBJ)
11607   ___P((___processor_state ___ps,
11608         ___UTF_8STRING x,
11609         ___SCMOBJ *obj,
11610         int arg_num),
11611        ());
11612___IMP_FUNC(___SCMOBJ,___NONNULLUTF_8STRINGLIST_to_SCMOBJ)
11613   ___P((___processor_state ___ps,
11614         ___UTF_8STRING *x,
11615         ___SCMOBJ *obj,
11616         int arg_num),
11617        ());
11618___IMP_FUNC(___SCMOBJ,___UTF_16STRING_to_SCMOBJ)
11619   ___P((___processor_state ___ps,
11620         ___UTF_16STRING x,
11621         ___SCMOBJ *obj,
11622         int arg_num),
11623        ());
11624___IMP_FUNC(___SCMOBJ,___NONNULLUTF_16STRING_to_SCMOBJ)
11625   ___P((___processor_state ___ps,
11626         ___UTF_16STRING x,
11627         ___SCMOBJ *obj,
11628         int arg_num),
11629        ());
11630___IMP_FUNC(___SCMOBJ,___NONNULLUTF_16STRINGLIST_to_SCMOBJ)
11631   ___P((___processor_state ___ps,
11632         ___UTF_16STRING *x,
11633         ___SCMOBJ *obj,
11634         int arg_num),
11635        ());
11636___IMP_FUNC(___SCMOBJ,___UCS_2STRING_to_SCMOBJ)
11637   ___P((___processor_state ___ps,
11638         ___UCS_2STRING x,
11639         ___SCMOBJ *obj,
11640         int arg_num),
11641        ());
11642___IMP_FUNC(___SCMOBJ,___NONNULLUCS_2STRING_to_SCMOBJ)
11643   ___P((___processor_state ___ps,
11644         ___UCS_2STRING x,
11645         ___SCMOBJ *obj,
11646         int arg_num),
11647        ());
11648___IMP_FUNC(___SCMOBJ,___NONNULLUCS_2STRINGLIST_to_SCMOBJ)
11649   ___P((___processor_state ___ps,
11650         ___UCS_2STRING *x,
11651         ___SCMOBJ *obj,
11652         int arg_num),
11653        ());
11654___IMP_FUNC(___SCMOBJ,___UCS_4STRING_to_SCMOBJ)
11655   ___P((___processor_state ___ps,
11656         ___UCS_4STRING x,
11657         ___SCMOBJ *obj,
11658         int arg_num),
11659        ());
11660___IMP_FUNC(___SCMOBJ,___NONNULLUCS_4STRING_to_SCMOBJ)
11661   ___P((___processor_state ___ps,
11662         ___UCS_4STRING x,
11663         ___SCMOBJ *obj,
11664         int arg_num),
11665        ());
11666___IMP_FUNC(___SCMOBJ,___NONNULLUCS_4STRINGLIST_to_SCMOBJ)
11667   ___P((___processor_state ___ps,
11668         ___UCS_4STRING *x,
11669         ___SCMOBJ *obj,
11670         int arg_num),
11671        ());
11672___IMP_FUNC(___SCMOBJ,___WCHARSTRING_to_SCMOBJ)
11673   ___P((___processor_state ___ps,
11674         ___WCHARSTRING x,
11675         ___SCMOBJ *obj,
11676         int arg_num),
11677        ());
11678___IMP_FUNC(___SCMOBJ,___NONNULLWCHARSTRING_to_SCMOBJ)
11679   ___P((___processor_state ___ps,
11680         ___WCHARSTRING x,
11681         ___SCMOBJ *obj,
11682         int arg_num),
11683        ());
11684___IMP_FUNC(___SCMOBJ,___NONNULLWCHARSTRINGLIST_to_SCMOBJ)
11685   ___P((___processor_state ___ps,
11686         ___WCHARSTRING *x,
11687         ___SCMOBJ *obj,
11688         int arg_num),
11689        ());
11690___IMP_FUNC(___SCMOBJ,___VARIANT_to_SCMOBJ)
11691   ___P((___processor_state ___ps,
11692         ___VARIANT x,
11693         ___SCMOBJ *obj,
11694         int arg_num),
11695        ());
11696___IMP_FUNC(___SCMOBJ,___STRING_to_UCS_2STRING)
11697   ___P((char *str_char,
11698         ___UCS_2STRING *str_UCS_2,
11699         int char_encoding),
11700        ());
11701___IMP_FUNC(void,___free_UCS_2STRING)
11702   ___P((___UCS_2STRING str_UCS_2),
11703        ());
11704___IMP_FUNC(___SCMOBJ,___NONNULLSTRINGLIST_to_NONNULLUCS_2STRINGLIST)
11705   ___P((char **str_list_char,
11706         ___UCS_2STRING **str_list_UCS_2,
11707         int char_encoding),
11708        ());
11709___IMP_FUNC(void,___free_NONNULLUCS_2STRINGLIST)
11710   ___P((___UCS_2STRING *str_list_UCS_2),
11711        ());
11712___IMP_FUNC(___SCMOBJ,___make_sfun_stack_marker)
11713   ___P((___processor_state ___ps,
11714         ___SCMOBJ *marker,
11715         ___SCMOBJ proc_or_false),
11716        ());
11717___IMP_FUNC(void,___kill_sfun_stack_marker)
11718   ___P((___SCMOBJ marker),
11719        ());
11720#endif
11721
11722#ifndef ___INCLUDED_FROM_MEM
11723___IMP_FUNC(void*,___alloc_rc)
11724   ___P((___PSD
11725         ___SIZE_T bytes),
11726        ());
11727___IMP_FUNC(void,___release_rc)
11728   ___P((void *ptr),
11729        ());
11730___IMP_FUNC(void,___addref_rc)
11731   ___P((void *ptr),
11732        ());
11733___IMP_FUNC(___SCMOBJ,___data_rc)
11734   ___P((void *ptr),
11735        ());
11736___IMP_FUNC(void,___set_data_rc)
11737   ___P((void *ptr,
11738         ___SCMOBJ val),
11739        ());
11740___IMP_FUNC(___SCMOBJ,___alloc_scmobj)
11741   ___P((___processor_state ___ps,
11742         int subtype,
11743         ___SIZE_TS bytes),
11744        ());
11745___IMP_FUNC(___SCMOBJ,___release_scmobj)
11746   ___P((___SCMOBJ obj),
11747        ());
11748___IMP_FUNC(___SCMOBJ,___make_pair)
11749   ___P((___processor_state ___ps,
11750         ___SCMOBJ car,
11751         ___SCMOBJ cdr),
11752        ());
11753___IMP_FUNC(___SCMOBJ,___make_vector)
11754   ___P((___processor_state ___ps,
11755         ___SIZE_TS length,
11756         ___SCMOBJ init),
11757        ());
11758___IMP_FUNC(void,___still_obj_refcount_inc)
11759   ___P((___SCMOBJ obj),
11760        ());
11761___IMP_FUNC(void,___still_obj_refcount_dec)
11762   ___P((___SCMOBJ obj),
11763        ());
11764___IMP_FUNC(___SCMOBJ,___gc_hash_table_ref)
11765   ___P((___SCMOBJ ht,
11766         ___SCMOBJ key),
11767        ());
11768___IMP_FUNC(___SCMOBJ,___gc_hash_table_set)
11769   ___P((___SCMOBJ ht,
11770         ___SCMOBJ key,
11771         ___SCMOBJ val),
11772        ());
11773___IMP_FUNC(___SCMOBJ,___gc_hash_table_union_find)
11774   ___P((___SCMOBJ ht,
11775         ___SCMOBJ key1,
11776         ___SCMOBJ key2,
11777         ___BOOL find),
11778        ());
11779___IMP_FUNC(___SCMOBJ,___gc_hash_table_rehash)
11780   ___P((___SCMOBJ ht_src,
11781         ___SCMOBJ ht_dst),
11782        ());
11783#endif
11784
11785#ifndef ___INCLUDED_FROM_SETUP
11786___GSTATEDECL
11787___IMP_FUNC(___BOOL,___iswalpha)
11788   ___P((___UCS_4 x),
11789        ());
11790___IMP_FUNC(___BOOL,___iswdigit)
11791   ___P((___UCS_4 x),
11792        ());
11793___IMP_FUNC(___BOOL,___iswspace)
11794   ___P((___UCS_4 x),
11795        ());
11796___IMP_FUNC(___BOOL,___iswupper)
11797   ___P((___UCS_4 x),
11798        ());
11799___IMP_FUNC(___BOOL,___iswlower)
11800   ___P((___UCS_4 x),
11801        ());
11802___IMP_FUNC(___UCS_4,___towupper)
11803   ___P((___UCS_4 x),
11804        ());
11805___IMP_FUNC(___UCS_4,___towlower)
11806   ___P((___UCS_4 x),
11807        ());
11808___IMP_FUNC(___SCMOBJ,___string_collate)
11809   ___P((___SCMOBJ s1,
11810         ___SCMOBJ s2),
11811        ());
11812___IMP_FUNC(___SCMOBJ,___string_collate_ci)
11813   ___P((___SCMOBJ s1,
11814         ___SCMOBJ s2),
11815        ());
11816___IMP_FUNC(double,___copysign)
11817   ___P((double x,
11818         double y),
11819        ());
11820___IMP_FUNC(___BOOL,___isfinite)
11821   ___P((double x),
11822        ());
11823___IMP_FUNC(___BOOL,___isnan)
11824   ___P((double x),
11825        ());
11826___IMP_FUNC(double,___trunc)
11827   ___P((double x),
11828        ());
11829___IMP_FUNC(double,___round)
11830   ___P((double x),
11831        ());
11832#ifdef ___DEFINE_SCALBN
11833___IMP_FUNC(double,___scalbn)
11834   ___P((double x,
11835         int n),
11836        ());
11837#endif
11838#ifdef ___DEFINE_ILOGB
11839___IMP_FUNC(int,___ilogb)
11840   ___P((double x),
11841        ());
11842#endif
11843#ifdef ___DEFINE_EXPM1
11844___IMP_FUNC(double,___expm1)
11845   ___P((double x),
11846        ());
11847#endif
11848#ifdef ___DEFINE_LOG1P
11849___IMP_FUNC(double,___log1p)
11850   ___P((double x),
11851        ());
11852#endif
11853#ifdef ___DEFINE_SINH
11854___IMP_FUNC(double,___sinh)
11855   ___P((double x),
11856        ());
11857#endif
11858#ifdef ___DEFINE_COSH
11859___IMP_FUNC(double,___cosh)
11860   ___P((double x),
11861        ());
11862#endif
11863#ifdef ___DEFINE_TANH
11864___IMP_FUNC(double,___tanh)
11865   ___P((double x),
11866        ());
11867#endif
11868#ifdef ___DEFINE_ASINH
11869___IMP_FUNC(double,___asinh)
11870   ___P((double x),
11871        ());
11872#endif
11873#ifdef ___DEFINE_ACOSH
11874___IMP_FUNC(double,___acosh)
11875   ___P((double x),
11876        ());
11877#endif
11878#ifdef ___DEFINE_ATANH
11879___IMP_FUNC(double,___atanh)
11880   ___P((double x),
11881        ());
11882#endif
11883#ifdef ___DEFINE_ATAN2
11884___IMP_FUNC(double,___atan2)
11885   ___P((double y,
11886         double x),
11887        ());
11888#endif
11889#ifdef ___DEFINE_POW
11890___IMP_FUNC(double,___pow)
11891   ___P((double x,
11892         double y),
11893        ());
11894#endif
11895___IMP_FUNC(___SCMOBJ,___F64_to_STRING)
11896   ___P((___PSD
11897         double x),
11898        ());
11899___IMP_FUNC(void,___setup_params_reset)
11900   ___P((___setup_params_struct *setup_params),
11901        ());
11902___IMP_FUNC(___SCMOBJ,___setup)
11903   ___P((___setup_params_struct *setup_params),
11904        ());
11905___IMP_FUNC(void,___cleanup) ___PVOID;
11906___IMP_FUNC(void,___cleanup_and_exit_process)
11907   ___P((int status),
11908        ());
11909___IMP_FUNC(___SCMOBJ,___current_vm_resize)
11910   ___P((___PSD
11911         ___SCMOBJ thunk,
11912         int target_processor_count),
11913        ());
11914___IMP_FUNC(___BOOL,___garbage_collect)
11915   ___P((___PSD
11916         ___SIZE_TS requested_words_still),
11917        ());
11918___IMP_FUNC(___SCMOBJ,___setup_vmstate)
11919   ___P((___virtual_machine_state ___vms),
11920        ());
11921___IMP_FUNC(void,___cleanup_vmstate)
11922   ___P((___virtual_machine_state ___vms),
11923        ());
11924___IMP_FUNC(___SCMOBJ,___setup_pstate)
11925   ___P((___processor_state ___ps,
11926         ___virtual_machine_state ___vms),
11927        ());
11928___IMP_FUNC(void,___cleanup_pstate)
11929   ___P((___processor_state ___ps),
11930        ());
11931___IMP_FUNC(___SIZE_T,___get_min_heap) ___PVOID;
11932___IMP_FUNC(void,___set_min_heap)
11933   ___P((___SIZE_T bytes),
11934        ());
11935___IMP_FUNC(___SIZE_T,___get_max_heap) ___PVOID;
11936___IMP_FUNC(void,___set_max_heap)
11937   ___P((___SIZE_T bytes),
11938        ());
11939___IMP_FUNC(int,___get_live_percent) ___PVOID;
11940___IMP_FUNC(void,___set_live_percent)
11941   ___P((int percent),
11942        ());
11943___IMP_FUNC(int,___get_parallelism_level) ___PVOID;
11944___IMP_FUNC(void,___set_parallelism_level)
11945   ___P((int level),
11946        ());
11947___IMP_FUNC(int,___get_standard_level) ___PVOID;
11948___IMP_FUNC(void,___set_standard_level)
11949   ___P((int level),
11950        ());
11951___IMP_FUNC(void,___set_gambitdir)
11952   ___P((___UCS_2STRING gambitdir),
11953        ());
11954___IMP_FUNC(int,___set_debug_settings)
11955   ___P((int mask,
11956         int new_settings),
11957        ());
11958___IMP_FUNC(___program_startup_info_struct*,___get_program_startup_info)
11959   ___PVOID;
11960___IMP_FUNC(___SCMOBJ,___call)
11961   ___P((___PSD
11962         ___WORD nargs,
11963         ___SCMOBJ proc,
11964         ___SCMOBJ marker),
11965        ());
11966___IMP_FUNC(___SCMOBJ,___run)
11967   ___P((___SCMOBJ thunk),
11968        ());
11969#ifdef ___SUPPORT_LOWLEVEL_EXEC
11970___IMP_FUNC(___WORD,___lowlevel_exec)
11971   ___P((___processor_state ___ps),
11972        ());
11973#endif
11974___IMP_FUNC(___SCMOBJ,___machine_code_block_fixup)
11975   ___P((___processor_state ___ps,
11976         void *mcb,
11977         ___SCMOBJ fixup_locs,
11978         ___SCMOBJ fixup_objs),
11979        ());
11980___IMP_FUNC(void,___throw_error)
11981   ___P((___PSD
11982         ___SCMOBJ err),
11983        ());
11984___IMP_FUNC(void,___propagate_error)
11985   ___P((___PSD
11986         ___SCMOBJ err),
11987        ());
11988#ifdef ___DEBUG_HOST_CHANGES
11989___IMP_FUNC(void,___register_host_entry)
11990   ___P((___PSD
11991         ___WORD start,
11992         char *module_name,
11993         char *file,
11994         int line),
11995        ());
11996#endif
11997#ifdef ___ACTIVITY_LOG
11998___IMP_FUNC(void,___actlog_add_pstate)
11999   ___P((___processor_state ___ps,
12000         ___U16 *type,
12001         char *name,
12002         ___U32 color),
12003        ());
12004___IMP_FUNC(void,___actlog_begin_pstate)
12005   ___P((___processor_state ___ps,
12006         ___U16 *type,
12007         char *name,
12008         ___U32 color),
12009        ());
12010___IMP_FUNC(void,___actlog_end_pstate)
12011   ___P((___processor_state ___ps),
12012        ());
12013___IMP_FUNC(void,___actlog_start)
12014   ___P((___processor_state ___ps),
12015        ());
12016___IMP_FUNC(void,___actlog_stop)
12017   ___P((___processor_state ___ps),
12018        ());
12019___IMP_FUNC(void,___actlog_dump)
12020   ___P((___virtual_machine_state ___vms,
12021         char *filename),
12022        ());
12023#endif
12024___IMP_FUNC(void,___raise_interrupt_pstate)
12025   ___P((___processor_state ___ps,
12026         int code),
12027        ());
12028___IMP_FUNC(void,___raise_interrupt_vmstate)
12029   ___P((___virtual_machine_state ___vms,
12030         int code),
12031        ());
12032___IMP_FUNC(void,___raise_interrupt)
12033   ___P((int code),
12034        ());
12035___IMP_FUNC(void,___begin_interrupt_service_pstate)
12036   ___P((___processor_state ___ps),
12037        ());
12038___IMP_FUNC(___BOOL,___check_interrupt_pstate)
12039   ___P((___processor_state ___ps,
12040         int code),
12041        ());
12042___IMP_FUNC(void,___end_interrupt_service_pstate)
12043   ___P((___processor_state ___ps,
12044         int code),
12045        ());
12046___IMP_FUNC(void,___disable_interrupts_pstate)
12047   ___P((___processor_state ___ps),
12048        ());
12049___IMP_FUNC(void,___enable_interrupts_pstate)
12050   ___P((___processor_state ___ps),
12051        ());
12052#endif
12053
12054#ifndef ___INCLUDED_FROM_OS_SETUP
12055___IMP_FUNC(void,___mask_all_interrupts_begin)
12056   ___P((___mask_all_interrupts_state *state),
12057        ());
12058___IMP_FUNC(void,___mask_all_interrupts_end)
12059   ___P((___mask_all_interrupts_state *state),
12060        ());
12061#endif
12062
12063#ifndef ___INCLUDED_FROM_OS_TTY
12064___IMP_FUNC(void,___mask_user_interrupts_begin)
12065   ___P((___mask_user_interrupts_state *state),
12066        ());
12067___IMP_FUNC(void,___mask_user_interrupts_end)
12068   ___P((___mask_user_interrupts_state *state),
12069        ());
12070#endif
12071
12072#ifndef ___INCLUDED_FROM_OS_TIME
12073___IMP_FUNC(void,___mask_heartbeat_interrupts_begin)
12074   ___P((___mask_heartbeat_interrupts_state *state),
12075        ());
12076___IMP_FUNC(void,___mask_heartbeat_interrupts_end)
12077   ___P((___mask_heartbeat_interrupts_state *state),
12078        ());
12079#endif
12080
12081#ifndef ___INCLUDED_FROM_OS_IO
12082___IMP_FUNC(void,___mask_child_interrupts_begin)
12083   ___P((___mask_child_interrupts_state *state),
12084        ());
12085___IMP_FUNC(void,___mask_child_interrupts_end)
12086   ___P((___mask_child_interrupts_state *state),
12087        ());
12088#endif
12089
12090#ifndef ___INCLUDED_FROM_OS_BASE
12091#ifndef ___DEBUG_ALLOC_MEM
12092___IMP_FUNC(void *,___alloc_mem)
12093   ___P((___SIZE_T bytes),
12094        ());
12095___IMP_FUNC(void,___free_mem)
12096   ___P((void *ptr),
12097        ());
12098___IMP_FUNC(void *,___alloc_mem_heap)
12099   ___P((___SIZE_T bytes),
12100        ());
12101___IMP_FUNC(void,___free_mem_heap)
12102   ___P((void *ptr),
12103        ());
12104#else
12105___IMP_FUNC(void *,___alloc_mem)
12106   ___P((___SIZE_T bytes,
12107         int lineno,
12108         char *file),
12109        ());
12110___IMP_FUNC(void,___free_mem)
12111   ___P((void *ptr,
12112         int lineno,
12113         char *file),
12114        ());
12115___IMP_FUNC(void *,___alloc_mem_heap)
12116   ___P((___SIZE_T bytes,
12117         int lineno,
12118         char *file),
12119        ());
12120___IMP_FUNC(void,___free_mem_heap)
12121   ___P((void *ptr,
12122         int lineno,
12123         char *file),
12124        ());
12125#endif
12126___IMP_FUNC(void *,___alloc_mem_code)
12127   ___P((___SIZE_T bytes),
12128        ());
12129___IMP_FUNC(void,___free_mem_code)
12130   ___P((void *ptr),
12131        ());
12132#endif
12133
12134#ifndef ___INCLUDED_FROM_OS_THREAD
12135#ifdef ___USE_emulated_sync
12136___IMP_FUNC(___WORD,___emulated_compare_and_swap_word)
12137   ___P((___VOLATILE ___WORD *ptr,
12138         ___WORD oldval,
12139         ___WORD newval),
12140        ());
12141___IMP_FUNC(___WORD,___emulated_fetch_and_add_word)
12142   ___P((___VOLATILE ___WORD *ptr,
12143         ___WORD val),
12144        ());
12145___IMP_FUNC(___WORD,___emulated_fetch_and_clear_word)
12146   ___P((___VOLATILE ___WORD *ptr),
12147        ());
12148___IMP_FUNC(void,___emulated_shared_memory_barrier) ___PVOID;
12149#endif
12150#ifdef ___DEFINE_THREAD_LOCAL_STORAGE_GETTER_SETTER
12151___IMP_FUNC(void *,___get_tls_ptr) ___PVOID;
12152___IMP_FUNC(void,___set_tls_ptr)
12153   ___P((void *ptr),
12154        ());
12155#endif
12156#endif
12157
12158#endif
12159#endif
12160
12161#endif
12162