home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Demos / OOFILE / Buildable, limited OOFILE / c-tree headers / ctcmpl.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-06-24  |  3.7 KB  |  165 lines  |  [TEXT/CWIE]

  1. /*
  2.  *    c-tree PLUS(tm)    Version 6.0
  3.  *            Release A4
  4.  *            September 12, 1991
  5.  */
  6.  
  7. #ifndef ctCMPLH
  8. #define ctCMPLH
  9.  
  10. /* Macintosh ctcmpl.h */
  11.  
  12. #define ctMACINTOSH
  13. #define PROTOTYPE
  14. #ifdef THINK_C
  15. #define ctSTRICTANSI
  16. #endif
  17.  
  18. #include <stddef.h>
  19. #include <stdlib.h>
  20. #include <stdarg.h>
  21. #include <stdio.h>
  22. #ifdef __MWERKS__
  23.     #include <unix.h>
  24. #else
  25.      #include <fcntl.h>
  26. #endif
  27. #include <ctype.h>
  28. #include <string.h>
  29.  
  30. #define BUPDATE (O_RDWR | O_BINARY)
  31. #define BCREATE (O_CREAT | O_TRUNC | O_BINARY | O_RDWR)
  32.  
  33. /* #define ctEXCLCREAT */
  34. #define C255    -1
  35. #define ct_NULL (char *) 0
  36. #define far
  37. #define _far 
  38. #define _export 
  39. #define _loadds
  40.  
  41.  
  42.  
  43. /*
  44. ** runtime mapping
  45. */
  46. /*#define ctrt_scanf        scanf */
  47. #undef ctrt_fprintf
  48. #undef ctrt_sprintf
  49. #undef ctrt_printf
  50. #undef ctrt_fopen
  51. #undef ctrt_fclose
  52. #undef ctrt_strcpy
  53. #undef ctrt_strcat
  54. #undef ctrt_strcmp
  55. #undef ctrt_strlen
  56. #undef ctrt_strncpy
  57. #undef ctrt_fscanf
  58. #undef ctrt_memcmp
  59. #undef ctrt_memcpy
  60. #undef ctrt_tmpnam
  61. #undef ctrt_memset
  62. #undef ctrt_toupper
  63. #define ctrt_strcpy        strcpy
  64. #define ctrt_strcat        strcat
  65. #define ctrt_strcmp        strcmp
  66. #define ctrt_strncmp(s1,s2,n)    strncmp(((pTEXT)(s1)),((pTEXT)(s2)),((size_t)(n)))
  67. #define ctrt_strlen        strlen
  68. #define ctrt_strncpy(d,s,n)        strncpy(((pTEXT)(d)),((pTEXT)(s)),((size_t)(n)))
  69. #define ctrt_exit        exitMac
  70. #define ctrt_memcmp(s1,s2,n)        memcmp(((pTEXT)(s1)),((pTEXT)(s2)),((size_t)(n)))
  71. #define ctrt_memchr(s,c,n)        memchr(((pTEXT)(s)),((NINT)(c)),((size_t)(n)))
  72. #define ctrt_tmpnam        tmpnam
  73. #define ctrt_toupper    toupper
  74. #define ctrt_memset(s,c,n)     memset(((pTEXT)(s)),((NINT)(c)),((size_t)(n)))
  75.  
  76. #ifdef makeCtSrvr
  77. #define OWNER   ((int)((Threads_ *)getThreadCtl())->current->refcon)
  78. #define ctrt_fprintf    fprintfMac
  79. #define ctrt_sprintf    sprintfMac
  80. #define ctrt_printf        printfMac
  81. #define ctrt_fopen        fopenMac
  82. #define ctrt_fclose        fcloseMac
  83. #define ctrt_fscanf        fscanfMac
  84. #define calloc  ct_alloc
  85. #define free    ctafree
  86. #else
  87. #define OWNER   (1)
  88. #define ctrt_fprintf    fprintf
  89. #define ctrt_sprintf    sprintf
  90. #define ctrt_printf        printf
  91. #define ctrt_fopen        fopen
  92. #define ctrt_fclose        fclose
  93. #define ctrt_fscanf        fscanf
  94. #define calloc  calloc
  95. #define free    free
  96. #endif
  97.  
  98. #define apOWNER OWNER
  99.  
  100.  
  101.  
  102. /*
  103. ** SYSTEM INDEPENDENT
  104. */
  105. #define icpylng(dp,sp,n) *dp++=*sp++; *dp++=*sp++; *dp++=*sp++; *dp++=*sp++;
  106. #define cpylng(dp,sp,n)    cpy4bf(dp,sp)
  107.  
  108. /*
  109. ** SYSTEM DEPENDENT: memcpy should perform high speed copy. It does NOT have to
  110. ** check for overlapped memory regions. memset should perform high speed
  111. ** buffer fill. CHECK THE ORDER OF THE PARAMETERS: dp is the destination,
  112. ** sp is the source.
  113. */
  114. #define ctrt_memcpy(s1,s2,n)    memcpy(((pTEXT)(s1)),((pTEXT)(s2)),((VRLEN)(n)))
  115.  
  116. #define cpy4bf(dp,sp)    memcpy(dp,sp,((size_t)(4)))
  117. #define cpybuf(dp,sp,n) memcpy(dp,sp,((size_t)(n)))
  118. #define cpybig(dp,sp,n) memcpy(dp,sp,((size_t)(n)))
  119. #define ctsfill(dp,ch,n) memset(dp,ch,((size_t)(n)))
  120. #define ctbfill(dp,ch,n) memset(dp,ch,((size_t)(n)))
  121.  
  122.  
  123. #define bigadr(tp,off)     (((pTEXT)tp) + off)
  124.  
  125. /*
  126. ** If FASTCOMP is defined, then your system must support CTCOMP(k1,k2,len)
  127. ** where k1 points to a key value, k2 points to a key value, len is the key
  128. ** length, and CTCOMP returns a zero if equal, or +n if k1 differs from k2
  129. ** in the nth byte and k1 > k2, or -n if k1 differs in the nth byte and
  130. ** k1 < k2.
  131. **
  132. ** If a different run time name is needed, use an additional #define
  133. ** here to change CTCOMP to the appropriate function name.
  134.  
  135. #define FASTCOMP
  136.  
  137. **
  138. */
  139.  
  140. #define FASTRIGHT
  141. #define SIZET
  142.  
  143. #define ctDECL
  144. #define ctMEM
  145.  
  146. #define cpymsg                cpybuf
  147. #define cpymbuf                cpybuf
  148. #define ctmfill                ctbfill
  149. #define cpysrcm                cpysrcl
  150.  
  151. #ifndef ctCONV
  152. #define ctCONV
  153. #endif
  154.  
  155. void *ct_alloc(size_t n,size_t s);
  156. void ctafree(void *p); 
  157.  
  158. #define ctALLOC
  159.  
  160.  
  161. #define ctMILLISECOND(t)    ((t < 1)? 0: (t+16) / 17)
  162.  
  163. #endif
  164. /* end of ctcmpl.h */
  165.