"Fossies" - the Fresh Open Source Software Archive

Member "scm/scmfig.h" (16 Jul 2015, 21994 Bytes) of package /linux/privat/scm-5f3.zip:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "scmfig.h" see the Fossies "Dox" file reference documentation and the latest Fossies "Diffs" side-by-side code changes report: 5f2_vs_5f3.

    1 /* "scmfig.h" system-dependent configuration.
    2  * Copyright (C) 1990-2006 Free Software Foundation, Inc.
    3  *
    4  * This program is free software: you can redistribute it and/or modify
    5  * it under the terms of the GNU Lesser General Public License as
    6  * published by the Free Software Foundation, either version 3 of the
    7  * License, or (at your option) any later version.
    8  *
    9  * This program is distributed in the hope that it will be useful, but
   10  * WITHOUT ANY WARRANTY; without even the implied warranty of
   11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   12  * Lesser General Public License for more details.
   13  *
   14  * You should have received a copy of the GNU Lesser General Public
   15  * License along with this program.  If not, see
   16  * <http://www.gnu.org/licenses/>.
   17  */
   18 
   19 /* Author: Aubrey Jaffer */
   20 
   21 #ifdef sequent
   22 # include <strings.h>
   23 # define strchr index
   24 # define strrchr rindex
   25 #else
   26 # ifndef PLAN9
   27 #  include <string.h>
   28 # endif
   29 #endif
   30 
   31 /* MS Windows signal handling hack added by Rainer Urian */
   32 /*
   33    SCM crashes on WindowsNT after hitting control-c.
   34 
   35    This is because signal handling in windows console applications is
   36    rather different from unix apps.  If control-c is hit on a console
   37    application Windows creates a new thread which executes the
   38    control-c signal handler.  Now, if the SCM handler does the longjmp
   39    back to the repl loop it does it via the stack of the signal
   40    handler thread which results always ever is an access violation.
   41 
   42    The solution to this problem is to let the signal handler thread
   43    raise a software interrupt in the main thread.
   44 
   45    This is done with the following  steps:
   46 
   47    1. contol-c is hit
   48 
   49    2. Windows creates the signal handler thread which in turn executes
   50    the routine win32_sigint as its signal handler.
   51 
   52    3. The handler suspends the main thread and gets the main threads
   53    register context.
   54 
   55    4. The handler simulates an interrupt call on the main thread by
   56    pointing Eip to the sigintstub stub function and also simulates a
   57    pushad , pushf of the main threads registers
   58 
   59    5. The handler resumes the main thread which when scheduled will
   60    execute sigintstub, which in turn calls the proper signal interupt
   61    (scamble_signal)
   62 */
   63 #ifdef _WIN32
   64 /* POCKETCONSOLE has the signal handler implemented in the  runtime */
   65 # ifndef POCKETCONSOLE
   66 #  define WINSIGNALS
   67 # endif
   68 #endif
   69 
   70 
   71 #include "scmflags.h"       /* user specified, system independent flags */
   72 
   73 /* IMPLINIT is the full pathname (surrounded by double quotes) of
   74    Init.scm, the Scheme initialization code.  This is best defined in
   75    the makefile.  If available, SCM uses the value of environment
   76    variable SCM_INIT_PATH instead of IMPLINIT. */
   77 
   78 /* #define IMPLINIT "/usr/jaffer/scm/Init.scm" */
   79 
   80 /* INITS is calls to initialization routines for any compiled
   81    libraries being linked into scm.  This is best done in the makefile.
   82 File:   INITS line:     functions defined:
   83 
   84 sc2.c   init_sc2(); substring-move-left!, substring-move-right!,
   85             substring-fill!, append!, and last-pair
   86 rgx.c   init_rgx(); regcomp and regexec. */
   87 
   88 /* #define INITS init_sc2(); */
   89 
   90 /* #define SICP */
   91 
   92 /* setbuf(0) needs to be done for tty ports in order for CHAR-READY?
   93    to work.  This can cause problems under MSDOS and other systems. */
   94 
   95 /* #define NOSETBUF */
   96 
   97 /* #define RECKLESS */
   98 
   99 /* #define CAUTIOUS */
  100 
  101 /* #define BIGNUMS */
  102 
  103 /* #define ARRAYS */
  104 
  105 /* #define FLOATS */
  106 
  107 /* Define SINGLES if you want single precision floats and
  108    (sizeof(float)==sizeof(long)) */
  109 
  110 #ifdef FLOATS
  111 # ifndef _MSC_VER
  112 #  define SINGLES
  113 # endif
  114 #endif
  115 
  116 /* #define SINGLESONLY */
  117 
  118 /* Define CDR_DOUBLES if (sizeof(double)==sizeof(long)), i.e.
  119    a `single' is really a double. */
  120 #ifdef FLOATS
  121 # ifdef __alpha
  122 #  define CDR_DOUBLES
  123 # endif
  124 
  125 # ifdef _UNICOS     /* doubles are no better than singles on Cray. */
  126 #  define SINGLESONLY
  127 # endif
  128 
  129 # ifdef CDR_DOUBLES
  130 #  define SINGLES
  131 #  define SINGLESONLY
  132 # endif
  133 #endif
  134 
  135 /* #define ENGNOT */
  136 
  137 /* Define SUN_DL to configure code in "dynl.c" so that dynamic linking
  138    is done using the SUN dynamic linking library "dl". */
  139 
  140 /* #define SUN_DL */
  141 
  142 /* Define DLD to configure code in "dynl.c" so that dynamic linking is
  143    done using the "dld" library.  DLD is ported to Linux, VAX
  144    (Ultrix), Sun 3 (SunOS 3.4 and 4.0), SPARCstation (SunOS 4.0),
  145    Sequent Symmetry (Dynix), and Atari ST.  See scm/README or
  146    scm/ANNOUNCE for ftp sites offering dld. */
  147 
  148 /* #define DLD */
  149 
  150 /* Define HAVE_DYNL if dynamic linking is available */
  151 
  152 #ifdef DLD
  153 # define HAVE_DYNL
  154 #endif
  155 #ifdef SUN_DL
  156 # define HAVE_DYNL
  157 #endif
  158 #ifdef HP_SHL
  159 # define HAVE_DYNL
  160 #endif
  161 
  162 #ifdef HAVE_DYNL
  163 # define CCLO
  164 #endif
  165 
  166 /* Define GC_FREE_SEGMENTS if you want segments of unused heap to
  167    be freed up after garbage collection.  Don't define it if you
  168    never want the heap to shrink. */
  169 #ifndef DONT_GC_FREE_SEGMENTS
  170 # define GC_FREE_SEGMENTS
  171 #endif
  172 
  173 /* MEMOIZE_LOCALS means to convert references to local variables to ILOCs,
  174    (relative lexical addresses into the environment).  This memoization
  175    makes evaluated Scheme code harder to read, so you may want to undefine
  176    this flag for debugging -- but SCM will run 3 to 6 times slower */
  177 #ifndef DONT_MEMOIZE_LOCALS
  178 # define MEMOIZE_LOCALS
  179 #endif
  180 
  181 /* #define CHEAP_CONTINUATIONS */
  182 
  183 /* #define TICKS */
  184 
  185 /* PROT386 should be defined on the compilation command line if the
  186    program is to be run on an intel 386 in protected mode.  `Huge'
  187    pointers common on MSDOS compilers do not work in protected mode.
  188    PROT386 is required if scm is to run as part of a Microsoft Windows
  189    application.  Added by Stephen Adams 8 May 92 */
  190 
  191 /* #define PROT386 */
  192 
  193 /* #define NON_PREEMPTIVE if you are using an non-preemptive operating
  194    system in which periodic polling for interrupts is necessary.
  195    Provide your own main procedure (e.g., WinMain, in Windows) or
  196    modify "scmmain.c".  Define and initialize unsigned int poll_count,
  197    and provide a procedure named poll_routine(), which POLL calls each
  198    time poll_count reaches zero.  poll_routine() must reinitialize
  199    poll_count.  It may also check for external actions, such as
  200    Windows messages.  The value assigned to poll_count can be quite
  201    large, e.g., 1000, while still maintaining good response time. */
  202 
  203 /* #define CAREFUL_INTS */
  204 
  205 /* Define MACRO if you want C level support for hygienic and referentially
  206    transparent macros. */
  207 
  208 /* #define MACRO */
  209 
  210 /* STDC_HEADERS indicates that the include file names are the same as
  211    ANSI C.  For most modern systems this is the case. */
  212 
  213 /* added by Yasuaki Honda */
  214 #ifdef THINK_C
  215 # define __STDC__
  216 # ifndef macintosh
  217 #  define macintosh
  218 # endif
  219 #endif
  220 
  221 /* added by Bob Schumaker, cobblers@netcom.com */
  222 #ifdef __MWERKS__
  223 # ifndef macintosh
  224 #  define macintosh
  225 # endif
  226 # define bzero(p, n)    memset(p, 0, n)
  227 # define bcopy          memcpy
  228 #endif
  229 /* added by Denys Duchier */
  230 #ifndef SVR4
  231 # ifdef __SVR4
  232 #  define SVR4
  233 # endif
  234 #endif
  235 
  236 #ifdef __STDC__
  237 # ifndef __HIGHC__      /* overly fussy compiler */
  238 #  define USE_ANSI_PROTOTYPES
  239 # endif
  240 # ifndef __GNUC__
  241 #  define STDC_HEADERS
  242 # else
  243 #  ifdef sparc
  244 #   ifdef SVR4
  245 #    define STDC_HEADERS
  246 #   endif
  247 #  else
  248 #   ifndef tahoe
  249 #    ifndef sun
  250 #     define STDC_HEADERS
  251 #    endif
  252 #   endif
  253 #  endif
  254 # endif
  255 #endif
  256 #ifdef __aarch64__
  257 # define SHORT_INT
  258 # define CDR_DOUBLES
  259 #endif
  260 #ifdef __alpha
  261 # define SHORT_INT
  262 #endif
  263 #ifdef __ia64__
  264 # define SHORT_INT
  265 # define CDR_DOUBLES
  266 #endif
  267 #ifdef __x86_64
  268 # define SHORT_INT
  269 # define CDR_DOUBLES
  270 #endif
  271 #ifdef MSDOS            /* Microsoft C 5.10 and 6.00A */
  272 # ifndef GO32
  273 #  define SHORT_INT
  274 #  define SHORT_SIZET
  275 # endif
  276 #endif
  277 #ifdef _QC
  278 # define SHORT_INT
  279 # define SHORT_SIZET
  280 #endif
  281 #ifdef __TURBOC__
  282 # define SHORT_INT
  283 # define SHORT_SIZET
  284 # define LACK_SBRK
  285 # ifndef __TOS__
  286 #  define MSDOS
  287 # endif
  288 #endif
  289 #ifdef __HIGHC__
  290 # define LACK_SBRK
  291 #endif
  292 #ifdef _WIN32
  293 # define MSDOS
  294 # define LACK_SBRK
  295 # define LACK_TIMES
  296 #endif
  297 #ifdef _MSDOS
  298 # define MSDOS
  299 #endif
  300 #ifdef MSDOS
  301 # define STDC_HEADERS
  302 #endif
  303 
  304 #ifdef POCKETCONSOLE
  305 # define NOSETBUF
  306 # define LACK_FTIME
  307 #endif
  308 
  309 #ifdef vms
  310 # define STDC_HEADERS
  311 #endif
  312 
  313 #ifdef nosve
  314 # define STDC_HEADERS
  315 #endif
  316 
  317 #ifdef linux
  318 # define HAVE_SELECT
  319 # define HAVE_SYS_TIME_H
  320 # define STDC_HEADERS
  321 #endif
  322 
  323 #ifdef _UNICOS
  324 # define STDC_HEADERS
  325 #endif
  326 
  327 #ifdef _AIX
  328 # define _POSIX_SOURCE
  329 # define LACK_FTIME
  330 #endif
  331 
  332 #ifdef __sgi__
  333 # define LACK_FTIME
  334 # define STDC_HEADERS
  335 # define USE_ANSI_PROTOTYPES
  336 # define HAVE_SYS_TIME_H
  337 # define __SVR4
  338 #endif
  339 
  340 #ifdef __SVR4
  341 # define HAVE_SELECT
  342 #endif
  343 
  344 #ifdef PLAN9
  345 # define STDC_HEADERS
  346 #endif
  347 
  348 #ifdef hpux
  349 # define LACK_E_IDs
  350 #endif
  351 
  352 /* C-Set++ for OS/2 */
  353 #ifdef __IBMC__
  354 # define STDC_HEADERS
  355 # define LACK_TIMES
  356 # define LACK_SBRK
  357 #endif
  358 
  359 #ifdef __CYGWIN__
  360 /* # define LACK_FTIME */
  361 # define HAVE_SELECT
  362 # define HAVE_SYS_TIME_H
  363 # undef MSDOS
  364 #endif
  365 
  366 #ifdef __amigaos__
  367 # define HAVE_SELECT
  368 # define HAVE_SYS_TIME_H
  369 # define LACK_SBRK
  370 #endif
  371 
  372 /* PROMPT is the prompt string printed at top level */
  373 
  374 #ifndef PROMPT
  375 # ifdef SICP
  376 #  define PROMPT "==> "
  377 # else
  378 #  define PROMPT "> "
  379 # endif
  380 #endif
  381 
  382 /* #define BRACKETS_AS_PARENS to have [ and ] be read as ( and ) in forms. */
  383 
  384 /* #define BRACKETS_AS_PARENS */
  385 
  386 /* LINE_INCREMENTORS are the characters which cause the line count to
  387    be incremented for the purposes of error reporting.  This feature
  388    is only used for scheme code loaded from files.
  389 
  390    WHITE_SPACES are other characters which should be treated like spaces
  391    in programs.  in both cases sparate characters with ":case " */
  392 
  393 #define LINE_INCREMENTORS  '\n'
  394 #ifdef MSDOS
  395 # define WHITE_SPACES  ' ':case '\t':case '\r':case '\f':case 26
  396 #else
  397 # define WHITE_SPACES  ' ':case '\t':case '\r':case '\f'
  398 #endif
  399 
  400 #ifdef __ia64__
  401 # define PTR2INT(x) ((long)(x))
  402 #else
  403 # ifdef __x86_64
  404 #  define PTR2INT(x) ((long)(x))
  405 # else
  406 #  define PTR2INT(x) ((int)(x))
  407 # endif
  408 #endif
  409 
  410 #ifndef __builtin_expect
  411 # ifndef __GNUC__
  412 #  define __builtin_expect(expr, expected) (expr)
  413 # else
  414 #  if (__GNUC__ < 3)
  415 #   define __builtin_expect(expr, expected) (expr)
  416 #  endif
  417 # endif
  418 #endif
  419 
  420 #define SCM_EXPECT_TRUE(expr) (__builtin_expect(expr, !0))
  421 #define SCM_EXPECT_FALSE(expr) (__builtin_expect(expr, 0))
  422 
  423 #ifdef __GNUC__
  424 # define FENCE asm volatile ("")
  425 #else
  426 # define FENCE /**/
  427 #endif
  428 
  429 #ifdef NON_PREEMPTIVE
  430 # define VERIFY_INTS(s1, s2) /**/
  431 # define DEFER_INTS /**/
  432 # ifdef TICKS
  433 #  define POLL {if (0==poll_count--) poll_routine(); \
  434           if (0==tick_count--) tick_signal();}
  435 # else
  436 #  define POLL {if (0==poll_count--) poll_routine();}
  437 # endif
  438 # define CHECK_INTS POLL
  439 # define ALLOW_INTS POLL
  440 # define DEFER_INTS_EGC /**/
  441 # define ALLOW_INTS_EGC /**/
  442 #else
  443 # ifdef CAREFUL_INTS
  444 typedef struct {char *fname; int linum;} ints_infot;
  445 extern ints_infot *ints_info;
  446 #  define VERIFY_INTS(s1, s2) {if (!ints_disabled)\
  447      ints_warn(s1, s2, __FILE__, __LINE__); }
  448 #  define DEFER_INTS \
  449    {static ints_infot info = {__FILE__, __LINE__};\
  450      FENCE;if (1==ints_disabled) ints_viol(&info, 1);\
  451        else {ints_info = &info; ints_disabled = 1;FENCE;}}
  452 #  define ALLOW_INTS \
  453    {static ints_infot info = {__FILE__, __LINE__};\
  454     FENCE;if (1!=ints_disabled) ints_viol(&info, 0);\
  455       else {ints_info = &info; ints_disabled = 0;FENCE;CHECK_INTS}}
  456 #  define DEFER_INTS_EGC \
  457    {static ints_infot info = {__FILE__, __LINE__};\
  458     FENCE;if (1==ints_disabled) ints_viol(&info, 1);\
  459       else {ints_info = &info; ints_disabled = 2;FENCE;}}
  460 #  define ALLOW_INTS_EGC \
  461    {static ints_infot info = {__FILE__, __LINE__};\
  462     FENCE;if (1==ints_disabled) ints_viol(&info, 0);\
  463       else {ints_info = &info; ints_disabled = 0;FENCE;CHECK_INTS}}
  464 # else
  465 #  define VERIFY_INTS(s1, s2) /**/
  466 #  define DEFER_INTS {FENCE;ints_disabled = 1;FENCE;}
  467 #  define ALLOW_INTS {FENCE;ints_disabled = 0;FENCE;CHECK_INTS}
  468 #  define DEFER_INTS_EGC {FENCE;ints_disabled = 2;FENCE;}
  469 #  define ALLOW_INTS_EGC {FENCE;ints_disabled = 0;FENCE;CHECK_INTS}
  470 # endif
  471 # ifdef TICKS
  472 #  define CHECK_INTS {if (deferred_proc) (*deferred_proc)(); POLL;}
  473 #  define POLL {if (0==tick_count--) tick_signal();}
  474 # else
  475 #  define CHECK_INTS {if (deferred_proc) (*deferred_proc)();}
  476 #  define POLL /**/
  477 # endif
  478 #endif
  479 
  480 #ifndef STACK_LIMIT
  481 # define STACK_LIMIT (HEAP_SEG_SIZE)
  482 #endif
  483 
  484 #define CHECK_STACK {if (2 < scm_verbose) stack_check();}
  485 
  486 /* Cray machines have pointers that are incremented once for each word,
  487    rather than each byte, the 3 most significant bits encode the byte
  488    within the word.  The following macros deal with this by storing the
  489    native Cray pointers like the ones that looks like scm expects.  This
  490    is done for any pointers that might appear in the car of a cell, pointers
  491    to vector elts, functions, &c are not munged.  */
  492 #ifdef _UNICOS
  493 # define SCM2PTR(x) ((int)(x) >> 3)
  494 # define PTR2SCM(x) (((SCM)(x)) << 3)
  495 # define POINTERS_MUNGED
  496 #else
  497 # ifdef TEST_SCM2PTR
  498 #  define SCM2PTR(x) ((x) ^ 0xf0L)
  499 #  define PTR2SCM(x) (((SCM)(x)) ^ 0xf0L)
  500 #  define POINTERS_MUNGED
  501 # else
  502 #  define SCM2PTR(x) (x)
  503 #  define PTR2SCM(x) ((SCM)(x))
  504 # endif
  505 #endif
  506 
  507 /* FIXABLE is non-null if its long argument can be encoded in an INUM. */
  508 
  509 #define POSFIXABLE(n) SCM_EXPECT_TRUE((n) <= MOST_POSITIVE_FIXNUM)
  510 #define NEGFIXABLE(n) SCM_EXPECT_TRUE((n) >= MOST_NEGATIVE_FIXNUM)
  511 #define UNEGFIXABLE(n) SCM_EXPECT_TRUE((n) <= -MOST_NEGATIVE_FIXNUM)
  512 #define FIXABLE(n) (POSFIXABLE(n) && NEGFIXABLE(n))
  513 
  514 /* The following 8 definitions are defined automatically by the C
  515    pre-processor.  You will need to override these if you are
  516    cross-compiling or if the C pre-processor has different properties
  517    than the compiler. */
  518 
  519 #if (((-1)%2==-1) && ((-1)%(-2)==-1) && (1%2==1) && (1%(-2)==1))
  520 #else
  521 # define BADIVSGNS
  522 #endif
  523 
  524 /* SRS is signed right shift */
  525 /*--- Turbo C++ v1.0 has a bug with right shifts of signed longs!
  526       It is believed to be fixed in Turbo C++ v1.01     ---*/
  527 #if (-1==(((-1)<<2)+2)>>2) && (__TURBOC__ != 0x295)
  528 # define SRS(x, y) ((x)>>y)
  529 # ifdef __TURBOC__
  530 #  define INUM(x) (((x)>>1)>>1)
  531 # else
  532 #  define INUM(x) SRS(x, 2)
  533 # endif
  534 #else
  535 # define SRS(x, y) (((x)<0) ? ~((~(x))>>y) : (x)>>y)
  536 # define INUM(x) SRS(x, 2)
  537 #endif
  538 
  539 #ifdef __TURBOC__
  540 /* shifts of more than one are done by a library call, single shifts are
  541    performed in registers */
  542 # define MAKINUM(x) ((((x)<<1)<<1)+2L)
  543 #else
  544 # define MAKINUM(x) (((x)<<2)+2L)
  545 #endif
  546 
  547 #ifdef _DCC
  548 # define ASCII
  549 #else
  550 # if (('\n'=='\025') && (' '=='\100') && ('a'=='\201') && ('A'=='\301'))
  551 #  define EBCDIC
  552 # endif
  553 # if (('\n'=='\012') && (' '=='\040') && ('a'=='\141') && ('A'=='\101'))
  554 #  define ASCII
  555 # endif
  556 #endif
  557 
  558 /* CHAR_CODE_LIMIT is the number of distinct characters represented by
  559    the unsigned char datatype. */
  560 /* MOST_POSITIVE_FIXNUM is the INUM closest to positive infinity. */
  561 /* MOST_NEGATIVE_FIXNUM is the INUM closest to negative infinity. */
  562 
  563 #ifdef __STDC__
  564 # define HAVE_LIMITSH
  565 #endif
  566 #ifdef MWC
  567 # define HAVE_LIMITSH
  568 #endif
  569 
  570 #ifdef HAVE_LIMITSH
  571 # include <limits.h>
  572 # ifdef UCHAR_MAX
  573 #  define CHAR_CODE_LIMIT (UCHAR_MAX+1L)
  574 # else
  575 #  define CHAR_CODE_LIMIT 256L
  576 # endif
  577 # define MOST_POSITIVE_FIXNUM (LONG_MAX>>2)
  578 # ifdef _UNICOS         /* Stupid cray bug */
  579 #  define MOST_NEGATIVE_FIXNUM ((long)LONG_MIN/4)
  580 # else
  581 #  define MOST_NEGATIVE_FIXNUM SRS((long)LONG_MIN, 2)
  582 # endif             /* UNICOS */
  583 #else
  584 # define CHAR_CODE_LIMIT 256L
  585 # define MOST_POSITIVE_FIXNUM ((long)((unsigned long)~0L>>3))
  586 # if (0 != ~0)
  587 #  define MOST_NEGATIVE_FIXNUM (-MOST_POSITIVE_FIXNUM-1)
  588 # else
  589 #  define MOST_NEGATIVE_FIXNUM (-MOST_POSITIVE_FIXNUM)
  590 # endif
  591 #endif
  592 
  593 /* INTBUFLEN is the maximum number of characters neccessary for the
  594    printed or string representation of an exact number. */
  595 
  596 #ifndef CHAR_BIT
  597 # define CHAR_BIT 8
  598 #endif
  599 #ifndef LONG_BIT
  600 # define LONG_BIT (CHAR_BIT*sizeof(long)/sizeof(char))
  601 #endif
  602 #define INTBUFLEN (5+LONG_BIT)
  603 
  604 /* Define BIGDIG to an integer type whose size is smaller than long if
  605    you want bignums.  BIGRAD is one greater than the biggest BIGDIG. */
  606 /* Define DIGSTOOBIG if the digits equivalent to a long won't fit in a long. */
  607 #ifdef BIGNUMS
  608 # define SBIGLONG long
  609 # define UBIGLONG unsigned SBIGLONG
  610 # ifdef _UNICOS
  611 #  define DIGSTOOBIG
  612 #  if (1L << 31) <= USHRT_MAX
  613 #   define BIGDIG unsigned short
  614 #  else
  615 #   define BIGDIG unsigned int
  616 #  endif
  617 #  define BITSPERDIG 32
  618 # else
  619 #  if INT_MAX < LONG_MAX
  620 #   define BIGDIG unsigned int
  621 #  else
  622 #   define BIGDIG unsigned short
  623 #  endif
  624 # endif
  625 # define BITSPERDIG (sizeof(BIGDIG)*CHAR_BIT)
  626 # define BIGRAD (1L << BITSPERDIG)
  627 # define DIGSPERLONG ((sizet)((sizeof(UBIGLONG))/sizeof(BIGDIG)))
  628 # define BIGUP(x) (((UBIGLONG)(x)) << BITSPERDIG)
  629 # define BIGDN(x) (((UBIGLONG)(x)) >> BITSPERDIG)
  630 # define BIGLO(x) ((x) & (BIGRAD-1L))
  631 /* NUMDIGS_MAX is the maximum number of digits for BIGNUMS */
  632 # ifndef NUMDIGS_MAX
  633 #  define NUMDIGS_MAX 1000
  634 # endif
  635 #endif
  636 
  637 #ifndef BIGDIG
  638 # ifndef FLOATS
  639 #  define INUMS_ONLY
  640 # endif
  641 #endif
  642 
  643 /* FLOBUFLEN is the maximum number of characters neccessary for the
  644    printed or string representation of an inexact number. */
  645 
  646 #ifdef FLOATS
  647 # define FLOBUFLEN (10+2*(sizeof(double)/sizeof(char)*CHAR_BIT*3+9)/10)
  648 #endif /* FLOATS */
  649 
  650 /* MAXEXP is the maximum double precision exponent */
  651 /* FLTMAX is less than or equal the largest single precision float */
  652 
  653 #ifdef FLOATS
  654 # ifdef STDC_HEADERS
  655 #  ifndef macintosh
  656 #   ifndef PLAN9
  657 #    include <float.h>
  658 #   endif
  659 #  endif
  660 # endif
  661 # ifdef DBL_MAX_10_EXP
  662 #  define MAXEXP DBL_MAX_10_EXP
  663 # else
  664 #  define MAXEXP 308   /* IEEE doubles */
  665 # endif
  666 # ifndef DBL_DIG
  667 #  define DBL_DIG 15
  668 # endif
  669 # ifndef DBL_MAX_EXP
  670 #  define DBL_MAX_EXP 1024
  671 # endif
  672 # ifdef FLT_MAX
  673 #  define FLTMAX FLT_MAX
  674 # else
  675 #  define FLTMAX 1e+23
  676 # endif
  677 #endif
  678 
  679 #ifdef FLOATS
  680 # ifndef __MINGW32__
  681 /* Also asinh and acosh */
  682 #  define HAVE_ATANH
  683 # endif
  684 #endif
  685 
  686 #ifdef unix
  687 # define HAVE_UNIX
  688 #endif
  689 #ifdef __unix__
  690 # define HAVE_UNIX
  691 #endif
  692 #ifdef _IBMR2
  693 # define HAVE_UNIX
  694 # define STDC_HEADERS
  695 #endif
  696 
  697 /* Only some machines have pipes */
  698 #ifdef HAVE_UNIX
  699   /* DJGPP (gcc for i386) defines unix! */
  700 # define HAVE_PIPE
  701 #endif
  702 
  703 #ifndef macintosh
  704 # ifndef _M_ARM
  705 #  ifndef _M_ARMT
  706 #   ifdef __WINDOWS__       /* there should be a better flag for this. */
  707 #    define PROT386
  708 #   endif
  709 #  endif
  710 # endif
  711 #endif
  712 
  713 /* PTR_LT defines how to compare two CELLPTRs (which may not be in the
  714    same array).  CELLPTR is a pointer to a cons cell which may be
  715    compared or differenced.  SCMPTR is used for stack bounds. */
  716 
  717 #if defined(__TURBOC__) && !defined(__TOS__)
  718 # ifdef PROT386
  719 typedef cell *CELLPTR;
  720 typedef SCM *SCMPTR;
  721 #  define PTR_LT(x, y) (((long)(x)) < ((long)(y)))
  722 # else
  723 typedef cell huge *CELLPTR;
  724 typedef SCM  huge *SCMPTR;
  725 #  define PTR_LT(x, y) ((x) < (y))
  726 # endif
  727 #else /* not __TURBOC__ */
  728 typedef cell *CELLPTR;
  729 typedef SCM  *SCMPTR;
  730 # ifdef nosve
  731 #  define PTR_MASK 0xffffffffffff
  732 #  define PTR_LT(x, y) (((int)(x)&PTR_MASK) < ((int)(y)&PTR_MASK))
  733 # else
  734 #  define PTR_LT(x, y) ((x) < (y))
  735 # endif
  736 #endif
  737 
  738 #define PTR_GT(x, y) PTR_LT(y, x)
  739 #define PTR_LE(x, y) (!PTR_GT(x, y))
  740 #define PTR_GE(x, y) (!PTR_LT(x, y))
  741 
  742 #ifdef STDC_HEADERS
  743 # ifdef PLAN9
  744 #  define sizet long
  745 # else
  746 #  include <stdlib.h>
  747 #  ifdef AMIGA
  748 #   include <stddef.h>
  749 #  endif
  750 #  define sizet size_t
  751 # endif
  752 #else
  753 # ifdef _SIZE_T
  754 #  define sizet size_t
  755 # else
  756 #  define sizet unsigned int
  757 # endif
  758 #endif
  759 
  760 #ifdef __APPLE__
  761 # include <unistd.h>
  762 #endif
  763 
  764 #ifdef macintosh
  765 # include <unistd.h>
  766 #endif
  767 
  768 #ifdef __FreeBSD__
  769 # include <unistd.h>
  770 #endif
  771 
  772 #ifdef linux
  773 # include <unistd.h>
  774 #endif
  775 
  776 /* On VMS, GNU C's errno.h contains a special hack to get link attributes
  777    for errno correct for linking with libc. */
  778 
  779 #ifndef PLAN9
  780 # include <errno.h>
  781 #endif
  782 
  783 /* SYSCALL retries system calls that have been interrupted (EINTR) */
  784 #ifdef vms
  785 # ifndef __GNUC__
  786 #  include <ssdef.h>
  787 #  define SCM_INTERRUPTED(errno) (EVMSERR==errno && \
  788                   (vaxc$errno>>3)==(SS$_CONTROLC>>3))
  789 # endif
  790 #endif
  791 
  792 #ifndef SCM_INTERRUPTED
  793 # ifdef EINTR
  794 #  if (EINTR > 0)
  795 #   define SCM_INTERRUPTED(errno) (EINTR==errno)
  796 #  endif
  797 # endif
  798 #endif
  799 
  800 #ifndef SCM_INTERRUPTED
  801 # define SCM_INTERRUPTED(errno) (0)
  802 #endif
  803 
  804 #ifdef _WIN32
  805 // Windows doesn't set errno = EINTR
  806 # define SYSCALL(line) do{line;while(GetLastError() == ERROR_OPERATION_ABORTED){SetLastError(0);Sleep(10);line};}while(0)
  807 #else
  808 # define SYSCALL(line) do{errno = 0;line}while(SCM_INTERRUPTED(errno))
  809 #endif
  810 
  811 #ifdef EMFILE
  812 # ifdef ENFILE
  813 #  define SCM_NEED_FDS(errno) (EMFILE==errno || ENFILE==errno)
  814 # else
  815 #  define SCM_NEED_FDS(errno) (EMFILE==errno)
  816 # endif
  817 #else
  818 # define SCM_NEED_FDS(errno) (0)
  819 #endif
  820 
  821 #define SCM_OPENCALL(line) {int gcs = 0;\
  822                  while (!0) {errno = 0; if ((line)) break;\
  823                  if (0==gcs++ && SCM_NEED_FDS(errno)) \
  824                    gc_for_open_files();\
  825                   else if (!SCM_INTERRUPTED(errno)) break;}}
  826 
  827 #ifndef MSDOS
  828 # ifdef ARM_ULIB
  829     extern volatile int errno;
  830 # else
  831     extern int errno;
  832 # endif
  833 #endif
  834 #ifdef __TURBOC__
  835 # if (__TURBOC__==1)
  836  /* Needed for TURBOC V1.0 */
  837  extern int errno;
  838 # endif
  839 #endif
  840 
  841 /* EXIT_SUCCESS is the default code to return from SCM if no errors
  842    were encountered.  EXIT_FAILURE is the default code to return from
  843    SCM if errors were encountered.  The return code can be explicitly
  844    specified in a SCM program with (quit <n>). */
  845 
  846 #ifndef EXIT_SUCCESS
  847 # ifdef vms
  848 #  define EXIT_SUCCESS 1
  849 # else
  850 #  define EXIT_SUCCESS 0
  851 # endif
  852 #endif
  853 #ifndef EXIT_FAILURE
  854 # ifdef vms
  855 #  define EXIT_FAILURE 2
  856 # else
  857 #  define EXIT_FAILURE 1
  858 # endif
  859 #endif
  860 
  861 /* Yasuaki Honda, Bob Schumaker */
  862 /* Think C and Metrowerks lack isascii macro */
  863 #ifdef macintosh
  864 # define isascii(c) ((unsigned)(c) <= 0x7f)
  865 #endif
  866 #ifdef _DCC
  867 # define isascii(c) ((unsigned)(c) <= 0x7f)
  868 #endif
  869 
  870 #ifdef __STDC__
  871 # define VOLATILE volatile
  872 #else
  873 # define VOLATILE /**/
  874 #endif
  875 
  876 #ifdef _MSC_VER
  877                 // Disable annoying warnings for:
  878 # pragma warning (disable: 4102) // unreferenced label
  879 # pragma warning (disable: 4018) // signed/unsigned mismatch
  880 # pragma warning (disable: 4101) // unreferenced variables
  881 # pragma warning (disable: 4244) // conversion from unsigned long to unsigned short
  882 #endif
  883 
  884 /* end of automatic C pre-processor definitions */