home *** CD-ROM | disk | FTP | other *** search
/ synchro.net / synchro.net.tar / synchro.net / main / SBBS_ARC / XSDK_301.ZIP / SDK / XSDKDEFS.H < prev    next >
Encoding:
C/C++ Source or Header  |  2000-06-02  |  10.1 KB  |  294 lines

  1. /* XSDKDEFS.H */
  2.  
  3. #ifndef _XSDKDEFS_H
  4. #define _XSDKDEFS_H
  5.  
  6. /**********/
  7. /* Macros */
  8. /**********/
  9.  
  10. #ifdef _WIN32
  11. #define mswait    Sleep        /* Win32 equivalent */
  12. #endif
  13.                                     /* Control characters */
  14. #define STX     0x02                /* Start of text            ^B    */
  15. #define ETX     0x03                /* End of text                ^C    */
  16. #define BS        0x08                /* Back space                ^H    */
  17. #define TAB     0x09                /* Horizontal tabulation    ^I    */
  18. #define LF        0x0a                /* Line feed                ^J    */
  19. #define FF        0x0c                /* Form feed                ^L    */
  20. #define CR        0x0d                /* Carriage return            ^M    */
  21. #define ESC     0x1b                /* Escape                    ^[    */
  22. #define SP      0x20                /* Space                        */
  23.  
  24.  
  25. #define DCD    0x8000        /* Data carrier detect bit in msr            */
  26.  
  27. #define TABSIZE     4        /* Tabs will expand to 4 chars upon input    */
  28.  
  29. #define SAVE_LINES     4        /* Maximum number of lines to save            */
  30. #define LINE_BUFSIZE 512    /* Size of line output buffer               */
  31.  
  32. #define HIGH 8                /* High intensity attribute bit */
  33.  
  34.                             /* user_misc bits */
  35. #define ANSI    (1<<0)        /* user has ANSI capability */
  36. #define COLOR    (1<<1)        /* user has monochrome ANSI display */
  37. #define RIP     (1<<2)        /* RIP compatible terminal detected */
  38. #define WIP     (1<<3)        /* WIP compatible terminal detected */
  39.  
  40. #ifndef uchar                /* Short-hand for unsigned data types */
  41. #define uchar unsigned char
  42. #endif
  43. #ifndef uint
  44. #define uint unsigned int
  45. #endif
  46. #ifndef ushort
  47. #define ushort unsigned short
  48. #endif
  49. #ifndef ulong
  50. #define ulong unsigned long
  51. #endif
  52.  
  53.                             /* Bits in 'mode' for getkey and getstr     */
  54. #define K_UPPER        (1<<0)    /* Converts all letters to upper case         */
  55. #define K_UPRLWR    (1<<1)  /* Upper/Lower case automatically           */
  56. #define K_NUMBER    (1<<2)  /* Allow numbers only                       */
  57. #define K_WRAP        (1<<3)  /* Allows word wrap                            */
  58. #define K_MSG        (1<<4)  /* Allows ANSI, ^N ^A ^G                    */
  59. #define K_SPIN      (1<<5)  /* Spinning cursor (same as SPIN)           */
  60. #define K_LINE      (1<<6)  /* Input line (inverse color)               */
  61. #define K_EDIT      (1<<7)  /* Edit string passed                       */
  62. #define K_CHAT        (1<<8)    /* In chat multi-chat                         */
  63. #define K_NOCRLF    (1<<9)    /* Don't print CRLF after string input      */
  64. #define K_ALPHA     (1<<10) /* Only allow alphabetic characters         */
  65. #define K_AUTODEL    (1<<11) /* Auto-delete text (used with K_EDIT)        */
  66. #define K_LOWPRIO    (1<<12) /* Low priority getstr() operation            */
  67. #define K_GETSTR    (1<<13) /* getkey() called from getstr()            */
  68.  
  69.                             /* Miscellaneous Modem Settings (mdm_misc)    */
  70. #define MDM_FLOWCTRL (1<<0)    /* Use flow control with modem                */
  71. #define MDM_STAYHIGH (1<<1) /* Stay at highest DTE rate                 */
  72.  
  73. #define LOOP_NOPEN   50        /* Retries before file access denied        */
  74. #define LOOP_NODEDAB 100    /* Retries on NODE.DAB locking/unlocking    */
  75.  
  76. #define MAX_NODES    250     /* Maximum number of nodes                    */
  77.  
  78. enum {                                /* Node Status */
  79.      NODE_WFC                        /* Waiting for Call */
  80.     ,NODE_LOGON                      /* at logon prompt */
  81.     ,NODE_NEWUSER                     /* New user applying */
  82.     ,NODE_INUSE                         /* In Use */
  83.     ,NODE_QUIET                         /* In Use - quiet mode */
  84.     ,NODE_OFFLINE                     /* Offline */
  85.     ,NODE_NETTING                     /* Networking */
  86.     ,NODE_EVENT_WAITING                /* Waiting for all nodes to be inactive */
  87.     ,NODE_EVENT_RUNNING                /* Running an external event */
  88.     ,NODE_EVENT_LIMBO                /* Allowing another node to run an event */
  89.     };
  90.  
  91.                                     /* Bit values for node.misc */
  92. #define    NODE_ANON    (1<<0)            /* Anonymous User */
  93. #define    NODE_LOCK    (1<<1)            /* Locked for sysops only */
  94. #define    NODE_INTR    (1<<2)            /* Interrupted - hang up */
  95. #define NODE_MSGW   (1<<3)            /* Message is waiting */
  96. #define NODE_POFF   (1<<4)            /* Page disabled */
  97. #define NODE_AOFF    (1<<5)            /* Activity Alert disabled */
  98. #define NODE_UDAT    (1<<6)            /* User data has been updated */
  99. #define NODE_RRUN    (1<<7)            /* Re-run this node when log off */
  100. #define NODE_EVENT    (1<<8)            /* Must run node event after log off */
  101. #define NODE_DOWN    (1<<9)            /* Down this node after logoff */
  102. #define NODE_RPCHT    (1<<10)         /* Reset private chat */
  103. #define NODE_NMSG   (1<<11)         /* Node message waiting (new way) */
  104.  
  105.  
  106. enum {                                /* Node Action */
  107.      NODE_MAIN                        /* Main Prompt */
  108.     ,NODE_RMSG                         /* Reading Messages */
  109.     ,NODE_RMAL                        /* Reading Mail */
  110.     ,NODE_SMAL                         /* Sending Mail */
  111.     ,NODE_RTXT                         /* Reading G-Files */
  112.     ,NODE_RSML                         /* Reading Sent Mail */
  113.     ,NODE_PMSG                         /* Posting Message */
  114.     ,NODE_AMSG                         /* Auto-message */
  115.     ,NODE_XTRN                          /* Running External Program */
  116.     ,NODE_DFLT                          /* Main Defaults Section */
  117.     ,NODE_XFER                           /* Transfer Prompt */
  118.     ,NODE_DLNG                        /* Downloading File */
  119.     ,NODE_ULNG                        /* Uploading File */
  120.     ,NODE_BXFR                        /* Bidirectional Transfer */
  121.     ,NODE_LFIL                        /* Listing Files */
  122.     ,NODE_LOGN                        /* Logging on */
  123.     ,NODE_LCHT                        /* In Local Chat with Sysop */
  124.     ,NODE_MCHT                         /* In Multi-Chat with Other Nodes */
  125.     ,NODE_GCHT                           /* In Local Chat with Guru */
  126.     ,NODE_CHAT                           /* In Chat Section */
  127.     ,NODE_SYSP                         /* Sysop Activity */
  128.     ,NODE_TQWK                        /* Transferring QWK packet */
  129.     ,NODE_PCHT                        /* Private node-to-node chat */
  130.     ,NODE_PAGE                        /* Paging node for Private Chat */
  131.     ,NODE_RFSD                        /* Retrieving file from sequential dev */
  132.     };
  133.  
  134.                             /* Different bits in node_misc                */
  135. #define NM_ANSALARM (1<<0)    /* Alarm locally on answer                    */
  136. #define NM_WFCSCRN  (1<<1)    /* Wait for call screen                     */
  137. #define NM_WFCMSGS    (1<<2)    /* Include total messages/files on WFC        */
  138. #define NM_LCL_EDIT (1<<3)    /* Use local editor to create messages        */
  139. #define NM_EMSOVL    (1<<4)    /* Use expanded memory of overlays            */
  140. #define NM_WINOS2    (1<<5)    /* Use Windows/OS2 time slice API call        */
  141. #define NM_INT28    (1<<6)    /* Make int 28 DOS idle calls                */
  142. #define NM_NODV     (1<<7)    /* Don't detect and use DESQview API        */
  143. #define NM_NO_NUM    (1<<8)    /* Don't allow logons by user number        */
  144. #define NM_LOGON_R    (1<<9)    /* Allow logons by user real name            */
  145. #define NM_LOGON_P    (1<<10) /* Secure logons (always ask for password)    */
  146. #define NM_NO_LKBRD (1<<11) /* No local keyboard (at all)                */
  147. #define NM_SYSPW    (1<<12) /* Protect WFC keys and Alt keys with SY:    */
  148. #define NM_NO_INACT (1<<13) /* No local inactivity alert/logoff         */
  149. #define NM_NOBEEP    (1<<14) /* Don't beep locally                       */
  150. #define NM_LOWPRIO    (1<<15) /* Always use low priority input            */
  151. #define NM_7BITONLY (1L<<16) /* Except 7-bit input only (E71 terminals)  */
  152.  
  153. #if !defined(__COLORS)
  154. #define __COLORS
  155.  
  156.     enum COLORS {
  157.         BLACK,            /* dark colors */
  158.         BLUE,
  159.         GREEN,
  160.         CYAN,
  161.         RED,
  162.         MAGENTA,
  163.         BROWN,
  164.         LIGHTGRAY,
  165.         DARKGRAY,        /* light colors */
  166.         LIGHTBLUE,
  167.         LIGHTGREEN,
  168.         LIGHTCYAN,
  169.         LIGHTRED,
  170.         LIGHTMAGENTA,
  171.         YELLOW,
  172.         WHITE
  173.     };
  174. #endif
  175.  
  176. #ifndef BLINK
  177. #define BLINK        128 /* blink bit */
  178. #endif
  179.  
  180. #ifdef __WATCOMC__
  181.  
  182.  
  183.     #define ffblk find_t
  184.     #define findfirst(x,y,z) _dos_findfirst(x,z,y)
  185.     #define findnext(x) _dos_findnext(x)
  186.     #pragma aux mswait "_*"
  187. #endif
  188.  
  189. /* Windows Types */
  190. #ifndef BYTE
  191. #define BYTE    uchar
  192. #endif
  193. #ifndef WORD
  194. #define WORD    ushort
  195. #endif
  196. #ifndef DWORD
  197. #define DWORD    ulong
  198. #endif
  199. #ifndef BOOL
  200. #define BOOL    int
  201. #endif
  202. #ifndef TRUE
  203. #define TRUE    1
  204. #define FALSE    0
  205. #endif
  206. #ifndef HANDLE
  207. #define HANDLE    void*
  208. #endif
  209.  
  210. /****************************************************************************/
  211. /* MALLOC/FREE Macros for various compilers and environments                */
  212. /* MALLOC is used for allocations of 64k or less                            */
  213. /* FREE is used to free buffers allocated with MALLOC                        */
  214. /* LMALLOC is used for allocations of possibly larger than 64k                */
  215. /* LFREE is used to free buffers allocated with LMALLOC                     */
  216. /* REALLOC is used to re-size a previously MALLOCed or LMALLOCed buffer     */
  217. /* FAR16 is used to create a far (32-bit) pointer in 16-bit compilers        */
  218. /* HUGE16 is used to create a huge (32-bit) pointer in 16-bit compilers     */
  219. /****************************************************************************/
  220. #if defined(__COMPACT__) || defined(__LARGE__) || defined(__HUGE__)
  221.     #define __16BIT__
  222.     #define HUGE16 huge
  223.     #define FAR16 far
  224.     #if defined(__TURBOC__)
  225.         #define REALLOC(x,y) farrealloc(x,y)
  226.         #define LMALLOC(x) farmalloc(x)
  227.         #define MALLOC(x) farmalloc(x)
  228.         #define LFREE(x) farfree(x)
  229.         #define FREE(x) farfree(x)
  230.     #elif defined(__WATCOMC__)
  231.         #define REALLOC realloc
  232.         #define LMALLOC(x) halloc(x,1)    /* far heap, but slow */
  233.         #define MALLOC malloc            /* far heap, but 64k max */
  234.         #define LFREE hfree
  235.         #define FREE free
  236.     #else    /* Other 16-bit Compiler */
  237.         #define REALLOC realloc
  238.         #define LMALLOC malloc
  239.         #define MALLOC malloc
  240.         #define LFREE free
  241.         #define FREE free
  242.     #endif
  243. #else        /* 32-bit Compiler or Small Memory Model */
  244.     #define HUGE16
  245.     #define FAR16
  246.     #define REALLOC realloc
  247.     #define LMALLOC malloc
  248.     #define MALLOC malloc
  249.     #define LFREE free
  250.     #define FREE free
  251. #endif
  252.  
  253. #define KEY_BUFSIZE 256
  254.  
  255. #define CRLF  { outchar(CR); outchar(LF); }
  256.  
  257. #define SYSOP (user_level>=sysop_level) /* Is current user sysop t/f macro     */
  258.  
  259. #define bgotoxy(x,y)    printf("\x1b[%d;%dH",y,x)   /* place the cursor at   */
  260.                                                     /* location x,y via ANSI */
  261.  
  262. #define SAVELINE        { slatr[slcnt]=latr; \
  263.                             sprintf(slbuf[slcnt<SAVE_LINES ? slcnt++ : slcnt] \
  264.                             ,"%.*s",lbuflen,lbuf); \
  265.                             lbuflen=0; }
  266. #define RESTORELINE     { lbuflen=0; attr(slatr[--slcnt]); \
  267.                             bputs(slbuf[slcnt]); }
  268.  
  269. /************/
  270. /* Typedefs */
  271. /************/
  272.  
  273. #ifdef _WIN32    /* necessary for compatibility with SBBS v2 */
  274. #pragma pack(push)
  275. #pragma pack(1)
  276. #endif
  277.  
  278. typedef struct {                        /* Node information kept in NODE.DAB */
  279.     uchar    status,                        /* Current Status of Node */
  280.             errors,                        /* Number of Critical Errors */
  281.             action;                        /* Action User is doing on Node */
  282.     ushort    useron,                        /* User on Node */
  283.             connection,                    /* Connection rate of Node */
  284.             misc,                        /* Miscellaneous bits for node */
  285.             aux;                        /* Auxillary word for node */
  286.     ulong    extaux;                        /* Extended aux dword for node */
  287.             } node_t;
  288.  
  289. #ifdef _WIN32
  290. #pragma pack(pop)        /* original packing */
  291. #endif
  292.  
  293. #endif    /* Don't add anything after this endif */
  294.