home *** CD-ROM | disk | FTP | other *** search
/ Serving the Web / ServingTheWeb1995.disc1of1.iso / linux / slacksrce / tcl / tcl+tk+t / tclx7.3bl / tclx7 / tclX7.3b / src / tclExtdInt.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-07-16  |  13.9 KB  |  582 lines

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