summaryrefslogtreecommitdiffstats
path: root/generic/tcl.h
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2012-03-20 10:15:02 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2012-03-20 10:15:02 (GMT)
commit10f86a8692c0a3a978d81ff4ab06c6f04dde6d99 (patch)
tree2b91bafe7209fe7a322a5a7f9ec87572e868bf81 /generic/tcl.h
parent23f5b19d027c7c6f2eec97dd900569b56a9087f7 (diff)
downloadtcl-10f86a8692c0a3a978d81ff4ab06c6f04dde6d99.zip
tcl-10f86a8692c0a3a978d81ff4ab06c6f04dde6d99.tar.gz
tcl-10f86a8692c0a3a978d81ff4ab06c6f04dde6d99.tar.bz2
[Bug 3288345] Wrong Tcl_StatBuf used on Cygwin
(backported from Tcl 8.5)
Diffstat (limited to 'generic/tcl.h')
-rw-r--r--generic/tcl.h105
1 files changed, 76 insertions, 29 deletions
diff --git a/generic/tcl.h b/generic/tcl.h
index b9355da..e794032 100644
--- a/generic/tcl.h
+++ b/generic/tcl.h
@@ -82,6 +82,7 @@ extern "C" {
/*
* STRICT: See MSDN Article Q83456
*/
+
#ifdef __WIN32__
# ifndef STRICT
# define STRICT
@@ -234,11 +235,11 @@ extern "C" {
# endif
#endif
-
/*
* Definitions that allow this header file to be used either with or
* without ANSI C features like function prototypes.
*/
+
#undef _ANSI_ARGS_
#undef CONST
#ifndef INLINE
@@ -265,7 +266,7 @@ extern "C" {
# define CONST84_RETURN
#else
# ifdef USE_COMPAT_CONST
-# define CONST84
+# define CONST84
# define CONST84_RETURN CONST
# else
# define CONST84 CONST
@@ -273,10 +274,10 @@ extern "C" {
# endif
#endif
-
/*
* Make sure EXTERN isn't defined elsewhere
*/
+
#ifdef EXTERN
# undef EXTERN
#endif /* EXTERN */
@@ -287,15 +288,15 @@ extern "C" {
# define EXTERN extern TCL_STORAGE_CLASS
#endif
-
/*
* The following code is copied from winnt.h.
- * If we don't replicate it here, then <windows.h> can't be included
+ * If we don't replicate it here, then <windows.h> can't be included
* after tcl.h, since tcl.h also defines VOID.
* This block is skipped under Cygwin and Mingw.
*
*
*/
+
#if defined(__WIN32__) && !defined(HAVE_WINNT_IGNORE_VOID)
#ifndef VOID
#define VOID void
@@ -372,7 +373,7 @@ typedef long LONG;
*/
#if !defined(TCL_WIDE_INT_TYPE)&&!defined(TCL_WIDE_INT_IS_LONG)
-# if defined(__WIN32__) && !defined(__CYGWIN__)
+# if defined(__WIN32__)
# define TCL_WIDE_INT_TYPE __int64
# ifdef __BORLANDC__
typedef struct stati64 Tcl_StatBuf;
@@ -439,7 +440,21 @@ typedef struct stat Tcl_StatBuf;
* Windows or some other strange platform.
*/
# ifndef TCL_LL_MODIFIER
-# ifdef HAVE_STRUCT_STAT64
+# ifdef __CYGWIN__
+typedef struct _stat32i64 {
+ dev_t st_dev;
+ ino_t st_ino;
+ unsigned short st_mode;
+ short st_nlink;
+ short st_uid;
+ short st_gid;
+ dev_t st_rdev;
+ long long st_size;
+ struct {long tv_sec;} st_atim;
+ struct {long tv_sec;} st_mtim;
+ struct {long tv_sec;} st_ctim;
+} Tcl_StatBuf;
+# elif defined(HAVE_STRUCT_STAT64)
typedef struct stat64 Tcl_StatBuf;
# else
typedef struct stat Tcl_StatBuf;
@@ -531,7 +546,6 @@ typedef unsigned (__stdcall Tcl_ThreadCreateProc) _ANSI_ARGS_((ClientData client
typedef void (Tcl_ThreadCreateProc) _ANSI_ARGS_((ClientData clientData));
#endif
-
/*
* Threading function return types used for abstracting away platform
* differences when writing a Tcl_ThreadCreateProc. See the NewThread
@@ -545,14 +559,14 @@ typedef void (Tcl_ThreadCreateProc) _ANSI_ARGS_((ClientData clientData));
# define TCL_THREAD_CREATE_RETURN return 0
#else
# define Tcl_ThreadCreateType void
-# define TCL_THREAD_CREATE_RETURN
+# define TCL_THREAD_CREATE_RETURN
#endif
-
/*
* Definition of values for default stacksize and the possible flags to be
* given to Tcl_CreateThread.
*/
+
#define TCL_THREAD_STACK_DEFAULT (0) /* Use default size for stack */
#define TCL_THREAD_NOFLAGS (0000) /* Standard flags, default behaviour */
#define TCL_THREAD_JOINABLE (0001) /* Mark the thread as joinable */
@@ -579,6 +593,7 @@ typedef void (Tcl_ThreadCreateProc) _ANSI_ARGS_((ClientData clientData));
* The following flag is experimental and only intended for use by Expect. It
* will probably go away in a later release.
*/
+
#define TCL_REG_BOSONLY 002000 /* prepend \A to pattern so it only
* matches at the beginning of the
* string. */
@@ -594,6 +609,7 @@ typedef void (Tcl_ThreadCreateProc) _ANSI_ARGS_((ClientData clientData));
* relative to the start of the match string, not the beginning of the
* entire string.
*/
+
typedef struct Tcl_RegExpIndices {
long start; /* character offset of first character in match */
long end; /* character offset of first character after the
@@ -614,6 +630,7 @@ typedef struct Tcl_RegExpInfo {
* Picky compilers complain if this typdef doesn't appear before the
* struct's reference in tclDecls.h.
*/
+
typedef Tcl_StatBuf *Tcl_Stat_;
typedef struct stat *Tcl_OldStat_;
@@ -637,6 +654,7 @@ typedef struct stat *Tcl_OldStat_;
* TCL_CONTINUE Go on to the next iteration of the current loop;
* the interpreter's result is meaningless.
*/
+
#define TCL_OK 0
#define TCL_ERROR 1
#define TCL_RETURN 2
@@ -648,6 +666,7 @@ typedef struct stat *Tcl_OldStat_;
/*
* Flags to control what substitutions are performed by Tcl_SubstObj():
*/
+
#define TCL_SUBST_COMMANDS 001
#define TCL_SUBST_VARIABLES 002
#define TCL_SUBST_BACKSLASHES 004
@@ -675,7 +694,6 @@ typedef struct Tcl_Value {
*/
struct Tcl_Obj;
-
/*
* Procedure types defined by Tcl:
*/
@@ -695,8 +713,8 @@ typedef int (Tcl_CmdObjTraceProc) _ANSI_ARGS_((ClientData clientData,
Tcl_Interp *interp, int level, CONST char *command,
Tcl_Command commandInfo, int objc, struct Tcl_Obj * CONST * objv));
typedef void (Tcl_CmdObjTraceDeleteProc) _ANSI_ARGS_((ClientData clientData));
-typedef void (Tcl_DupInternalRepProc) _ANSI_ARGS_((struct Tcl_Obj *srcPtr,
- struct Tcl_Obj *dupPtr));
+typedef void (Tcl_DupInternalRepProc) _ANSI_ARGS_((struct Tcl_Obj *srcPtr,
+ struct Tcl_Obj *dupPtr));
typedef int (Tcl_EncodingConvertProc)_ANSI_ARGS_((ClientData clientData,
CONST char *src, int srcLen, int flags, Tcl_EncodingState *statePtr,
char *dst, int dstLen, int *srcReadPtr, int *dstWrotePtr,
@@ -706,7 +724,7 @@ typedef int (Tcl_EventProc) _ANSI_ARGS_((Tcl_Event *evPtr, int flags));
typedef void (Tcl_EventCheckProc) _ANSI_ARGS_((ClientData clientData,
int flags));
typedef int (Tcl_EventDeleteProc) _ANSI_ARGS_((Tcl_Event *evPtr,
- ClientData clientData));
+ ClientData clientData));
typedef void (Tcl_EventSetupProc) _ANSI_ARGS_((ClientData clientData,
int flags));
typedef void (Tcl_ExitProc) _ANSI_ARGS_((ClientData clientData));
@@ -725,13 +743,14 @@ typedef int (Tcl_ObjCmdProc) _ANSI_ARGS_((ClientData clientData,
typedef int (Tcl_PackageInitProc) _ANSI_ARGS_((Tcl_Interp *interp));
typedef void (Tcl_PanicProc) _ANSI_ARGS_(TCL_VARARGS(CONST char *, format));
typedef void (Tcl_TcpAcceptProc) _ANSI_ARGS_((ClientData callbackData,
- Tcl_Channel chan, char *address, int port));
+ Tcl_Channel chan, char *address, int port));
typedef void (Tcl_TimerProc) _ANSI_ARGS_((ClientData clientData));
typedef int (Tcl_SetFromAnyProc) _ANSI_ARGS_((Tcl_Interp *interp,
struct Tcl_Obj *objPtr));
typedef void (Tcl_UpdateStringProc) _ANSI_ARGS_((struct Tcl_Obj *objPtr));
typedef char *(Tcl_VarTraceProc) _ANSI_ARGS_((ClientData clientData,
- Tcl_Interp *interp, CONST84 char *part1, CONST84 char *part2, int flags));
+ Tcl_Interp *interp, CONST84 char *part1, CONST84 char *part2,
+ int flags));
typedef void (Tcl_CommandTraceProc) _ANSI_ARGS_((ClientData clientData,
Tcl_Interp *interp, CONST char *oldName, CONST char *newName,
int flags));
@@ -885,7 +904,6 @@ typedef struct Tcl_SavedResult {
char resultSpace[TCL_RESULT_SIZE+1];
} Tcl_SavedResult;
-
/*
* The following definitions support Tcl's namespace facility.
* Note: the first five fields must match exactly the fields in a
@@ -910,7 +928,6 @@ typedef struct Tcl_Namespace {
* namespace. */
} Tcl_Namespace;
-
/*
* The following structure represents a call frame, or activation record.
* A call frame defines a naming context for a procedure call: its local
@@ -950,7 +967,6 @@ typedef struct Tcl_CallFrame {
VOID *dummy13;
} Tcl_CallFrame;
-
/*
* Information about commands that is returned by Tcl_GetCommandInfo and
* passed to Tcl_SetCommandInfo. objProc is an objc/objv object-based
@@ -992,6 +1008,7 @@ typedef struct Tcl_CmdInfo {
* field that clients should use is the string field, accessible via the
* macro Tcl_DStringValue.
*/
+
#define TCL_DSTRING_STATIC_SIZE 200
typedef struct Tcl_DString {
char *string; /* Points to beginning of string: either
@@ -1014,6 +1031,7 @@ typedef struct Tcl_DString {
* be specified in the "tcl_precision" variable, and the number of
* bytes of buffer space required by Tcl_PrintDouble.
*/
+
#define TCL_MAX_PREC 17
#define TCL_DOUBLE_SPACE (TCL_MAX_PREC+10)
@@ -1022,6 +1040,7 @@ typedef struct Tcl_DString {
* string representation of an integer in base 10 (assuming the existence
* of 64-bit integers).
*/
+
#define TCL_INTEGER_SPACE 24
/*
@@ -1029,12 +1048,14 @@ typedef struct Tcl_DString {
* output braces (careful! if you change this flag be sure to change
* the definitions at the front of tclUtil.c).
*/
+
#define TCL_DONT_USE_BRACES 1
/*
* Flag that may be passed to Tcl_GetIndexFromObj to force it to disallow
* abbreviated strings.
*/
+
#define TCL_EXACT 1
/*
@@ -1051,6 +1072,7 @@ typedef struct Tcl_DString {
* Special freeProc values that may be passed to Tcl_SetResult (see
* the man page for details):
*/
+
#define TCL_VOLATILE ((Tcl_FreeProc *) 1)
#define TCL_STATIC ((Tcl_FreeProc *) 0)
#define TCL_DYNAMIC ((Tcl_FreeProc *) 3)
@@ -1058,6 +1080,7 @@ typedef struct Tcl_DString {
/*
* Flag values passed to variable-related procedures.
*/
+
#define TCL_GLOBAL_ONLY 1
#define TCL_NAMESPACE_ONLY 2
#define TCL_APPEND_VALUE 4
@@ -1105,7 +1128,6 @@ typedef struct Tcl_DString {
# define TCL_PARSE_PART1 0x400
#endif
-
/*
* Types for linked variables:
*/
@@ -1116,10 +1138,10 @@ typedef struct Tcl_DString {
#define TCL_LINK_WIDE_INT 5
#define TCL_LINK_READ_ONLY 0x80
-
/*
* Forward declarations of Tcl_HashTable and related types.
*/
+
typedef struct Tcl_HashKeyType Tcl_HashKeyType;
typedef struct Tcl_HashTable Tcl_HashTable;
typedef struct Tcl_HashEntry Tcl_HashEntry;
@@ -1139,6 +1161,7 @@ typedef void (Tcl_FreeHashEntryProc) _ANSI_ARGS_((Tcl_HashEntry *hPtr));
* access the bucketPtr member of the Tcl_HashTableEntry structure. This
* member has been removed and the space used to store the hash value.
*/
+
#ifndef TCL_HASH_KEY_STORE_HASH
# define TCL_HASH_KEY_STORE_HASH 1
#endif
@@ -1384,6 +1407,7 @@ typedef struct Tcl_HashSearch {
* a Tcl_Event header followed by additional information specific to that
* event.
*/
+
struct Tcl_Event {
Tcl_EventProc *proc; /* Procedure to call to service this event. */
struct Tcl_Event *nextPtr; /* Next in list of pending events, or NULL. */
@@ -1392,6 +1416,7 @@ struct Tcl_Event {
/*
* Positions to pass to Tcl_QueueEvent:
*/
+
typedef enum {
TCL_QUEUE_TAIL, TCL_QUEUE_HEAD, TCL_QUEUE_MARK
} Tcl_QueuePosition;
@@ -1400,16 +1425,17 @@ typedef enum {
* Values to pass to Tcl_SetServiceMode to specify the behavior of notifier
* event routines.
*/
+
#define TCL_SERVICE_NONE 0
#define TCL_SERVICE_ALL 1
-
/*
* The following structure keeps is used to hold a time value, either as
* an absolute time (the number of seconds from the epoch) or as an
* elapsed time. On Unix systems the epoch is Midnight Jan 1, 1970 GMT.
* On Macintosh systems the epoch is Midnight Jan 1, 1904 GMT.
*/
+
typedef struct Tcl_Time {
long sec; /* Seconds. */
long usec; /* Microseconds. */
@@ -1418,7 +1444,6 @@ typedef struct Tcl_Time {
typedef void (Tcl_SetTimerProc) _ANSI_ARGS_((Tcl_Time *timePtr));
typedef int (Tcl_WaitForEventProc) _ANSI_ARGS_((Tcl_Time *timePtr));
-
/*
* Bits to pass to Tcl_CreateFileHandler and Tcl_CreateChannelHandler
* to indicate what sorts of events are of interest:
@@ -1432,6 +1457,7 @@ typedef int (Tcl_WaitForEventProc) _ANSI_ARGS_((Tcl_Time *timePtr));
* disposition of the stdio handles. TCL_STDIN, TCL_STDOUT, TCL_STDERR,
* are also used in Tcl_GetStdChannel.
*/
+
#define TCL_STDIN (1<<1)
#define TCL_STDOUT (1<<2)
#define TCL_STDERR (1<<3)
@@ -1448,11 +1474,13 @@ typedef int (Tcl_WaitForEventProc) _ANSI_ARGS_((Tcl_Time *timePtr));
* Value to use as the closeProc for a channel that supports the
* close2Proc interface.
*/
+
#define TCL_CLOSE2PROC ((Tcl_DriverCloseProc *)1)
/*
* Channel version tag. This was introduced in 8.3.2/8.4.
*/
+
#define TCL_CHANNEL_VERSION_1 ((Tcl_ChannelTypeVersion) 0x1)
#define TCL_CHANNEL_VERSION_2 ((Tcl_ChannelTypeVersion) 0x2)
#define TCL_CHANNEL_VERSION_3 ((Tcl_ChannelTypeVersion) 0x3)
@@ -1468,6 +1496,7 @@ typedef int (Tcl_WaitForEventProc) _ANSI_ARGS_((Tcl_Time *timePtr));
/*
* Typedefs for the various operations in a channel type:
*/
+
typedef int (Tcl_DriverBlockModeProc) _ANSI_ARGS_((
ClientData instanceData, int mode));
typedef int (Tcl_DriverCloseProc) _ANSI_ARGS_((ClientData instanceData,
@@ -1544,6 +1573,7 @@ typedef void (Tcl_DriverThreadActionProc) _ANSI_ARGS_ ((
* It is recommend that the Tcl_Channel* functions are used to access
* elements of this structure, instead of direct accessing.
*/
+
typedef struct Tcl_ChannelType {
char *typeName; /* The name of the channel type in Tcl
* commands. This storage is owned by
@@ -1616,13 +1646,13 @@ typedef struct Tcl_ChannelType {
/*
* Enum for different types of file paths.
*/
+
typedef enum Tcl_PathType {
TCL_PATH_ABSOLUTE,
TCL_PATH_RELATIVE,
TCL_PATH_VOLUME_RELATIVE
} Tcl_PathType;
-
/*
* The following structure is used to pass glob type data amongst
* the various glob routines and Tcl_FSMatchInDirectory.
@@ -1641,6 +1671,7 @@ typedef struct Tcl_GlobTypeData {
/*
* type and permission definitions for glob command
*/
+
#define TCL_GLOB_TYPE_BLOCK (1<<0)
#define TCL_GLOB_TYPE_CHAR (1<<1)
#define TCL_GLOB_TYPE_DIR (1<<2)
@@ -1656,10 +1687,10 @@ typedef struct Tcl_GlobTypeData {
#define TCL_GLOB_PERM_W (1<<3)
#define TCL_GLOB_PERM_X (1<<4)
-
/*
* Typedefs for the various filesystem operations:
*/
+
typedef int (Tcl_FSStatProc) _ANSI_ARGS_((Tcl_Obj *pathPtr, Tcl_StatBuf *buf));
typedef int (Tcl_FSAccessProc) _ANSI_ARGS_((Tcl_Obj *pathPtr, int mode));
typedef Tcl_Channel (Tcl_FSOpenFileChannelProc)
@@ -1927,6 +1958,7 @@ typedef struct Tcl_Filesystem {
* TCL_CREATE_SYMBOLIC_LINK: Create a symbolic or soft link.
* TCL_CREATE_HARD_LINK: Create a hard link.
*/
+
#define TCL_CREATE_SYMBOLIC_LINK 0x01
#define TCL_CREATE_HARD_LINK 0x02
@@ -1934,6 +1966,7 @@ typedef struct Tcl_Filesystem {
* The following structure represents the Notifier functions that
* you can override with the Tcl_SetNotifier call.
*/
+
typedef struct Tcl_NotifierProcs {
Tcl_SetTimerProc *setTimerProc;
Tcl_WaitForEventProc *waitForEventProc;
@@ -1945,11 +1978,11 @@ typedef struct Tcl_NotifierProcs {
Tcl_ServiceModeHookProc *serviceModeHookProc;
} Tcl_NotifierProcs;
-
/*
* The following structure represents a user-defined encoding. It collects
* together all the functions that are used by the specific encoding.
*/
+
typedef struct Tcl_EncodingType {
CONST char *encodingName; /* The name of the encoding, e.g. "euc-jp".
* This name is the unique key for this
@@ -2007,7 +2040,6 @@ typedef struct Tcl_EncodingType {
#define TCL_ENCODING_END 0x02
#define TCL_ENCODING_STOPONERROR 0x04
-
/*
* The following data structures and declarations are for the new Tcl
* parser.
@@ -2018,6 +2050,7 @@ typedef struct Tcl_EncodingType {
* variable reference, one of the following structures is created to
* describe the token.
*/
+
typedef struct Tcl_Token {
int type; /* Type of token, such as TCL_TOKEN_WORD;
* see below for valid types. */
@@ -2117,6 +2150,7 @@ typedef struct Tcl_Token {
* will be stored in the error field of the Tcl_Parse structure
* defined below.
*/
+
#define TCL_PARSE_SUCCESS 0
#define TCL_PARSE_QUOTE_EXTRA 1
#define TCL_PARSE_BRACE_EXTRA 2
@@ -2132,6 +2166,7 @@ typedef struct Tcl_Token {
* A structure of the following type is filled in by Tcl_ParseCommand.
* It describes a single command parsed from an input string.
*/
+
#define NUM_STATIC_TOKENS 20
typedef struct Tcl_Parse {
@@ -2215,12 +2250,13 @@ typedef struct Tcl_Parse {
* encoding method was misidentified. This error
* is reported only if TCL_ENCODING_STOPONERROR
* was specified.
- *
+ *
* TCL_CONVERT_UNKNOWN: The source string contained a character
* that could not be represented in the target
* encoding. This error is reported only if
* TCL_ENCODING_STOPONERROR was specified.
*/
+
#define TCL_CONVERT_MULTIBYTE -1
#define TCL_CONVERT_SYNTAX -2
#define TCL_CONVERT_UNKNOWN -3
@@ -2236,6 +2272,7 @@ typedef struct Tcl_Parse {
* UCS-4 is experimental and not recommended. It works for the core,
* but most extensions expect UCS-2.
*/
+
#ifndef TCL_UTF_MAX
#define TCL_UTF_MAX 3
#endif
@@ -2244,6 +2281,7 @@ typedef struct Tcl_Parse {
* This represents a Unicode character. Any changes to this should
* also be reflected in regcustom.h.
*/
+
#if TCL_UTF_MAX > 4
/*
* unsigned int isn't 100% accurate as it should be a strict 4-byte
@@ -2283,7 +2321,6 @@ typedef unsigned short Tcl_UniChar;
#define panic Tcl_Panic
#define panicVA Tcl_PanicVA
-
/*
* The following constant is used to test for older versions of Tcl
* in the stubs tables.
@@ -2356,6 +2393,7 @@ EXTERN void Tcl_Main _ANSI_ARGS_((int argc, char **argv,
* This function is not *implemented* by the tcl library, so the storage
* class is neither DLLEXPORT nor DLLIMPORT
*/
+
#undef TCL_STORAGE_CLASS
#define TCL_STORAGE_CLASS
@@ -2369,8 +2407,17 @@ EXTERN int Tcl_AppInit _ANSI_ARGS_((Tcl_Interp *interp));
/*
* end block for C++
*/
+
#ifdef __cplusplus
}
#endif
#endif /* _TCL */
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */