home *** CD-ROM | disk | FTP | other *** search
/ Dream 44 / Amiga_Dream_44.iso / RiscPc / jeux / ArcBoard004.arc / !GNUChessX / src / h / gnuchess < prev    next >
Text File  |  1996-01-10  |  18KB  |  577 lines

  1. /*
  2.  * gnuchess.h - Header file for GNU CHESS
  3.  *
  4.  * Copyright (c) 1988,1989,1990 John Stanback
  5.  * Copyright (c) 1992 Free Software Foundation
  6.  *
  7.  * This file is part of GNU CHESS.
  8.  *
  9.  * GNU Chess is free software; you can redistribute it and/or modify
  10.  * it under the terms of the GNU General Public License as published by
  11.  * the Free Software Foundation; either version 2, or (at your option)
  12.  * any later version.
  13.  *
  14.  * GNU Chess is distributed in the hope that it will be useful,
  15.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  17.  * GNU General Public License for more details.
  18.  *
  19.  * You should have received a copy of the GNU General Public License
  20.  * along with GNU Chess; see the file COPYING.  If not, write to
  21.  * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  22.  */
  23. #define CHESSTOOL
  24. #define USEINT
  25. #define QUIETBOOKGEN
  26. #define GNU3
  27. #define HISTORY
  28. #define GDX
  29.  
  30. #define HASHFILE "<gnuchessx$dir>.gnuchess.hash"
  31. #define BINBOOK "<gnuchessx$dir>.gnuchess.data"
  32. #define BINECO "<gnuchessx$dir>.gnuchess.eco"
  33. #define PGNECO "<gnuchessx$dir>.gnuchess.ecopgn"
  34. #define LANGFILE "<gnuchessx$dir>.gnuchess.lang"
  35. #ifdef WIN32
  36. #define stat _stat
  37. #define close _close
  38. #define lseek _lseek
  39. #define open _open
  40. #define read _read
  41. #define write _write
  42. #endif
  43.  
  44. #if !defined(__STDC__) && !defined(MSDOS)
  45. #define const
  46. #endif
  47.  
  48. #ifndef __GNUC__
  49. #define inline
  50. #endif
  51. #ifndef MSDOS
  52. #define huge
  53. #endif
  54. #include <stdio.h>
  55. #if defined(HAVE_MEMSET)
  56. #ifdef __arm__
  57. #include <string.h>     
  58. #else
  59. #include <memory.h> 
  60. #endif
  61. #endif
  62. #ifdef SIGNCHAR
  63. typedef signed char CHAR;
  64. #else
  65. typedef char CHAR;
  66. #endif
  67. typedef unsigned char UCHAR;
  68. typedef short tshort;
  69. typedef unsigned short utshort;
  70. #ifdef USEINT
  71. typedef  int SHORT;
  72. typedef  unsigned int UTSHORT;
  73. #else
  74. typedef unsigned short UTSHORT;
  75. typedef short SHORT;
  76. #endif
  77.  
  78. #ifndef __arm__
  79. #define SEEK_SET 0
  80. #define SEEK_END 2
  81. #endif
  82.  
  83. #ifdef DEBUG
  84. void
  85. ShowDBLine (CHAR *, SHORT, SHORT,
  86.         SHORT, SHORT, SHORT,
  87.         utshort *);
  88.      extern FILE *debugfd;
  89.      extern SHORT debuglevel;
  90.  
  91. #endif /* DEBUG */
  92.  
  93. #include <ctype.h>
  94. #include <string.h>
  95. #include <stdlib.h>
  96.  
  97. #if defined(MSDOS) || defined(WIN32)
  98. #define HAVE_TIME_H
  99. #include <malloc.h>
  100. #define RWA_ACC "r+b"
  101. #define WA_ACC "w+b"
  102. #define printz printf
  103. #define scanz scanf
  104. #else
  105. #define RWA_ACC "r+"
  106. #define WA_ACC "w+"
  107. /*#ifndef Think_C
  108. #include <sys/param.h>
  109. #include <sys/types.h>
  110. #ifndef AMIGADOS
  111. #include <sys/times.h>
  112. #endif
  113. #endif  Think_C */
  114. #ifdef NONDSP
  115. #define printz printf
  116. #define scanz scanf
  117. #else
  118. #include <curses.h>
  119. #define scanz fflush(stdout),scanw
  120. #define printz printw
  121. #endif
  122. #endif /* MSDOS */
  123.  
  124. #ifdef HAVE_TIME_H
  125. #include <time.h>
  126. #endif
  127.  
  128.  
  129. /* Magic for those compilers that can't handle "huge" static structures... */
  130. /* Be sure to also invoke Initialize_mem() if you use this */
  131. #ifdef Think_C
  132. #define ALLOCATE(ms) if (!(_##ms=malloc(sizeof(ms)))) \
  133.         {perror(#ms);exit(1);}\
  134.         else printf("Allocate %s @ %ld, %ld bytes.\n", #ms, _##ms, sizeof(ms));
  135. /* #define etab (*_etab) */
  136. #define nextpos (*_nextpos)
  137. #define nextdir (*_nextdir)
  138. #define history (*_history)
  139. #define Tree (*_Tree)
  140. #endif /* Think_C */
  141.  
  142. /* Piece values */
  143. #define valueP 100
  144. #define valueN 350
  145. #define valueB 355
  146. #define valueR 550
  147. #define valueQ 1100
  148. #define valueK 1200
  149. /* masks into upper 8 bits of ataks array */
  150. #define ctlP 0x4000
  151. #define ctlN 0x2800
  152. #define ctlB 0x1800
  153. #define ctlR 0x0400
  154. #define ctlQ 0x0200
  155. #define ctlK 0x0100
  156. #define ctlBQ 0x1200
  157. #define ctlBN 0x0800
  158. #define ctlRQ 0x0600
  159. #define ctlNN 0x2000
  160. /* attack functions */
  161. #define Patak(c, u) (atak[c][u] > ctlP)
  162. #define Anyatak(c, u) (atak[c][u] > 0)
  163. /* distance function */
  164. #define taxicab(a,b) taxidata[a][b]
  165. /* king positions */
  166. #define wking PieceList[white][0]
  167. #define bking PieceList[black][0]
  168. #define EnemyKing PieceList[c2][0]
  169. /* constants */
  170. /* castle moves */
  171. #define BLACKCASTLE    0x3C3E
  172. #define WHITECASTLE    0x0406
  173. #define LONGBLACKCASTLE    0x3C3A
  174. #define LONGWHITECASTLE    0x0402
  175. /* truth values */
  176. #define false 0
  177. #define true 1
  178. /* colors */
  179. #define white 0
  180. #define black 1
  181. #define neutral 2
  182. /* piece code defines */
  183. #define no_piece 0
  184. #define pawn 1
  185. #define knight 2
  186. #define bishop 3
  187. #define rook 4
  188. #define queen 5
  189. #define king 6
  190. #define bpawn 7
  191. /* node flags */
  192. #define pmask 0x0007
  193. #define promote 0x0008
  194. #define cstlmask 0x0010
  195. #define epmask 0x0020
  196. #define exact 0x0040
  197. #define pwnthrt 0x0080
  198. #define check 0x0100
  199. #define capture 0x0200
  200. #define draw 0x0400
  201. #define book 0x1000
  202. /* move symbols */
  203. #define pxx (CP[2])
  204. #define qxx (CP[1])
  205. #define rxx (CP[4])
  206. #define cxx (CP[3])
  207. /* for everything that can't use the above */
  208. #define Qxx " pnbrqk"
  209. #define Pxx " PNBRQK"
  210. #define Cxx "abcdefgh"
  211. #define Rxx "12345678"
  212. /***************************************************************************/
  213. /***************** Table limits ********************************************/
  214. #define TREE 1500        /* max number of tree entries */
  215. #define MAXDEPTH 35        /* max depth a search can be carried */
  216. #define MINDEPTH 2        /* min search depth =1 (no hint), >1 hint */
  217. #define MAXMOVES 400        /* max number of half moves in a game */
  218. #define NMOVELIMIT 20
  219. #define XCLIMIT 5        /* number of different Time inputs */
  220. #ifndef BOOKSIZE
  221. #if defined MSDOS || defined(__arm__)
  222. #define BOOKSIZE 10000        /* Number of unique position/move combinations allowed */
  223. #else
  224. #define BOOKSIZE 250000        /* Number of unique position/move combinations allowed */
  225. #endif
  226. #endif
  227. #define CPSIZE 235        /* size of lang file max */
  228. #define DEFETABLE 18001        /* static eval cache */
  229. #ifdef ECO
  230. #define ECOCNT  5
  231. #endif
  232. /***************** tuning paramaters **********************************************/
  233. #define NMOVEINIT { 75,75,60,55,55,55,55,58,55,56,60,64,68,72,76,80,84,88,90,94,98,98,98,98,99,99,99}
  234. #define MINGAMEIN 4
  235. #define MINMOVES 15
  236. #define FBEYOND 5
  237. #define SBEYOND 9
  238. #define TBEYOND 11
  239. #define HASHDEPTH 2        /* depth above which to use HashFile */
  240. #define HASHMOVELIMIT 40    /* Use HashFile only for this many moves */
  241. #define PTVALUE 0            /* material value below which pawn threats at 5 & 3 are used */
  242. #define ZDELTA 40        /* score delta per ply to cause extra time to be given */
  243. #define QBLOCK false        /* if true cache quiescent positions */
  244. #define BESTDELTA 90
  245. /* about 1/2 second worth of nodes for your machine */
  246. #ifdef Think_C
  247. #define ZNODES 500              /* check the time every ZNODES positions */
  248. #else /* Think_C */
  249. #define ZNODES 4000             /* check the time every ZNODES positions */
  250. #endif /* Think_C */
  251. #define MAXTCCOUNTX  5        /* max number of time clicks per search to complete ply*/
  252. #define MAXTCCOUNTR 6        /* max number of time clicks per search extensions*/
  253. #define HISTORYLIM 4096        /* Max value of history killer */
  254. #define WAWNDW 50        /* alpha window when computer white*/
  255. #define WBWNDW 50        /* beta window when computer white*/
  256. #define BAWNDW 50        /* alpha window when computer black*/
  257. #define BBWNDW 50        /* beta window when computer black*/
  258. #define BXWNDW 50        /* window to force position scoring at lower */
  259. #define WXWNDW 50        /* window to force position scoring at lower */
  260. #ifdef SMALLRANDY
  261. #define DITHER 2        /* max amount random can alter a pos value */
  262. #else
  263. #define DITHER 5
  264. #endif
  265. #define BBONUS 2        /* points per stage value of B increases */
  266. #define RBONUS 6        /* points per stage value of R increases */
  267. #define PCRASHS    5
  268. #define PCRASHV 5
  269. #define PCENTERS 5
  270. #define PCENTERV 5
  271. #define KINGPOSLIMIT  -1    /* King positional scoring limit */
  272. #define KINGSAFETY  40
  273. #define NULLMOVELIM valueQ    /* below this total material on board don't use null move */
  274. #define DEPTHMARGIN 2
  275. #define THRSTAGE    6
  276. #define CHECKSTAGE  8
  277.  
  278. /************************* parameters for Opening Book *********************************/
  279. #define BOOKFAIL 8        /* if no book move found for BOOKFAIL turns stop using book */
  280. #define BOOKMAXPLY 100        /* Max plys to keep in book database */
  281. #define BOOKPOCKET 64
  282. #define BOOKRAND 1000        /* used to select an opening move from a list */
  283. #define BOOKENDPCT 950        /* 5 % chance a BOOKEND will stop the book */
  284. #define DONTUSE -32000        /* flag move as don't use */
  285. /*************************** Book access defines ****************************************/
  286. #define LASTMOVE 0x4000        /* means this is the last move of an opening */
  287. #define BADMOVE 0x8000        /* means this is a bad move in this position */
  288. /****************************************************************************************/
  289.  
  290.      struct leaf
  291.      {
  292.            tshort f;
  293.     tshort t;
  294.     tshort  score;
  295.     tshort  reply;
  296.     tshort  width;
  297.            utshort flags;
  298.      };
  299.      struct GameRec
  300.      {
  301.        utshort gmove;    /* this move */
  302.        tshort score;        /* score after this move */
  303.        tshort depth;        /* search depth this move */
  304.        long time;               /* search time this move */
  305.        tshort piece;        /* piece captured */
  306.        tshort color;        /* color */
  307.        tshort flags;        /* move flags capture, promote, castle */
  308.        tshort Game50;        /* flag for repetition */
  309.        long nodes;        /* nodes searched for this move */
  310.        unsigned long hashkey, hashbd;    /* board key before this move */
  311.        tshort epssq;        /* epssquare before this move */
  312. #ifdef DEBUG40
  313.        UTSHORT d1[7];
  314. #endif
  315.      };
  316.      struct TimeControlRec
  317.      {
  318.        SHORT moves[2];
  319.        long clock[2];
  320.      };
  321.  
  322.      struct flags
  323.      {
  324.        SHORT mate;        /* the game is over */
  325.        SHORT post;        /* show principle variation */
  326.        SHORT quit;        /* quit/exit */
  327.        SHORT regularstart;    /* did the game start from standard
  328.                  * initial board ? */
  329.        SHORT reverse;        /* reverse board display */
  330.        SHORT bothsides;        /* computer plays both sides */
  331.        SHORT hash;        /* enable/disable transposition table */
  332.        SHORT force;        /* enter moves */
  333.        SHORT easy;        /* disable thinking on opponents time */
  334.        SHORT beep;        /* enable/disable beep */
  335.        SHORT timeout;        /* time to make a move */
  336.        SHORT musttimeout;    /* time to make a move */
  337.        SHORT back;        /* time to make a move */
  338.        SHORT rcptr;        /* enable/disable recapture heuristics */
  339.        SHORT rv;        /* reverse video */
  340.        SHORT stars;        /* add stars to uxdsp screen */
  341.        SHORT coords;        /* add coords to visual screen */
  342.        SHORT shade;
  343.        SHORT material;        /* draw on lack of material */
  344.        SHORT illegal;        /* illegal position */
  345.        SHORT onemove;        /* timing is onemove */
  346.        SHORT gamein;        /* timing is gamein */
  347.        SHORT autolist;        /* list games */
  348.        SHORT threat;            /* Enable threats, tom@izf.tno.nl */
  349.        SHORT nonull;            /* Disable nullmoves, tom@izf.tno.nl */
  350.        SHORT deepnull;          /* Enable deep nullmoves, tom@izf.tno.nl */
  351.        SHORT verydeep;          /* Enable very deep nullmoves, tom@izf.tno.nl */
  352.        SHORT pvs;               /* Enable PVS, tom@izf.tno.nl */
  353.        SHORT neweval;           /* Enable new eval, tom@izf.tno.nl */
  354.        SHORT noscore;           /* Enable no score heuristic, tom@izf.tno.nl */
  355. #ifdef DEBUG
  356.     SHORT nott;
  357.     SHORT noft;
  358.     SHORT nocache;
  359. #endif
  360.      };
  361. #ifdef DEBUG
  362.      extern FILE *debugfile;
  363.  
  364. #endif /* DEBUG */
  365. #ifdef HISTORY
  366.      extern UTSHORT history[32768];
  367. #endif
  368.      extern CHAR *ColorStr[2];
  369.      extern UTSHORT MV[MAXDEPTH+1];
  370.      extern SHORT PCRASH,PCENTER;
  371.      extern int MSCORE;
  372.      extern int mycnt1, mycnt2;
  373.      extern SHORT ahead;
  374.      extern SHORT chesstool;
  375.      extern struct leaf Tree[TREE], *root,rootnode;
  376.      extern CHAR savefile[], listfile[];
  377.      extern SHORT TrPnt[];
  378.      extern SHORT board[], color[];
  379.      extern SHORT PieceList[2][64], PawnCnt[2][8];
  380.      extern SHORT castld[], Mvboard[];
  381.      extern tshort svalue[64];
  382.      extern struct flags flag;
  383.      extern SHORT opponent, computer, INCscore;
  384.      extern tshort WAwindow, BAwindow, WBwindow, BBwindow;
  385.      extern SHORT dither, player;
  386.      extern tshort xwndw, contempt;
  387.      extern SHORT epsquare;
  388.      extern long ResponseTime, ExtraTime, MaxResponseTime, et, et0, time0, ft;
  389.      extern long reminus, replus;
  390.      extern unsigned long GenCnt, NodeCnt, ETnodes, EvalNodes;
  391.      extern tshort HashDepth, HashMoveLimit;
  392.      extern struct GameRec GameList[];
  393.      extern SHORT GameCnt, Game50;
  394.      extern SHORT Sdepth, MaxSearchDepth;
  395.      extern int Book;
  396.      extern struct TimeControlRec TimeControl;
  397.      extern int TCadd;
  398.      extern SHORT TCflag, TCmoves, TCminutes, TCseconds, OperatorTime;
  399.      extern int timecomp[MINGAMEIN], timeopp[MINGAMEIN];
  400.      extern int compptr,oppptr;
  401.      extern SHORT XCmore,XCadd[], XCmoves[], XCminutes[], XCseconds[], XC;
  402.      extern const SHORT otherside[];
  403.      extern const SHORT Stboard[];
  404.      extern const SHORT Stcolor[];
  405.      extern SHORT hint;
  406.      extern SHORT TOflag;
  407.      extern SHORT stage, stage2, Developed[];
  408.      extern SHORT ChkFlag[], CptrFlag[], PawnThreat[];
  409.      extern SHORT QueenCheck[];  /* tom@izf.tno.nl */
  410.      extern SHORT NMoves[];  /* tom@izf.tno.nl */
  411.      extern SHORT Threat[];  /* tom@izf.tno.nl */
  412.      extern SHORT ThreatSave[];  /* tom@izf.tno.nl */
  413.      extern SHORT Pscore[], Tscore[];
  414.      extern SHORT mtl[], pmtl[], hung[], emtl[];
  415.      extern SHORT Pindex[];
  416.      extern SHORT PieceCnt[];
  417.      extern SHORT FROMsquare, TOsquare;
  418.      extern SHORT HasKnight[], HasBishop[], HasRook[], HasQueen[];
  419.      extern const SHORT qrook[];
  420.      extern const SHORT krook[];
  421.      extern const SHORT kingP[];
  422.      extern const SHORT rank7[];
  423.      extern const SHORT sweep[];
  424.      extern const SHORT epmove1[], epmove2[];
  425.      extern UTSHORT killr0[], killr1[];
  426.      extern UTSHORT killr2[], killr3[];
  427.      extern UTSHORT PV, SwagHt, Swag0, Swag1, Swag2, Swag3, Swag4, sidebit;
  428.      extern tshort killt[0x4000];
  429.      extern SHORT mtl[2], pmtl[2], hung[2];
  430.      extern const SHORT value[];
  431.      extern const SHORT control[];
  432.      extern UCHAR nextpos[8][64][64];
  433.      extern UCHAR nextdir[8][64][64];
  434.      extern const SHORT ptype[2][8];
  435.      extern unsigned int starttime;
  436.      extern SHORT distdata[64][64], taxidata[64][64];
  437.      extern CHAR mvstr[5][7];
  438. #ifndef AMIGADOS
  439.      extern union U admin;
  440. #endif
  441.      extern UTSHORT bookmaxply;
  442.      extern unsigned long bookcount;
  443.      extern unsigned long booksize;
  444.      extern CHAR *CP[];
  445. #ifdef QUIETBACKGROUND
  446.      extern SHORT background;
  447. #endif /* QUIETBACKGROUND */
  448.  
  449.      extern CHAR *DRAW;
  450.  
  451. #define distance(a,b) distdata[a][b]
  452. #define row(a) ((a) >> 3)
  453. #define column(a) ((a) & 7)
  454. #define locn(a,b) (((a) << 3) | (b))
  455.      extern SHORT distdata[64][64];
  456.  
  457. /* init external functions */
  458.      extern void InitConst (CHAR *lang);
  459.      extern void Initialize_dist (void);
  460.      extern void NewGame (void);
  461.      extern int parse (FILE * fd, UTSHORT *mv, SHORT side, CHAR *opening);
  462.      extern void GetOpenings (void);
  463.      extern int OpeningBook (SHORT *hint, SHORT side);
  464.      extern int GOpeningBook (SHORT *hint, SHORT side, CHAR *mv);
  465.      extern void SelectMove (SHORT side, SHORT iop);
  466.      extern int
  467.       search (SHORT side,
  468.            SHORT ply,
  469.            SHORT depth,
  470.                SHORT ext,
  471.            SHORT alpha,
  472.            SHORT beta,
  473.            UTSHORT *bstline,
  474.            SHORT *rpt,
  475.            SHORT SAVEHT,
  476.            SHORT didnull );
  477.      extern void Initialize_moves (void);
  478.      extern void MoveList (SHORT side, SHORT ply);
  479.      extern void CaptureList (SHORT side, SHORT ply);
  480.      extern int castle (SHORT side, SHORT kf, SHORT kt, SHORT iop);
  481.      extern void ataks (SHORT side, SHORT *a);
  482.      extern void
  483.       MakeMove (SHORT side,
  484.          struct leaf * node,
  485.          SHORT *tempb,
  486.          SHORT *tempc,
  487.          SHORT *tempsf,
  488.          SHORT *tempst);
  489.      extern void
  490.       UnmakeMove (SHORT side,
  491.            struct leaf * node,
  492.            SHORT *tempb,
  493.            SHORT *tempc,
  494.            SHORT *tempsf,
  495.            SHORT *tempst);
  496.      extern void InitializeStats (void);
  497.      extern int
  498.       evaluate (SHORT side,
  499.          SHORT ply,
  500.          SHORT depth,
  501.          SHORT ext,
  502.          SHORT alpha,
  503.          SHORT beta,
  504.              SHORT *terminal,
  505.          SHORT *InChk);
  506.      extern SHORT ScorePosition (SHORT side);
  507.      extern void ExaminePosition (void);
  508.      extern void UpdateWeights (void);
  509.      extern void Initialize (void);
  510.      extern void InputCommand (void);
  511.      extern void ExitChess (void);
  512.      extern void ClrScreen (void);
  513.      extern void SetTimeControl (void);
  514.      extern void SelectLevel (CHAR *sx);
  515.      extern void
  516.       UpdateDisplay (SHORT f,
  517.               SHORT t,
  518.               SHORT flag,
  519.               SHORT iscastle);
  520.      extern void ElapsedTime (SHORT iop);
  521.      extern void ShowSidetoMove (void);
  522.      extern void SearchStartStuff (SHORT side);
  523.      extern void ShowDepth (CHAR ch);
  524.      extern void TerminateSearch (int);
  525.      extern void
  526.       ShowResults (SHORT score,
  527.             UTSHORT *bstline,
  528.             CHAR ch);
  529.      extern void PromptForMove (void);
  530.      extern void SetupBoard (void);
  531.      extern void algbr (SHORT f, SHORT t, SHORT flag);
  532.      extern void OutputMove (SHORT score);
  533.      extern void ShowCurrentMove (SHORT pnt, SHORT f, SHORT t);
  534.      extern void ListGame (void);
  535.      extern void ShowMessage (CHAR *s);
  536.      extern void ClrScreen (void);
  537.      extern void gotoXY (SHORT x, SHORT y);
  538.      extern void ClrEoln (void);
  539.      extern void DrawPiece (SHORT sq);
  540.      extern void UpdateClocks (void);
  541.      extern void DoDebug (void);
  542.      extern void DoTable (SHORT table[64]);
  543.      extern void ShowPostnValues (void);
  544.      extern void ChangeXwindow (void);
  545.      extern void SetContempt (void);
  546.      extern void ChangeHashDepth (void);
  547.      extern void ChangeBetaWindow (void);
  548.      extern void ChangeAlphaWindow (void);
  549.      extern void GiveHint (void);
  550.      extern void ShowPrompt (void);
  551.      extern void EditBoard (void);
  552.      extern void help (void);
  553.      extern void ChangeSearchDepth (void);
  554.      extern void skip (void);
  555.      extern void skipb (void);
  556.      extern void EnPassant (SHORT xside, SHORT f, SHORT t, SHORT iop);
  557.      extern void ShowNodeCnt (long int NodeCnt);
  558.      extern void ShowLine (UTSHORT *bstline);
  559.      extern int pick (SHORT p1, SHORT p2);
  560.      extern int VerifyMove (CHAR *s, SHORT inp, UTSHORT *mv);
  561.      extern void VMoveList (SHORT side, register SHORT ply);
  562. #if !defined(AMIGADOS)
  563.      extern struct gdxadmin B;
  564. #endif
  565.  
  566. #if defined(AMIGADOS)  &&  !defined(XBOARD)
  567. #define exit(retcode) CleanExit(retcode)
  568. #endif
  569. /* Take care of MEMSET once and for all... */
  570. #if (!defined(HAVE_MEMSET) || defined(MSDOS)) && !defined(__GNUC__)
  571. #define memset(s,c,l) {\
  572.   unsigned long j; \
  573.     for (j = 0; j < (l); j++) \
  574.       ((CHAR *)s)[j] = (c);}
  575. #endif /* MEMSET */
  576.  
  577.