OSDN Git Service

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