home *** CD-ROM | disk | FTP | other *** search
/ ftp.barnyard.co.uk / 2015.02.ftp.barnyard.co.uk.tar / ftp.barnyard.co.uk / cpm / commercial-software / programming / AZTEC302.ZIP / HEADER.ARC < prev    next >
Text File  |  1998-09-16  |  12KB  |  594 lines

  1. assert.h
  2. #ifndef NDEBUG
  3. #ifndef stderr
  4. #include <stdio.h>
  5. #endif
  6. #define assert(x) if (!(x)) {fprintf(stderr,"Assertion failed: x, file %s, line %d\n",__FILE__,__LINE__); exit(1);}
  7. #else
  8. #define assert(x)
  9. #endif
  10. ctype.h
  11. /* Copyright (C) 1984 by Manx Software Systems */
  12.  
  13. extern char ctp_[];
  14.  
  15. #define isalpha(x) (ctp_[(x)+1]&0x03)
  16. #define isupper(x) (ctp_[(x)+1]&0x01)
  17. #define islower(x) (ctp_[(x)+1]&0x02)
  18. #define isdigit(x) (ctp_[(x)+1]&0x04)
  19. #define isxdigit(x) (ctp_[(x)+1]&0x08)
  20. #define isalnum(x) (ctp_[(x)+1]&0x07)
  21. #define isspace(x) (ctp_[(x)+1]&0x10)
  22. #define ispunct(x) (ctp_[(x)+1]&0x40)
  23. #define iscntrl(x) (ctp_[(x)+1]&0x20)
  24. #define isprint(x) (ctp_[(x)+1]&0xc7)
  25. #define isgraph(x) (ctp_[(x)+1]&0x47)
  26. #define isascii(x) (((x)&0x80)==0)
  27.  
  28. #define toascii(x) ((x)&127)
  29. #define _tolower(x) ((x)|0x20)
  30. #define _toupper(x) ((x)&0x5f)
  31. dioctl.h
  32. /* Copyright (C) 1983 by Manx Software Systems */
  33.  
  34. #define TIOCGETP    0        /* read contents of tty control structure */
  35. #define TIOCSETP    1        /* set contents of tty control structure */
  36. #define TIOCSETN    1        /* ditto only don't wait for output to flush */
  37.  
  38. /* special codes for MSDOS 2.x only */
  39. #define TIOCREAD    2        /* read control info from device */
  40. #define TIOCWRITE    3        /* write control info to device */
  41. #define TIOCDREAD    4        /* same as 2 but for drives */
  42. #define TIOCDWRITE    5        /* same as 3 but for drives */
  43. #define GETISTATUS    6        /* get input status */
  44. #define GETOSTATUS    7        /* get output status */
  45.  
  46. struct sgttyb {
  47.     short sg_flags;        /* control flags */
  48.     char sg_erase;        /* ignored */
  49.     char sg_kill;        /* ignored */
  50. };
  51.  
  52. /* settings for flags */
  53. #define RAW        0x20    /* no echo or mapping of input/output BDOS(6) */
  54.  
  55. /* Refer to the MSDOS technical reference for detailed information on
  56.  * the remaining flags.
  57.  */
  58. errno.h
  59. extern int errno;
  60. extern char *sys_errlist[];
  61. extern int sys_nerr;
  62.  
  63. /* MsDos return codes */
  64. #define EINVAL    1
  65. #define ENOENT    2
  66. #define ENOTDIR    3
  67. #define EMFILE    4
  68. #define EACCES    5
  69. #define EBADF    6
  70. #define EARENA    7
  71. #define ENOMEM    8
  72. #define EFAULT    9
  73. #define EINVENV    10
  74. #define EBADFMT    11
  75. #define EINVACC    12
  76. #define EINVDAT    13
  77. #define ENODEV    15
  78. #define ERMCD    16
  79. #define EXDEV    17
  80. #define ENOMORE    18
  81.  
  82. /* additional codes used by Aztec C */
  83. #define EEXIST    19
  84. #define ENOTTY    20
  85. /* used by the math library */
  86. #define ERANGE    21
  87. #define EDOM    22
  88. fcntl.h
  89. #define O_RDONLY    0
  90. #define O_WRONLY    1
  91. #define O_RDWR        2
  92. #define O_CREAT        0x0100
  93. #define O_TRUNC        0x0200
  94. #define O_EXCL        0x0400
  95. #define O_APPEND    0x0800
  96. io.h
  97. /* Copyright (C) 1982 by Manx Software Systems */
  98. /*
  99.  * if MAXCHAN is changed then the initialization of chantab in croot.c
  100.  * should be adjusted so that it initializes EXACTLY MAXCHAN elements of 
  101.  * the array.  If this is not done, the I/O library may exhibit
  102.  * strange behavior.
  103.  */
  104. #define MAXCHAN    11    /* maximum number of I/O channels */
  105.  
  106. /*
  107.  * argument to device routines.
  108.  *        this is a typedef to allow future redeclaration to guarantee 
  109.  *        enough space to store either a pointer or an integer.
  110.  */
  111. typedef char *_arg;
  112.  
  113. /*
  114.  * device control structure
  115.  */
  116. struct device {
  117.     char d_read;
  118.     char d_write;
  119.     char d_ioctl;    /* used by character special devices (eg CON:) */
  120.     char d_seek;    /* used by random I/O devices (eg: a file) */
  121.     int (*d_open)();    /* for special open handling */
  122. };
  123.  
  124. /*
  125.  * device table, contains names and pointers to device entries
  126.  */
  127. struct devtabl {
  128.     char *d_name;
  129.     struct device *d_dev;
  130.     _arg d_arg;
  131. };
  132.  
  133. /*
  134.  * channel table: relates fd's to devices
  135.  */
  136. struct channel {
  137.     char c_read;
  138.     char c_write;
  139.     char c_ioctl;
  140.     char c_seek;
  141.     int (*c_close)();
  142.     _arg c_arg;
  143. } ;
  144. extern struct channel chantab[MAXCHAN];
  145.  
  146. struct fcb {
  147.     char f_driv;
  148.     char f_name[8];
  149.     char f_type[3];
  150.     char f_ext;
  151.     char f_resv[2];
  152.     char f_rc;
  153.     char f_sydx[16];
  154.     char f_cr;
  155.     unsigned f_record; char f_overfl;
  156. };
  157.  
  158. struct fcbtab {
  159.     struct fcb fcb;
  160.     char offset;
  161.     char flags;
  162.     char user;
  163. };
  164.  
  165. #define    OPNFIL    15
  166. #define CLSFIL    16
  167. #define DELFIL    19
  168. #define READSQ    20
  169. #define WRITSQ    21
  170. #define MAKFIL    22
  171. #define SETDMA    26
  172. #define GETUSR    32
  173. #define READRN    33
  174. #define WRITRN    34
  175. #define FILSIZ    35
  176. #define SETREC    36
  177.  
  178. #define Wrkbuf ((char *)0x80)
  179. libc.h
  180. /* Copyright (C) 1981, 1982 by Manx Software Systems */
  181.  
  182. extern int errno;
  183. #define FLT_FAULT    0        /* vector for floating-point faults */
  184. extern int (*Sysvec[])();
  185.  
  186. #define NULL 0
  187. #define EOF -1
  188. #define BUFSIZ 1024
  189.  
  190. #define _BUSY    0x01
  191. #define _ALLBUF    0x02
  192. #define _DIRTY    0x04
  193. #define _EOF    0x08
  194. #define _IOERR    0x10
  195. #define _TEMP    0x20    /* temporary file (delete on close) */
  196.  
  197. typedef struct {
  198.     char *_bp;            /* current position in buffer */
  199.     char *_bend;        /* last character in buffer + 1 */
  200.     char *_buff;        /* address of buffer */
  201.     char _flags;        /* open mode, etc. */
  202.     char _unit;            /* token returned by open */
  203.     char _bytbuf;        /* single byte buffer for unbuffer streams */
  204.     int    _buflen;        /* length of buffer */
  205.     char *_tmpname;        /* name of file for temporaries */
  206. } FILE;
  207.  
  208. extern FILE Cbuffs[];
  209. extern char *Stdbufs;            /* free list of buffers */
  210. long ftell();
  211.  
  212. #define stdin (&Cbuffs[0])
  213. #define stdout (&Cbuffs[1])
  214. #define stderr (&Cbuffs[2])
  215. #define getchar() agetc(stdin)
  216. #define putchar(c) aputc(c, stdout)
  217. #define feof(fp) (((fp)->_flags&_EOF)!=0)
  218. #define ferror(fp) (((fp)->_flags&_IOERR)!=0)
  219. #define clearerr(fp) ((fp)->_flags &= ~(_IOERR|_EOF))
  220. #define fileno(fp) ((fp)->_unit)
  221. lmacros.h
  222.     nlist
  223. ; Copyright (C) 1985 by Manx Software Systems, Inc.
  224. ; :ts=8
  225.     ifndef    MODEL
  226. MODEL    equ    0
  227.     endif
  228.     if    MODEL and 1
  229.     largecode
  230. FARPROC    equ 1
  231. FPTRSIZE equ    4
  232.     else
  233. FPTRSIZE equ    2
  234.     endif
  235.     if    MODEL and 2
  236. LONGPTR equ 1
  237.     endif
  238.  
  239. ;this macro to be used on returning
  240. ;restores bp and registers 
  241. pret    macro
  242. if havbp
  243.     pop bp
  244. endif
  245.     ret
  246.     endm
  247.  
  248. internal macro    pname
  249.     public    pname
  250. pname    proc
  251.     endm
  252.  
  253. intrdef    macro    pname
  254.     public    pname
  255. ifdef FARPROC
  256.     pname    label    far
  257. else
  258.     pname    label    near
  259. endif
  260.     endm
  261.  
  262. procdef    macro    pname, args
  263.     public pname&_
  264. ifdef    FARPROC
  265.     _arg    = 6
  266.     pname&_    proc    far
  267. else
  268.     _arg    = 4
  269.     pname&_    proc    near
  270. endif
  271. ifnb <args>
  272.     push bp
  273.     mov bp,sp
  274.     havbp = 1
  275.     decll <args>
  276. else
  277.     havbp = 0
  278. endif
  279.     endm
  280.  
  281. entrdef    macro    pname, args
  282.     public pname&_
  283. ifdef    FARPROC
  284.     _arg    = 6
  285.     pname&_:
  286. else
  287.     _arg    = 4
  288.     pname&_:
  289. endif
  290. ifnb <args>
  291. if    havbp
  292.     push    bp
  293.     mov    bp,sp
  294. else
  295.     error must declare main proc with args, if entry has args
  296. endif
  297.     decll <args>
  298. endif
  299.     endm
  300.  
  301. ;this macro equates 'aname' to arg on stack
  302. decl    macro     aname, type
  303. ;;'byte' or anything else
  304. havtyp    = 0
  305. ifidn    <type>,<byte>
  306.     aname    equ    byte ptr _arg[bp]
  307.     _arg = _arg + 2
  308.     havtyp = 1
  309. endif
  310. ifidn    <type>,<dword>
  311.     aname    equ dword ptr _arg[bp]
  312.     _arg = _arg + 4
  313.     havtyp = 1
  314. endif
  315. ifidn <type>,<cdouble>
  316.     aname    equ qword ptr _arg[bp]
  317.     _arg = _arg + 8
  318.     havtyp = 1
  319. endif
  320. ifidn <type>, <ptr>
  321.     ifdef LONGPTR
  322.         aname    equ dword ptr _arg[bp]
  323.         _arg = _arg + 4
  324.     else
  325.         aname equ    word ptr _arg[bp]
  326.         _arg = _arg + 2
  327.     endif
  328.     havtyp = 1
  329. endif
  330. ifidn <type>, <fptr>
  331.     ifdef FARPROC
  332.         aname    equ dword ptr _arg[bp]
  333.         _arg = _arg + 4
  334.     else
  335.         aname equ    word ptr _arg[bp]
  336.         _arg = _arg + 2
  337.     endif
  338.     havtyp = 1
  339. endif
  340. ifidn <type>, <word>
  341.     aname equ    word ptr _arg[bp]
  342.     _arg = _arg + 2
  343.     havtyp = 1
  344. endif
  345. ife    havtyp
  346.     error -- type is unknown.
  347. endif
  348.     endm
  349.  
  350. ;this macro loads an arg pointer into DEST, with optional SEGment
  351. ldptr    macro    dest, argname, seg
  352. ifdef    LONGPTR
  353.     ifnb <seg>        ;;get segment if specified
  354.         ifidn <seg>,<es>
  355.             les    dest,argname
  356.         else
  357.             ifidn <seg>,<ds>
  358.                 lds dest,argname
  359.             else
  360.                 mov dest, word ptr argname
  361.                 mov seg, word ptr argname[2]
  362.             endif
  363.         endif
  364.     else
  365.         ifidn <dest>,<si>        ;;si gets seg in ds
  366.             lds    si, argname
  367.         else
  368.             ifidn <dest>,<di>    ;;or, es:di
  369.                 les    di, argname
  370.             else
  371.                 garbage error: no seg for long pointer
  372.             endif
  373.         endif
  374.     endif
  375. else
  376.     mov dest, word ptr argname    ;;get the pointer
  377. ENDIF
  378.     ENDM
  379.  
  380. decll    macro    list
  381.     IRP    i,<list>
  382.     decl i
  383.     ENDM
  384.     ENDM
  385.  
  386. pend    macro    pname
  387. pname&_    endp
  388.     endm
  389.  
  390. retptrm    macro    src,seg
  391. mov    ax, word ptr src
  392. ifdef    LONGPTR
  393.     mov    dx, word ptr src+2
  394. endif
  395.     endm
  396.  
  397. retptrr    macro    src,seg
  398. mov    ax,src
  399. ifdef LONGPTR
  400.     ifnb <seg>
  401.         mov    dx, seg
  402.     endif
  403. endif
  404.     endm
  405.  
  406. retnull    macro
  407. ifdef LONGPTR
  408.     sub    dx,dx
  409. endif
  410.     sub    ax,ax
  411.      endm
  412.  
  413. pushds    macro
  414.     ifdef LONGPTR
  415.     push    ds
  416.     endif
  417.     endm
  418.  
  419. popds    macro
  420.     ifdef LONGPTR
  421.     pop    ds
  422.     endif
  423.     endm
  424.  
  425. finish    macro
  426. codeseg    ends
  427.     endm
  428.  
  429.     list
  430. codeseg    segment    byte public 'code'
  431.     assume    cs:codeseg
  432. math.h
  433. double sin(), cos(), tan(), cotan();
  434. double asin(), acos(), atan(), atan2();
  435. double ldexp(), frexp(), modf();
  436. double floor(), ceil(), fabs();
  437. double log(), log10(), exp(), sqrt(), pow();
  438. double sinh(), cosh(), tanh();
  439.  
  440. #define HUGE_VAL 1.79e+308
  441. #define LOGHUGE    709.778
  442. #define TINY_VAL 2.2e-308
  443. #define LOGTINY    -708.396
  444. memory.h
  445. extern char *memcpy(), *memchr(), *memcpy(), memset();
  446. extern int memcmp();
  447. search.h
  448. typedef    int VISIT;
  449. #define preorder     1
  450. #define postorder     2
  451. #define endorder     3
  452. #define    leaf         4
  453. setjmp.h
  454. /* Copyright (C) 1983 by Manx Software Systems */
  455. #define JBUFSIZE    (6*sizeof(int))
  456.  
  457. typedef char jmp_buf[JBUFSIZE];
  458. sgtty.h
  459. /* Copyright (C) 1983 by Manx Software Systems */
  460.  
  461. #define TIOCGETP    0        /* read contents of tty control structure */
  462. #define TIOCSETP    1        /* set contents of tty control structure */
  463. #define TIOCSETN    1        /* ditto only don't wait for output to flush */
  464.  
  465. struct sgttyb {
  466.     char sg_erase;        /* ignored */
  467.     char sg_kill;        /* ignored */
  468.     short sg_flags;        /* control flags */
  469. };
  470.  
  471. /* settings for flags */
  472. #define _VALID    0x3a
  473. #define RAW        0x20    /* no echo or mapping of input/output BDOS(6) */
  474. #define CRMOD    0x10    /* map input CR to NL, output NL to CR LF */
  475. #define ECHO    0x08    /* ignored unless CBREAK is set */
  476. #define CBREAK    0x02    /* input using BDOS(1), unless echo off then */
  477.                         /* same as RAW */
  478. signal.h
  479. /* Copyright (C) 1985 by Manx Software Systems, Inc. */
  480.  
  481. #define SIG_DFL    ((void (*)())0)
  482. #define SIG_IGN    ((void (*)())1)
  483. #define SIG_ERR    ((void (*)())-1)
  484.  
  485. #define SIGINT    1
  486. #define SIGTERM    2
  487. #define SIGABRT    3
  488. #define SIGFPE    4
  489. #define SIGILL    5
  490. #define SIGSEGV    6
  491.  
  492. #define _NUMSIG    6
  493. #define _FSTSIG    1
  494. stat.h
  495. /* Copyright (C) 1984 by Manx Software Systems */
  496.  
  497. struct stat {
  498.     char st_attr;
  499.     long st_mtime;
  500.     long st_size;
  501. };
  502.  
  503. /* settings of the st_attr field */
  504. #define ST_RDONLY    0x01    /* read only file */
  505. #define ST_HIDDEN    0x02    /* hidden file */
  506. #define ST_SYSTEM    0x04    /* system file */
  507. #define ST_VLABEL    0x08    /* volume label */
  508. #define ST_DIRECT    0x10    /* file is a sub-directory */
  509. #define ST_ARCHIV    0x20    /* set when file has been written and closed */
  510.  
  511. /* the format of the st_mtime field is:
  512.     <   year    > < month> <  day  >  < hours > <  minutes > < sec/2 >
  513.     3 3 2 2 2 2 2 2  2 2 2 2 1 1 1 1  1 1 1 1 1 1 0 0  0 0 0 0 0 0 0 0
  514.     1 0 9 8 7 6 5 4  3 2 1 0 9 8 7 6  5 4 3 2 1 0 9 8  7 6 5 4 3 2 1 0
  515.  
  516. where:
  517.     year is from 0-119 for 1980-2099
  518.     month is 1-12
  519.     day is 1-31
  520.     hours is 0-23
  521.     minutes is 0-59
  522.     sec/2 is 0-29
  523. */
  524. stdio.h
  525. /* Copyright (C) 1982, 1984 by Manx Software Systems */
  526. #define fgetc getc
  527. #define fputc putc
  528. #define NULL (void *)0
  529. #define EOF -1
  530.  
  531.  
  532. #define BUFSIZ 1024
  533. #define MAXSTREAM    20
  534.  
  535. #define _BUSY    0x01
  536. #define _ALLBUF    0x02
  537. #define _DIRTY    0x04
  538. #define _EOF    0x08
  539. #define _IOERR    0x10
  540. #define _TEMP    0x20    /* temporary file (delete on close) */
  541.  
  542. typedef struct {
  543.     char *_bp;            /* current position in buffer */
  544.     char *_bend;        /* last character in buffer + 1 */
  545.     char *_buff;        /* address of buffer */
  546.     char _flags;        /* open mode, etc. */
  547.     char _unit;            /* token returned by open */
  548.     char _bytbuf;        /* single byte buffer for unbuffer streams */
  549.     int    _buflen;        /* length of buffer */
  550.     char *_tmpname;        /* name of file for temporaries */
  551. } FILE;
  552.  
  553. extern FILE Cbuffs[];
  554. FILE *fopen();
  555. long ftell();
  556.  
  557. #define stdin (&Cbuffs[0])
  558. #define stdout (&Cbuffs[1])
  559. #define stderr (&Cbuffs[2])
  560. #define getchar() agetc(stdin)
  561. #define putchar(c) aputc(c, stdout)
  562. #define feof(fp) (((fp)->_flags&_EOF)!=0)
  563. #define ferror(fp) (((fp)->_flags&_IOERR)!=0)
  564. #define clearerr(fp) ((fp)->_flags &= ~(_IOERR|_EOF))
  565. #define fileno(fp) ((fp)->_unit)
  566. #define fflush(fp) flsh_(fp,-1)
  567.  
  568. #define    P_tmpdir    ""
  569. #define L_tmpnam    40
  570. time.h
  571. /* Copyright (C) 1984, 1985 by Manx Software Systems */
  572.  
  573. #define CLK_TCK 100
  574. typedef long time_t;
  575. typedef long clock_t;
  576.  
  577. struct tm {
  578.     short tm_sec;
  579.     short tm_min;
  580.     short tm_hour;
  581.     short tm_mday;
  582.     short tm_mon;
  583.     short tm_year;
  584.     short tm_wday;
  585.     short tm_yday;
  586.     short tm_isdst;
  587.     short tm_hsec;
  588. };
  589.  
  590. struct tm *gmtime(), *localtime();
  591. char *asctime(), *ctime();
  592. time_t time();
  593.  $fldpss:%,$fldpds:%,$fldsss:%,$fldsds:%,$fstss:%,$fstds:%
  594.     extrn $fs