machine.h 41 KB

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