home *** CD-ROM | disk | FTP | other *** search
/ PC Online 1996 October / PCO_10.ISO / filesbbs / bsrc_260.arj / INCLUDE.ZIP / includes.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-03-26  |  13.6 KB  |  485 lines

  1. /*--------------------------------------------------------------------------*/
  2. /*                                                                          */
  3. /*                                                                          */
  4. /*      ------------         Bit-Bucket Software, Co.                       */
  5. /*      \ 10001101 /         Writers and Distributors of                    */
  6. /*       \ 011110 /          Freely Available<tm> Software.                 */
  7. /*        \ 1011 /                                                          */
  8. /*         ------                                                           */
  9. /*                                                                          */
  10. /*              (C) Copyright 1987-96, Bit Bucket Software Co.              */
  11. /*                                                                          */
  12. /*                                                                          */
  13. /*                                                                          */
  14. /*                   Common Include Files for BinkleyTerm                   */
  15. /*                                                                          */
  16. /*                                                                          */
  17. /*    For complete  details  of the licensing restrictions, please refer    */
  18. /*    to the License  agreement,  which  is published in its entirety in    */
  19. /*    the MAKEFILE and BT.C, and also contained in the file LICENSE.260.    */
  20. /*                                                                          */
  21. /*    USE  OF THIS FILE IS SUBJECT TO THE  RESTRICTIONS CONTAINED IN THE    */
  22. /*    BINKLEYTERM  LICENSING  AGREEMENT.  IF YOU DO NOT FIND THE TEXT OF    */
  23. /*    THIS  AGREEMENT IN ANY OF THE  AFOREMENTIONED FILES,  OR IF YOU DO    */
  24. /*    NOT HAVE THESE FILES,  YOU  SHOULD  IMMEDIATELY CONTACT BIT BUCKET    */
  25. /*    SOFTWARE CO.  AT ONE OF THE  ADDRESSES  LISTED BELOW.  IN NO EVENT    */
  26. /*    SHOULD YOU  PROCEED TO USE THIS FILE  WITHOUT HAVING  ACCEPTED THE    */
  27. /*    TERMS  OF  THE  BINKLEYTERM  LICENSING  AGREEMENT,  OR  SUCH OTHER    */
  28. /*    AGREEMENT AS YOU ARE ABLE TO REACH WITH BIT BUCKET SOFTWARE, CO.      */
  29. /*                                                                          */
  30. /*                                                                          */
  31. /* You can contact Bit Bucket Software Co. at any one of the following      */
  32. /* addresses:                                                               */
  33. /*                                                                          */
  34. /* Bit Bucket Software Co.        FidoNet  1:104/501, 1:343/491             */
  35. /* P.O. Box 460398                AlterNet 7:42/1491                        */
  36. /* Aurora, CO 80046               BBS-Net  86:2030/1                        */
  37. /*                                Internet f491.n343.z1.fidonet.org         */
  38. /*                                                                          */
  39. /* Please feel free to contact us at any time to share your comments about  */
  40. /* our software and/or licensing policies.                                  */
  41. /*                                                                          */
  42. /*--------------------------------------------------------------------------*/
  43.  
  44. /*
  45.  * This file drives all the defines and includes in BinkleyTerm. In
  46.  * here we handle cross-compiler portability issues. It was originally
  47.  * born to make compiled headers (a neat feature of Borland C) work,
  48.  * but the other role quickly caught on as well.
  49.  *
  50.  * Some of the portability stuff will no doubt wind up in other Bink
  51.  * include files -- but the system-level stuff such as utime, etc
  52.  * is all dealt with here.
  53.  *
  54.  * All main Bink modules should include this file before any specific
  55.  * local includes.
  56.  *
  57.  */
  58.  
  59. /* System include files */
  60.  
  61. #include <stdio.h>
  62. #include <signal.h>
  63. #include <ctype.h>
  64. #include <conio.h>
  65. #include <string.h>
  66. #include <process.h>
  67. #include <stdlib.h>
  68. #include <stdarg.h>
  69. #include <io.h>
  70.  
  71. #ifndef __IBMC__                /* CSET2 */
  72. #include <dos.h>
  73. #endif
  74.  
  75. #include <errno.h>
  76. #include <time.h>
  77. #include <fcntl.h>
  78. #include <share.h>
  79.  
  80. /*
  81.  * Compiler-specific stuff. The baseline in this sucker is
  82.  * Microsoft C 6.00a. Below what you see are the includes and
  83.  * macros we need to differentiate individual compilers from
  84.  * the baseline.
  85.  *
  86.  * The easiest way to add a new compiler is to replicate the
  87.  * _MSC_VER section using whatever manifest constant your
  88.  * compiler uses to identify itself, then do the fixups in
  89.  * that section.
  90.  *
  91.  * Be sure to put your section before that last define for
  92.  * COMPILER_NAME!
  93.  *
  94.  */
  95.  
  96. #ifdef __TURBOC__                /* Borland C++ 2.0                */
  97. /*
  98.  * Borland.
  99.  *
  100.  * No sharing stream open. (s)open/fdopen works, though.
  101.  * Signal call is non-generic and incompatible
  102.  * Read/Write to far memory in near model not implemented
  103.  * Console output non-generic
  104.  * No utime call
  105.  *
  106.  */
  107.  
  108. #ifdef __BORLANDC__
  109. #define COMPILER_NAME   "-Borland"
  110. #else
  111. #define COMPILER_NAME   "-Turbo"
  112. #endif
  113. #define MUST_FDOPEN            /* Share streams: sopen+fdopen    */
  114. #define NO_SIGNALS            /* Don't install a signal handler */
  115.  
  116. #ifdef OS_2
  117. #include <utime.h>
  118.  
  119. typedef struct utimbuf UTIMBUF;
  120.  
  121. #define UT_ACTIME actime
  122. typedef long off_t;
  123.  
  124. #include <sys\types.h>
  125. #include <sys\stat.h>
  126. #include <mem.h>
  127. #include <dir.h>
  128. #include <alloc.h>
  129. #define _fmalloc(n) malloc (n)
  130. #define _ffree(n) free (n)
  131. #undef sopen                    /* we don't want to use all the args */
  132. #define sopen(a,b,c) open (a, b|c)
  133. typedef void _cdecl SIGTYPE;
  134. #define SIGARGS void
  135. typedef void _cdecl MAINTYPE;
  136. #define far
  137. #define __32BIT__
  138. #define _Far16 __far16
  139. #define _Seg16 __far16
  140. #define _Pascal __pascal
  141. #else /* Not OS/2 */
  142.  
  143. /* uncomment the following line for BC++ 2.0              */
  144. /*#define __TURBOC_OLD__ */
  145.  
  146. #define NEED_CPUTS            /* Need our own cputs             */
  147. #define NEED_PUTCH            /* Need our own putch             */
  148. #define NEED_CPRINTF            /* Need our own cprintf           */
  149.  
  150. #ifdef __TURBOC_OLD__
  151. #define NEED_DOSREAD            /* Need our own _dos_(read/write) */
  152. struct utimbuf
  153. {
  154.     time_t actime;                /* access time */
  155.     time_t modtime;            /* modification time */
  156. };
  157. int cdecl utime (char *, struct utimbuf *);
  158. #endif                            /* __TURBOC_OLD__ */
  159.  
  160. #ifndef __TURBOC_OLD__
  161. #include <utime.h>
  162. #endif
  163.  
  164. typedef struct utimbuf UTIMBUF;
  165.  
  166. #define UT_ACTIME actime
  167. typedef long off_t;
  168.  
  169. #if __BORLANDC__ >= 0x410
  170. #include <sys\types.h>
  171. #include <sys\stat.h>
  172. #else
  173. #include <types.h>
  174. #include <stat.h>
  175. #endif
  176.  
  177. #include <mem.h>
  178. #include <dir.h>
  179. #include <alloc.h>
  180. #define _fmalloc(n) farmalloc (n)
  181. #define _ffree(n) farfree (n)
  182. #undef sopen                    /* we don't want to use all the args */
  183. #define sopen(a,b,c) open (a, b|c)
  184. typedef void _cdecl SIGTYPE;
  185. #define SIGARGS void
  186. typedef void _cdecl MAINTYPE;
  187.  
  188. #endif /* OS_2 */
  189. #endif /* defined __TURBOC __ */
  190.  
  191. #ifdef _MSC_VER                /* Microsoft C 5.1 or 6.0a        */
  192. /*
  193.  * Microsoft.
  194.  *
  195.  * By and large, it's Microsoft compatible <grin>
  196.  *
  197.  * MSC 5.10 and below has no way to open a stream in
  198.  * sharing mode. sopen/fdopen doesn't work.
  199.  *
  200.  */
  201.  
  202. #if _MSC_VER == 510
  203. #define COMPILER_NAME   "-uSoft5.1"
  204. #endif
  205. #if _MSC_VER == 600
  206. #define COMPILER_NAME   "-uSoft6.0"
  207. #endif
  208. #if _MSC_VER == 700
  209. #define COMPILER_NAME   "-uSoft7.0"
  210. #define ANSI_TIME_T
  211. #endif
  212. #if _MSC_VER == 800
  213. #define COMPILER_NAME   "-uSoft8.0"
  214. #pragma warning ( disable : 4746 )    /* Unsized arrays treated as __far */
  215. #endif
  216. #if _MSC_VER < 600
  217. #define CANT_FSOPEN
  218. #endif
  219. #include <sys\types.h>
  220. #include <sys\stat.h>
  221. #include <sys/utime.h>
  222. typedef struct utimbuf UTIMBUF;
  223. #define UT_ACTIME actime
  224. #include <memory.h>
  225. #include <direct.h>
  226. #include <malloc.h>
  227. typedef void _cdecl SIGTYPE;
  228. #define SIGARGS int sigarg
  229. #define SIGNAL_ARGUMENT
  230. typedef void _cdecl MAINTYPE;
  231.  
  232. #endif /* defined _MSC_VER */
  233.  
  234. #ifdef __IBMC__                /* IBM C Set/2   */
  235. /*
  236.  * IBM.
  237.  *
  238.  * By and large, it's Microsoft compatible <grin>
  239.  * At the moment we have to use the migration libs.
  240.  *
  241.  */
  242.  
  243. #define COMPILER_NAME   "-IBMC/2"
  244. #include <sys\types.h>
  245. #include <sys\stat.h>
  246. #include <sys/utime.h>
  247. typedef struct utimbuf UTIMBUF;
  248.  
  249. #define UT_ACTIME actime
  250. #include <memory.h>
  251. #include <direct.h>
  252. #include <malloc.h>
  253. #define MUST_FDOPEN            /* Share streams: sopen+fdopen    */
  254. #define NEED_MKTEMP            /* Need our own mktemp            */
  255. typedef void SIGTYPE;
  256.  
  257. #define SIGARGS int sigarg
  258. #define SIGNAL_ARGUMENT
  259. typedef int MAINTYPE;
  260. #define BINKLEY_SOUNDS      /* Use MMPM/2 to play sounds      */
  261. #define TIMEZONE _timezone
  262. #ifndef __32BIT__
  263. #define __32BIT__
  264. #endif /* defined __32BIT__ */
  265. #endif /* defined __IBMC__ */
  266.  
  267. #ifdef __WATCOMC__            /* WATCOM C++ 9.5, thanks to SJD  */
  268. /*
  269.  * WATCOM.
  270.  *
  271.  * No sharing stream open. sopen/fdopen doesn't work.
  272.  * No mktemp call
  273.  * utime structure member naming different
  274.  *
  275.  */
  276.  
  277. #ifdef __FLAT__
  278. #define __32BIT__
  279. #define COMPILER_NAME   "-WATCOM C/32"
  280. #else
  281. #define COMPILER_NAME   "-WATCOM"
  282. #endif
  283.  
  284. #define MUST_FDOPEN            /* Share streams: sopen+fdopen    */
  285. #define SHARE_SOPEN            /* Share streams: sopen, not open */
  286. #define NEED_MKTEMP            /* Need our own mktemp            */
  287. #include <sys\types.h>
  288. #include <sys\stat.h>
  289. #include <sys\utime.h>
  290. typedef struct utimbuf UTIMBUF;
  291.  
  292. #define UT_ACTIME actime
  293. #include <direct.h>
  294. #include <malloc.h>
  295.  
  296. #define SIGTYPE void
  297. #define SIGARGS int sigarg
  298. typedef void MAINTYPE;
  299.  
  300. #ifdef __FLAT__
  301. #define _osmode OS2_MODE
  302. #define _fmalloc(n) malloc(n)
  303. #define _ffree(p)   free(p)
  304. #endif
  305.  
  306. #endif /* defined __WATCOMC__ */
  307.  
  308. #ifdef __ZTC__                    /* Zortech C++ 3.0 */
  309. /*
  310.  * Zortech.
  311.  *
  312.  * No sharing stream open. sopen/fdopen doesn't work.
  313.  * Signal handler stuff incompatible
  314.  * Read/Write to far memory in near model not implemented
  315.  * No console I/O functions
  316.  * No mktemp call
  317.  * utime doesn't use a structure
  318.  * no ultoa, we use more limited ltoa
  319.  * tzset not there or needed
  320.  *
  321.  */
  322.  
  323. #define COMPILER_NAME   "-Zortech"
  324. #define CANT_FSOPEN            /* No way to share streams        */
  325. #define SHARE_SOPEN            /* Share streams: sopen, not open */
  326. #define NO_SIGNALS            /* Don't install a signal handler */
  327. #define NEED_DOSREAD            /* Need our own _dos_(read/write) */
  328. #define NEED_CPUTS            /* Need our own cputs             */
  329. #define NEED_PUTCH            /* Need our own putch             */
  330. #define NEED_MKTEMP            /* Need our own mktemp            */
  331. #include <sys\types.h>
  332. #include <sys\stat.h>
  333. struct utimbuf
  334. {
  335.     time_t actime;                /* access time */
  336.     time_t modtime;            /* modification time */
  337. };
  338. typedef time_t UTIMBUF;        /* ZTC utime uses a time_t array  */
  339.  
  340. #define UT_ACTIME actime
  341. #ifdef __VCM__
  342. #define __LARGE__                /* VCM model same as large, really*/
  343. #endif
  344. typedef long off_t;
  345.  
  346. #include <direct.h>
  347. #define _fmalloc(n) farmalloc (n)
  348. #define _ffree(n) farfree (n)
  349. #define ultoa(x,y,z) ltoa((long)x,y,z)
  350. #define stricmp(x,y) strcmpl(x,y)
  351. #define _dos_setdrive(x,y) dos_setdrive(x,y)
  352. #define tzset()
  353. typedef void _cdecl SIGTYPE;
  354.  
  355. #define SIGARGS void
  356. typedef void _cdecl MAINTYPE;
  357.  
  358. #endif /* defined __ZTC__ */
  359.  
  360. /*
  361.  * Make sure there's at least a zero-length string for
  362.  * the compiler name.
  363.  *
  364.  * THIS LINE SHOULD ALWAYS BE LAST!
  365.  *
  366.  */
  367.  
  368. #ifndef COMPILER_NAME
  369. #define COMPILER_NAME   ""
  370. #endif
  371.  
  372. #ifdef ANSI_TIME_T
  373. #define ANSI_TIME_T_DELTA 2209075200L
  374. #endif
  375.  
  376. #define DOS16
  377.  
  378. #ifdef OS_2
  379. #undef DOS16
  380. #endif
  381.  
  382. #ifdef _WIN32
  383.  
  384. #define far
  385. #define pascal
  386. #define WINAPI      __stdcall
  387. #define UCT_DIFFERENTIAL _timezone
  388. #define ANSI_TIME_T
  389. #define ANSI_TIME_T_DELTA (_timezone)    /* amazingly, this just works! */
  390. #define NEED_DOSREAD            /* Need our own _dos_(read/write) */
  391. #define BINKLEY_SOUNDS        /* NT can make noise! */
  392. #define real_flush(a) _commit(a)
  393. #define _fmalloc malloc
  394. #define _ffree free
  395. typedef unsigned short USHORT;
  396. typedef unsigned long ULONG, HANDLE;
  397. typedef long DWORD;
  398. typedef int HFILE;
  399. typedef unsigned char *PCH;
  400. typedef unsigned short HVIO;
  401.  
  402. #define COMFILE_PREFIX ""
  403. #define COMFILE_SUFFIX ".BAT"
  404. #define SHARE_DEFAULT 1
  405. #define BBS_SPAWN
  406. typedef unsigned char *PSZ;
  407. #pragma warning (disable: 4201 4244)
  408. #undef DOS16
  409.  
  410. #endif /* defined _WIN32 */
  411.  
  412. #ifdef DOS16
  413.  
  414. typedef unsigned short USHORT;
  415. typedef unsigned long ULONG;
  416. typedef long DWORD;
  417. typedef unsigned char BYTE;
  418. typedef unsigned short BOOL;
  419.  
  420. typedef int HFILE;
  421. typedef unsigned char far *PCH;
  422. typedef unsigned short HVIO;
  423.  
  424. #define HAVE_HYDRA
  425. #define LOCALFUNC _near _fastcall
  426. #define hfComHandle (port_ptr + 1)
  427. #define COMFILE_PREFIX ""
  428. #define COMFILE_SUFFIX ".BAT"
  429. typedef unsigned char far *PSZ;
  430. #define SHARE_DEFAULT 0
  431.  
  432. #endif /* defined DOS16 */
  433.  
  434. #ifdef OS_2
  435. #define INCL_NOPM
  436. #define INCL_BASE
  437. #define INCL_DOS
  438. #define INCL_DOSERRORS
  439. #define INCL_DOSDEVIOCTL
  440. #include <os2.h>
  441. #include "maxcomm.h"            /* moved here to avoid hcModem undefined        WRA */
  442.  
  443. #ifndef __WATCOMC__
  444. #define _dos_read DosRead
  445. #define _dos_write DosWrite
  446. #endif /* __WATCOMC__ */
  447.  
  448. #define COMFILE_PREFIX ""
  449. #define COMFILE_SUFFIX ".CMD"
  450. #define SHARE_DEFAULT 1
  451. #define BBS_SPAWN
  452. #define HAVE_HYDRA
  453. #ifdef __32BIT__
  454. #define LOCALFUNC
  455. #else
  456. #define LOCALFUNC _near
  457. #endif
  458. #ifndef TIMEZONE
  459. #define TIMEZONE timezone
  460. #endif
  461. #endif /* defined OS_2 */
  462.  
  463. #define isBITBRAIN 0x1b
  464.  
  465. #ifndef LOCALFUNC
  466. #define LOCALFUNC
  467. #endif
  468.  
  469. /* Local include files */
  470. #include "bink.h"
  471. #include "defines.h"
  472. #include "com.h"
  473. #include "xfer.h"
  474. #include "msgs.h"
  475. #include "zmodem.h"
  476. #include "keybd.h"
  477. #include "keyfncs.h"
  478. #include "sbuf.h"
  479. #include "sched.h"
  480. #include "timer.h"
  481. #include "vfossil.h"
  482. #include "externs.h"
  483. #include "prototyp.h"
  484.  
  485.