home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / top2src.zip / GLOBAL.C < prev    next >
C/C++ Source or Header  |  2000-07-13  |  11KB  |  275 lines

  1. /******************************************************************************
  2. GLOBAL.C     Global variable declarations.
  3.  
  4.     Copyright 1993 - 2000 Paul J. Sidorsky
  5.  
  6.     This program is free software; you can redistribute it and/or modify
  7.     it under the terms of the GNU General Public License, version 2, as
  8.     published by the Free Software Foundation.
  9.  
  10.     This program is distributed in the hope that it will be useful,
  11.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  12.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13.     GNU General Public License for more details.
  14.  
  15.     You should have received a copy of the GNU General Public License
  16.     along with this program; if not, write to the Free Software
  17.     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  18.  
  19. This module declares all program-wide global variables used in TOP.  It also
  20. contains comments describing each variable.
  21. ******************************************************************************/
  22.  
  23. #include "top.h"
  24.  
  25. /* Version and internal revision macros.  They are used by the ver and rev
  26.    variables below.  The defines up here are so they can be changed quickly
  27.    and easily. */
  28. #define TOP_VERSION "2.01b"
  29. #define TOP_REVISION "A321"
  30.  
  31. /* Borland global variable that sets the stack size. */
  32. extern unsigned _stklen = 8192L;
  33.  
  34. /* Variables below are mostly listed in the order added to TOP. */
  35.  
  36. /* Configuration data. */
  37. TOP_config_typ cfg;
  38. /* User's record number within USERS.TOP. */
  39. XINT user_rec_num = -1;
  40. /* User data. */
  41. user_data_typ user;
  42. /* String used by the word splitter. */
  43. char XFAR *word_str = NULL;
  44. /* Index of word starting positions, used by the word splitter. */
  45. XINT XFAR *word_pos = NULL;
  46. /* Index of word lengths, used by the word splitter. */
  47. XINT XFAR *word_len = NULL;
  48. /* Array of all handles of users currently in TOP. */
  49. stringarray2 XFAR *handles = NULL;
  50. /* Array of flags indicating which nodes are active in TOP. */
  51. unsigned char XFAR *activenodes = NULL;
  52. /* Time the message file was last read. */
  53. clock_t lastpoll = 0;
  54. /* Global output buffer. */
  55. unsigned char XFAR *outbuf =NULL;
  56. /* Flag indicating the node has been registered in the NODEIDX.  Do not
  57.    confuse with the reg... variables which relate to whether or not the
  58.    user has registered TOP.  */
  59. char isregistered = 0;
  60. /* Flag if the user has registered TOP. */
  61. RKVALID registeredtop = RK_UNREGISTERED;
  62. /* Full registration key string. */
  63. unsigned char XFAR *registeredto = NULL;
  64. /* Name, system, and type of registration. */
  65. unsigned char XFAR *regname = NULL;
  66. unsigned char XFAR *regsystem = NULL;
  67. unsigned char XFAR *regtype = NULL;
  68. /* Flag indicating the node has been added to the appropriate BBS useron
  69.    file. */
  70. char node_added = 0;
  71. /* Array of who the user has forgotten and who has forgotten the user. */
  72. unsigned char XFAR *forgetstatus = NULL;
  73. /* Last node a message was sent to, usually used with forgetting. */
  74. XINT lastsendtonode = -1;
  75. /* Local and LAN node type flags. */
  76. char localmode = 0, lanmode = 0;
  77. /* Not used.  I think this was left over from before the concept of a
  78.    "busy channel" was implemented. */
  79. char XFAR *busynodes = NULL;
  80. /* Holds file information for the BBS useron file, to detect changes. */
  81. struct ffblk ipcfildat;
  82. /* File handles for the following files, in order of appearance:
  83.    Unused, USERS.TOP, NODEIDX.TCH, NODEIDX2.TCH, MSGnode.TCH,
  84.    MSGother.TCH, USERON.BBS (oeq), IPCn.BBS (oeq), IPCother.BBS (oeq),
  85.    NODEn.RA (oeq), MIXnode.TCH, MIXother.TCH, CHGIDX.TCH,
  86.    CHANIDX.TCH, BIOIDX.TOP, BIORESP.TOP
  87.    Notes:  oeq - "Or Equivalent", means the file name differs with BBS type.
  88.            node - User's current node (also n).
  89.            other - Receiving node.  These handles are usually closed.
  90. */
  91. XINT cfgfil = -1, userfil = -1, nidxfil = -1, nidx2fil = -1, msginfil = -1,
  92.      msgoutfil = -1, useronfil = -1, ipcinfil = -1, ipcoutfil = -1,
  93.      rapagefil = -1, midxinfil = -1, midxoutfil = -1, chgfil = -1,
  94.      chidxfil = -1, bioidxfil = -1, biorespfil = -1;
  95. /* File information for the MIX file, to detect changes. */
  96. struct ffblk midxfileinfo;
  97. /* Lowest node.  While properly initialized it is not actually used in TOP.
  98.    It was left over from an implementation of Poker which used the lowest
  99.    node for processing. */
  100. XINT lowestnode = 0;
  101. /* Language text. */
  102. lang_text_typ XFAR **langptrs = NULL;
  103. /* Number of language items. */
  104. long numlang = 0;
  105. /* Not used.  Leftover from an older, crappier version of the command
  106.    processor. */
  107. XINT usedcmdlen = 0;
  108. /* Nodes configuration file handle.  Left over from beta versions which used
  109.    a binary node configuration file. */
  110. XINT nodecfgfil = -1;
  111. /* Current channel the user is on. */
  112. long curchannel = 0;
  113. /* getword functions return buffer. */
  114. unsigned char *wordret = NULL;
  115. /* Node index data for this node. */
  116. node_idx_typ *node = NULL;
  117. /* top_output() return buffer (used with OUT_STRING). */
  118. unsigned char *outputstr = NULL;
  119. /* Node configuration information for this node. */
  120. TOP_nodecfg_typ *nodecfg = NULL;
  121. /* Flags to process language (@), colour (^), and action (%) tokens.  Used
  122.    by top_output(). */
  123. char outproclang = TRUE;
  124. char outproccol = TRUE;
  125. char outprocact = TRUE;
  126. /* Default text attribute. */
  127. unsigned XINT outdefattrib = 0x07;
  128. /* Last command that was entered.  Set by checkcmdmatch() but not used
  129.    inside TOP. */
  130. unsigned char *lastcmd = NULL;
  131. /* Channel definition data from CHANNELS.CFG. */
  132. channel_data_typ *chan = NULL;
  133. /* Sets the msg.data1 field in a dispatch_message() call.  If you're
  134.    wondering why this is global it's because the data1 field was implemented
  135.    a long time after the messaging system was finalized, and I didn't feel
  136.    like changing upwards of a hundred function calls all over TOP to support
  137.    passing it to dispatch_message(). */
  138. long msgextradata = 0;
  139. /* Unused poker variable. */
  140. //|clock_t lastpokerpoll = 0;
  141. /* Number of action files being used. */
  142. char numactfiles = 0;
  143. /* Action file data. */
  144. action_file_typ **actfiles = NULL;
  145. /* Action data. */
  146. action_rec_typ ***actptrs = NULL;
  147. /* Current Y and X cursor locations.  Not used anywhere.  Left over from
  148.    a cruder version of dual window chat mode. */
  149. XINT ystore = 0, xstore = 0;
  150. /* Unused variable for a planned feature. */
  151. char redrawwindows = 1;
  152. /* Node currently waiting for a private chat, node this user has asked to
  153.    chat with. */
  154. XINT privchatin = -1, privchatout = -1;
  155. /* Current channel data. */
  156. chan_idx_typ cmibuf;
  157. /* Current channel's record number in CHANIDX.TCH. */
  158. XINT cmirec = -1;
  159. /* Last kernel execution time. */
  160. time_t lastkertime = 0;
  161. /* Unused, left over from a feature that was removed. */
  162. spawn_prog_typ *spawnprog = NULL;
  163. XINT numspawnprog = 0;
  164. /* Maximum and minimum security that can receive a message.  These are
  165.    used by dispatch_message() and are global for the same reason
  166.    msgextradata is. */
  167. unsigned XINT msgminsec = 0, msgmaxsec = 0;
  168. /* Used to store the current channel when the user enters "busy" mode. */
  169. unsigned long cmiprevchan = 1;
  170. /* Stores the number of credits when the user enters TOP.  Used with RA's
  171.    credit system. */
  172. long orignumcreds = 0;
  173. /* Whether or not the user is typing.  Used with dual window chat mode. */
  174. char onflag = 0;
  175. /* Flag telling dispatch_message() to send the next message as global (i.e.
  176.    on channel 0).  This variable is global for the same reason as
  177.    msgextradata. */
  178. char msgsendglobal = 0;
  179. /* Censor word definitions from CENSOR.CFG. */
  180. censor_word_typ *cwords = NULL;
  181. /* Number of censor definitions. */
  182. XINT numcensorwords = 0;
  183. /* Number of high-grade and low-grade censor warnings. */
  184. XINT censorwarningshigh = 0;
  185. XINT censorwarningslow = 0;
  186. /* Time of the last high-grade and low-grade censor warnings. */
  187. time_t lastcensorwarnhigh = 0;
  188. time_t lastcensorwarnlow = 0;
  189. /* Bio question definitions from BIOQUES.CFG. */
  190. bio_ques_typ *bioques = NULL;
  191. /* Number of bio questions. */
  192. XINT numbioques = 0;
  193. /* Controls whether TOP can treat doorkit "time left" messages as actual TOP
  194.    messages (which is cleaner) or if it should just display them on screen. */
  195. char blocktimemsgs = 0;
  196. /* Force TOP to fix the user's name.  Not used because some name fixing is
  197.    built into the doorkit anyhow. */
  198. char forcefix = 0;
  199.  
  200. /* Version and internal revision numbers, set from the macros above. */
  201. unsigned char ver[16] = TOP_VERSION;
  202. unsigned char rev[11] = TOP_REVISION;
  203.  
  204. /* Output buffers that are suitable for converting numeric data for use
  205.    as parameters to top_output(), because those parameters can only be
  206.    strings. */
  207. unsigned char outnum[9][12];
  208.  
  209. /* BBS function pointers.  See BBS.TXT for details. */
  210. char (XFAR *bbs_call_loaduseron)(XINT nodenum, bbsnodedata_typ *userdata) = NULL;
  211. char (XFAR *bbs_call_saveuseron)(XINT nodenum, bbsnodedata_typ *userdata) = NULL;
  212. XINT (XFAR *bbs_call_processmsgs)(void) = NULL;
  213. char (XFAR *bbs_call_page)(XINT nodenum, unsigned char *pagebuf) = NULL;
  214. void (XFAR *bbs_call_setexistbits)(bbsnodedata_typ *userdata) = NULL;
  215. void (XFAR *bbs_call_login)(void) = NULL;
  216. void (XFAR *bbs_call_logout)(void) = NULL;
  217. XINT (XFAR *bbs_call_openfiles)(void) = NULL;
  218. XINT (XFAR *bbs_call_updateopenfiles)(void) = NULL;
  219. char (XFAR *bbs_call_pageedit)(XINT nodenum, unsigned char *pagebuf) = NULL;
  220.  
  221. /* BBS configuration setting names used in TOP.CFG. */
  222. unsigned char *bbsnames[BBSTYPES] =
  223.     {
  224.     "UNKNOWN",
  225.     "RA2",
  226.     "MAX2",
  227.     "MAX3",
  228.     "SBBS11"
  229.     };
  230.  
  231. /* Node types used in NODES.CFG. */
  232. unsigned char *nodetypes[3] =
  233.     {
  234.     "Remote",
  235.     "Local",
  236.     "Network"
  237.     };
  238.  
  239. /* Maximus MCP pipe, used by TOP/2 only. */
  240. #ifdef __OS2__
  241. HPIPE hpMCP = 0;
  242. #endif
  243.  
  244. /* Predefined RA and SuperBBS status types. */
  245. unsigned char XFAR *ra_statustypes[8];
  246. unsigned char XFAR *sbbs_statustypes[11];
  247.  
  248. /* The remainder of the variables are unused poker variables. */
  249.  
  250. /*//|char XFAR *pokerlockflags = NULL;
  251. time_t XFAR *pokeretimes = NULL;
  252. XINT XFAR *pokerdtimes = NULL;
  253. XINT XFAR *pokerwtimes = NULL;
  254. char XFAR *pokeringame = NULL;
  255.  
  256. XINT pokermaingame = -1;
  257.  
  258. char XFAR pokerdefcardvals[POKERMAXDECK] =
  259.     {
  260.     14,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13,
  261.     14,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13,
  262.     14,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13,
  263.     14,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13,
  264.     15, 15
  265.     };
  266.  
  267. char XFAR pokerdefcardsuits[POKERMAXDECK] =
  268.     {
  269.     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
  270.     1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,
  271.     2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,
  272.     3,  3,  3,  3,  3,  3,  3,  3,  3,  3,  3,  3,  3,
  273.     0,  2
  274.     };*///|
  275.