home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / languages / tcl / tclX6.5c / src / tclExtdInt.h < prev    next >
Encoding:
C/C++ Source or Header  |  1992-12-19  |  12.8 KB  |  525 lines

  1. /*
  2.  * tclExtdInt.h
  3.  *
  4.  * Standard internal include file for Extended Tcl library..
  5.  *-----------------------------------------------------------------------------
  6.  * Copyright 1992 Karl Lehenbauer and Mark Diekhans.
  7.  *
  8.  * Permission to use, copy, modify, and distribute this software and its
  9.  * documentation for any purpose and without fee is hereby granted, provided
  10.  * that the above copyright notice appear in all copies.  Karl Lehenbauer and
  11.  * Mark Diekhans make no representations about the suitability of this
  12.  * software for any purpose.  It is provided "as is" without express or
  13.  * implied warranty.
  14.  *-----------------------------------------------------------------------------
  15.  * $Id: tclExtdInt.h,v 2.1 1992/11/17 06:26:44 markd Exp $
  16.  *-----------------------------------------------------------------------------
  17.  */
  18.  
  19. #ifndef TCLEXTDINT_H
  20. #define TCLEXTDINT_H
  21.  
  22. #include "tclExtend.h"
  23. #include "tclInt.h"
  24. #include "tclUnix.h"
  25. #include <sys/param.h>
  26.  
  27.  
  28. #ifdef TCL_NEED_SYS_SELECT_H
  29. #   include "sys/select.h"
  30. #endif
  31.  
  32. /*
  33.  * If tclUnix.h has already included time.h, don't include it again, some
  34.  * systems don't #ifdef inside of the file.  On some systems, undef
  35.  * CLK_TCK (defined in tclUnix.h) to avoid an annoying warning about
  36.  * redefinition.
  37.  */
  38. #ifdef TCL_NEED_TIME_H
  39. #    if TCL_SYS_TIME_H
  40. #        ifdef TCL_DUP_CLK_TCK
  41. #            undef CLK_TCK
  42. #        endif        
  43. #        include <time.h>
  44. #    endif
  45. #endif
  46.  
  47. /*
  48.  * Precompute milliseconds-per-tick, the " + CLK_TCK / 2" bit gets it to
  49.  * round off instead of truncate.  Take care of defining CLK_TCK if its not
  50.  * defined.
  51.  */
  52. #ifndef CLK_TCK
  53. #    ifdef HZ
  54. #        define CLK_TCK HZ
  55. #    else
  56. #        define CLK_TCK 60
  57. #    endif
  58. #endif
  59.  
  60. #define MS_PER_TICK ((1000 + CLK_TCK/2) / CLK_TCK)
  61.  
  62. /*
  63.  * If tclUnix.h did not bring times.h, bring it in here.
  64.  */
  65. #if TCL_GETTOD
  66. #    include <sys/times.h>
  67. #endif 
  68.  
  69. #include <values.h>
  70. #include <grp.h>
  71. /*
  72.  * On some systems this is not included by tclUnix.h.
  73.  */
  74.  
  75. /*
  76.  * These should be take from an include file, but it got to be such a mess
  77.  * to get the include files right that they are here for good measure.
  78.  */
  79. struct tm *gmtime ();
  80. struct tm *localtime ();
  81.  
  82. #ifndef MAXINT
  83. #    define BITSPERBYTE   8
  84. #    define BITS(type)    (BITSPERBYTE * (int)sizeof(type))
  85. #    define HIBITI        (1 << BITS(int) - 1)
  86. #    define MAXINT        (~HIBITI)
  87. #endif
  88.  
  89. #ifndef MININT
  90. #    define MININT (-MAXINT)-1
  91. #endif
  92.  
  93. #ifndef TRUE
  94. #    define TRUE   (1)
  95. #    define FALSE  (0)
  96. #endif
  97.  
  98. /*
  99.  * Structure to hold a regular expression, plus a Boyer-Moore compiled
  100.  * pattern.
  101.  */
  102.  
  103. typedef struct regexp_t {
  104.     regexp *progPtr;
  105.     char   *boyerMoorePtr;
  106.     int     noCase;
  107.     } regexp_t;
  108. typedef regexp_t *regexp_pt;
  109. /*
  110.  * Flags used by RegExpCompile:
  111.  */
  112. #define REXP_NO_CASE         1   /* Do matching regardless of case    */
  113. #define REXP_BOTH_ALGORITHMS 2   /* Use boyer-moore along with regexp */
  114.  
  115. /*
  116.  * Data structure to control a dynamic buffer.  These buffers are primarly
  117.  * used for reading things from files, were the maximum size is not known
  118.  * in advance, and the buffer must grow.  These are used in the case were
  119.  * the value is not to be returned as the interpreter result.
  120.  */
  121.  
  122. #define INIT_DYN_BUFFER_SIZE 256
  123.  
  124. typedef struct dynamicBuf_t {
  125.     char  buf [INIT_DYN_BUFFER_SIZE];   /* Initial buffer area.              */
  126.     char *ptr;                          /* Pointer to buffer area.           */
  127.     int   size;                         /* Current size of buffer.           */
  128.     int   len;                          /* Current string length (less '\0') */
  129.     } dynamicBuf_t;
  130.  
  131. /*
  132.  * Used to return argument messages by most commands.
  133.  */
  134. extern char *tclXWrongArgs;
  135.  
  136. /*
  137.  * Macros to do string compares.  They pre-check the first character before
  138.  * checking of the strings are equal.
  139.  */
  140.  
  141. #define STREQU(str1, str2) \
  142.         (((str1) [0] == (str2) [0]) && (strcmp (str1, str2) == 0))
  143. #define STRNEQU(str1, str2, cnt) \
  144.         (((str1) [0] == (str2) [0]) && (strncmp (str1, str2, cnt) == 0))
  145.  
  146. /*
  147.  * Prototypes for utility procedures.
  148.  */
  149. void
  150. Tcl_DynBufInit _ANSI_ARGS_((dynamicBuf_t *dynBufPtr));
  151.  
  152. void
  153. Tcl_DynBufFree _ANSI_ARGS_((dynamicBuf_t *dynBufPtr));
  154.  
  155. void
  156. Tcl_DynBufReturn _ANSI_ARGS_((Tcl_Interp    *interp,
  157.                               dynamicBuf_t *dynBufPtr));
  158.  
  159. void
  160. Tcl_DynBufAppend _ANSI_ARGS_((dynamicBuf_t *dynBufPtr,
  161.                               char         *newStr));
  162.  
  163. void
  164. Tcl_ExpandDynBuf _ANSI_ARGS_((dynamicBuf_t *dynBufPtr,
  165.                               int           appendSize));
  166.  
  167. int
  168. Tcl_DynamicFgets _ANSI_ARGS_((dynamicBuf_t *dynBufPtr,
  169.                               FILE         *filePtr,
  170.                               int           append));
  171.  
  172. int
  173. Tcl_ConvertFileHandle _ANSI_ARGS_((Tcl_Interp *interp,
  174.                                   char       *handle));
  175.  
  176. time_t
  177. Tcl_GetDate _ANSI_ARGS_((char   *p,
  178.                          time_t  now,
  179.                          long    zone));
  180.  
  181. int
  182. Tcl_ProcessSignal _ANSI_ARGS_((Tcl_Interp *interp,
  183.                                int         cmdResultCode));
  184.  
  185. void
  186. Tcl_RegExpClean _ANSI_ARGS_((regexp_pt regExpPtr));
  187.  
  188. int
  189. Tcl_RegExpCompile _ANSI_ARGS_((Tcl_Interp  *interp,
  190.                                regexp_pt    regExpPtr,
  191.                                char        *expression,
  192.                                int          flags));
  193.  
  194. int
  195. Tcl_RegExpExecute _ANSI_ARGS_((Tcl_Interp  *interp,
  196.                                regexp_pt    regExpPtr,
  197.                                char        *matchStrIn,
  198.                                char        *matchStrLower));
  199. void
  200. Tcl_ResetSignals ();
  201.  
  202. int
  203. Tcl_ReturnDouble _ANSI_ARGS_((Tcl_Interp *interp,
  204.                               double      number));
  205.  
  206. int
  207. Tcl_SetupFileEntry _ANSI_ARGS_((Tcl_Interp *interp,
  208.                                 int         fileNum,
  209.                                 int         readable,
  210.                                 int         writable));
  211.  
  212. void
  213. Tcl_SetupSigInt _ANSI_ARGS_(());
  214.  
  215. /*
  216.  * Definitions required to initialize all extended commands.  These are either
  217.  * the command executors or initialization routines that do the command
  218.  * initialization.  The initialization routines are used when there is more
  219.  * to initializing the command that just binding the command name to the
  220.  * executor.  Usually, this means initializing some command local data via
  221.  * the ClientData mechanism.  The command executors should be declared to be of
  222.  * type `Tcl_CmdProc', but this blows up some compilers, so they are declared
  223.  * with an ANSI prototype.
  224.  */
  225.  
  226. /*
  227.  * from tclXbsearch.c
  228.  */
  229. extern int 
  230. Tcl_BsearchCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  231.  
  232. /*
  233.  * from tclXchmod.c
  234.  */
  235. extern int 
  236. Tcl_ChmodCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  237.  
  238. extern int 
  239. Tcl_ChownCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  240.  
  241. extern int 
  242. Tcl_ChgrpCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  243.  
  244. /*
  245.  * from tclXclock.c
  246.  */
  247. extern int 
  248. Tcl_GetclockCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  249.  
  250. extern int 
  251. Tcl_FmtclockCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  252.  
  253. /*
  254.  * from tclXcnvclock.c
  255.  */
  256. extern int 
  257. Tcl_ConvertclockCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  258.  
  259. /*
  260.  * from tclXcmdloop.c
  261.  */
  262. extern int 
  263. Tcl_CommandloopCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  264.  
  265. /*
  266.  * from tclXdebug.c
  267.  */
  268. extern void
  269. Tcl_InitDebug _ANSI_ARGS_((Tcl_Interp *interp));
  270.  
  271. /*
  272.  * from tclXdup.c
  273.  */
  274. extern int 
  275. Tcl_DupCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  276.  
  277. /*
  278.  * from tclXfcntl.c
  279.  */
  280. extern int 
  281. Tcl_FcntlCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  282.  
  283. /*
  284.  * from tclXfilecmds.c
  285.  */
  286. extern int 
  287. Tcl_PipeCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  288.  
  289. extern int 
  290. Tcl_CopyfileCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  291.  
  292. extern int 
  293. Tcl_FstatCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  294.  
  295. extern int 
  296. Tcl_LgetsCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  297.  
  298. extern int
  299. Tcl_FlockCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  300.  
  301. extern int
  302. Tcl_FunlockCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  303.  
  304. /*
  305.  * from tclXfilescan.c
  306.  */
  307. extern void
  308. Tcl_InitFilescan _ANSI_ARGS_((Tcl_Interp *interp));
  309.  
  310. /*
  311.  * from tclXfmath.c
  312.  */
  313. extern int 
  314. Tcl_AcosCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  315.  
  316. extern int 
  317. Tcl_AsinCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  318.  
  319. extern int 
  320. Tcl_AtanCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  321.  
  322. extern int 
  323. Tcl_CosCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  324.  
  325. extern int 
  326. Tcl_SinCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  327.  
  328. extern int 
  329. Tcl_TanCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  330.  
  331. extern int 
  332. Tcl_CoshCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  333.  
  334. extern int 
  335. Tcl_SinhCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  336.  
  337. extern int 
  338. Tcl_TanhCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  339.  
  340. extern int 
  341. Tcl_ExpCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  342.  
  343. extern int 
  344. Tcl_LogCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  345.  
  346. extern int 
  347. Tcl_Log10Cmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  348.  
  349. extern int 
  350. Tcl_SqrtCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  351.  
  352. extern int 
  353. Tcl_FabsCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  354.  
  355. extern int 
  356. Tcl_FloorCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  357.  
  358. extern int 
  359. Tcl_CeilCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  360.  
  361. extern int 
  362. Tcl_FmodCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  363.  
  364. extern int 
  365. Tcl_PowCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  366.  
  367. /*
  368.  * from tclXgeneral.c
  369.  */
  370.  
  371. extern int 
  372. Tcl_EchoCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  373.  
  374. extern int 
  375. Tcl_InfoxCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  376.  
  377. extern int 
  378. Tcl_LoopCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  379.  
  380. /*
  381.  * from tclXid.c
  382.  */
  383. extern int 
  384. Tcl_IdCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  385.  
  386. /*
  387.  * from tclXkeylist.c
  388.  */
  389. extern int 
  390. Tcl_KeyldelCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  391.  
  392. extern int 
  393. Tcl_KeylgetCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  394.  
  395. extern int 
  396. Tcl_KeylkeysCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  397.  
  398. extern int 
  399. Tcl_KeylsetCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  400.  
  401. /*
  402.  * from tclXlist.c
  403.  */
  404. extern int 
  405. Tcl_LvarpopCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  406.  
  407. extern int 
  408. Tcl_LvarcatCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  409.  
  410. extern int 
  411. Tcl_LvarpushCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  412.  
  413. extern int 
  414. Tcl_LemptyCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  415.  
  416. /*
  417.  * from tclXmath.c
  418.  */
  419. extern int 
  420. Tcl_MaxCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  421.  
  422. extern int 
  423. Tcl_MinCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  424.  
  425. extern int 
  426. Tcl_RandomCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  427.  
  428. /*
  429.  * from tclXmsgcat.c
  430.  */
  431. extern void
  432. Tcl_InitMsgCat _ANSI_ARGS_((Tcl_Interp *interp));
  433.  
  434. /*
  435.  * from tclXprocess.c
  436.  */
  437. extern int 
  438. Tcl_ExeclCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  439.  
  440. extern int 
  441. Tcl_ForkCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  442.  
  443. extern int 
  444. Tcl_WaitCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  445.  
  446. /*
  447.  * from tclXprofile.c
  448.  */
  449. void
  450. Tcl_InitProfile _ANSI_ARGS_((Tcl_Interp *interp));
  451.  
  452. /*
  453.  * from tclXselect.c
  454.  */
  455. extern int 
  456. Tcl_SelectCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  457.  
  458. /*
  459.  * from tclXsignal.c
  460.  */
  461. extern void
  462. Tcl_InitSignalHandling _ANSI_ARGS_((Tcl_Interp *interp));
  463.  
  464. /*
  465.  * from tclXstring.c
  466.  */
  467. extern int 
  468. Tcl_CindexCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  469.  
  470. extern int 
  471. Tcl_ClengthCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  472.  
  473. extern int 
  474. Tcl_CrangeCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  475.  
  476. extern int 
  477. Tcl_ReplicateCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  478.  
  479. extern int 
  480. Tcl_TranslitCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  481.  
  482. extern int 
  483. Tcl_CtypeCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  484.  
  485. /*
  486.  * from tclXlib.c
  487.  */
  488. extern int
  489. Tcl_Demand_loadCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  490.  
  491. extern int
  492. Tcl_LoadlibindexCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  493.  
  494. /*
  495.  * from tclXunixcmds.c
  496.  */
  497. extern int 
  498. Tcl_AlarmCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  499.  
  500. extern int 
  501. Tcl_SleepCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  502.  
  503. extern int 
  504. Tcl_SystemCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  505.  
  506. extern int 
  507. Tcl_TimesCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  508.  
  509. extern int 
  510. Tcl_UmaskCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  511.  
  512. extern int 
  513. Tcl_LinkCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  514.  
  515. extern int 
  516. Tcl_UnlinkCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  517.  
  518. extern int 
  519. Tcl_MkdirCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  520.  
  521. extern int 
  522. Tcl_RmdirCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  523.  
  524. #endif
  525.