diff options
author | dkf <donal.k.fellows@manchester.ac.uk> | 2008-09-24 09:41:08 (GMT) |
---|---|---|
committer | dkf <donal.k.fellows@manchester.ac.uk> | 2008-09-24 09:41:08 (GMT) |
commit | ecb1cd56121d11f50f3eaab72ffc83bcc7483749 (patch) | |
tree | 12490c1ca7097e4a1a4f6616fe350aa1cbf6b8e2 /generic | |
parent | 248065d3dd60aa512d6ec1ab9b4229b05af916b0 (diff) | |
download | tcl-ecb1cd56121d11f50f3eaab72ffc83bcc7483749.zip tcl-ecb1cd56121d11f50f3eaab72ffc83bcc7483749.tar.gz tcl-ecb1cd56121d11f50f3eaab72ffc83bcc7483749.tar.bz2 |
Implement TIP #316.
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tcl.decls | 43 | ||||
-rw-r--r-- | generic/tclDecls.h | 143 | ||||
-rw-r--r-- | generic/tclFileName.c | 111 | ||||
-rw-r--r-- | generic/tclStubInit.c | 15 |
4 files changed, 308 insertions, 4 deletions
diff --git a/generic/tcl.decls b/generic/tcl.decls index 1351e02..0d8fea6 100644 --- a/generic/tcl.decls +++ b/generic/tcl.decls @@ -12,7 +12,7 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: tcl.decls,v 1.143 2008/08/21 21:35:37 dgp Exp $ +# RCS: @(#) $Id: tcl.decls,v 1.144 2008/09/24 09:41:13 dkf Exp $ library tcl @@ -2146,6 +2146,47 @@ declare 588 generic { Tcl_Obj *CONST objv[]) } +# Tcl_StatBuf reader functions. [TIP #316] +declare 589 generic { + unsigned Tcl_GetFSDeviceFromStat(const Tcl_StatBuf *statPtr) +} +declare 590 generic { + unsigned Tcl_GetFSInodeFromStat(const Tcl_StatBuf *statPtr) +} +declare 591 generic { + unsigned Tcl_GetModeFromStat(const Tcl_StatBuf *statPtr) +} +declare 592 generic { + int Tcl_GetLinkCountFromStat(const Tcl_StatBuf *statPtr) +} +declare 593 generic { + int Tcl_GetUserIdFromStat(const Tcl_StatBuf *statPtr) +} +declare 594 generic { + int Tcl_GetGroupIdFromStat(const Tcl_StatBuf *statPtr) +} +declare 595 generic { + int Tcl_GetDeviceTypeFromStat(const Tcl_StatBuf *statPtr) +} +declare 596 generic { + Tcl_WideInt Tcl_GetAccessTimeFromStat(const Tcl_StatBuf *statPtr) +} +declare 597 generic { + Tcl_WideInt Tcl_GetModificationTimeFromStat(const Tcl_StatBuf *statPtr) +} +declare 598 generic { + Tcl_WideInt Tcl_GetChangeTimeFromStat(const Tcl_StatBuf *statPtr) +} +declare 599 generic { + Tcl_WideUInt Tcl_GetSizeFromStat(const Tcl_StatBuf *statPtr) +} +declare 600 generic { + Tcl_WideUInt Tcl_GetBlocksFromStat(const Tcl_StatBuf *statPtr) +} +declare 601 generic { + unsigned Tcl_GetBlockSizeFromStat(const Tcl_StatBuf *statPtr) +} + ############################################################################## # Define the platform specific public Tcl interface. These functions are diff --git a/generic/tclDecls.h b/generic/tclDecls.h index d80093a..96d1774 100644 --- a/generic/tclDecls.h +++ b/generic/tclDecls.h @@ -8,7 +8,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclDecls.h,v 1.145 2008/08/21 21:35:38 dgp Exp $ + * RCS: @(#) $Id: tclDecls.h,v 1.146 2008/09/24 09:41:13 dkf Exp $ */ #ifndef _TCLDECLS @@ -3566,6 +3566,82 @@ EXTERN int Tcl_NRCallObjProc (Tcl_Interp * interp, ClientData clientData, int objc, Tcl_Obj *CONST objv[]); #endif +#ifndef Tcl_GetFSDeviceFromStat_TCL_DECLARED +#define Tcl_GetFSDeviceFromStat_TCL_DECLARED +/* 589 */ +EXTERN unsigned Tcl_GetFSDeviceFromStat ( + const Tcl_StatBuf * statBufPtr); +#endif +#ifndef Tcl_GetFSInodeFromStat_TCL_DECLARED +#define Tcl_GetFSInodeFromStat_TCL_DECLARED +/* 590 */ +EXTERN unsigned Tcl_GetFSInodeFromStat ( + const Tcl_StatBuf * statBufPtr); +#endif +#ifndef Tcl_GetModeFromStat_TCL_DECLARED +#define Tcl_GetModeFromStat_TCL_DECLARED +/* 591 */ +EXTERN unsigned Tcl_GetModeFromStat (const Tcl_StatBuf * statBufPtr); +#endif +#ifndef Tcl_GetLinkCountFromStat_TCL_DECLARED +#define Tcl_GetLinkCountFromStat_TCL_DECLARED +/* 592 */ +EXTERN int Tcl_GetLinkCountFromStat ( + const Tcl_StatBuf * statBufPtr); +#endif +#ifndef Tcl_GetUserIdFromStat_TCL_DECLARED +#define Tcl_GetUserIdFromStat_TCL_DECLARED +/* 593 */ +EXTERN int Tcl_GetUserIdFromStat ( + const Tcl_StatBuf * statBufPtr); +#endif +#ifndef Tcl_GetGroupIdFromStat_TCL_DECLARED +#define Tcl_GetGroupIdFromStat_TCL_DECLARED +/* 594 */ +EXTERN int Tcl_GetGroupIdFromStat ( + const Tcl_StatBuf * statBufPtr); +#endif +#ifndef Tcl_GetDeviceTypeFromStat_TCL_DECLARED +#define Tcl_GetDeviceTypeFromStat_TCL_DECLARED +/* 595 */ +EXTERN int Tcl_GetDeviceTypeFromStat ( + const Tcl_StatBuf * statBufPtr); +#endif +#ifndef Tcl_GetAccessTimeFromStat_TCL_DECLARED +#define Tcl_GetAccessTimeFromStat_TCL_DECLARED +/* 596 */ +EXTERN Tcl_WideInt Tcl_GetAccessTimeFromStat ( + const Tcl_StatBuf * statBufPtr); +#endif +#ifndef Tcl_GetModificationTimeFromStat_TCL_DECLARED +#define Tcl_GetModificationTimeFromStat_TCL_DECLARED +/* 597 */ +EXTERN Tcl_WideInt Tcl_GetModificationTimeFromStat ( + const Tcl_StatBuf * statBufPtr); +#endif +#ifndef Tcl_GetChangeTimeFromStat_TCL_DECLARED +#define Tcl_GetChangeTimeFromStat_TCL_DECLARED +/* 598 */ +EXTERN Tcl_WideInt Tcl_GetChangeTimeFromStat ( + const Tcl_StatBuf * statBufPtr); +#endif +#ifndef Tcl_GetSizeFromStat_TCL_DECLARED +#define Tcl_GetSizeFromStat_TCL_DECLARED +/* 599 */ +EXTERN Tcl_WideUInt Tcl_GetSizeFromStat (const Tcl_StatBuf * statBufPtr); +#endif +#ifndef Tcl_GetBlocksFromStat_TCL_DECLARED +#define Tcl_GetBlocksFromStat_TCL_DECLARED +/* 600 */ +EXTERN Tcl_WideUInt Tcl_GetBlocksFromStat ( + const Tcl_StatBuf * statBufPtr); +#endif +#ifndef Tcl_GetBlockSizeFromStat_TCL_DECLARED +#define Tcl_GetBlockSizeFromStat_TCL_DECLARED +/* 601 */ +EXTERN unsigned Tcl_GetBlockSizeFromStat ( + const Tcl_StatBuf * statBufPtr); +#endif typedef struct TclStubHooks { CONST struct TclPlatStubs *tclPlatStubs; @@ -4214,6 +4290,19 @@ typedef struct TclStubs { int (*tcl_NRCmdSwap) (Tcl_Interp * interp, Tcl_Command cmd, int objc, Tcl_Obj *CONST objv[], int flags); /* 586 */ void (*tcl_NRAddCallback) (Tcl_Interp * interp, Tcl_NRPostProc * postProcPtr, ClientData data0, ClientData data1, ClientData data2, ClientData data3); /* 587 */ int (*tcl_NRCallObjProc) (Tcl_Interp * interp, Tcl_ObjCmdProc * objProc, ClientData clientData, int objc, Tcl_Obj *CONST objv[]); /* 588 */ + unsigned (*tcl_GetFSDeviceFromStat) (const Tcl_StatBuf * statBufPtr); /* 589 */ + unsigned (*tcl_GetFSInodeFromStat) (const Tcl_StatBuf * statBufPtr); /* 590 */ + unsigned (*tcl_GetModeFromStat) (const Tcl_StatBuf * statBufPtr); /* 591 */ + int (*tcl_GetLinkCountFromStat) (const Tcl_StatBuf * statBufPtr); /* 592 */ + int (*tcl_GetUserIdFromStat) (const Tcl_StatBuf * statBufPtr); /* 593 */ + int (*tcl_GetGroupIdFromStat) (const Tcl_StatBuf * statBufPtr); /* 594 */ + int (*tcl_GetDeviceTypeFromStat) (const Tcl_StatBuf * statBufPtr); /* 595 */ + Tcl_WideInt (*tcl_GetAccessTimeFromStat) (const Tcl_StatBuf * statBufPtr); /* 596 */ + Tcl_WideInt (*tcl_GetModificationTimeFromStat) (const Tcl_StatBuf * statBufPtr); /* 597 */ + Tcl_WideInt (*tcl_GetChangeTimeFromStat) (const Tcl_StatBuf * statBufPtr); /* 598 */ + Tcl_WideUInt (*tcl_GetSizeFromStat) (const Tcl_StatBuf * statBufPtr); /* 599 */ + Tcl_WideUInt (*tcl_GetBlocksFromStat) (const Tcl_StatBuf * statBufPtr); /* 600 */ + unsigned (*tcl_GetBlockSizeFromStat) (const Tcl_StatBuf * statBufPtr); /* 601 */ } TclStubs; #if defined(USE_TCL_STUBS) && !defined(USE_TCL_STUB_PROCS) @@ -6642,6 +6731,58 @@ extern CONST TclStubs *tclStubsPtr; #define Tcl_NRCallObjProc \ (tclStubsPtr->tcl_NRCallObjProc) /* 588 */ #endif +#ifndef Tcl_GetFSDeviceFromStat +#define Tcl_GetFSDeviceFromStat \ + (tclStubsPtr->tcl_GetFSDeviceFromStat) /* 589 */ +#endif +#ifndef Tcl_GetFSInodeFromStat +#define Tcl_GetFSInodeFromStat \ + (tclStubsPtr->tcl_GetFSInodeFromStat) /* 590 */ +#endif +#ifndef Tcl_GetModeFromStat +#define Tcl_GetModeFromStat \ + (tclStubsPtr->tcl_GetModeFromStat) /* 591 */ +#endif +#ifndef Tcl_GetLinkCountFromStat +#define Tcl_GetLinkCountFromStat \ + (tclStubsPtr->tcl_GetLinkCountFromStat) /* 592 */ +#endif +#ifndef Tcl_GetUserIdFromStat +#define Tcl_GetUserIdFromStat \ + (tclStubsPtr->tcl_GetUserIdFromStat) /* 593 */ +#endif +#ifndef Tcl_GetGroupIdFromStat +#define Tcl_GetGroupIdFromStat \ + (tclStubsPtr->tcl_GetGroupIdFromStat) /* 594 */ +#endif +#ifndef Tcl_GetDeviceTypeFromStat +#define Tcl_GetDeviceTypeFromStat \ + (tclStubsPtr->tcl_GetDeviceTypeFromStat) /* 595 */ +#endif +#ifndef Tcl_GetAccessTimeFromStat +#define Tcl_GetAccessTimeFromStat \ + (tclStubsPtr->tcl_GetAccessTimeFromStat) /* 596 */ +#endif +#ifndef Tcl_GetModificationTimeFromStat +#define Tcl_GetModificationTimeFromStat \ + (tclStubsPtr->tcl_GetModificationTimeFromStat) /* 597 */ +#endif +#ifndef Tcl_GetChangeTimeFromStat +#define Tcl_GetChangeTimeFromStat \ + (tclStubsPtr->tcl_GetChangeTimeFromStat) /* 598 */ +#endif +#ifndef Tcl_GetSizeFromStat +#define Tcl_GetSizeFromStat \ + (tclStubsPtr->tcl_GetSizeFromStat) /* 599 */ +#endif +#ifndef Tcl_GetBlocksFromStat +#define Tcl_GetBlocksFromStat \ + (tclStubsPtr->tcl_GetBlocksFromStat) /* 600 */ +#endif +#ifndef Tcl_GetBlockSizeFromStat +#define Tcl_GetBlockSizeFromStat \ + (tclStubsPtr->tcl_GetBlockSizeFromStat) /* 601 */ +#endif #endif /* defined(USE_TCL_STUBS) && !defined(USE_TCL_STUB_PROCS) */ diff --git a/generic/tclFileName.c b/generic/tclFileName.c index 999a685..00c7067 100644 --- a/generic/tclFileName.c +++ b/generic/tclFileName.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclFileName.c,v 1.90 2008/08/13 18:14:44 dgp Exp $ + * RCS: @(#) $Id: tclFileName.c,v 1.91 2008/09/24 09:41:20 dkf Exp $ */ #include "tclInt.h" @@ -2527,6 +2527,115 @@ Tcl_AllocStatBuf(void) } /* + *--------------------------------------------------------------------------- + * + * Access functions for Tcl_StatBuf -- + * + * These functions provide portable read-only access to the portable + * fields of the Tcl_StatBuf structure (really a 'struct stat', 'struct + * stat64' or something else related). [TIP #316] + * + * Results: + * The value from the field being retrieved. + * + * Side effects: + * None. + * + *--------------------------------------------------------------------------- + */ + +unsigned +Tcl_GetFSDeviceFromStat( + const Tcl_StatBuf *statPtr) +{ + return (unsigned) statPtr->st_dev; +} + +unsigned +Tcl_GetFSInodeFromStat( + const Tcl_StatBuf *statPtr) +{ + return (unsigned) statPtr->st_ino; +} + +unsigned +Tcl_GetModeFromStat( + const Tcl_StatBuf *statPtr) +{ + return (unsigned) statPtr->st_mode; +} + +int +Tcl_GetLinkCountFromStat( + const Tcl_StatBuf *statPtr) +{ + return (int)statPtr->st_nlink; +} + +int +Tcl_GetUserIdFromStat( + const Tcl_StatBuf *statPtr) +{ + return (int) statPtr->st_uid; +} + +int +Tcl_GetGroupIdFromStat( + const Tcl_StatBuf *statPtr) +{ + return (int) statPtr->st_gid; +} + +int +Tcl_GetDeviceTypeFromStat( + const Tcl_StatBuf *statPtr) +{ + return (int) statPtr->st_rdev; +} + +Tcl_WideInt +Tcl_GetAccessTimeFromStat( + const Tcl_StatBuf *statPtr) +{ + return (Tcl_WideInt) statPtr->st_atime; +} + +Tcl_WideInt +Tcl_GetModificationTimeFromStat( + const Tcl_StatBuf *statPtr) +{ + return (Tcl_WideInt) statPtr->st_mtime; +} + +Tcl_WideInt +Tcl_GetChangeTimeFromStat( + const Tcl_StatBuf *statPtr) +{ + return (Tcl_WideInt) statPtr->st_ctime; +} + +Tcl_WideUInt +Tcl_GetSizeFromStat( + const Tcl_StatBuf *statPtr) +{ + return (Tcl_WideUInt) statPtr->st_size; +} + +Tcl_WideUInt +Tcl_GetBlocksFromStat( + const Tcl_StatBuf *statPtr) +{ + return (Tcl_WideUInt) statPtr->st_blocks; +} + +unsigned +Tcl_GetBlockSizeFromStat( + const Tcl_StatBuf *statPtr) +{ + return (unsigned) statPtr->st_blksize; +} + +/* * Local Variables: * mode: c * c-basic-offset: 4 diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c index 49f5029..5572326 100644 --- a/generic/tclStubInit.c +++ b/generic/tclStubInit.c @@ -8,7 +8,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclStubInit.c,v 1.162 2008/07/29 05:30:38 msofer Exp $ + * RCS: @(#) $Id: tclStubInit.c,v 1.163 2008/09/24 09:41:20 dkf Exp $ */ #include "tclInt.h" @@ -1114,6 +1114,19 @@ static const TclStubs tclStubs = { Tcl_NRCmdSwap, /* 586 */ Tcl_NRAddCallback, /* 587 */ Tcl_NRCallObjProc, /* 588 */ + Tcl_GetFSDeviceFromStat, /* 589 */ + Tcl_GetFSInodeFromStat, /* 590 */ + Tcl_GetModeFromStat, /* 591 */ + Tcl_GetLinkCountFromStat, /* 592 */ + Tcl_GetUserIdFromStat, /* 593 */ + Tcl_GetGroupIdFromStat, /* 594 */ + Tcl_GetDeviceTypeFromStat, /* 595 */ + Tcl_GetAccessTimeFromStat, /* 596 */ + Tcl_GetModificationTimeFromStat, /* 597 */ + Tcl_GetChangeTimeFromStat, /* 598 */ + Tcl_GetSizeFromStat, /* 599 */ + Tcl_GetBlocksFromStat, /* 600 */ + Tcl_GetBlockSizeFromStat, /* 601 */ }; /* !END!: Do not edit above this line. */ |