machine.h 49 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389
  1. /* machine.h Copyright (C) 1990-2002 Codemist Ltd */
  2. /*
  3. * Set characteristics of machine given type. This ought to be the only
  4. * file that inspects macros predefined by your compiler, and on the basis
  5. * of those it sets a further set of macros that identify features
  6. * that characterise your computer. If you move CSL to a new computer
  7. * you should expect to have to add a few lines to this file.
  8. * Ideally all macros used with #ifdef should be mentioned in this file,
  9. * as documentation about what is available. At any one time that will
  10. * not be so as (for instance) short-term debugging control things will
  11. * come and go...
  12. * I will try to put comments about each symbol the first time it is
  13. * mentioned here.
  14. */
  15. /*
  16. * This code may be used and modified, and redistributed in binary
  17. * or source form, subject to the "CCL Public License", which should
  18. * accompany it. This license is a variant on the BSD license, and thus
  19. * permits use of code derived from this in either open and commercial
  20. * projects: but it does require that updates to this code be made
  21. * available back to the originators of the package.
  22. * Before merging other code in with this or linking this code
  23. * with other packages or libraries please check that the license terms
  24. * of the other material are compatible with those of this.
  25. */
  26. /* Signature: 1ccdfd3d 28-Feb-2003 */
  27. #ifndef header_machine_h
  28. #define header_machine_h 1
  29. #include <stdio.h> /* almost everybody needs this */
  30. #include <stdlib.h>
  31. #include <signal.h> /* needed for errorset & floating exceptions */
  32. /*
  33. * The macro COMMON decides if the code is being built to implement
  34. * a Common Lisp or a Standard Lisp. If you want to build a Common
  35. * Lisp you should arrange that your makefiles establish -DCOMMON=1 as
  36. * a command-line option for the C compiler. NB with the COMMON option
  37. * you need a set of Lisp sources to build lots of higher level Common
  38. * Lisp functions, and these are not provided when CSL is shipped for
  39. * use with Reduce.
  40. */
  41. /*
  42. * I want COMMON Lisp mode systems to use 18-page bits even on small
  43. * machines, so that image files can port between those and big systems.
  44. * As of April 1995 I will do the same for Standard Lisp, so that image
  45. * files are always cross-portable. If this puts too heavy a load on memory
  46. * on the remaining systems that do not support virtual memory then I could
  47. * go back down to using 16-bits, but that also limits the size of the largest
  48. * supported vector, biggest bignum etc.
  49. * In April 2002 I change this to 22, giving 4 Mbyte pages. Because of the
  50. * way that vector-headers are packed that is a limit on the size of objects
  51. * anyway sountil I do more radical re-work (inclusing perhaps a universal
  52. * move to 64-bit items) this as as far as it can go.
  53. */
  54. #define SMALL_PAGE_BITS 22
  55. /*
  56. * It is assumed that all addresses are 32-bits long (i.e. sizeof(void *)==4),
  57. * and that the sign of (long int)malloc(...) is always the same. For
  58. * some segmented machines, and possibly the transputer, malloc'd addresses
  59. * may look negative and I am supposed to be able to cope with this.
  60. * Also ANSI do not specify what happens when you go
  61. * int p = ((int)q) >> n;
  62. * with respect to sign-bit propagation. On many (most?) machines shifts
  63. * on signed values will be arithmetic (i.e. propagate the sign bit)
  64. * but I have tried to identify places where I rely on this and provide
  65. * alternative code for use when signed shifts are logical.
  66. *
  67. * The case of 64-bit addresses is under investigation for the DEC Alpha;
  68. * that case works provided all CSL memory can be put at addresses lower
  69. * than 0x7fffffff. The DEC/OSF "-taso" linker option supports that.
  70. * An extended and more genuine version for 64-bit arithmetic and addresses
  71. * is also part of an experiment, but that will not be complete for
  72. * some while [Sept 1997].
  73. * Well, in fact I now seem to be able to run on genuine 64-bit architectures
  74. * (testing on NetBSD on a DEC Alpha)... [2001]
  75. */
  76. #undef SIGNED_SHIFTS_ARE_LOGICAL /* I hope I never have to activate this */
  77. #define MEGABYTE ((unsigned32)0x100000U)
  78. /*
  79. * I will define SOCKETS if a BSD-like socket library is available. Since
  80. * this is so on most important targets I will make it the default and
  81. * I will put an "#undef SOCKETS" where needbe, or go "-DNO_SOCKETS" when
  82. * I compile.
  83. */
  84. #ifndef NO_SOCKETS
  85. #define SOCKETS 1
  86. #endif
  87. /*
  88. * When WXWIN is defined I should be building using the wxWindows cross-
  89. * platform toolkit. In this case I will define CWIN too since the way I
  90. * interface to wxWindows is in many respects similar to that which I
  91. * originally used with my own CWIN windows code (which is built on the
  92. * MFC libraries). If I use either of those I will specify "WINDOW_SYSTEM"
  93. * too.
  94. */
  95. #ifdef WXWIN
  96. # ifndef CWIN
  97. # define CWIN 1
  98. # endif
  99. #endif
  100. /*
  101. * __WATCOMC__ is defined by Watcom C compilers. Note that some time in
  102. * 2002 the Watcom compilers turned open-source. I expect this compiler to
  103. * be associated with DOS/Windows and so if a version of Watcom for
  104. * some non x86 architecture or for a non-Microsoft operating system is
  105. * released some further adjustment will be needed here. Also note that for
  106. * the Windows build I need to link in the Microsoft Foundation Classes (MFC)
  107. * and those may not be available with OpenWatcom. So if I am using
  108. * OpenWatcom I will need to build either a command-line version or
  109. * the wxWindows variant.
  110. */
  111. #ifdef __WATCOMC__
  112. #ifndef __SW_3R
  113. /*
  114. * I really want this to have /3r or /5r calling conventions so that native
  115. * code and imulwat.asm can interface properly.
  116. */
  117. #error Watcom C to be used with register (default) calling conventions, /5r
  118. #endif
  119. #ifndef WINDOWS_NT
  120. /*
  121. * IMPNAME names the version of CSL that I am compiling. It is made
  122. * available as a string as the initial value of a variable IMPNAME. Note
  123. * that undue reliance upon this can make Lisp checkpoint images non-portable.
  124. */
  125. # define IMPNAME "DOS-386"
  126. /*
  127. * NATIVE_CODE_TAG is used as an identification number that indicates
  128. * what hard machine code conventions (this must include register conventions
  129. * as well as base machine architecture) apply in this version. When
  130. * any Lisp is compiled into real machine code the stored version of same
  131. * is marked with the value of NATIVE_CODE_TAG. If the image file that
  132. * results is loaded into a copy of CSL that uses the same tag then the
  133. * compiled code will be used. Otherwise it must not be. The objective here
  134. * is that a single image file *might* contain real machine code for
  135. * several architectures and I need to avoid mixups. Note that one
  136. * processor (eg Intel) may have different calling conventions (say
  137. * DOS/386, Windows and Linux) and one operating system and compiler may exist
  138. * on several different CPU architectures (eg Linux or generic UNix).
  139. * If I do not set a specific value of NATIVE_CODE_TAG it will default
  140. * to the value 0, which will be taken to mean "not available on this
  141. * version", which is at least a fairly safe situation.
  142. * I will also provide for a run-time computed extension to this tag
  143. * so that I can cope with machines that are very similar indeed but where
  144. * different optimisations are appropriate.
  145. */
  146. # define NATIVE_CODE_TAG 1 /* DOS, Watcom, DOS4GW */
  147. /*
  148. * Identify operating system being used
  149. */
  150. # define MS_DOS 1
  151. # undef SOCKETS
  152. /*
  153. * Identify the C compiler that I will use
  154. */
  155. # define WATCOM 1
  156. # define IMULTIPLY 1
  157. # define IDIVIDE 1
  158. /*
  159. * PAGE_BITS controls the size of page that CSL allocates memory in. For
  160. * 16-bit DOS this MUST be at most 16. Making it smaller would limit the
  161. * largest size of vectors and bignums in a bad way. For other systems it
  162. * can be (modestly) increased. If not set in this file a sensible default
  163. * applies. Keeping PAGE_BITS reasonably small makes some sense on machines
  164. * that do not have virtual memory, in that it reduces wastage due to
  165. * page granularity.
  166. */
  167. # define PAGE_BITS SMALL_PAGE_BITS
  168. /*
  169. * On computers with lots of registers I choose to keep many important
  170. * variables where they can be addressed relative to one pointer, nil.
  171. * On register-poor machines this is silly, and I use regular external
  172. * variables instead. NILSEG_EXTERNS selects this option. The incantation
  173. * -DNILSEG_REGISTER=1 when compiling can override this...
  174. */
  175. #ifndef NILSEG_REGISTER
  176. # define NILSEG_EXTERNS 1 /* externs.h */
  177. #endif
  178. /*
  179. * See "tags.h" - these symbols control the size of memory that can
  180. * be accomodated, and under MSDOS there is a limit at 16 Mbytes anyway,
  181. * so allocating tables that could map more would be silly.
  182. * It is valid to set MAX_HEAPSIZE up to 2048*MEGABYTE (probably!),
  183. * but bit-packing for code-pointers (for bytecoded functions) means that
  184. * MAX_BPSSIZE MUST be no larger than (64*MEGABYTE). Keeping these
  185. * values realistically small will save (a modest amount of) space for
  186. * tables of pages. If you do not set values in this header file some
  187. * sensible default values will apply, so values are only set here for
  188. * "small" machines where saving a few kilobytes may matter.
  189. * The default values will be 1Gbyte of heap plus 64 Mbytes of compiled
  190. * bytecode (and another 64 Mbytes of hard code, in any case where that
  191. * option is supported).
  192. */
  193. # define MAX_HEAPSIZE (2048*MEGABYTE)
  194. # define MAX_BPSSIZE (64*MEGABYTE)
  195. /*
  196. * On this (and some other machines) a steady stream of clock
  197. * ticks is available - I make these soft-interrupt CSL on a regular basis
  198. * and can then poll a window manager, refresh the screen, check for ^C
  199. * interrupts or whatever else needs doing.
  200. * The details will tend to be rather system specific.
  201. */
  202. # define TICK_STREAM 1
  203. /*
  204. * On some systems I will improve real speed or at the least arrange that
  205. * the times I record are not polluted by slow physical IO by buffering
  206. * screen updates. BUFFERED_STDOUT enables this. NEEDS_CARRIAGE_RETURN
  207. * must be set if buffers written by fwrite() need to have '\r' as well as
  208. * '\n' characters in them to mark line ends.
  209. */
  210. # define BUFFERED_STDOUT 1
  211. # define NEEDS_CARRIAGE_RETURN 1
  212. /*
  213. * If POLL_FOR_ATTN is defined than a function poll_for_attn will
  214. * be called early in the handling of a clock tick, and the call
  215. * can set interrupt_pending is a ^C (or similar event) has been
  216. * requested by the user but not yet processed. This is done when
  217. * detection of such events involves active interaction with the
  218. * operating system. E.g. under MSDOS the ^C interrupt is not taken
  219. * until a system call is made, so poll_for_attn() just does an otherwise
  220. * fairly cheap and harmless system call.
  221. */
  222. # define POLL_FOR_ATTN 1
  223. /*
  224. * HELP_SYSTEM is defined if (inside the Lisp) I allow for keeping a database
  225. * of messages that get scanned by a function called "help". Actually these
  226. * days the default is to include help support and NO_HELP_SYSTEM must be
  227. * defined to disable it.
  228. */
  229. # define HELP_SYSTEM 1
  230. #endif /* end of DOS variant of Watcom */
  231. #endif /* __WATCOMC__ */
  232. /*
  233. * The section here supports LCC as a (free) C compiler in a DOS-box.
  234. * LCC is very portable but MAYBE a DOS-like system is a good enough
  235. * starting place for anybody who wants to try it out.
  236. */
  237. #ifdef __LCC__
  238. # define IMPNAME "LCC"
  239. # define NATIVE_CODE_TAG 10 /* LCC (not really thought through!) */
  240. /*
  241. * Identify operating system being used and pretend to be DOS! Ie command
  242. * line interface only.
  243. */
  244. # define MS_DOS 1
  245. # undef SOCKETS
  246. /*
  247. * Identify the C compiler that I will use
  248. */
  249. # define LCC_C 1
  250. /* # define IMULTIPLY 1 */
  251. /* # define IDIVIDE 1 */
  252. # define PAGE_BITS SMALL_PAGE_BITS
  253. #ifndef NILSEG_REGISTER
  254. # define NILSEG_EXTERNS 1 /* externs.h */
  255. #endif
  256. # define MAX_HEAPSIZE (2048*MEGABYTE)
  257. # define MAX_BPSSIZE (64*MEGABYTE)
  258. # define TICK_STREAM 1
  259. #ifndef SOFTWARE_TICKS
  260. # define SOFTWARE_TICKS software_ticks
  261. #endif
  262. # define INITIAL_SOFTWARE_TICKS 3000
  263. # define SOFTWARE_TICKS_PER_SECOND 40
  264. # define BUFFERED_STDOUT 1
  265. # define NEEDS_CARRIAGE_RETURN 1
  266. # define POLL_FOR_ATTN 1
  267. /* # define HELP_SYSTEM 1 */
  268. #endif /* end of LCC */
  269. #ifdef MS_DOS
  270. /*
  271. * OPSYS is used to set the operating system identification put in
  272. * the "lispsystem*" variable
  273. */
  274. # ifndef OPSYS
  275. # define OPSYS "msdos"
  276. # endif
  277. #endif
  278. /*
  279. * The WINDOWS NT version is intended for all 32-bit windows worlds,
  280. * that is Windows NT, Windows 95 and (as a temporary expedient) Win32s
  281. * running on top of Windows 3.x. Eventually the support for win32s will
  282. * be abandoned.
  283. */
  284. #ifdef WINDOWS_NT
  285. /*
  286. * For very many purposes I will build a Windows NT version of this code
  287. * using a (slightly separate) window management packaged called CWIN.
  288. * But to provide flexibility for people who do not want to use this (for
  289. * instance if they wish to build the code for embedded use and not give
  290. * it any direct access to the user) I will not force this option here, but
  291. * will require that in suitable cases the C compiler is invoked with the
  292. * symbol CWIN predefined. This can make sense since the build sequences
  293. * in such cases will need to compile and link in parts of the CWIN
  294. * package too.
  295. */
  296. #ifdef CWIN
  297. /*
  298. * SIMULATED_PIPES directs pipe access through code I write for myself.
  299. */
  300. # define SIMULATED_PIPES 1
  301. #endif
  302. # define MS_DOS 1
  303. # ifdef __WATCOMC__
  304. # define NATIVE_CODE_TAG 2 /* Watcom, 32-bit Windows, register calling */
  305. # else
  306. /*
  307. * MS_C is set if we are using Microsoft C, or some other C compiler that
  308. * like __cdecl qualifiers in a load of places.
  309. */
  310. # define MS_C 1
  311. # define NATIVE_CODE_TAG 3 /* MS VC++ 5.0, Windows 95 & NT */
  312. # endif
  313. /*
  314. * The next just provides more info about the target operating system
  315. */
  316. # define USES_WIN32 1
  317. #ifndef NILSEG_REGISTER
  318. # define NILSEG_EXTERNS 1 /* externs.h */
  319. #endif
  320. # define MAX_HEAPSIZE (2048*MEGABYTE)
  321. # define MAX_BPSSIZE (64*MEGABYTE)
  322. /*
  323. * IMULTIPLY and IDIVIDE get defined if you have assembly code versions
  324. * of the primitive arithmetic routines that need 64-bit intermediate
  325. * working.
  326. */
  327. # define IMULTIPLY 1
  328. # define IDIVIDE 1
  329. # define TICK_STREAM 1
  330. /*
  331. * I guard SOFTWARE_TICKS this way so that the user can force its value
  332. * with -DSOFTWARE_TICKS=nnnn in CFLAGS, either to change the frequency of
  333. * polling or to force software ticks on a version of the system that
  334. * usually uses operating-system provided ones. The value 3000 chosen here
  335. * as a default seems to lead to a tolerable frequency of polling on
  336. * reasonably fast machines. Slow systems might like a smaller value to
  337. * keep them more responsive to the user?
  338. */
  339. #ifndef SOFTWARE_TICKS
  340. # define SOFTWARE_TICKS software_ticks
  341. #endif
  342. /*
  343. * If I define SOFTWARE_TICKS to be software_ticks and then ALSO
  344. * define INITIAL_SOFTWARE_TICKS I will use a dynamic scheme that
  345. * tries to adjust things to have about SOFTWARE_TICKS_PER_SECOND
  346. * ticks per second.
  347. */
  348. # define INITIAL_SOFTWARE_TICKS 3000
  349. # define SOFTWARE_TICKS_PER_SECOND 40
  350. /*
  351. * COMMAND_LINE_VERSION builds an NT variant that does not use the Window
  352. * susbsystem. It will be use a simple command-line interface.
  353. */
  354. #ifdef COMMAND_LINE_VERSION
  355. # define IMPNAME "DOS"
  356. # define OPSYS "dos"
  357. # define NO_HELP_SYSTEM 1
  358. #else
  359. # define IMPNAME "Windows"
  360. # define OPSYS "win32"
  361. /*
  362. * The next flag indicate that a system can provide a windowed
  363. * environment with support for graphics output. This arranges that
  364. * calls that print to stdout are handled specially
  365. */
  366. # define WINDOW_SYSTEM 1
  367. /*
  368. * Note that for Windows I will use the Microsoft HELP mechanism rather
  369. * than anything built inside the Lisp. However I build in the Help system
  370. * here in order to make debugging same easier.
  371. */
  372. # define HELP_SYSTEM 1
  373. #endif /* COMMAND_LINE_VERSION */
  374. /*
  375. * PIPES is set if the functions my_popen(command, dirn) and my_pclose() are
  376. * available. I do not make this synomymous with UNIX since a strict ANSI
  377. * C library will not provide these functions. Also I make the entries used
  378. * go via a system-specific hook since not all operating systems have calls
  379. * that are exactly like the Unix popen and pclose.
  380. */
  381. # define PIPES 1
  382. /*
  383. * In the case of Win32 I will have pipes if I am under Win32, bit
  384. * not Win32S - so I will have to have a run-time test to see if pipes are
  385. * really available. Oh misery!
  386. */
  387. # define PIPES_SOMETIMES 1
  388. #ifndef __WATCOMC__
  389. /*
  390. * BUILDING_DLL puts a __decltype(dllexport) qualifier in a load of
  391. * extern declarations. This may be useful if I want CSL/CCL to be a DLL
  392. * for some reason. But I have not checked this with Watcom C, only
  393. * with Microsoft, hence I do not enable it too generally.
  394. */
  395. /* # define BUILDING_DLL 1 */
  396. #endif
  397. #endif
  398. /*
  399. * I do not want to use Think C other than on a Mac. And in fact it is a very
  400. * long time since I build this version so it may well be broken by now.
  401. */
  402. #ifdef THINK_C /* Development on a Mac with System 7 and Think C 5.0 */
  403. /* Yes this is now old enough it should be pensioned off */
  404. # define IMPNAME "Macintosh"
  405. # define OPSYS "finder"
  406. /*
  407. * Bits of the operating-system interface like to know they are on a Mac.
  408. */
  409. # define MACINTOSH 1
  410. /*
  411. * See comment earlier on about default condition wrt socket support.
  412. */
  413. /*
  414. * SIXTEEN_BIT is set if I need to use "long int" to get a 32-bit value.
  415. * This will hardly ever be true now days! I do not guarantee that it
  416. * still works! Please avoid if at all possible.
  417. */
  418. # define SIXTEEN_BIT 1 /* Check this out - harmless anyway */
  419. # define PAGE_BITS SMALL_PAGE_BITS
  420. /*
  421. * OUT_OF_LINE being defined makes the code SLIGHTLY smaller and SLIGHTLY
  422. * slower. It only has an effect on the file "bytes1.c" where you can see
  423. * what it does.
  424. */
  425. # define OUT_OF_LINE 1 /* bytes1.c close to size limit for Mac? */
  426. # define ADDRESSES_HAVE_TOP_BIT_CLEAR 1
  427. # define TICK_STREAM 1
  428. # define MAX_HEAPSIZE (2048*MEGABYTE)
  429. # define MAX_BPSSIZE (64*MEGABYTE)
  430. # define WINDOW_SYSTEM 1
  431. # undef SOCKETS
  432. # define HELP_SYSTEM 1
  433. /*
  434. * If HOLD_BACK_MEMORY is defined it indicates a number of pages
  435. * to release to the operating system so that I do not utterly run out ever...
  436. * Most necessary if low level operating system routines in effect do
  437. * malloc() in a way I can not control.
  438. *
  439. * HOLD_BACK_MEMORY is asserted here and MUST BE for all machines
  440. * where sizeof(size_t) == 2, since in that case it will not be possible
  441. * to allocate memory in one big hunk.
  442. */
  443. # define HOLD_BACK_MEMORY 6
  444. /*
  445. * For the Macintosh I will use NewPtr rather than malloc - the main reason
  446. * I do this is that once malloc has grabbed space (under Think C) free
  447. * never hands it back to the operating system.
  448. */
  449. #include <memory.h>
  450. #undef nil /* Think C headers go "#define nil 0" which hurts me */
  451. #define malloc(n) NewPtr(n)
  452. #define free(p) DisposPtr((Ptr)(p))
  453. #endif
  454. /*
  455. * powerpc is another synonym for "Macintosh" in this context, and expects
  456. * you to be using the Symantecs C compiler.
  457. */
  458. #ifdef powerc /* Development on a PowerPC with System 7 and Symantecs */
  459. # define IMPNAME "PowerPC"
  460. # define OPSYS "finder"
  461. /*
  462. * Bits of the operating-system interface like to know they are on a Mac.
  463. */
  464. # define MACINTOSH 1
  465. /*
  466. * OUT_OF_LINE being defined makes the code SLIGHTLY smaller and SLIGHTLY
  467. * slower. It only has an effect on the file "bytes1.c" where you can see
  468. * what it does.
  469. */
  470. # define OUT_OF_LINE 1 /* bytes1.c close to size limit for Mac? */
  471. # define ADDRESSES_HAVE_TOP_BIT_CLEAR 1
  472. # define TICK_STREAM 1
  473. # define MAX_HEAPSIZE (2048*MEGABYTE)
  474. # define MAX_BPSSIZE (64*MEGABYTE)
  475. # define WINDOW_SYSTEM 1
  476. # define TICK_STREAM 1
  477. # define SOFTWARE_TICKS software_ticks
  478. # define INITIAL_SOFTWARE_TICKS 3000
  479. # define SOFTWARE_TICKS_PER_SECOND 40
  480. # define POLL_FOR_ATTN 1
  481. # define NO_HELP_SYSTEM 1
  482. # undef SOCKETS
  483. # define HELP_SYSTEM 1
  484. /*
  485. * If HOLD_BACK_MEMORY is defined it indicates a number of pages
  486. * to release to the operating system so that I do not utterly run out ever...
  487. * Most necessary if low level operating system routines in effect do
  488. * malloc() in a way I can not control.
  489. *
  490. * HOLD_BACK_MEMORY is asserted here and MUST BE for all machines
  491. * where sizeof(size_t) == 2, since in that case it will not be possible
  492. * to allocate memory in one big hunk.
  493. */
  494. # define HOLD_BACK_MEMORY 6
  495. #undef nil /* Think C headers go "#define nil 0" which hurts me */
  496. #endif
  497. #ifdef arm /* Old RISCIX compiler... */
  498. # define __arm 1
  499. #endif
  500. #ifdef __arm
  501. # define IMPNAME "Archimedes"
  502. # undef SOCKETS
  503. #ifdef __riscos
  504. /* Note NOT automatically defined by release compiler: Use -D__riscos please */
  505. /*
  506. * A profile option is available to help record low-level execution
  507. * profiles of CSL's performance. Intended for use by those involved in
  508. * fine-tuning system performance.
  509. */
  510. # define SHOW_COUNTS_AVAILABLE 1 /* gc1.c */
  511. /*
  512. * RISCOS is the operating system on an Acorn Archimedes
  513. */
  514. # define RISCOS 1
  515. # define OPSYS "riscos"
  516. # define HOLD_BACK_MEMORY 1
  517. # define PAGE_BITS SMALL_PAGE_BITS
  518. # define OUT_OF_LINE 1 /* memory generally tight? */
  519. # define ADDRESSES_HAVE_TOP_BIT_CLEAR 1
  520. # define MAX_HEAPSIZE (2048*MEGABYTE)
  521. # define MAX_BPSSIZE (64*MEGABYTE)
  522. # define TICK_STREAM 1
  523. /*
  524. * USE_AUTOINDEX causes the code that pushes multiple values onto
  525. * the Lisp stack to use the addressing idiom (*++sp) and *(sp--)
  526. * repeatedly. Otherwise the data movement and stack adjustment are
  527. * written out as separate steps so that all adjustment is done in
  528. * a single operation. With sufficiently clever compilers this ought not
  529. * to matter, but at present there are plenty of compilers around that
  530. * are not that smart!
  531. */
  532. # define USE_AUTOINDEX 1
  533. #ifndef SOFTWARE_TICKS
  534. # define SOFTWARE_TICKS 3000 /* Maybe this is more robust?? */
  535. #endif
  536. # define WINDOW_SYSTEM 1
  537. # define HELP_SYSTEM 1
  538. /*
  539. * In the case of RiscOS I will support pipes ONLY to the extent that
  540. * the gnuplot interface requires them. Indeed the apparently generic
  541. * (popen ...) function will send messages via the window manager with
  542. * destination gnuplot (tested with gnuplot 3.4) only. Beware!
  543. */
  544. # define SIMULATED_PIPES 1
  545. # define PIPES 1
  546. #else /* __riscos : the converse is taken to be RISCIX (Unix) */
  547. /*
  548. * Where Unix is available I use times() to read the clock, and report
  549. * user CPU time. The value given to UNIX_TIMES indicates the clock
  550. * tick resolution used. If this is not set I use clock() instead, which
  551. * tends to count system time as well as user time and hence make the
  552. * reports suggest lower performance... Do you call this cheating?
  553. */
  554. # define UNIX_TIMES 100
  555. # define UNIX 1
  556. # define PIPES 1
  557. #endif /* __riscos */
  558. #endif /* __arm */
  559. /*
  560. * For the Alpha I have tried builds in DECs OSF/1 (where the code works
  561. * OK using the "-taso" linker option) and under NetBSD in true 64-bit
  562. * mode. This setup would not work for Windows NT (now defunct for alphas?),
  563. * and might not behave well for Linux-alpha. Indeed the Alpha and in general
  564. * 64-bit support is still in the process of stabilising!
  565. */
  566. #ifdef __alpha
  567. # define IMPNAME "DEC Alpha"
  568. # define UNIX 1
  569. # define BSD_LIB 1
  570. # define PIPES 1
  571. #ifdef __NetBSD__
  572. # define UNIX_TIMES 100
  573. #else
  574. # define UNIX_TIMES 60
  575. #endif
  576. /*
  577. * SIXTY_FOUR_BIT can be set if I have a representation of 64-bit
  578. * integers (efficiently) available. This gets mapped onto the
  579. * typedef names int64 and unsigned64, and may be used to speed up
  580. * bignum arithmetic. SIXTY_FOUR_BIT defined directly indicates that
  581. * the data type "long int" is a 64 bit one. If "LONG_LONG_64" is set
  582. * (instead) then the long integer type is taken to be "long long int",
  583. * an option relevant for (eg) super-sparc. The flag SIXTY_FOUR_BIT on its
  584. * own does not change the representation of data at all: it just changes
  585. * the way in which bignumber code is implemented in rather minor ways.
  586. * However it is needed if the next option (ADDRESS_64) is to be used.
  587. */
  588. # define SIXTY_FOUR_BIT 1
  589. /*
  590. * ADDRESS_64 is set to activate the mode where all items in Lisp
  591. * are stored as 64 rather than just 32 bits. Doing so doubles the
  592. * size of data structures but allows the use of truly huge amounts of
  593. * memory. If may be NEEDED for some future computer architectures as
  594. * backwards-compatibility modes whereby 64-bit machines can simulate
  595. * 32 bit ones are gradually withdrawn. At present the computer that
  596. * I am working on this using runs NetBSD hence the #ifdef. Note that
  597. * heap images from ADDRESS_64 systems are not compatible with ones from
  598. * the 32-bit universe.
  599. */
  600. #ifdef __NetBSD__
  601. # define ADDRESS_64 1
  602. #endif
  603. # ifndef _CC_NORCROFT
  604. /*
  605. * MULDIV64 is set if "long" is a 64-bit type to be used in Imultiply etc
  606. * here (temporarily) I only use it if I am using the DEC C compiler.
  607. */
  608. # define MULDIV64 1
  609. # endif
  610. #endif
  611. /*
  612. * Something of a place-holder for the Intel 64-bit chip. Here I expect
  613. * it to be run on some form of Unix as a true 64-bit system.
  614. */
  615. #ifdef __ia64
  616. # define IMPNAME "ia64"
  617. # define UNIX 1
  618. # define BSD_LIB 1
  619. # define PIPES 1
  620. # define UNIX_TIMES 60
  621. # define SIXTY_FOUR_BIT 1
  622. # define ADDRESS_64 1
  623. # define MULDIV64 1
  624. #endif
  625. #ifndef __sgi
  626. #ifdef __mips
  627. # ifndef __mips__
  628. # define __mips__
  629. # endif
  630. #endif
  631. #ifdef __mips__
  632. # define IMPNAME "MIPS"
  633. /*
  634. * To my amazement on most machines an integer GCD function based on
  635. * subtraction and shifting outperformed one based on division. Where
  636. * really fast hardware division is available define this symbol to
  637. * use the more obvious code.
  638. */
  639. # define FAST_DIVISION 1 /* arith09.c (gcd) */
  640. # define UNIX 1
  641. # define PIPES 1
  642. /*
  643. * Ultrix seems to object to fopen(xx, "rb"), and demand fopen(xx, "r")
  644. * This is harmless of all UNIX systems, as all I/O is binary in Unix, but
  645. * most other versions will at least accept "rb" and "wb", and if the C
  646. * library is ANSI compatible they MUST do so.
  647. */
  648. # define NO_BINARY_FOPEN 1
  649. /* At present I can deal with two UNIX library types; BSD and NCC
  650. * With BSD_LIB set then use will be made of isatty(2) and some other
  651. * functions. With NCC_LIB (which is rather strict) private knowledge of the
  652. * systems is used. But since NCC is the Codemist C compiler and library
  653. * maybe we (Codemist) are entitled to exploit a bit of inside information
  654. * from time to time?
  655. */
  656. #ifdef SGICC
  657. # undef __sgi
  658. #endif
  659. # ifdef __titan
  660. # define NCC_LIB 1
  661. # else
  662. # ifdef __sgi
  663. # define NCC_LIB 1
  664. # else
  665. # define BSD_LIB 1
  666. # define WANT_POSIX 1
  667. # define UNIX_TIMES CLK_TCK
  668. # endif
  669. # endif
  670. #endif
  671. #endif
  672. #ifdef __sgi
  673. # if __mips == 3
  674. # define IMPNAME "SGI MIPS III"
  675. # elif __mips == 1
  676. # define IMPNAME "SGI MIPS I"
  677. # else
  678. # define IMPNAME "SGI"
  679. # endif
  680. # define WANT_POSIX 1
  681. # define PIPES 1
  682. # define UNIX_TIMES CLK_TCK
  683. # define UNIX 1
  684. # define BSD_LIB 1
  685. #endif
  686. #ifdef vax
  687. # ifdef vms
  688. /* this allows me to compile under VAX/VMS directly */
  689. # define __vmsvax__
  690. # endif
  691. #endif
  692. #ifdef __vax__
  693. # define IMPNAME "VAX"
  694. # define NO_BINARY_FOPEN 1
  695. # define UNIX_TIMES 60
  696. # define UNIX 1
  697. # define BSD_LIB 1
  698. # define PIPES 1
  699. # define USE_AUTOINDEX 1
  700. #endif
  701. #ifdef __vmsvax__
  702. # define IMPNAME "VAX/VMS"
  703. # define OPSYS "vms"
  704. # define VAXFLOAT 1
  705. # define UNIX_TIMES 60 /* OK under VMS? */
  706. # define HELP_SYSTEM 1
  707. # define USE_AUTOINDEX 1
  708. # undef SOCKETS
  709. #endif
  710. #ifdef NeXT
  711. /*
  712. * This was once tested on a Pentium Pro running NeXT, and may deserve
  713. * adjustment for other variant targets.
  714. */
  715. # define IMPNAME "NeXT"
  716. # define UNIX 1 /* almost! */
  717. # define OPSYS "unix" /* close enough! */
  718. # define UNIX_TIMES 60
  719. # define BSD_LIB 1
  720. # define USE_DIRECT_H 1 /* use <direct.h> not <dirent.h> */
  721. # define UTIME_TIME_T 1 /* Arg type for utime() function */
  722. # define NO_GETCWD 1 /* Functionality unavailable? */
  723. #endif
  724. #ifdef _rs6000
  725. # define IMPNAME "rs/6000"
  726. # define UNIX 1
  727. /*
  728. * Magic to do with the need for symbols predefined before <stdio.h> etc
  729. * get scanned on this machine.
  730. */
  731. # define WANT_POSIX 1
  732. # define PIPES 1
  733. # define UNIX_TIMES 100
  734. # define BSD_LIB 1
  735. #endif
  736. #ifdef SR2201
  737. /*
  738. * Experimental use of the Hitachi mpp based on HP-precision derived CPUs.
  739. * No longer under serious consideration.
  740. */
  741. # define IMPNAME "SR2201"
  742. # define UNIX 1
  743. # define PIPES 1
  744. # define UNIX_TIMES 100
  745. # define BSD_LIB 1
  746. /*
  747. * USE_PVM guards extra capability for the Lisp so that it can use PVM
  748. * to provide a parallel Lisp environment, at least in a crude way. Well
  749. * these days I think that MPI is a better bet anyway, so that is another
  750. * respect in which this code is a historical relic!
  751. */
  752. # define USE_PVM 1
  753. #endif
  754. #ifdef __clipper
  755. # define IMPNAME "Clipper"
  756. # define UNIX 1
  757. # define NCC_LIB 1
  758. #endif
  759. #ifdef __bsdos__
  760. # define IMPNAME "BSD/OS 2.1"
  761. # define UNIX 1
  762. # define UNIX_TIMES 60
  763. # define PIPES 1
  764. # define BSD_LIB 1
  765. # define IMULTIPLY 1
  766. # define IDIVIDE 1
  767. #endif
  768. #ifdef __CYGWIN32__
  769. # define IMPNAME "CygWin32"
  770. # define OPSYS "cygwin32"
  771. # define NATIVE_CODE_TAG 9
  772. # define UNIX 1 /* Well not really, but close enough! */
  773. # define PIPES 1
  774. # define BSD_LIB 1
  775. #endif
  776. #ifdef __linux__
  777. /*
  778. * Linux can be run on many sorts of host hardware. The entry here is for
  779. * Linux on x86 systems. Other cases (Alpha, Sparc etc?) could be detected
  780. * earlier in this file and if they define IMPNAME this set of defaults
  781. * will not get activated. I think this all shows that there is a problem
  782. * around here. The C compiler used provides (default) predefined symbols,
  783. * and my configuration may need to depend in part on hardware architecture,
  784. * operating system AND the specific C compiler. But in some cases there are
  785. * strong associations between combinations of these.
  786. */
  787. #ifndef IMPNAME /* more specific variants can go first */
  788. # define IMPNAME "Linux"
  789. /*
  790. * WARNING - I ought to filter the next line on Intel archirecture,
  791. * since otherwise it will cause trouble on other variants on Linux!
  792. */
  793. # define NATIVE_CODE_TAG 4 /* Linux, Intel, Pentium conventions */
  794. # define UNIX 1
  795. # define PIPES 1
  796. # define BSD_LIB 1
  797. #endif
  798. #endif
  799. #ifdef __hp9000s300
  800. # define IMPNAME "HP/9000.300"
  801. # define WANT_POSIX 1
  802. /*
  803. * HP Unix has a few features that I need to support specially in sysunix.c
  804. */
  805. # define HP_UNIX 1
  806. /*
  807. * More (HP-specific) magic that arranges that the standard headers
  808. * provide XOPEN support.
  809. */
  810. # ifndef _INCLUDE_XOPEN_SOURCE
  811. # define _INCLUDE_XOPEN_SOURCE 1
  812. # endif
  813. # define PIPES 1
  814. # define UNIX_TIMES CLK_TCK
  815. # define UNIX 1
  816. # define BSD_LIB 1
  817. #endif
  818. #ifdef __hp9000s800
  819. # define IMPNAME "HP/9000.800"
  820. # define WANT_POSIX 1
  821. # define HP_UNIX 1
  822. # define _INCLUDE_XOPEN_SOURCE 1
  823. # define PIPES 1
  824. # define UNIX_TIMES CLK_TCK
  825. # define UNIX 1
  826. # define BSD_LIB 1
  827. #endif
  828. #ifdef __APOLLO__
  829. # define IMPNAME "Apollo"
  830. # define UNIX_TIMES 60
  831. # define UNIX 1
  832. # define BSD_LIB 1
  833. # define PIPES 1
  834. /*
  835. * I define OUT_OF_LINE here to reduce stress on a C compiler that has in the
  836. * past given some trouble.
  837. */
  838. # define OUT_OF_LINE 1
  839. #endif
  840. #ifdef __ibm370
  841. /*
  842. * Note that I have not tested CSL on this target yet... and image files etc
  843. * will not be compatible from ASCII to EBCDIC machines. Furthermore you
  844. * may have trouble finding an instance of the IBM mainframe architecture now!
  845. */
  846. # define IMPNAME "S/370"
  847. # define OPSYS "mvs"
  848. # define HELP_SYSTEM 1
  849. # undef SOCKETS
  850. #endif
  851. #ifdef __m88k__
  852. /*
  853. * I had one of these (a Data General Aviion) once...
  854. */
  855. # define IMPNAME "mc88000"
  856. # define UNIX_TIMES 60
  857. # define UNIX 1
  858. # define BSD_LIB 1
  859. # define PIPES 1
  860. #endif
  861. /* GNU C defines __GNUC__ */
  862. /* SPARCCompiler defines __SUNPRO_C */
  863. #if defined(__sparc) || defined(__sparc__)
  864. # if defined(__SUNPRO_C)
  865. # define IMPNAME "SPARC-SUNPRO"
  866. # define NATIVE_CODE_TAG 5
  867. # elif defined(__GNUC__)
  868. # define IMPNAME "SPARC-GCC"
  869. /*
  870. * It may be that SPARC and the 2 C compilers mentioned here both use
  871. * identical code, so I could give them the same tag. But equally I might
  872. * need to refine things to cope with the difference between the baseline
  873. * sparc architecture and the ultra-sparc (etc) variants.
  874. */
  875. # define NATIVE_CODE_TAG 6
  876. # else
  877. # define IMPNAME "SPARC"
  878. # endif
  879. # define UNIX 1
  880. # define UNIX_TIMES CLK_TCK
  881. # define BSD_LIB 1
  882. # define PIPES 1
  883. #else
  884. /*
  885. * This is the older version of SPARC options.
  886. */
  887. #if defined __sparc__
  888. # define IMPNAME "SPARC"
  889. # ifdef sun /* For Sparcstation with sub-standard C library */
  890. /* You may need to adjust this for your sun */
  891. typedef char *VoidStar;
  892. #endif
  893. # include <sys/param.h>
  894. # define UNIX_TIMES HZ
  895. # define UNIX 1
  896. # define BSD_LIB 1
  897. # define PIPES 1
  898. #endif
  899. #ifdef __sparc
  900. # define IMPNAME "SPARC"
  901. # define UNIX 1
  902. # define NO_BINARY_FOPEN 1 /* probably not needed */
  903. # ifndef BSD_LIB
  904. # define NCC_LIB 1
  905. # endif
  906. # define PIPES 1
  907. #endif
  908. #endif
  909. #ifdef __kcm /* The ICL "Knowledge Crunching Machine */
  910. # define IMPNAME "KCM"
  911. # define OPSYS "kcm"
  912. # define HELP_SYSTEM 1
  913. # undef SOCKETS
  914. #endif
  915. #ifdef __BORLANDC__
  916. /*
  917. * An experimental build for 32-bit console mode using Borland C 4.0. Not
  918. * really needed any more but kept here as a historical relic.
  919. */
  920. # define IMPNAME "Borland 4.0"
  921. # define NATIVE_CODE_TAG 7
  922. # define MS_DOS 1
  923. # define OPSYS "msdos"
  924. # define PAGE_BITS SMALL_PAGE_BITS
  925. #ifndef NILSEG_REGISTER
  926. # define NILSEG_EXTERNS 1 /* externs.h */
  927. #endif
  928. # define MAX_HEAPSIZE (2048*MEGABYTE)
  929. # define MAX_BPSSIZE (64*MEGABYTE)
  930. # define TICK_STREAM 1
  931. # define SOFTWARE_TICKS software_ticks
  932. # define INITIAL_SOFTWARE_TICKS 3000
  933. # define SOFTWARE_TICKS_PER_SECOND 40
  934. # define POLL_FOR_ATTN 1
  935. # define NO_HELP_SYSTEM 1
  936. # undef SOCKETS /* It may be that Borland have these */
  937. #endif
  938. #ifdef OLD_OPTIONS_NO_LONGER_SUPPORTED
  939. # undef SOCKETS
  940. /*
  941. * I once supported MSDOS using Zortech C release 3.0
  942. * This could be used in two modes - one for 80286 systems, and one for
  943. * 386 and 486. When using this option ensure that you have collected
  944. * all available patches and updates from Zortech... DOS16RM is set by
  945. * Zortech C when in 16-bit extended mode.
  946. * Note that the compiler referred to here as "Zortech" is now shipped
  947. * by Symantec, and their current offering is not the one I use when
  948. * building and testing my code. I have no reason to suppose that the
  949. * Symantec C will give problems here, but it is very probable that some
  950. * small changes to the makefile and code will be called for if you use it.
  951. */
  952. #ifdef DOS16RM /* Intel 80286 family (16 bit mode) */
  953. /* For use with Zortech Mode Z extender */
  954. # define IMPNAME "MSDOS/286"
  955. # define MS_DOS 1
  956. # define ZORTECH_C 1
  957. # define BUFFERED_STDOUT 1
  958. # define NEEDS_CARRIAGE_RETURN 1
  959. # define SIXTEEN_BIT 1
  960. # define PAGE_BITS 16
  961. #ifndef NILSEG_REGISTER
  962. # define NILSEG_EXTERNS 1 /* externs.h */
  963. #endif
  964. # define MAX_HEAPSIZE (2048*MEGABYTE)
  965. # define MAX_BPSSIZE (64*MEGABYTE)
  966. # define OUT_OF_LINE 1
  967. # define TICK_STREAM 1
  968. # define POLL_FOR_ATTN 1
  969. #ifndef SOFTWARE_TICKS
  970. # define SOFTWARE_TICKS software_ticks
  971. #endif
  972. # define INITIAL_SOFTWARE_TICKS 3000
  973. # define SOFTWARE_TICKS_PER_SECOND 40
  974. # define HOLD_BACK_MEMORY 1
  975. # define HELP_SYSTEM 1
  976. #endif
  977. /*
  978. * DOS386 is predefined by Zortech in flat 32-bit mode. I use the
  979. * Flashtek X-32VM DOS extender so that virtual memory is available
  980. * to me, but you could rebuild without that and the code would still
  981. * work.
  982. */
  983. #ifdef DOS386 /* Zortech 32-bit mode 386 */
  984. # define IMPNAME "MSDOS/386"
  985. # define MS_DOS 1
  986. # define ZORTECH_C 1
  987. # define IMULTIPLY 1
  988. # define IDIVIDE 1
  989. # define PAGE_BITS SMALL_PAGE_BITS
  990. /*
  991. * Selecting the NILSEG_EXTERNS option gives a (roughly 4%) speed-up
  992. * for the 386. Really it is a toss-up whether to use it or not.
  993. */
  994. #ifndef NILSEG_REGISTER
  995. # define NILSEG_EXTERNS 1 /* externs.h */
  996. #endif
  997. # define MAX_HEAPSIZE (2048*MEGABYTE)
  998. # define MAX_BPSSIZE (64*MEGABYTE)
  999. # define TICK_STREAM 1
  1000. # define BUFFERED_STDOUT 1
  1001. # define NEEDS_CARRIAGE_RETURN 1
  1002. /*
  1003. * define OLD_ZORTECH_DOS_EXTENDER if you need to use software ticks.
  1004. */
  1005. #ifdef OLD_ZORTECH_DOS_EXTENDER
  1006. /*
  1007. * If fully asynchronous clock interrupts are too hard or too dangerous
  1008. * (and in Zortech 'X' mode they are in January 1992 - pending a bug-fix
  1009. * release of the DOS extender) I can provide second best with sem-
  1010. * regular polling done totally from within the CSL software. There will
  1011. * be both performance loss and a loss of responsiveness - the value that
  1012. * the macro SOFTWARE_TICKS is given will allow some control over
  1013. * this trade-off, with small values giving better response but lower
  1014. * overall speed. The latest Zortech extender I have tried is 3.0r4, which
  1015. * needs SOFTWARE_TICKS, but if I use the Flashtek extender I seem to be
  1016. * OK. See comments above whereby in recent versions of CSL I can make
  1017. * the count here dynamic to tune the rate of clicks a to deliver a
  1018. * measure of the number of ticks per second rather than the ration of
  1019. * elemental operatiomns within CSL to these clicks.
  1020. */
  1021. #ifndef SOFTWARE_TICKS
  1022. # define SOFTWARE_TICKS 3000
  1023. #endif
  1024. #endif
  1025. # define POLL_FOR_ATTN 1
  1026. # define HELP_SYSTEM 1
  1027. #endif
  1028. #ifdef GCC386 /* GNU C for DOS */
  1029. # define IMPNAME "GCC/386"
  1030. # define NATIVE_CODE_TAG 8
  1031. # define MS_DOS 1
  1032. # define PAGE_BITS SMALL_PAGE_BITS
  1033. /*
  1034. * Selecting the NILSEG_EXTERNS option gives a (roughly 4%) speed-up
  1035. * for the 386. Really it is a toss-up whether to use it or not.
  1036. */
  1037. #ifndef NILSEG_REGISTER
  1038. # define NILSEG_EXTERNS 1 /* externs.h */
  1039. #endif
  1040. # define MAX_HEAPSIZE (2048*MEGABYTE)
  1041. # define MAX_BPSSIZE (64*MEGABYTE)
  1042. # define TICK_STREAM 1
  1043. # define BUFFERED_STDOUT 1
  1044. # define NEEDS_CARRIAGE_RETURN 1
  1045. #ifndef SOFTWARE_TICKS
  1046. # define SOFTWARE_TICKS software_ticks
  1047. #endif
  1048. # define INITIAL_SOFTWARE_TICKS 3000
  1049. # define SOFTWARE_TICKS_PER_SECOND 40
  1050. # define POLL_FOR_ATTN 1
  1051. # define HELP_SYSTEM 1
  1052. # define IMULTIPLY 1
  1053. # define IDIVIDE 1
  1054. # define HUGE_VAL 1.7976931348623167e+308 /* deficient headers */
  1055. #endif
  1056. #ifdef ATARI /* Lattice C for all STs */
  1057. # define IMPNAME "ATARI"
  1058. # define OPSYS "atari"
  1059. /*
  1060. * Identify the C compiler I will use; well I actually use Lattice and Norcroft
  1061. */
  1062. # define LATTICE_C 1
  1063. # define SIXTEEN_BIT 1 /* Certainly not needed with NCC. Lattice? */
  1064. # define HOLD_BACK_MEMORY 1
  1065. # define PAGE_BITS SMALL_PAGE_BITS
  1066. #ifndef NILSEG_REGISTER
  1067. # define NILSEG_EXTERNS 1 /* externs.h */
  1068. #endif
  1069. # define MAX_HEAPSIZE (2048*MEGABYTE)
  1070. # define MAX_BPSSIZE (64*MEGABYTE)
  1071. # define TICK_STREAM 1
  1072. # define NO_COPYING_GC 1
  1073. # define POLL_FOR_ATTN 1
  1074. # define HELP_SYSTEM 1
  1075. /*
  1076. * If I know that addresses returned by malloc() will always have their top
  1077. * bit either set or clear I assert ADDRESSES_HAVE_TOP_BIT_SET or _CLEAR.
  1078. * Otherwise CSL will discover for itself at run time. I can set _UNKNOWN
  1079. * to stress that dynamic discovery is needed.
  1080. */
  1081. # define ADDRESSES_HAVE_TOP_BIT_CLEAR 1
  1082. #define sqrt(x) atari_sqrt(x)
  1083. #define exp(x) atari_exp(x)
  1084. #define sin(x) atari_sin(x)
  1085. #define cos(x) atari_cos(x)
  1086. #define tan(x) atari_tan(x)
  1087. #define atan(x) atari_atan(x)
  1088. #define asin(x) atari_asin(x)
  1089. #define acos(x) atari_acos(x)
  1090. #define sinh(x) atari_sinh(x)
  1091. #define cosh(x) atari_cosh(x)
  1092. #define tanh(x) atari_tanh(x)
  1093. #define log(x) atari_log(x)
  1094. #define pow(x,y) atari_pow(x,y)
  1095. #define frexp(x,y) atari_frexp(x,y)
  1096. #define ldexp(x,y) atari_ldexp(x,y)
  1097. extern double atari_sqrt(double);
  1098. extern double atari_exp(double);
  1099. extern double atari_sin(double);
  1100. extern double atari_cos(double);
  1101. extern double atari_tan(double);
  1102. extern double atari_atan(double);
  1103. extern double atari_asin(double);
  1104. extern double atari_acos(double);
  1105. extern double atari_sinh(double);
  1106. extern double atari_cosh(double);
  1107. extern double atari_tanh(double);
  1108. extern double atari_log(double);
  1109. extern double atari_pow(double,double);
  1110. extern double atari_frexp(double, int*);
  1111. extern double atari_ldexp(double,int);
  1112. #endif
  1113. #else
  1114. /*
  1115. * But having withdrawn support I will arrange that if anybody tries to use
  1116. * the old code they get a diagnostic. There remains a reasonable chance that
  1117. * by altering this file and making a modest number of system-specific
  1118. * patches elsewhere (notably in sysxxx.c and its associates) the system
  1119. * could be revived. And if there is substantial demand I may try that
  1120. * myself, provided I can gain access to a suitable computer.
  1121. */
  1122. #ifdef DOS16RM /* Intel 80286 family (16 bit mode) */
  1123. #error This compiler/computer is not lonnger supported by CSL
  1124. #endif
  1125. #ifdef DOS386 /* Zortech 32-bit mode 386 */
  1126. #error This compiler/computer is not lonnger supported by CSL
  1127. #endif
  1128. #ifdef GCC386 /* GNU C for DOS */
  1129. #error This compiler/computer is not lonnger supported by CSL
  1130. #endif
  1131. #ifdef ATARI /* Lattice C for all STs */
  1132. #error This compiler/computer is not lonnger supported by CSL
  1133. #endif
  1134. #endif /* OLD_OPTIONS_NO_LONGER_SUPPORTED */
  1135. /*
  1136. * Now to make things easier for experimentation I will set some defaults
  1137. * for the name of the implementation and the style of operating system
  1138. * in use.
  1139. */
  1140. #ifndef IMPNAME
  1141. # define IMPNAME "Generic"
  1142. #endif
  1143. #ifndef OPSYS
  1144. # define UNIX 1
  1145. #endif
  1146. #ifdef UNIX
  1147. # ifndef OPSYS
  1148. # define OPSYS "unix"
  1149. # endif
  1150. # ifndef HELP_SYSTEM
  1151. # define HELP_SYSTEM 1
  1152. # endif
  1153. # ifndef ADDRESS_SIGN_UNKNOWN
  1154. # ifndef ADDRESSES_HAVE_TOP_BIT_SET
  1155. # define ADDRESSES_HAVE_TOP_BIT_CLEAR 1
  1156. # endif
  1157. # endif
  1158. #endif
  1159. /*----------------------------------------------------------------------*/
  1160. #ifdef WANT_POSIX
  1161. # ifndef _POSIX_SOURCE
  1162. # define _POSIX_SOURCE 1
  1163. # define _INCLUDE_POSIX_SOURCE 1
  1164. # endif
  1165. #endif
  1166. #ifndef WINDOW_SYSTEM
  1167. #ifdef CWIN
  1168. #define WINDOW_SYSTEM 1
  1169. #endif
  1170. #ifdef WXWIN
  1171. #define WINDOW_SYSTEM 1
  1172. #endif
  1173. #endif
  1174. #ifdef WINDOW_SYSTEM
  1175. # ifndef BUFFERED_STDOUT
  1176. # define BUFFERED_STDOUT 1
  1177. # endif
  1178. #endif
  1179. #ifndef NATIVE_CODE_TAG
  1180. # define NATIVE_CODE_TAG 0 /* Native code not available */
  1181. #endif
  1182. #ifndef _cplusplus
  1183. /*
  1184. * If I am compiling with a C++ compiler then setjmp is a BAD thing to
  1185. * use, but there are "better" exception handling facilities. If you are
  1186. * going to link the code here with any C++ class libraries (say that
  1187. * look after graphical user interfaces) it might make sense to compile
  1188. * everything in C++ mode just to be on the safe side. With some C++
  1189. * compilers the conflict between setjmp and try/catch seems to be
  1190. * pretty extreme. In some cases it may even extend to the whole
  1191. * application failing to link.
  1192. */
  1193. #include <setjmp.h>
  1194. #endif
  1195. #include <time.h> /* so I can declare base_time etc as clock_t */
  1196. #ifdef MS_C
  1197. /*
  1198. * If I use something other than __cdecl as the default calling convention
  1199. * with Microsoft C I need to stick in a qualifier for some of my functions
  1200. * where the standard calling model is needed. Eg signal handler fns. For
  1201. * compilers other than the Microsoft one I do not need qualifiers at all.
  1202. */
  1203. # define MS_CDECL __cdecl
  1204. #else
  1205. # define MS_CDECL
  1206. #endif
  1207. /*
  1208. * When building for use with Windows (Win32 or Win32s) I will make most
  1209. * entrypoints available if the whole package is linked as a DLL. At least
  1210. * I do that if building with Microsoft C - with Watcom I need to do more
  1211. * work first to understand how to make that option work.
  1212. */
  1213. #ifdef BUILDING_DLL
  1214. #define DLLexport __declspec(dllexport)
  1215. #else
  1216. #define DLLexport
  1217. #endif
  1218. /*
  1219. * Several C compilers that I have come across follow an ANSI draft that
  1220. * called the clock quantum CLK_TCK, while in the final standard it
  1221. * is CLOCKS_PER_SEC. Attempt to patch things up. If even CLK_TCK is not
  1222. * defined I would rather you gave me a value using -DCLOCKS_PER_SEC, or
  1223. * maybe in a machine-specific #ifdef... but I still try at least SOMETHING.
  1224. *
  1225. * In similar style, some sets of supposedly standard header files fail to
  1226. * define EXIT_SUCCESS, EXIT_FAILURE or SEEK_SET. I attempt to patch things
  1227. * up here, but really it would be better to get the host C compiler mended.
  1228. */
  1229. #ifndef CLK_TCK
  1230. # define CLK_TCK 60 /* Utterly spurious value - I know no better */
  1231. #endif
  1232. #ifndef CLOCKS_PER_SEC
  1233. # define CLOCKS_PER_SEC (CLK_TCK)
  1234. #endif
  1235. #ifndef EXIT_SUCCESS
  1236. # define EXIT_SUCCESS 0
  1237. #endif
  1238. #ifndef EXIT_FAILURE
  1239. # define EXIT_FAILURE 1
  1240. #endif
  1241. # ifndef SEEK_SET
  1242. # define SEEK_SET 0
  1243. # endif
  1244. # ifndef SEEK_END
  1245. # define SEEK_END 2
  1246. # endif
  1247. #ifdef NO_HELP_SYSTEM
  1248. /* Even if default for this architecture, remove HELP support */
  1249. # undef HELP_SYSTEM
  1250. #endif
  1251. #ifdef INITIAL_SOFTWARE_TICKS
  1252. # ifndef SOFTWARE_TICKS_PER_SECOND
  1253. # define SOFTWARE_TICKS_PER_SECOND 40
  1254. # endif
  1255. #endif
  1256. #ifdef SOFTWARE_TICKS_PER_SECOND
  1257. # ifndef INITIAL_SOFTWARE_TICKS
  1258. # define INITIAL_SOFTWARE_TICKS 3000
  1259. # endif
  1260. #endif
  1261. #ifdef CWIN
  1262. # include "cwin.h"
  1263. #endif
  1264. #endif /* header_machine_h */
  1265. /* end machine.h */