home *** CD-ROM | disk | FTP | other *** search
/ APDL Public Domain 1 / APDL_PD1A.iso / program / language / icon / Source / h / Config next >
Encoding:
Text File  |  1990-07-19  |  11.7 KB  |  617 lines

  1. /*
  2.  * Icon configuration.
  3.  */
  4.  
  5. /*
  6.  * System-specific definitions are in define.h
  7.  */
  8. #include "../h/define.h"
  9.  
  10. #include <stdio.h>
  11.  
  12. /*
  13.  *  A number of symbols are defined here.  Some are specific to individual
  14.  *  to operating systems.  Examples are:
  15.  *
  16.  *    MSDOS        MS-DOS for PCs
  17.  *    UNIX        any UNIX system
  18.  *    VMS        VMS for the VAX
  19.  *
  20.  *  These are defined to be 1 or 0 depending on which operating system
  21.  *  the installation is being done under.  They are all defined and only
  22.  *  one is defined to be 1.  (They are used in the form #if VAX || MSDOS.)
  23.  *
  24.  *  There also are definitions of symbols for specific computers and
  25.  *  versions of operating systems.  These include:
  26.  *
  27.  *    SUN        code specific to the Sun Workstation
  28.  *    MICROSOFT    code specific to the Microsoft C compiler for MS-DOS
  29.  *
  30.  *  Other definitions may occur for different configurations. These include:
  31.  *
  32.  *    DeBug        debugging code
  33.  *    MemMon        memory monitoring output
  34.  *
  35.  *  Other definitions perform configurations that are common to several
  36.  *  systems. An example is:
  37.  *
  38.  *    Double        align reals at double-word boundaries
  39.  *
  40.  */
  41.  
  42. /*
  43.  * The following definitions insure that all the symbols for operating
  44.  * systems that are not relevant are defined to be 0 -- so that they
  45.  * can be used in logical expressions in #if directives.
  46.  */
  47.  
  48. #ifndef PORT
  49. #define PORT 0
  50. #endif                    /* PORT */
  51.  
  52. #ifndef AMIGA
  53. #define AMIGA 0
  54. #endif                    /* AMIGA */
  55.  
  56. #ifndef ATARI_ST
  57. #define ATARI_ST 0
  58. #endif                    /* ATARI_ST */
  59.  
  60. #ifndef HIGHC_386
  61. #define HIGHC_386 0
  62. #endif                    /* HIGHC_386 */
  63.  
  64. #ifndef MACINTOSH
  65. #define MACINTOSH 0
  66. #endif                    /* MACINTOSH */
  67.  
  68. #ifndef MSDOS
  69. #define MSDOS 0
  70. #endif                    /* MSDOS */
  71.  
  72. #ifndef MVS
  73. #define MVS 0
  74. #endif                    /* MVS */
  75.  
  76. #ifndef OS2
  77. #define OS2 0
  78. #endif                    /* OS2 */
  79.  
  80. #ifndef UNIX
  81. #define UNIX 0
  82. #endif                    /* UNIX */
  83.  
  84. #ifndef VM
  85. #define VM 0
  86. #endif                    /* VM */
  87.  
  88. #ifndef VMS
  89. #define VMS 0
  90. #endif                    /* VMS */
  91.  
  92.  
  93. /*
  94.  * The following definitions serve to cast common conditionals is
  95.  *  a positive way, while allowing defaults for the cases that
  96.  *  occur most frequently.  That is, if co-expressions are not supported,
  97.  *  NoCoexpr is defined in define.h, but if they are supported, no
  98.  *  definition is needed in define.h; nonetheless subsequent conditionals
  99.  *  can be cast as #ifdef Coexpr.
  100.  */
  101.  
  102. #ifndef NoCoexpr
  103. #undef Coexpr
  104. #define Coexpr
  105. #endif                    /* NoCoexpr */
  106.  
  107. #ifndef NoEnvVars
  108. #undef EnvVars
  109. #define EnvVars
  110. #endif                    /* NoEnvVars */
  111.  
  112. #ifndef NoTraceBack
  113. #undef TraceBack
  114. #define TraceBack
  115. #endif                    /* NoTraceBack */
  116.  
  117. #ifndef NoStrInvoke
  118. #undef StrInvoke
  119. #define StrInvoke
  120. #endif                    /* NoStrInvoke */
  121.  
  122. #ifndef NoMathFncs
  123. #undef MathFncs
  124. #define MathFncs
  125. #endif                    /* NoMathFncs */
  126.  
  127. #ifndef NoLargeInts
  128. #undef LargeInts
  129. #define LargeInts
  130. #endif                    /* NoLargeInts */
  131.  
  132. #ifndef NoMemMon
  133. #ifdef EnvVars
  134. #undef MemMon
  135. #define MemMon
  136. #endif                    /* EnvVars */
  137. #endif                    /* NoMemMon */
  138.  
  139. #ifndef NoExternalFunctions
  140. #undef ExternalFunctions
  141. #define ExternalFunctions
  142. #endif                    /* NoExternalFunctions */
  143.  
  144. /*
  145.  * Names for standard environment variables, if they are supported.
  146.  * The standard names are used unless they are overridden.
  147.  */
  148.  
  149. #ifdef EnvVars
  150.  
  151. #ifndef MEMMON
  152. #define MEMMON "MEMMON"
  153. #endif
  154.  
  155. #ifndef NOERRBUF
  156. #define NOERRBUF "NOERRBUF"
  157. #endif
  158.  
  159. #ifndef TRACE
  160. #define TRACE "TRACE"
  161. #endif
  162.  
  163. #ifndef COEXPSIZE
  164. #define COEXPSIZE "COEXPSIZE"
  165. #endif
  166.  
  167. #ifndef STRSIZE
  168. #define STRSIZE "STRSIZE"
  169. #endif
  170.  
  171. #ifndef HEAPSIZE
  172. #define HEAPSIZE "HEAPSIZE"
  173. #endif
  174.  
  175. #ifndef BLOCKSIZE
  176. #define BLOCKSIZE "BLOCKSIZE"
  177. #endif
  178.  
  179. #ifndef BLKSIZE
  180. #define BLKSIZE "BLKSIZE"
  181. #endif
  182.  
  183. #ifndef STATSIZE
  184. #define STATSIZE "STATSIZE"
  185. #endif
  186.  
  187. #ifndef STATINCR
  188. #define STATINCR "STATINCR"
  189. #endif
  190.  
  191. #ifndef MSTKSIZE
  192. #define MSTKSIZE "MSTKSIZE"
  193. #endif
  194.  
  195. #ifndef QLSIZE
  196. #define QLSIZE "QLSIZE"
  197. #endif
  198.  
  199. #ifndef ICONCORE
  200. #define ICONCORE "ICONCORE"
  201. #endif
  202.  
  203. #ifndef IPATH
  204. #define IPATH "IPATH"
  205. #endif
  206.  
  207. #endif                    /* EnvVars */
  208.  
  209. /*
  210.  * EBCDIC == 0 corresponds to ASCII.  EBCDIC == 1 corresponds to EBCDIC
  211.  *  collating sequence, while EBCDIC == 2 provides the ASCII collating
  212.  *  sequence for EBCDIC systems.
  213.  */
  214. #ifndef EBCDIC
  215. #define EBCDIC 0
  216. #endif                    /* EBCDIC */
  217.  
  218. /*
  219.  * Other defaults.
  220.  */
  221.  
  222. #ifdef DeBug
  223. #undef DeBugTrans
  224. #undef DeBugLinker
  225. #undef DeBugIconx
  226. #define DeBugTrans
  227. #define DeBugLinker
  228. #define DeBugIconx
  229. #endif                    /* DeBug */
  230.  
  231. #ifdef ExecImages
  232. #undef IconCalling
  233. #endif                    /* ExecImages */
  234.  
  235. #ifndef AllocType
  236. #define AllocType unsigned int
  237. #endif                    /* AllocType */
  238.  
  239. typedef AllocType msize;
  240.  
  241. #ifndef ErrorExit
  242. #define ErrorExit 1
  243. #endif                    /* ErrorExit */
  244.  
  245. #ifndef NormalExit
  246. #define NormalExit 0
  247. #endif                    /* NormalExit */
  248.  
  249. #ifndef Hz
  250. #define Hz 60
  251. #endif                    /* Hz */
  252.  
  253. #ifndef MaxHdr
  254. #define MaxHdr 4096
  255. #endif                    /* MaxHdr */
  256.  
  257. #ifndef StackAlign
  258. #define StackAlign 2
  259. #endif                    /* StackAlign */
  260.  
  261. #ifndef SysTime
  262. #define SysTime <time.h>
  263. #endif                    /* SysTime */
  264.  
  265. #ifndef WordBits
  266. #define WordBits 32
  267. #endif                    /* WordBits */
  268.  
  269. #ifndef IntBits
  270. #define IntBits WordBits
  271. #endif                    /* IntBits */
  272.  
  273. #ifndef SourceSuffix
  274. #define SourceSuffix ".icn"
  275. #endif                    /* SourceSuffix */
  276.  
  277. #ifndef IcodeSuffix
  278. #define IcodeSuffix ""
  279. #endif                    /* IcodeSuffix */
  280.  
  281. #ifndef IcodeASuffix
  282. #define IcodeASuffix ""
  283. #endif                    /* IcodeASuffix */
  284.  
  285. #ifndef U1Suffix
  286. #define U1Suffix ".u1"
  287. #endif                    /* U1Suffix */
  288.  
  289. #ifndef U2Suffix
  290. #define U2Suffix ".u2"
  291. #endif                    /* U2Suffix */
  292.  
  293. #ifndef USuffix
  294. #define USuffix ".u"
  295. #endif                    /* USuffix */
  296.  
  297. /*
  298.  * Representations of directories. LocalDir is the "current working directory".
  299.  *  SourceDir is where the source file is. 
  300.  */
  301.  
  302. #define LocalDir ""
  303. #define SourceDir (char *)NULL
  304.  
  305. #ifndef TargetDir
  306. #define TargetDir LocalDir
  307. #endif                    /* TargetDir */
  308.  
  309. #ifndef Options
  310. #if ARM || UNIX
  311. #define Options "ce:mo:stuxLS:"
  312. #else                    /* ARM || UNIX */
  313. #define Options "ce:o:stuxLS:"
  314. #endif                    /* ARM || UNIX */
  315. #endif                    /* Options */
  316.  
  317. #ifndef Usage
  318. #if ARM || UNIX
  319. #define Usage "[-cmstu] [-e efile] [-o ofile] [-Sxnnnn]"
  320. #else                    /* ARM || UNIX */
  321. #if MVS || VM
  322. #define Usage "<-cstu> <-e efile> <-o ofile> <-Sxnnnn>"
  323. #else                    /* MVS || VM */
  324. #define Usage "[-cstu] [-e efile] [-o ofile] [-Sxnnnn]"
  325. #endif                    /* MVS || VM */
  326. #endif                    /* ARM || UNIX */
  327. #endif                    /* Usage */
  328.  
  329. #ifndef Pipes
  330. #if UNIX || VMS
  331. #define Pipes
  332. #endif                    /* UNIX || VMS */
  333. #endif                    /* Pipes */
  334.  
  335. #ifndef SystemFnc
  336. #if AMIGA || ARM || ATARI_ST || MSDOS || MVS || OS2 || UNIX || VM || VMS
  337. #define SystemFnc
  338. #endif                    /* AMIGA || ARM || ATARI_ST || ... */
  339. #endif                    /* SystemFnc */
  340.  
  341. /*
  342.  * Default sizing and such.
  343.  */
  344.  
  345. /*
  346.  * Set up typedefs and related definitions depending on whether or not
  347.  * ints and pointers are the same size.
  348.  */
  349.  
  350. #if IntBits == 16
  351. typedef long int word;
  352. typedef unsigned long int uword;
  353. #else                    /* IntBits == 16 */
  354. typedef int word;
  355. typedef unsigned int uword;
  356. #endif                    /* IntBits == 16 */
  357.  
  358. #define WordSize sizeof(word)
  359.  
  360. #ifndef ByteBits
  361. #define ByteBits 8
  362. #endif                    /* ByteBits */
  363.  
  364. /*
  365.  * Define the size of the units in MemMon (allocation history) files.
  366.  */
  367. #ifndef MMUnits
  368. #define MMUnits WordSize
  369. #endif                    /* MMUnits */
  370.  
  371. /*
  372.  * Change the name of gcvt() if we're supplying our own version,
  373.  * to avoid complaints under VMS and others with shared libraries.
  374.  */
  375.  
  376. #ifdef IconGcvt
  377. #define gcvt icon_gcvt
  378. #endif                    /* IconGcvt */
  379.  
  380.  
  381. /*
  382.  *  The following definitions depend on whether or not the ANSI C standard
  383.  *  is supported.
  384.  */
  385.  
  386. #ifdef Standard
  387. #undef StandardC
  388. #undef StandardPP
  389. #undef StandardLib
  390. #define StandardC
  391. #define StandardPP
  392. #define StandardLib
  393. #endif                    /* Standard */
  394.  
  395. #ifdef StandardPP
  396. #define Cat(x,y) x##y
  397. #define Lit(x) #x
  398. #else                    /* StandardPP */
  399. #define Ident(x) x
  400. #define Cat(x,y) Ident(x)y
  401. #define Lit(x) "x"
  402. #endif                    /* StandardPP */
  403.  
  404. #ifdef StandardC
  405. #undef Prototypes
  406. #define Prototypes
  407. #ifndef PointerDef
  408. typedef void *pointer;
  409. #endif                    /* PointerDef */
  410. #undef VoidType
  411. #define VoidType
  412. #define Bell '\a'
  413. #else                    /* StandardC */
  414. #ifndef PointerDef
  415. typedef char *pointer;
  416. #endif                    /* PointerDef */
  417. #if EBCDIC
  418. #define Bell '\x2F'
  419. #else                    /* EBCDIC */
  420. #define Bell '\007'
  421. #endif                    /* EBCDIC */
  422. #endif                    /* StandardC */
  423.  
  424. #ifdef StandardLib
  425. #undef SysMem
  426. #define SysMem
  427. #endif                    /* StandardLib */
  428.  
  429. #if IntBits != WordBits
  430. #undef SysMem
  431. #endif                    /* Intbits != WordBits */
  432.  
  433. #ifdef SysMem
  434. #undef memcopy
  435. #undef memfill
  436. #define memcopy memcpy
  437. #define memfill memset
  438. #endif                    /* SysMem */
  439.  
  440. /*
  441.  * Provide definition to use void if it's supported (mainly avoids error
  442.  *  messages with some C compilers.  Note: typedef does not work, so care
  443.  *  is needed not to use compound declarations.
  444.  */
  445.  
  446. #ifdef VoidType
  447. #define novalue void
  448. #define noargs void
  449. #else                    /* VoidType */
  450. #define novalue int
  451. #define noargs
  452. #endif                    /* VoidType */
  453.  
  454. /*
  455.  * Customize output if not pre-defined.
  456.  */
  457.  
  458. #ifndef TraceOut
  459. #define TraceOut(s) fprintf(stderr,s)
  460. #endif                    /* TraceOut */
  461.  
  462. #if EBCDIC
  463. #define BackSlash "\xe0"
  464. #else                    /* EBCDIC */
  465. #define BackSlash "\\"
  466. #endif                    /* EBCDIC */
  467.  
  468. #if UNIX
  469. #define WriteBinary "w"
  470. #define ReadBinary "r"
  471. #define WriteText "w"
  472. #define ReadText "r"
  473. #endif                    /* UNIX */
  474.  
  475. #ifndef WriteBinary
  476. #define WriteBinary "wb"
  477. #endif                    /* WriteBinary */
  478.  
  479. #ifndef ReadBinary
  480. #define ReadBinary "rb"
  481. #endif                    /* ReadBinary */
  482.  
  483. #ifndef WriteText
  484. #define WriteText "w"
  485. #endif                    /* WriteText */
  486.  
  487. #ifndef ReadText
  488. #define ReadText "r"
  489. #endif                    /* ReadText */
  490.  
  491. /*
  492.  * Typedefs to make some things easier.
  493.  */
  494.  
  495. typedef int (*fptr)();
  496. typedef struct descrip *dptr;
  497.  
  498. /*
  499.  * "hidden" is used to declare static functions;  "hidden" normally == "static",
  500.  *  except with compilers that can't handle "static" in prototypes.
  501.  */
  502.  
  503. #ifndef hidden
  504. #define hidden static
  505. #endif                    /* hidden */
  506.  
  507. /*
  508.  * The "Params" macro allows a single declaration to be used with both old- and
  509.  *  new-style compilers.
  510.  */
  511.  
  512. #ifdef Prototypes
  513. #define Params(a) a
  514. #else                    /* Prototypes */
  515. #define Params(a) ()
  516. #endif                    /* Prototypes */
  517.  
  518. /*
  519.  * cal_time holds a calendar time.
  520.  */
  521. struct cal_time {
  522.    int year;        /* yyyy */
  523.    int month_no;    /* month number: 1-12 */
  524.    char *month_nm;    /* month name: "January", "February", ... */
  525.    int mday;        /* day of the month */
  526.    char *wday;        /* "Sunday", "Monday", ... */
  527.    int hour;        /* hour by 24 hr clock */
  528.    int minute;
  529.    int second;
  530.    };
  531.  
  532. /*
  533.  * Function prototypes.
  534.  */
  535.  
  536. #include "../h/proto.h"
  537.  
  538. /*
  539.  * More definitions depending on whether or not ints and pointers
  540.  * are the same size.  These must follow the include of proto.h to
  541.  * avoid redefinition problems with some compilers.
  542.  */
  543.  
  544. #if IntBits == 16
  545. #define sbrk lsbrk
  546. #define qsort llqsort
  547. #define strlen lstrlen
  548. #endif                    /* IntBits == 16 */
  549.  
  550. /*
  551.  * The following code is operating-system dependent [@config.01].
  552.  *  Any configuration stuff that has to be done at this point.
  553.  */
  554.  
  555. #if PORT
  556.    /* Probably nothing is needed. */
  557. Deliberate Syntax Error
  558. #endif                    /* PORT */
  559.  
  560. #if AMIGA || ARM || ATARI_ST || MACINTOSH || MSDOS || MVS || VM || VMS
  561.    /* Nothing is needed */
  562. #endif                    /* AMIGA || MACINTOSH ...*/
  563.  
  564. #if HIGHC_386
  565. /*
  566.  * MetaWare's HighC 386 macro putc doesn't handle putc('\n') correctly -
  567.  * sometimes a CR is not written out before the LF.  So, redefine
  568.  * macro putc to actually issue an fputc.
  569.  */
  570. #undef putc
  571. #define putc(c,f) fputc(c,f)
  572. #endif                    /* HIGHC_386 */
  573.  
  574. #if MACINTOSH
  575. #if LSC
  576. /*
  577.  * LightSpeed C requires that #define tokens appear after prototypes
  578.  */
  579. #define index strchr
  580. #define malloc mlalloc
  581. #define rindex strrchr
  582. #define unlink remove
  583. #endif                    /* LSC */
  584. #endif                    /* MACINTOSH */
  585.  
  586. #if UNIX
  587.  
  588. #undef WriteBinary
  589. #define WriteBinary "w"
  590.  
  591. #undef ReadBinary
  592. #define ReadBinary "r"
  593.  
  594. #ifndef NoHardWiredPaths
  595. #define HardWiredPaths
  596. #endif                    /* NoHardWiredPaths */
  597.  
  598. #ifndef NoHeader
  599. #undef Header
  600. #define Header
  601. #endif                    /* NoHeader */
  602.  
  603. #endif                    /* UNIX */
  604.  
  605. /*
  606.  * End of operating-system specific code.
  607.  */
  608.  
  609.  
  610. #ifndef DiffPtrs
  611. #define DiffPtrs(p1,p2) (word)((p1)-(p2))
  612. #endif                    /* Diffptrs */
  613.  
  614. #ifndef AllocReg
  615. #define AllocReg(n) malloc((msize)n)
  616. #endif                    /* AllocReg */
  617.