home *** CD-ROM | disk | FTP | other *** search
/ Complete Linux / Complete Linux.iso / docs / devel / tcl / tclx7_31.z / tclx7_31 / tcldev / tclX7.3a-p1 / src / tclExtdInt.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-01-25  |  14.1 KB  |  578 lines

  1. /*
  2.  * tclExtdInt.h
  3.  *
  4.  * Standard internal include file for Extended Tcl library..
  5.  *-----------------------------------------------------------------------------
  6.  * Copyright 1991-1993 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 3.4 1994/01/25 01:07:01 markd Exp $
  16.  *-----------------------------------------------------------------------------
  17.  */
  18.  
  19. #ifndef TCLEXTDINT_H
  20. #define TCLEXTDINT_H
  21.  
  22. #include "tclExtend.h"
  23. #include "tclXconfig.h"
  24. #include "tclInt.h"
  25.  
  26. #include <sys/param.h>
  27.  
  28. /*
  29.  * Use the real functions, not the Tcl interface that hides signals.
  30.  */
  31. #undef open
  32. #undef read
  33. #undef waitpid
  34. #undef write
  35.  
  36. /*
  37.  * If tclUnix.h has already included time.h, don't include it again, some
  38.  * systems don't #ifdef inside of the file.
  39.  */
  40. #ifndef NO_SYS_TIME_H
  41. #    include <time.h>
  42. #endif
  43.  
  44. #include <sys/times.h>
  45.  
  46. /*
  47.  * Precompute milliseconds-per-tick, the " + CLK_TCK / 2" bit gets it to
  48.  * round off instead of truncate.  Take care of defining CLK_TCK if its not
  49.  * defined.
  50.  */
  51. #ifndef CLK_TCK
  52. #    ifdef HZ
  53. #        define CLK_TCK HZ
  54. #    else
  55. #        define CLK_TCK 60
  56. #    endif
  57. #endif
  58.  
  59. /*
  60.  * We will need to convert OS ticks, as returned by times() for example,
  61.  * into milliseconds. The macro TICKS_TO_MS() will return milliseconds as
  62.  * an integer value.
  63.  */
  64. #if 1000 > CLK_TCK
  65.         /*
  66.          * On low resolution systems we can get away with the constant
  67.          * expression MS_PER_TICK. Note that the addition of half the
  68.          * clock hertz results in appoximate rounding instead of truncation.
  69.          *
  70.          */
  71. #  define TICKS_TO_MS(_ticks_)  ((_ticks_) * (1000 + CLK_TCK/2) / CLK_TCK)
  72. #else
  73.         /*
  74.          * On systems where the question is ticks per millisecond, not
  75.          * milliseconds per tick, we need to use floating point arithmetic.
  76.          */
  77. #  define TICKS_TO_MS(_ticks_)  (long)((_ticks_) * 1000.0 / CLK_TCK)
  78. #endif
  79.  
  80. #include <math.h>
  81.  
  82. #ifdef NO_VALUES_H
  83. #    include <limits.h>
  84. #else
  85. #    include <values.h>
  86. #endif
  87.  
  88. #ifndef MAXDOUBLE
  89. #    define MAXDOUBLE HUGE_VAL
  90. #endif
  91.  
  92. #include <grp.h>
  93.  
  94. /*
  95.  * Included the tcl file tclUnix.h after other system files, as it checks
  96.  * if certain things are defined.
  97.  */
  98. #include "tclUnix.h"
  99.  
  100. /*
  101.  * These should be take from an include file, but it got to be such a mess
  102.  * to get the include files right that they are here for good measure.
  103.  */
  104. struct tm *gmtime ();
  105. struct tm *localtime ();
  106.  
  107. /*
  108.  * Determine how a timezone is obtained from "struct tm".  If there is no
  109.  * time zone in this struct (very lame) then use the timezone variable.
  110.  * This is done in a way to make the timezone variable the method of
  111.  * second to last resort, as some systems have it in addition to a field in
  112.  * "struct tm".  The last resort is to use gettimeofday to determine the
  113.  * time zone (this is all a big drag).
  114.  */
  115.  
  116. #if defined(HAVE_TM_TZADJ)
  117. #    define TCL_USE_TM_TZADJ
  118. #    define TCL_GOT_TIMEZONE
  119. #endif
  120. #if defined(HAVE_TM_GMTOFF) && !defined (TCL_GOT_TIMEZONE)
  121. #    define TCL_USE_TM_GMTOFF
  122. #    define TCL_GOT_TIMEZONE
  123. #endif
  124. #if defined(HAVE_TIMEZONE_VAR) && !defined (TCL_GOT_TIMEZONE)
  125. #    define TCL_USE_TIMEZONE_VAR
  126. #    define TCL_GOT_TIMEZONE
  127. #endif
  128. #if defined(HAVE_GETTIMEOFDAY) && !defined (TCL_GOT_TIMEZONE)
  129. #    define TCL_USE_GETTIMEOFDAY
  130. #    define TCL_GOT_TIMEZONE
  131. #endif
  132.  
  133.  
  134. #ifndef MAXINT
  135. #    ifdef INT_MAX    /* POSIX */
  136. #        define MAXINT INT_MAX
  137. #    else
  138. #        define BITSPERBYTE   8
  139. #        define BITS(type)    (BITSPERBYTE * (int)sizeof(type))
  140. #        define HIBITI        (1 << BITS(int) - 1)
  141. #        define MAXINT        (~HIBITI)
  142. #    endif
  143. #endif
  144.  
  145. #ifndef MININT
  146. #    ifdef INT_MIN        /* POSIX */
  147. #        define MININT INT_MIN
  148. #    else
  149. #        define MININT (-MAXINT)-1
  150. #    endif
  151. #endif
  152.  
  153. /*
  154.  * If no MAXLONG, assume sizeof (long) == sizeof (int).
  155.  */
  156. #ifndef MAXLONG
  157. #    ifdef LONG_MAX /* POSIX */
  158. #        define MAXLONG LONG_MAX
  159. #    else
  160. #        define MAXLONG MAXINT  
  161. #    endif
  162. #endif
  163.  
  164. #ifndef TRUE
  165. #    define TRUE   (1)
  166. #    define FALSE  (0)
  167. #endif
  168.  
  169. /*
  170.  * Structure to hold a regular expression, plus a Boyer-Moore compiled
  171.  * pattern.  Also structure to return submatch info.
  172.  */
  173.  
  174. typedef struct {
  175.     regexp *progPtr;
  176.     char   *boyerMoorePtr;
  177.     int     noCase;
  178. } Tcl_regexp;
  179.  
  180. typedef struct {
  181.     int start;
  182.     int end;
  183. } Tcl_SubMatchInfo [NSUBEXP];
  184.  
  185. /*
  186.  * Flags used by Tcl_RegExpCompile:
  187.  */
  188. #define REXP_NO_CASE         1   /* Do matching regardless of case    */
  189. #define REXP_BOTH_ALGORITHMS 2   /* Use boyer-moore along with regexp */
  190.  
  191. /*
  192.  * Used to return argument messages by most commands.
  193.  */
  194. extern char *tclXWrongArgs;
  195.  
  196. /*
  197.  * Macros to do string compares.  They pre-check the first character before
  198.  * checking of the strings are equal.
  199.  */
  200.  
  201. #define STREQU(str1, str2) \
  202.         (((str1) [0] == (str2) [0]) && (strcmp (str1, str2) == 0))
  203. #define STRNEQU(str1, str2, cnt) \
  204.         (((str1) [0] == (str2) [0]) && (strncmp (str1, str2, cnt) == 0))
  205.  
  206. /*
  207.  * Macro to do ctype functions with 8 bit character sets.
  208.  */
  209. #define ISSPACE(c) (isspace ((unsigned char) c))
  210. #define ISDIGIT(c) (isdigit ((unsigned char) c))
  211. #define ISLOWER(c) (islower ((unsigned char) c))
  212.  
  213. /*
  214.  * Macro that behaves like strdup, only uses ckalloc.
  215.  */
  216. #define ckstrdup(sourceStr) \
  217.   (strcpy (ckalloc (strlen (sourceStr) + 1), sourceStr))
  218.  
  219.  
  220. /*
  221.  * Prototypes for utility procedures.
  222.  */
  223. extern int
  224. Tcl_CommandLoop _ANSI_ARGS_((Tcl_Interp *interp,
  225.                              int         interactive));
  226.  
  227. extern int
  228. Tcl_DStringGets _ANSI_ARGS_((FILE         *filePtr,
  229.                              Tcl_DString  *dynStrPtr));
  230.  
  231. extern int
  232. Tcl_GetDate _ANSI_ARGS_((char   *p,
  233.                          time_t  now,
  234.                          long    zone,
  235.                          time_t *timePtr));
  236.  
  237. extern OpenFile *
  238. Tcl_GetOpenFileStruct _ANSI_ARGS_((Tcl_Interp *interp,
  239.                                    char       *handle));
  240.  
  241. extern int
  242. Tcl_ProcessSignal _ANSI_ARGS_((ClientData  clientData,
  243.                                Tcl_Interp *interp,
  244.                                int         cmdResultCode));
  245.  
  246. extern void
  247. Tcl_RegExpClean _ANSI_ARGS_((Tcl_regexp *regExpPtr));
  248.  
  249. extern int
  250. Tcl_RegExpCompile _ANSI_ARGS_((Tcl_Interp  *interp,
  251.                                Tcl_regexp  *regExpPtr,
  252.                                char        *expression,
  253.                                int          flags));
  254.  
  255. extern int
  256. Tcl_RegExpExecute _ANSI_ARGS_((Tcl_Interp       *interp,
  257.                                Tcl_regexp       *regExpPtr,
  258.                                char             *matchStrIn,
  259.                                char             *matchStrLower,
  260.                                Tcl_SubMatchInfo  subMatchInfo));
  261.  
  262.  
  263. extern int
  264. Tcl_GetTime _ANSI_ARGS_((Tcl_Interp *interp,
  265.                          CONST char *string,
  266.                          time_t     *timePtr));
  267.  
  268. extern int
  269. Tcl_RelativeExpr _ANSI_ARGS_((Tcl_Interp  *interp,
  270.                               char        *cstringExpr,
  271.                               long         stringLen,
  272.                               long        *exprResultPtr));
  273.  
  274. extern void
  275. Tcl_ResetSignals ();
  276.  
  277. extern FILE *
  278. Tcl_SetupFileEntry _ANSI_ARGS_((Tcl_Interp *interp,
  279.                                 int         fileNum,
  280.                                 int         permissions));
  281.  
  282. extern void
  283. Tcl_CloseForError _ANSI_ARGS_((Tcl_Interp *interp,
  284.                                int         fileNum));
  285.  
  286. /*
  287.  * Definitions required to initialize all extended commands.  These are either
  288.  * the command executors or initialization routines that do the command
  289.  * initialization.  The initialization routines are used when there is more
  290.  * to initializing the command that just binding the command name to the
  291.  * executor.  Usually, this means initializing some command local data via
  292.  * the ClientData mechanism.  The command executors should be declared to be of
  293.  * type `Tcl_CmdProc', but this blows up some compilers, so they are declared
  294.  * with an ANSI prototype.
  295.  */
  296.  
  297. /*
  298.  * from tclXbsearch.c
  299.  */
  300. extern int 
  301. Tcl_BsearchCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  302.  
  303. /*
  304.  * from tclXchmod.c
  305.  */
  306. extern int 
  307. Tcl_ChmodCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  308.  
  309. extern int 
  310. Tcl_ChownCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  311.  
  312. extern int 
  313. Tcl_ChgrpCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  314.  
  315. /*
  316.  * from tclXclock.c
  317.  */
  318. extern int 
  319. Tcl_GetclockCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  320.  
  321. extern int 
  322. Tcl_FmtclockCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  323.  
  324. /*
  325.  * from tclXcnvclock.c
  326.  */
  327. extern int 
  328. Tcl_ConvertclockCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  329.  
  330. /*
  331.  * from tclXcmdloop.c
  332.  */
  333. extern int 
  334. Tcl_CommandloopCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  335.  
  336. /*
  337.  * from tclXdebug.c
  338.  */
  339. extern void
  340. Tcl_InitDebug _ANSI_ARGS_((Tcl_Interp *interp));
  341.  
  342. /*
  343.  * from tclXdup.c
  344.  */
  345. extern int 
  346. Tcl_DupCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  347.  
  348. /*
  349.  * from tclXfcntl.c
  350.  */
  351. extern int 
  352. Tcl_FcntlCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  353.  
  354. /*
  355.  * from tclXfilecmds.c
  356.  */
  357. extern int 
  358. Tcl_PipeCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  359.  
  360. extern int 
  361. Tcl_CopyfileCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  362.  
  363. extern int 
  364. Tcl_LgetsCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  365.  
  366. extern int 
  367. Tcl_FrenameCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  368.  
  369. /*
  370.  * from tclXfstat.c
  371.  */
  372. extern int 
  373. Tcl_FstatCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  374.  
  375. /*
  376.  * from tclXflock.c
  377.  */
  378. extern int
  379. Tcl_FlockCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  380.  
  381. extern int
  382. Tcl_FunlockCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  383.  
  384. extern int
  385. Tcl_ReaddirCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  386.  
  387. /*
  388.  * from tclXfilescan.c
  389.  */
  390. extern void
  391. Tcl_InitFilescan _ANSI_ARGS_((Tcl_Interp *interp));
  392.  
  393. /*
  394.  * from tclXgeneral.c
  395.  */
  396.  
  397. extern int 
  398. Tcl_EchoCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  399.  
  400. extern int 
  401. Tcl_InfoxCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  402.  
  403. extern int 
  404. Tcl_LoopCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  405.  
  406. /*
  407.  * from tclXid.c
  408.  */
  409. extern int 
  410. Tcl_IdCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  411.  
  412. /*
  413.  * from tclXkeylist.c
  414.  */
  415. extern int 
  416. Tcl_KeyldelCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  417.  
  418. extern int 
  419. Tcl_KeylgetCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  420.  
  421. extern int 
  422. Tcl_KeylkeysCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  423.  
  424. extern int 
  425. Tcl_KeylsetCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  426.  
  427. /*
  428.  * from tclXlist.c
  429.  */
  430. extern int 
  431. Tcl_LvarpopCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  432.  
  433. extern int 
  434. Tcl_LvarcatCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  435.  
  436. extern int 
  437. Tcl_LvarpushCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  438.  
  439. extern int 
  440. Tcl_LemptyCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  441.  
  442. extern int 
  443. Tcl_LassignCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  444.  
  445. extern int 
  446. Tcl_LmatchCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  447.  
  448. /*
  449.  * from tclXmath.c
  450.  */
  451. extern int 
  452. Tcl_MaxCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  453.  
  454. extern int 
  455. Tcl_MinCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  456.  
  457. extern int 
  458. Tcl_RandomCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  459.  
  460. /*
  461.  * from tclXmsgcat.c
  462.  */
  463. extern void
  464. Tcl_InitMsgCat _ANSI_ARGS_((Tcl_Interp *interp));
  465.  
  466. /*
  467.  * from tclXprocess.c
  468.  */
  469. extern int 
  470. Tcl_ExeclCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  471.  
  472. extern int 
  473. Tcl_ForkCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  474.  
  475. extern int 
  476. Tcl_WaitCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  477.  
  478. /*
  479.  * from tclXprofile.c
  480.  */
  481. void
  482. Tcl_InitProfile _ANSI_ARGS_((Tcl_Interp *interp));
  483.  
  484. /*
  485.  * from tclXselect.c
  486.  */
  487. extern int 
  488. Tcl_SelectCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  489.  
  490. /*
  491.  * from tclXsignal.c
  492.  */
  493. extern void
  494. Tcl_InitSignalHandling _ANSI_ARGS_((Tcl_Interp *interp));
  495.  
  496. /*
  497.  * from tclXstring.c
  498.  */
  499. extern int 
  500. Tcl_CindexCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  501.  
  502. extern int 
  503. Tcl_ClengthCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  504.  
  505. extern int 
  506. Tcl_CrangeCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  507.  
  508. extern int 
  509. Tcl_ReplicateCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  510.  
  511. extern int 
  512. Tcl_TranslitCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  513.  
  514. extern int 
  515. Tcl_CtypeCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  516.  
  517. extern int 
  518. Tcl_CtokenCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  519.  
  520. extern int 
  521. Tcl_CexpandCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  522.  
  523. extern int 
  524. Tcl_CequalCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  525.  
  526. /*
  527.  * from tclXlib.c
  528.  */
  529. extern void
  530. Tcl_InitLibrary _ANSI_ARGS_((Tcl_Interp *interp));
  531.  
  532. /*
  533.  * from tclXunixcmds.c
  534.  */
  535. extern int 
  536. Tcl_AlarmCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  537.  
  538. extern int 
  539. Tcl_ChrootCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  540.  
  541. extern int 
  542. Tcl_NiceCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  543.  
  544. extern int 
  545. Tcl_SleepCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  546.  
  547. extern int 
  548. Tcl_SyncCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  549.  
  550. extern int 
  551. Tcl_SystemCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  552.  
  553. extern int 
  554. Tcl_TimesCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  555.  
  556. extern int 
  557. Tcl_UmaskCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  558.  
  559. extern int 
  560. Tcl_LinkCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  561.  
  562. extern int 
  563. Tcl_UnlinkCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  564.  
  565. extern int 
  566. Tcl_MkdirCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  567.  
  568. extern int 
  569. Tcl_RmdirCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  570.  
  571. /*
  572.  * from tclXserver.c
  573.  */
  574. extern int
  575. Tcl_ServerOpenCmd _ANSI_ARGS_((ClientData, Tcl_Interp*, int, char**));
  576.  
  577. #endif
  578.