diff options
Diffstat (limited to 'generic')
-rw-r--r-- | generic/rege_dfa.c | 2 | ||||
-rw-r--r-- | generic/regex.h | 8 | ||||
-rw-r--r-- | generic/regexec.c | 2 | ||||
-rw-r--r-- | generic/regguts.h | 2 | ||||
-rw-r--r-- | generic/tcl.decls | 10 | ||||
-rw-r--r-- | generic/tcl.h | 26 | ||||
-rw-r--r-- | generic/tclCompExpr.c | 5 | ||||
-rw-r--r-- | generic/tclDate.c | 6 | ||||
-rw-r--r-- | generic/tclEnv.c | 7 | ||||
-rw-r--r-- | generic/tclExecute.c | 4 | ||||
-rw-r--r-- | generic/tclGetDate.y | 8 | ||||
-rw-r--r-- | generic/tclIOUtil.c | 6 | ||||
-rw-r--r-- | generic/tclInt.h | 4 | ||||
-rw-r--r-- | generic/tclNamesp.c | 19 | ||||
-rw-r--r-- | generic/tclObj.c | 4 | ||||
-rw-r--r-- | generic/tclPathObj.c | 4 | ||||
-rw-r--r-- | generic/tclStubInit.c | 7 | ||||
-rw-r--r-- | generic/tclStubLib.c | 11 | ||||
-rwxr-xr-x | generic/tclThreadAlloc.c | 4 | ||||
-rw-r--r-- | generic/tclThreadStorage.c | 4 | ||||
-rw-r--r-- | generic/tclTrace.c | 8 | ||||
-rw-r--r-- | generic/tclVar.c | 10 | ||||
-rw-r--r-- | generic/tommath.h | 235 |
23 files changed, 230 insertions, 166 deletions
diff --git a/generic/rege_dfa.c b/generic/rege_dfa.c index a6b3848..c80996a 100644 --- a/generic/rege_dfa.c +++ b/generic/rege_dfa.c @@ -660,7 +660,7 @@ getvacant( struct sset *ss; struct sset *p; struct arcp ap; - struct arcp lastap; + struct arcp lastap = {NULL, 0}; /* silence gcc 4 warning */ color co; ss = pickss(v, d, cp, start); diff --git a/generic/regex.h b/generic/regex.h index dfd11ec..b8498ab 100644 --- a/generic/regex.h +++ b/generic/regex.h @@ -294,7 +294,7 @@ int re_comp(regex_t *, __REG_CONST char *, size_t, int); int regcomp(regex_t *, __REG_CONST char *, int); #endif #ifdef __REG_WIDE_T -int __REG_WIDE_COMPILE(regex_t *, __REG_CONST __REG_WIDE_T *, size_t, int); +MODULE_SCOPE int __REG_WIDE_COMPILE(regex_t *, __REG_CONST __REG_WIDE_T *, size_t, int); #endif #ifndef __REG_NOCHAR int re_exec(regex_t *, __REG_CONST char *, size_t, rm_detail_t *, size_t, regmatch_t [], int); @@ -303,10 +303,10 @@ int re_exec(regex_t *, __REG_CONST char *, size_t, rm_detail_t *, size_t, regmat int regexec(regex_t *, __REG_CONST char *, size_t, regmatch_t [], int); #endif #ifdef __REG_WIDE_T -int __REG_WIDE_EXEC(regex_t *, __REG_CONST __REG_WIDE_T *, size_t, rm_detail_t *, size_t, regmatch_t [], int); +MODULE_SCOPE int __REG_WIDE_EXEC(regex_t *, __REG_CONST __REG_WIDE_T *, size_t, rm_detail_t *, size_t, regmatch_t [], int); #endif -re_void regfree(regex_t *); -extern size_t regerror(int, __REG_CONST regex_t *, char *, size_t); +MODULE_SCOPE re_void regfree(regex_t *); +MODULE_SCOPE size_t regerror(int, __REG_CONST regex_t *, char *, size_t); /* automatically gathered by fwd; do not hand-edit */ /* =====^!^===== end forwards =====^!^===== */ diff --git a/generic/regexec.c b/generic/regexec.c index 79536e1..6862ef9 100644 --- a/generic/regexec.c +++ b/generic/regexec.c @@ -404,7 +404,7 @@ cfind( { struct dfa *s; struct dfa *d; - chr *cold; + chr *cold = NULL; /* silence gcc 4 warning */ int ret; s = newdfa(v, &v->g->search, cm, &v->dfa1); diff --git a/generic/regguts.h b/generic/regguts.h index 728d5eb..190d40b 100644 --- a/generic/regguts.h +++ b/generic/regguts.h @@ -51,7 +51,9 @@ /* assertions */ #ifndef assert #ifndef REG_DEBUG +#ifndef NDEBUG #define NDEBUG /* no assertions */ +#endif #endif /* !REG_DEBUG */ #include <assert.h> #endif diff --git a/generic/tcl.decls b/generic/tcl.decls index 3254f2c..49d0d33 100644 --- a/generic/tcl.decls +++ b/generic/tcl.decls @@ -11,7 +11,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.114 2005/10/08 14:42:44 dgp Exp $ +# RCS: @(#) $Id: tcl.decls,v 1.115 2005/11/27 02:33:48 das Exp $ library tcl @@ -2069,3 +2069,11 @@ declare 1 macosx { int maxPathLen, char *libraryPath) } + +############################################################################## + +# Public functions that are not accessible via the stubs table: +# (listed here _as comments_ so that the 'checkstubs' make target does not +# complain about them) + +# void Tcl_Main(int argc, char **argv, Tcl_AppInitProc *appInitProc) diff --git a/generic/tcl.h b/generic/tcl.h index 5f6b7dd..83c5821 100644 --- a/generic/tcl.h +++ b/generic/tcl.h @@ -13,7 +13,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.h,v 1.207 2005/11/03 00:17:30 patthoyts Exp $ + * RCS: @(#) $Id: tcl.h,v 1.208 2005/11/27 02:33:48 das Exp $ */ #ifndef _TCL @@ -45,7 +45,12 @@ extern "C" { * win/tcl.m4 (not patchlevel) * win/makefile.bc (not patchlevel) 2 LOC * README (sections 0 and 2, with and without separator) - * macosx/Tcl.pbproj/project.pbxproj (not patchlevel) 2 LOC + * macosx/Tcl.pbproj/project.pbxproj (not patchlevel) 1 LOC + * macosx/Tcl.pbproj/default.pbxuser (not patchlevel) 1 LOC + * macosx/Tcl.xcode/project.pbxproj (not patchlevel) 2 LOC + * macosx/Tcl.xcode/default.pbxuser (not patchlevel) 1 LOC + * macosx/Tcl.xcodeproj/project.pbxproj (not patchlevel) 8 LOC + * macosx/Tcl.xcodeproj/default.pbxuser (not patchlevel) 4 LOC * win/README.binary (sections 0-4, with and without separator) * win/README (not patchlevel) (sections 0 and 2) * unix/tcl.spec (2 LOC Major/Minor, 1 LOC patch) @@ -330,6 +335,23 @@ typedef long LONG; #endif /* + * Darwin specifc configure overrides (to support fat compiles, where + * configure runs only once for multiple architectures): + */ + +#ifdef __APPLE__ +# ifdef __LP64__ +# undef TCL_WIDE_INT_TYPE +# define TCL_WIDE_INT_IS_LONG 1 +# define TCL_CFG_DO64BIT 1 +# else /* !__LP64__ */ +# define TCL_WIDE_INT_TYPE long long +# undef TCL_WIDE_INT_IS_LONG +# undef TCL_CFG_DO64BIT +# endif /* __LP64__ */ +#endif /* __APPLE__ */ + +/* * Define Tcl_WideInt to be a type that is (at least) 64-bits wide, and define * Tcl_WideUInt to be the unsigned variant of that type (assuming that where * we have one, we can have the other.) diff --git a/generic/tclCompExpr.c b/generic/tclCompExpr.c index 7e808e9..2651a51 100644 --- a/generic/tclCompExpr.c +++ b/generic/tclCompExpr.c @@ -9,7 +9,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclCompExpr.c,v 1.30 2005/11/02 14:51:04 dkf Exp $ + * RCS: @(#) $Id: tclCompExpr.c,v 1.31 2005/11/27 02:33:48 das Exp $ */ #include "tclInt.h" @@ -323,7 +323,8 @@ CompileSubExpr( CompileEnv *envPtr) /* Holds resulting instructions. */ { Tcl_Interp *interp = infoPtr->interp; - Tcl_Token *tokenPtr, *endPtr, *afterSubexprPtr; + Tcl_Token *tokenPtr, *endPtr = NULL; /* silence gcc 4 warning */ + Tcl_Token *afterSubexprPtr; OperatorDesc *opDescPtr; Tcl_HashEntry *hPtr; CONST char *operator; diff --git a/generic/tclDate.c b/generic/tclDate.c index 2daf7b2..3ee7bf4 100644 --- a/generic/tclDate.c +++ b/generic/tclDate.c @@ -249,6 +249,8 @@ static time_t ToSeconds(time_t Hours, time_t Minutes, static int LookupWord(char *buff); static int TclDatelex(void* info); +MODULE_SCOPE int yyparse (void *); + @@ -1871,6 +1873,10 @@ yyreturn: +MODULE_SCOPE int yychar; +MODULE_SCOPE YYSTYPE yylval; +MODULE_SCOPE int yynerrs; + /* * Month and day table. */ diff --git a/generic/tclEnv.c b/generic/tclEnv.c index 9417f1a..812c2e4 100644 --- a/generic/tclEnv.c +++ b/generic/tclEnv.c @@ -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: tclEnv.c,v 1.27 2005/11/01 15:30:52 dkf Exp $ + * RCS: @(#) $Id: tclEnv.c,v 1.28 2005/11/27 02:33:49 das Exp $ */ #include "tclInt.h" @@ -43,6 +43,7 @@ static int environSize = 0; /* Non-zero means that the environ array was #if defined(__APPLE__) && defined(__DYNAMIC__) #include <crt_externs.h> +MODULE_SCOPE char **environ; char **environ = NULL; #endif @@ -53,8 +54,8 @@ char **environ = NULL; static char * EnvTraceProc(ClientData clientData, Tcl_Interp *interp, CONST char *name1, CONST char *name2, int flags); static void ReplaceString(CONST char *oldStr, char *newStr); -void TclSetEnv(CONST char *name, CONST char *value); -void TclUnsetEnv(CONST char *name); +MODULE_SCOPE void TclSetEnv(CONST char *name, CONST char *value); +MODULE_SCOPE void TclUnsetEnv(CONST char *name); #if defined(__CYGWIN__) && defined(__WIN32__) static void TclCygwinPutenv(CONST char *string); #endif diff --git a/generic/tclExecute.c b/generic/tclExecute.c index 7bfb787..38a7a6e 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.c @@ -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: tclExecute.c,v 1.220 2005/11/04 22:38:38 msofer Exp $ + * RCS: @(#) $Id: tclExecute.c,v 1.221 2005/11/27 02:33:49 das Exp $ */ #include "tclInt.h" @@ -2353,7 +2353,9 @@ TclExecuteByteCode( { Tcl_Obj *objPtr, *incrPtr; int opnd, pcAdjustment; +#ifndef NO_WIDE_TYPE Tcl_WideInt w; +#endif long i; char *part1, *part2; Var *varPtr, *arrayPtr; diff --git a/generic/tclGetDate.y b/generic/tclGetDate.y index 8ce6df3..2351139 100644 --- a/generic/tclGetDate.y +++ b/generic/tclGetDate.y @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclGetDate.y,v 1.29 2005/11/04 20:13:30 kennykb Exp $ + * RCS: @(#) $Id: tclGetDate.y,v 1.30 2005/11/27 02:33:49 das Exp $ */ %{ @@ -157,6 +157,8 @@ static time_t ToSeconds(time_t Hours, time_t Minutes, static int LookupWord(char *buff); static int TclDatelex(void* info); +MODULE_SCOPE int yyparse (void *); + %} @@ -433,6 +435,10 @@ o_merid : /* NULL */ { %% +MODULE_SCOPE int yychar; +MODULE_SCOPE YYSTYPE yylval; +MODULE_SCOPE int yynerrs; + /* * Month and day table. */ diff --git a/generic/tclIOUtil.c b/generic/tclIOUtil.c index 349ed9d..92203cc 100644 --- a/generic/tclIOUtil.c +++ b/generic/tclIOUtil.c @@ -17,7 +17,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclIOUtil.c,v 1.125 2005/11/01 15:47:39 dkf Exp $ + * RCS: @(#) $Id: tclIOUtil.c,v 1.126 2005/11/27 02:33:49 das Exp $ */ #include "tclInt.h" @@ -49,8 +49,8 @@ static void FsRecacheFilesystemList(void); * they are not (and should not be) used anywhere else. */ -extern CONST char * tclpFileAttrStrings[]; -extern CONST TclFileAttrProcs tclpFileAttrProcs[]; +MODULE_SCOPE CONST char * tclpFileAttrStrings[]; +MODULE_SCOPE CONST TclFileAttrProcs tclpFileAttrProcs[]; /* * The following functions are obsolete string based APIs, and should be diff --git a/generic/tclInt.h b/generic/tclInt.h index 8558e14..7ad1f25 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -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: tclInt.h,v 1.258 2005/11/14 00:41:05 msofer Exp $ + * RCS: @(#) $Id: tclInt.h,v 1.259 2005/11/27 02:33:49 das Exp $ */ #ifndef _TCLINT @@ -68,7 +68,7 @@ typedef int ptrdiff_t; /* * Ensure WORDS_BIGENDIAN is defined correcly: * Needs to happen here in addition to configure to work with fat compiles on - * Darwin (i.e. ppc and i386 at the same time). + * Darwin (where configure runs only once for multiple architectures). */ #ifdef HAVE_SYS_TYPES_H diff --git a/generic/tclNamesp.c b/generic/tclNamesp.c index a1b81c0..9e48c49 100644 --- a/generic/tclNamesp.c +++ b/generic/tclNamesp.c @@ -21,7 +21,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclNamesp.c,v 1.88 2005/11/14 00:41:05 msofer Exp $ + * RCS: @(#) $Id: tclNamesp.c,v 1.89 2005/11/27 02:33:49 das Exp $ */ #include "tclInt.h" @@ -4893,7 +4893,7 @@ NamespaceEnsembleCmd( } if (objc == 5) { - Tcl_Obj *resultObj; + Tcl_Obj *resultObj = NULL; /* silence gcc 4 warning */ if (Tcl_GetIndexFromObj(interp, objv[4], configOptions, "option", 0, &index) != TCL_OK) { @@ -4913,7 +4913,7 @@ NamespaceEnsembleCmd( } break; case CONF_NAMESPACE: { - Tcl_Namespace *namespacePtr; + Tcl_Namespace *namespacePtr = NULL; /* silence gcc 4 warning */ Tcl_GetEnsembleNamespace(NULL, token, &namespacePtr); Tcl_SetResult(interp, ((Namespace *)namespacePtr)->fullName, @@ -4921,7 +4921,7 @@ NamespaceEnsembleCmd( break; } case CONF_PREFIX: { - int flags; + int flags = 0; /* silence gcc 4 warning */ Tcl_GetEnsembleFlags(NULL, token, &flags); Tcl_SetObjResult(interp, @@ -4942,9 +4942,9 @@ NamespaceEnsembleCmd( * Produce list of all information. */ - Tcl_Obj *resultObj, *tmpObj; - Tcl_Namespace *namespacePtr; - int flags; + Tcl_Obj *resultObj, *tmpObj = NULL; /* silence gcc 4 warning */ + Tcl_Namespace *namespacePtr = NULL; /* silence gcc 4 warning */ + int flags = 0; /* silence gcc 4 warning */ TclNewObj(resultObj); @@ -4999,8 +4999,9 @@ NamespaceEnsembleCmd( Tcl_DictSearch search; Tcl_Obj *listObj; int done, len, allocatedMapFlag = 0; - Tcl_Obj *subcmdObj, *mapObj, *unknownObj; /* Defaults */ - int permitPrefix, flags; + Tcl_Obj *subcmdObj = NULL, *mapObj = NULL, + *unknownObj = NULL; /* Defaults, silence gcc 4 warnings */ + int permitPrefix, flags = 0; /* silence gcc 4 warning */ Tcl_GetEnsembleSubcommandList(NULL, token, &subcmdObj); Tcl_GetEnsembleMappingDict(NULL, token, &mapObj); diff --git a/generic/tclObj.c b/generic/tclObj.c index ea66c42..54b84c8 100644 --- a/generic/tclObj.c +++ b/generic/tclObj.c @@ -12,10 +12,11 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclObj.c,v 1.101 2005/11/18 17:23:02 msofer Exp $ + * RCS: @(#) $Id: tclObj.c,v 1.102 2005/11/27 02:33:49 das Exp $ */ #include "tclInt.h" +#include "tclCompile.h" #include "tommath.h" #include <float.h> @@ -41,6 +42,7 @@ Tcl_Obj *tclFreeObjList = NULL; */ #ifdef TCL_THREADS +MODULE_SCOPE Tcl_Mutex tclObjMutex; Tcl_Mutex tclObjMutex; #endif diff --git a/generic/tclPathObj.c b/generic/tclPathObj.c index 9878f73..dd354c7 100644 --- a/generic/tclPathObj.c +++ b/generic/tclPathObj.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: tclPathObj.c,v 1.47 2005/10/12 22:21:25 dkf Exp $ + * RCS: @(#) $Id: tclPathObj.c,v 1.48 2005/11/27 02:33:49 das Exp $ */ #include "tclInt.h" @@ -33,7 +33,7 @@ static Tcl_Obj* GetExtension(Tcl_Obj *pathPtr); * internally. */ -Tcl_ObjType tclFsPathType = { +static Tcl_ObjType tclFsPathType = { "path", /* name */ FreeFsPathInternalRep, /* freeIntRepProc */ DupFsPathInternalRep, /* dupIntRepProc */ diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c index 2b87660..bb1d018 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.123 2005/10/08 14:42:45 dgp Exp $ + * RCS: @(#) $Id: tclStubInit.c,v 1.124 2005/11/27 02:33:49 das Exp $ */ #include "tclInt.h" @@ -58,6 +58,11 @@ Tcl_NotifierProcs tclOriginalNotifier = { NULL }; +MODULE_SCOPE TclIntStubs tclIntStubs; +MODULE_SCOPE TclIntPlatStubs tclIntPlatStubs; +MODULE_SCOPE TclPlatStubs tclPlatStubs; +MODULE_SCOPE TclStubs tclStubs; + /* * WARNING: The contents of this file is automatically generated by the * tools/genStubs.tcl script. Any modifications to the function declarations diff --git a/generic/tclStubLib.c b/generic/tclStubLib.c index 98b3255..3b44f98 100644 --- a/generic/tclStubLib.c +++ b/generic/tclStubLib.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: tclStubLib.c,v 1.10 2005/11/20 18:33:17 jenglish Exp $ + * RCS: @(#) $Id: tclStubLib.c,v 1.11 2005/11/27 02:33:49 das Exp $ */ /* @@ -29,9 +29,14 @@ /* * Ensure that Tcl_InitStubs is built as an exported symbol. The other stub - * functions should be built as non-exported symbols. + * symbols should be built as non-exported symbols. */ +MODULE_SCOPE TclStubs *tclStubsPtr; +MODULE_SCOPE TclPlatStubs *tclPlatStubsPtr; +MODULE_SCOPE TclIntStubs *tclIntStubsPtr; +MODULE_SCOPE TclIntPlatStubs *tclIntPlatStubsPtr; + TclStubs *tclStubsPtr = NULL; TclPlatStubs *tclPlatStubsPtr = NULL; TclIntStubs *tclIntStubsPtr = NULL; @@ -75,7 +80,7 @@ HasStubSupport( #undef Tcl_InitStubs #endif -CONST char * +MODULE_SCOPE CONST char * Tcl_InitStubs( Tcl_Interp *interp, CONST char *version, diff --git a/generic/tclThreadAlloc.c b/generic/tclThreadAlloc.c index 4ec3a1a..392d1d8 100755 --- a/generic/tclThreadAlloc.c +++ b/generic/tclThreadAlloc.c @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclThreadAlloc.c,v 1.18 2005/11/02 11:55:47 dkf Exp $ + * RCS: @(#) $Id: tclThreadAlloc.c,v 1.19 2005/11/27 02:33:49 das Exp $ */ #include "tclInt.h" @@ -611,7 +611,7 @@ TclThreadFreeObj( *---------------------------------------------------------------------- */ -void +MODULE_SCOPE void Tcl_GetMemoryInfo( Tcl_DString *dsPtr) { diff --git a/generic/tclThreadStorage.c b/generic/tclThreadStorage.c index 4e7f0ee..949b7a3 100644 --- a/generic/tclThreadStorage.c +++ b/generic/tclThreadStorage.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: tclThreadStorage.c,v 1.8 2005/10/30 22:01:36 dkf Exp $ + * RCS: @(#) $Id: tclThreadStorage.c,v 1.9 2005/11/27 02:33:49 das Exp $ */ #include "tclInt.h" @@ -51,7 +51,7 @@ static Tcl_HashTable * ThreadStorageGetHashTable(Tcl_ThreadId id); * because these hash tables MAY be used by the threaded memory allocator. */ -Tcl_HashKeyType tclThreadStorageHashKeyType = { +static Tcl_HashKeyType tclThreadStorageHashKeyType = { TCL_HASH_KEY_TYPE_VERSION, /* version */ TCL_HASH_KEY_SYSTEM_HASH | TCL_HASH_KEY_RANDOMIZE_HASH, /* flags */ diff --git a/generic/tclTrace.c b/generic/tclTrace.c index f1e43ec..2d6ef71 100644 --- a/generic/tclTrace.c +++ b/generic/tclTrace.c @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclTrace.c,v 1.30 2005/11/08 14:24:55 dkf Exp $ + * RCS: @(#) $Id: tclTrace.c,v 1.31 2005/11/27 02:33:49 das Exp $ */ #include "tclInt.h" @@ -98,9 +98,9 @@ typedef struct { typedef int (Tcl_TraceTypeObjCmd)(Tcl_Interp *interp, int optionIndex, int objc, Tcl_Obj *CONST objv[]); -Tcl_TraceTypeObjCmd TclTraceVariableObjCmd; -Tcl_TraceTypeObjCmd TclTraceCommandObjCmd; -Tcl_TraceTypeObjCmd TclTraceExecutionObjCmd; +MODULE_SCOPE Tcl_TraceTypeObjCmd TclTraceVariableObjCmd; +MODULE_SCOPE Tcl_TraceTypeObjCmd TclTraceCommandObjCmd; +MODULE_SCOPE Tcl_TraceTypeObjCmd TclTraceExecutionObjCmd; /* * Each subcommand has a number of 'types' to which it can apply. Currently diff --git a/generic/tclVar.c b/generic/tclVar.c index 22ed6f5..0bf98cf 100644 --- a/generic/tclVar.c +++ b/generic/tclVar.c @@ -15,7 +15,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclVar.c,v 1.116 2005/11/07 10:50:22 dkf Exp $ + * RCS: @(#) $Id: tclVar.c,v 1.117 2005/11/27 02:33:49 das Exp $ */ #include "tclInt.h" @@ -62,10 +62,10 @@ static int SetArraySearchObj(Tcl_Interp *interp, Tcl_Obj *objPtr); * by the bytecode compiler and engine or to the public interface. */ -Var * TclLookupSimpleVar(Tcl_Interp *interp, +MODULE_SCOPE Var * TclLookupSimpleVar(Tcl_Interp *interp, CONST char *varName, int flags, CONST int create, CONST char **errMsgPtr, int *indexPtr); -int TclObjUnsetVar2(Tcl_Interp *interp, +MODULE_SCOPE int TclObjUnsetVar2(Tcl_Interp *interp, Tcl_Obj *part1Ptr, CONST char *part2, int flags); static Tcl_DupInternalRepProc DupLocalVarName; @@ -111,13 +111,13 @@ static Tcl_ObjType localVarNameType = { static Tcl_FreeInternalRepProc FreeNsVarName; static Tcl_DupInternalRepProc DupNsVarName; -Tcl_ObjType tclNsVarNameType = { +static Tcl_ObjType tclNsVarNameType = { "namespaceVarName", FreeNsVarName, DupNsVarName, PanicOnUpdateVarName, PanicOnSetVarName }; #endif -Tcl_ObjType tclParsedVarNameType = { +static Tcl_ObjType tclParsedVarNameType = { "parsedVarName", FreeParsedVarName, DupParsedVarName, UpdateParsedVarName, PanicOnSetVarName }; diff --git a/generic/tommath.h b/generic/tommath.h index ed2b986..8bb3675 100644 --- a/generic/tommath.h +++ b/generic/tommath.h @@ -21,6 +21,9 @@ #ifndef TOMMATH_STORAGE_CLASS #define TOMMATH_STORAGE_CLASS extern #endif +#ifndef MODULE_SCOPE +#define MODULE_SCOPE extern +#endif #include <stdio.h> #include <string.h> @@ -174,7 +177,7 @@ extern "C" { typedef int mp_err; /* you'll have to tune these... */ -extern int KARATSUBA_MUL_CUTOFF, +MODULE_SCOPE int KARATSUBA_MUL_CUTOFF, KARATSUBA_SQR_CUTOFF, TOOM_MUL_CUTOFF, TOOM_SQR_CUTOFF; @@ -213,7 +216,7 @@ typedef int ltm_prime_callback(unsigned char *dst, int len, void *dat); #define SIGN(m) ((m)->sign) /* error code to char* string */ -TOMMATH_STORAGE_CLASS char *mp_error_to_string(int code); +TOMMATH_STORAGE_CLASS MODULE_SCOPE char *mp_error_to_string(int code); /* ---> init and deinit bignum functions <--- */ /* init a bignum */ @@ -223,22 +226,22 @@ TOMMATH_STORAGE_CLASS int mp_init(mp_int *a); TOMMATH_STORAGE_CLASS void mp_clear(mp_int *a); /* init a null terminated series of arguments */ -TOMMATH_STORAGE_CLASS int mp_init_multi(mp_int *mp, ...); +TOMMATH_STORAGE_CLASS MODULE_SCOPE int mp_init_multi(mp_int *mp, ...); /* clear a null terminated series of arguments */ -TOMMATH_STORAGE_CLASS void mp_clear_multi(mp_int *mp, ...); +TOMMATH_STORAGE_CLASS MODULE_SCOPE void mp_clear_multi(mp_int *mp, ...); /* exchange two ints */ -TOMMATH_STORAGE_CLASS void mp_exch(mp_int *a, mp_int *b); +TOMMATH_STORAGE_CLASS MODULE_SCOPE void mp_exch(mp_int *a, mp_int *b); /* shrink ram required for a bignum */ -TOMMATH_STORAGE_CLASS int mp_shrink(mp_int *a); +TOMMATH_STORAGE_CLASS MODULE_SCOPE int mp_shrink(mp_int *a); /* grow an int to a given size */ -TOMMATH_STORAGE_CLASS int mp_grow(mp_int *a, int size); +TOMMATH_STORAGE_CLASS MODULE_SCOPE int mp_grow(mp_int *a, int size); /* init to a given number of digits */ -TOMMATH_STORAGE_CLASS int mp_init_size(mp_int *a, int size); +TOMMATH_STORAGE_CLASS MODULE_SCOPE int mp_init_size(mp_int *a, int size); /* ---> Basic Manipulations <--- */ #define mp_iszero(a) (((a)->used == 0) ? MP_YES : MP_NO) @@ -246,118 +249,118 @@ TOMMATH_STORAGE_CLASS int mp_init_size(mp_int *a, int size); #define mp_isodd(a) (((a)->used > 0 && (((a)->dp[0] & 1) == 1)) ? MP_YES : MP_NO) /* set to zero */ -TOMMATH_STORAGE_CLASS void mp_zero(mp_int *a); +TOMMATH_STORAGE_CLASS MODULE_SCOPE void mp_zero(mp_int *a); /* set to a digit */ -TOMMATH_STORAGE_CLASS void mp_set(mp_int *a, mp_digit b); +TOMMATH_STORAGE_CLASS MODULE_SCOPE void mp_set(mp_int *a, mp_digit b); /* set a 32-bit const */ -TOMMATH_STORAGE_CLASS int mp_set_int(mp_int *a, unsigned long b); +TOMMATH_STORAGE_CLASS MODULE_SCOPE int mp_set_int(mp_int *a, unsigned long b); /* get a 32-bit value */ unsigned long mp_get_int(mp_int * a); /* initialize and set a digit */ -TOMMATH_STORAGE_CLASS int mp_init_set (mp_int * a, mp_digit b); +TOMMATH_STORAGE_CLASS MODULE_SCOPE int mp_init_set (mp_int * a, mp_digit b); /* initialize and set 32-bit value */ -TOMMATH_STORAGE_CLASS int mp_init_set_int (mp_int * a, unsigned long b); +TOMMATH_STORAGE_CLASS MODULE_SCOPE int mp_init_set_int (mp_int * a, unsigned long b); /* copy, b = a */ -TOMMATH_STORAGE_CLASS int mp_copy(mp_int *a, mp_int *b); +TOMMATH_STORAGE_CLASS MODULE_SCOPE int mp_copy(mp_int *a, mp_int *b); /* inits and copies, a = b */ -TOMMATH_STORAGE_CLASS int mp_init_copy(mp_int *a, mp_int *b); +TOMMATH_STORAGE_CLASS MODULE_SCOPE int mp_init_copy(mp_int *a, mp_int *b); /* trim unused digits */ -TOMMATH_STORAGE_CLASS void mp_clamp(mp_int *a); +TOMMATH_STORAGE_CLASS MODULE_SCOPE void mp_clamp(mp_int *a); /* ---> digit manipulation <--- */ /* right shift by "b" digits */ -TOMMATH_STORAGE_CLASS void mp_rshd(mp_int *a, int b); +TOMMATH_STORAGE_CLASS MODULE_SCOPE void mp_rshd(mp_int *a, int b); /* left shift by "b" digits */ -TOMMATH_STORAGE_CLASS int mp_lshd(mp_int *a, int b); +TOMMATH_STORAGE_CLASS MODULE_SCOPE int mp_lshd(mp_int *a, int b); /* c = a / 2**b */ -TOMMATH_STORAGE_CLASS int mp_div_2d(mp_int *a, int b, mp_int *c, mp_int *d); +TOMMATH_STORAGE_CLASS MODULE_SCOPE int mp_div_2d(mp_int *a, int b, mp_int *c, mp_int *d); /* b = a/2 */ -TOMMATH_STORAGE_CLASS int mp_div_2(mp_int *a, mp_int *b); +TOMMATH_STORAGE_CLASS MODULE_SCOPE int mp_div_2(mp_int *a, mp_int *b); /* c = a * 2**b */ -TOMMATH_STORAGE_CLASS int mp_mul_2d(mp_int *a, int b, mp_int *c); +TOMMATH_STORAGE_CLASS MODULE_SCOPE int mp_mul_2d(mp_int *a, int b, mp_int *c); /* b = a*2 */ -TOMMATH_STORAGE_CLASS int mp_mul_2(mp_int *a, mp_int *b); +TOMMATH_STORAGE_CLASS MODULE_SCOPE int mp_mul_2(mp_int *a, mp_int *b); /* c = a mod 2**d */ -TOMMATH_STORAGE_CLASS int mp_mod_2d(mp_int *a, int b, mp_int *c); +TOMMATH_STORAGE_CLASS MODULE_SCOPE int mp_mod_2d(mp_int *a, int b, mp_int *c); /* computes a = 2**b */ -TOMMATH_STORAGE_CLASS int mp_2expt(mp_int *a, int b); +TOMMATH_STORAGE_CLASS MODULE_SCOPE int mp_2expt(mp_int *a, int b); /* Counts the number of lsbs which are zero before the first zero bit */ -TOMMATH_STORAGE_CLASS int mp_cnt_lsb(mp_int *a); +TOMMATH_STORAGE_CLASS MODULE_SCOPE int mp_cnt_lsb(mp_int *a); /* I Love Earth! */ /* makes a pseudo-random int of a given size */ -TOMMATH_STORAGE_CLASS int mp_rand(mp_int *a, int digits); +TOMMATH_STORAGE_CLASS MODULE_SCOPE int mp_rand(mp_int *a, int digits); /* ---> binary operations <--- */ /* c = a XOR b */ -TOMMATH_STORAGE_CLASS int mp_xor(mp_int *a, mp_int *b, mp_int *c); +TOMMATH_STORAGE_CLASS MODULE_SCOPE int mp_xor(mp_int *a, mp_int *b, mp_int *c); /* c = a OR b */ -TOMMATH_STORAGE_CLASS int mp_or(mp_int *a, mp_int *b, mp_int *c); +TOMMATH_STORAGE_CLASS MODULE_SCOPE int mp_or(mp_int *a, mp_int *b, mp_int *c); /* c = a AND b */ -TOMMATH_STORAGE_CLASS int mp_and(mp_int *a, mp_int *b, mp_int *c); +TOMMATH_STORAGE_CLASS MODULE_SCOPE int mp_and(mp_int *a, mp_int *b, mp_int *c); /* ---> Basic arithmetic <--- */ /* b = -a */ -TOMMATH_STORAGE_CLASS int mp_neg(mp_int *a, mp_int *b); +TOMMATH_STORAGE_CLASS MODULE_SCOPE int mp_neg(mp_int *a, mp_int *b); /* b = |a| */ -TOMMATH_STORAGE_CLASS int mp_abs(mp_int *a, mp_int *b); +TOMMATH_STORAGE_CLASS MODULE_SCOPE int mp_abs(mp_int *a, mp_int *b); /* compare a to b */ -TOMMATH_STORAGE_CLASS int mp_cmp(mp_int *a, mp_int *b); +TOMMATH_STORAGE_CLASS MODULE_SCOPE int mp_cmp(mp_int *a, mp_int *b); /* compare |a| to |b| */ -TOMMATH_STORAGE_CLASS int mp_cmp_mag(mp_int *a, mp_int *b); +TOMMATH_STORAGE_CLASS MODULE_SCOPE int mp_cmp_mag(mp_int *a, mp_int *b); /* c = a + b */ -TOMMATH_STORAGE_CLASS int mp_add(mp_int *a, mp_int *b, mp_int *c); +TOMMATH_STORAGE_CLASS MODULE_SCOPE int mp_add(mp_int *a, mp_int *b, mp_int *c); /* c = a - b */ -TOMMATH_STORAGE_CLASS int mp_sub(mp_int *a, mp_int *b, mp_int *c); +TOMMATH_STORAGE_CLASS MODULE_SCOPE int mp_sub(mp_int *a, mp_int *b, mp_int *c); /* c = a * b */ -TOMMATH_STORAGE_CLASS int mp_mul(mp_int *a, mp_int *b, mp_int *c); +TOMMATH_STORAGE_CLASS MODULE_SCOPE int mp_mul(mp_int *a, mp_int *b, mp_int *c); /* b = a*a */ -TOMMATH_STORAGE_CLASS int mp_sqr(mp_int *a, mp_int *b); +TOMMATH_STORAGE_CLASS MODULE_SCOPE int mp_sqr(mp_int *a, mp_int *b); /* a/b => cb + d == a */ -TOMMATH_STORAGE_CLASS int mp_div(mp_int *a, mp_int *b, mp_int *c, mp_int *d); +TOMMATH_STORAGE_CLASS MODULE_SCOPE int mp_div(mp_int *a, mp_int *b, mp_int *c, mp_int *d); /* c = a mod b, 0 <= c < b */ -TOMMATH_STORAGE_CLASS int mp_mod(mp_int *a, mp_int *b, mp_int *c); +TOMMATH_STORAGE_CLASS MODULE_SCOPE int mp_mod(mp_int *a, mp_int *b, mp_int *c); /* ---> single digit functions <--- */ /* compare against a single digit */ -TOMMATH_STORAGE_CLASS int mp_cmp_d(mp_int *a, mp_digit b); +TOMMATH_STORAGE_CLASS MODULE_SCOPE int mp_cmp_d(mp_int *a, mp_digit b); /* c = a + b */ -TOMMATH_STORAGE_CLASS int mp_add_d(mp_int *a, mp_digit b, mp_int *c); +TOMMATH_STORAGE_CLASS MODULE_SCOPE int mp_add_d(mp_int *a, mp_digit b, mp_int *c); /* c = a - b */ -TOMMATH_STORAGE_CLASS int mp_sub_d(mp_int *a, mp_digit b, mp_int *c); +TOMMATH_STORAGE_CLASS MODULE_SCOPE int mp_sub_d(mp_int *a, mp_digit b, mp_int *c); /* c = a * b */ TOMMATH_STORAGE_CLASS int mp_mul_d(mp_int *a, mp_digit b, mp_int *c); @@ -366,105 +369,105 @@ TOMMATH_STORAGE_CLASS int mp_mul_d(mp_int *a, mp_digit b, mp_int *c); TOMMATH_STORAGE_CLASS int mp_div_d(mp_int *a, mp_digit b, mp_int *c, mp_digit *d); /* a/3 => 3c + d == a */ -TOMMATH_STORAGE_CLASS int mp_div_3(mp_int *a, mp_int *c, mp_digit *d); +TOMMATH_STORAGE_CLASS MODULE_SCOPE int mp_div_3(mp_int *a, mp_int *c, mp_digit *d); /* c = a**b */ -TOMMATH_STORAGE_CLASS int mp_expt_d(mp_int *a, mp_digit b, mp_int *c); +TOMMATH_STORAGE_CLASS MODULE_SCOPE int mp_expt_d(mp_int *a, mp_digit b, mp_int *c); /* c = a mod b, 0 <= c < b */ -TOMMATH_STORAGE_CLASS int mp_mod_d(mp_int *a, mp_digit b, mp_digit *c); +TOMMATH_STORAGE_CLASS MODULE_SCOPE int mp_mod_d(mp_int *a, mp_digit b, mp_digit *c); /* ---> number theory <--- */ /* d = a + b (mod c) */ -TOMMATH_STORAGE_CLASS int mp_addmod(mp_int *a, mp_int *b, mp_int *c, mp_int *d); +TOMMATH_STORAGE_CLASS MODULE_SCOPE int mp_addmod(mp_int *a, mp_int *b, mp_int *c, mp_int *d); /* d = a - b (mod c) */ -TOMMATH_STORAGE_CLASS int mp_submod(mp_int *a, mp_int *b, mp_int *c, mp_int *d); +TOMMATH_STORAGE_CLASS MODULE_SCOPE int mp_submod(mp_int *a, mp_int *b, mp_int *c, mp_int *d); /* d = a * b (mod c) */ -TOMMATH_STORAGE_CLASS int mp_mulmod(mp_int *a, mp_int *b, mp_int *c, mp_int *d); +TOMMATH_STORAGE_CLASS MODULE_SCOPE int mp_mulmod(mp_int *a, mp_int *b, mp_int *c, mp_int *d); /* c = a * a (mod b) */ -TOMMATH_STORAGE_CLASS int mp_sqrmod(mp_int *a, mp_int *b, mp_int *c); +TOMMATH_STORAGE_CLASS MODULE_SCOPE int mp_sqrmod(mp_int *a, mp_int *b, mp_int *c); /* c = 1/a (mod b) */ -TOMMATH_STORAGE_CLASS int mp_invmod(mp_int *a, mp_int *b, mp_int *c); +TOMMATH_STORAGE_CLASS MODULE_SCOPE int mp_invmod(mp_int *a, mp_int *b, mp_int *c); /* c = (a, b) */ -TOMMATH_STORAGE_CLASS int mp_gcd(mp_int *a, mp_int *b, mp_int *c); +TOMMATH_STORAGE_CLASS MODULE_SCOPE int mp_gcd(mp_int *a, mp_int *b, mp_int *c); /* produces value such that U1*a + U2*b = U3 */ -TOMMATH_STORAGE_CLASS int mp_exteuclid(mp_int *a, mp_int *b, mp_int *U1, mp_int *U2, mp_int *U3); +TOMMATH_STORAGE_CLASS MODULE_SCOPE int mp_exteuclid(mp_int *a, mp_int *b, mp_int *U1, mp_int *U2, mp_int *U3); /* c = [a, b] or (a*b)/(a, b) */ -TOMMATH_STORAGE_CLASS int mp_lcm(mp_int *a, mp_int *b, mp_int *c); +TOMMATH_STORAGE_CLASS MODULE_SCOPE int mp_lcm(mp_int *a, mp_int *b, mp_int *c); /* finds one of the b'th root of a, such that |c|**b <= |a| * * returns error if a < 0 and b is even */ -TOMMATH_STORAGE_CLASS int mp_n_root(mp_int *a, mp_digit b, mp_int *c); +TOMMATH_STORAGE_CLASS MODULE_SCOPE int mp_n_root(mp_int *a, mp_digit b, mp_int *c); /* special sqrt algo */ -TOMMATH_STORAGE_CLASS int mp_sqrt(mp_int *arg, mp_int *ret); +TOMMATH_STORAGE_CLASS MODULE_SCOPE int mp_sqrt(mp_int *arg, mp_int *ret); /* is number a square? */ -TOMMATH_STORAGE_CLASS int mp_is_square(mp_int *arg, int *ret); +TOMMATH_STORAGE_CLASS MODULE_SCOPE int mp_is_square(mp_int *arg, int *ret); /* computes the jacobi c = (a | n) (or Legendre if b is prime) */ -TOMMATH_STORAGE_CLASS int mp_jacobi(mp_int *a, mp_int *n, int *c); +TOMMATH_STORAGE_CLASS MODULE_SCOPE int mp_jacobi(mp_int *a, mp_int *n, int *c); /* used to setup the Barrett reduction for a given modulus b */ -TOMMATH_STORAGE_CLASS int mp_reduce_setup(mp_int *a, mp_int *b); +TOMMATH_STORAGE_CLASS MODULE_SCOPE int mp_reduce_setup(mp_int *a, mp_int *b); /* Barrett Reduction, computes a (mod b) with a precomputed value c * * Assumes that 0 < a <= b*b, note if 0 > a > -(b*b) then you can merely * compute the reduction as -1 * mp_reduce(mp_abs(a)) [pseudo code]. */ -TOMMATH_STORAGE_CLASS int mp_reduce(mp_int *a, mp_int *b, mp_int *c); +TOMMATH_STORAGE_CLASS MODULE_SCOPE int mp_reduce(mp_int *a, mp_int *b, mp_int *c); /* setups the montgomery reduction */ -TOMMATH_STORAGE_CLASS int mp_montgomery_setup(mp_int *a, mp_digit *mp); +TOMMATH_STORAGE_CLASS MODULE_SCOPE int mp_montgomery_setup(mp_int *a, mp_digit *mp); /* computes a = B**n mod b without division or multiplication useful for * normalizing numbers in a Montgomery system. */ -TOMMATH_STORAGE_CLASS int mp_montgomery_calc_normalization(mp_int *a, mp_int *b); +TOMMATH_STORAGE_CLASS MODULE_SCOPE int mp_montgomery_calc_normalization(mp_int *a, mp_int *b); /* computes x/R == x (mod N) via Montgomery Reduction */ -TOMMATH_STORAGE_CLASS int mp_montgomery_reduce(mp_int *a, mp_int *m, mp_digit mp); +TOMMATH_STORAGE_CLASS MODULE_SCOPE int mp_montgomery_reduce(mp_int *a, mp_int *m, mp_digit mp); /* returns 1 if a is a valid DR modulus */ -TOMMATH_STORAGE_CLASS int mp_dr_is_modulus(mp_int *a); +TOMMATH_STORAGE_CLASS MODULE_SCOPE int mp_dr_is_modulus(mp_int *a); /* sets the value of "d" required for mp_dr_reduce */ -TOMMATH_STORAGE_CLASS void mp_dr_setup(mp_int *a, mp_digit *d); +TOMMATH_STORAGE_CLASS MODULE_SCOPE void mp_dr_setup(mp_int *a, mp_digit *d); /* reduces a modulo b using the Diminished Radix method */ -TOMMATH_STORAGE_CLASS int mp_dr_reduce(mp_int *a, mp_int *b, mp_digit mp); +TOMMATH_STORAGE_CLASS MODULE_SCOPE int mp_dr_reduce(mp_int *a, mp_int *b, mp_digit mp); /* returns true if a can be reduced with mp_reduce_2k */ -TOMMATH_STORAGE_CLASS int mp_reduce_is_2k(mp_int *a); +TOMMATH_STORAGE_CLASS MODULE_SCOPE int mp_reduce_is_2k(mp_int *a); /* determines k value for 2k reduction */ -TOMMATH_STORAGE_CLASS int mp_reduce_2k_setup(mp_int *a, mp_digit *d); +TOMMATH_STORAGE_CLASS MODULE_SCOPE int mp_reduce_2k_setup(mp_int *a, mp_digit *d); /* reduces a modulo b where b is of the form 2**p - k [0 <= a] */ -TOMMATH_STORAGE_CLASS int mp_reduce_2k(mp_int *a, mp_int *n, mp_digit d); +TOMMATH_STORAGE_CLASS MODULE_SCOPE int mp_reduce_2k(mp_int *a, mp_int *n, mp_digit d); /* returns true if a can be reduced with mp_reduce_2k_l */ -TOMMATH_STORAGE_CLASS int mp_reduce_is_2k_l(mp_int *a); +TOMMATH_STORAGE_CLASS MODULE_SCOPE int mp_reduce_is_2k_l(mp_int *a); /* determines k value for 2k reduction */ -TOMMATH_STORAGE_CLASS int mp_reduce_2k_setup_l(mp_int *a, mp_int *d); +TOMMATH_STORAGE_CLASS MODULE_SCOPE int mp_reduce_2k_setup_l(mp_int *a, mp_int *d); /* reduces a modulo b where b is of the form 2**p - k [0 <= a] */ -TOMMATH_STORAGE_CLASS int mp_reduce_2k_l(mp_int *a, mp_int *n, mp_int *d); +TOMMATH_STORAGE_CLASS MODULE_SCOPE int mp_reduce_2k_l(mp_int *a, mp_int *n, mp_int *d); /* d = a**b (mod c) */ -TOMMATH_STORAGE_CLASS int mp_exptmod(mp_int *a, mp_int *b, mp_int *c, mp_int *d); +TOMMATH_STORAGE_CLASS MODULE_SCOPE int mp_exptmod(mp_int *a, mp_int *b, mp_int *c, mp_int *d); /* ---> Primes <--- */ @@ -476,25 +479,25 @@ TOMMATH_STORAGE_CLASS int mp_exptmod(mp_int *a, mp_int *b, mp_int *c, mp_int *d) #endif /* table of first PRIME_SIZE primes */ -extern const mp_digit ltm_prime_tab[]; +MODULE_SCOPE const mp_digit ltm_prime_tab[]; /* result=1 if a is divisible by one of the first PRIME_SIZE primes */ -TOMMATH_STORAGE_CLASS int mp_prime_is_divisible(mp_int *a, int *result); +TOMMATH_STORAGE_CLASS MODULE_SCOPE int mp_prime_is_divisible(mp_int *a, int *result); /* performs one Fermat test of "a" using base "b". * Sets result to 0 if composite or 1 if probable prime */ -TOMMATH_STORAGE_CLASS int mp_prime_fermat(mp_int *a, mp_int *b, int *result); +TOMMATH_STORAGE_CLASS MODULE_SCOPE int mp_prime_fermat(mp_int *a, mp_int *b, int *result); /* performs one Miller-Rabin test of "a" using base "b". * Sets result to 0 if composite or 1 if probable prime */ -TOMMATH_STORAGE_CLASS int mp_prime_miller_rabin(mp_int *a, mp_int *b, int *result); +TOMMATH_STORAGE_CLASS MODULE_SCOPE int mp_prime_miller_rabin(mp_int *a, mp_int *b, int *result); /* This gives [for a given bit size] the number of trials required * such that Miller-Rabin gives a prob of failure lower than 2^-96 */ -TOMMATH_STORAGE_CLASS int mp_prime_rabin_miller_trials(int size); +TOMMATH_STORAGE_CLASS MODULE_SCOPE int mp_prime_rabin_miller_trials(int size); /* performs t rounds of Miller-Rabin on "a" using the first * t prime bases. Also performs an initial sieve of trial @@ -503,14 +506,14 @@ TOMMATH_STORAGE_CLASS int mp_prime_rabin_miller_trials(int size); * * Sets result to 1 if probably prime, 0 otherwise */ -TOMMATH_STORAGE_CLASS int mp_prime_is_prime(mp_int *a, int t, int *result); +TOMMATH_STORAGE_CLASS MODULE_SCOPE int mp_prime_is_prime(mp_int *a, int t, int *result); /* finds the next prime after the number "a" using "t" trials * of Miller-Rabin. * * bbs_style = 1 means the prime must be congruent to 3 mod 4 */ -TOMMATH_STORAGE_CLASS int mp_prime_next_prime(mp_int *a, int t, int bbs_style); +TOMMATH_STORAGE_CLASS MODULE_SCOPE int mp_prime_next_prime(mp_int *a, int t, int bbs_style); /* makes a truly random prime of a given size (bytes), * call with bbs = 1 if you want it to be congruent to 3 mod 4 @@ -537,28 +540,28 @@ TOMMATH_STORAGE_CLASS int mp_prime_next_prime(mp_int *a, int t, int bbs_style); * so it can be NULL * */ -TOMMATH_STORAGE_CLASS int mp_prime_random_ex(mp_int *a, int t, int size, int flags, ltm_prime_callback cb, void *dat); +TOMMATH_STORAGE_CLASS MODULE_SCOPE int mp_prime_random_ex(mp_int *a, int t, int size, int flags, ltm_prime_callback cb, void *dat); /* ---> radix conversion <--- */ -TOMMATH_STORAGE_CLASS int mp_count_bits(mp_int *a); +TOMMATH_STORAGE_CLASS MODULE_SCOPE int mp_count_bits(mp_int *a); -TOMMATH_STORAGE_CLASS int mp_unsigned_bin_size(mp_int *a); -TOMMATH_STORAGE_CLASS int mp_read_unsigned_bin(mp_int *a, const unsigned char *b, int c); -TOMMATH_STORAGE_CLASS int mp_to_unsigned_bin(mp_int *a, unsigned char *b); -TOMMATH_STORAGE_CLASS int mp_to_unsigned_bin_n (mp_int * a, unsigned char *b, unsigned long *outlen); +TOMMATH_STORAGE_CLASS MODULE_SCOPE int mp_unsigned_bin_size(mp_int *a); +TOMMATH_STORAGE_CLASS MODULE_SCOPE int mp_read_unsigned_bin(mp_int *a, const unsigned char *b, int c); +TOMMATH_STORAGE_CLASS MODULE_SCOPE int mp_to_unsigned_bin(mp_int *a, unsigned char *b); +TOMMATH_STORAGE_CLASS MODULE_SCOPE int mp_to_unsigned_bin_n (mp_int * a, unsigned char *b, unsigned long *outlen); -TOMMATH_STORAGE_CLASS int mp_signed_bin_size(mp_int *a); -TOMMATH_STORAGE_CLASS int mp_read_signed_bin(mp_int *a, const unsigned char *b, int c); -TOMMATH_STORAGE_CLASS int mp_to_signed_bin(mp_int *a, unsigned char *b); -TOMMATH_STORAGE_CLASS int mp_to_signed_bin_n (mp_int * a, unsigned char *b, unsigned long *outlen); +TOMMATH_STORAGE_CLASS MODULE_SCOPE int mp_signed_bin_size(mp_int *a); +TOMMATH_STORAGE_CLASS MODULE_SCOPE int mp_read_signed_bin(mp_int *a, const unsigned char *b, int c); +TOMMATH_STORAGE_CLASS MODULE_SCOPE int mp_to_signed_bin(mp_int *a, unsigned char *b); +TOMMATH_STORAGE_CLASS MODULE_SCOPE int mp_to_signed_bin_n (mp_int * a, unsigned char *b, unsigned long *outlen); TOMMATH_STORAGE_CLASS int mp_read_radix(mp_int *a, const char *str, int radix); -TOMMATH_STORAGE_CLASS int mp_toradix(mp_int *a, char *str, int radix); -TOMMATH_STORAGE_CLASS int mp_toradix_n(mp_int * a, char *str, int radix, int maxlen); -TOMMATH_STORAGE_CLASS int mp_radix_size(mp_int *a, int radix, int *size); +TOMMATH_STORAGE_CLASS MODULE_SCOPE int mp_toradix(mp_int *a, char *str, int radix); +TOMMATH_STORAGE_CLASS MODULE_SCOPE int mp_toradix_n(mp_int * a, char *str, int radix, int maxlen); +TOMMATH_STORAGE_CLASS MODULE_SCOPE int mp_radix_size(mp_int *a, int radix, int *size); -TOMMATH_STORAGE_CLASS int mp_fread(mp_int *a, int radix, FILE *stream); -TOMMATH_STORAGE_CLASS int mp_fwrite(mp_int *a, int radix, FILE *stream); +TOMMATH_STORAGE_CLASS MODULE_SCOPE int mp_fread(mp_int *a, int radix, FILE *stream); +TOMMATH_STORAGE_CLASS MODULE_SCOPE int mp_fwrite(mp_int *a, int radix, FILE *stream); #define mp_read_raw(mp, str, len) mp_read_signed_bin((mp), (str), (len)) #define mp_raw_size(mp) mp_signed_bin_size(mp) @@ -573,27 +576,27 @@ TOMMATH_STORAGE_CLASS int mp_fwrite(mp_int *a, int radix, FILE *stream); #define mp_tohex(M, S) mp_toradix((M), (S), 16) /* lowlevel functions, do not call! */ -TOMMATH_STORAGE_CLASS int s_mp_add(mp_int *a, mp_int *b, mp_int *c); -TOMMATH_STORAGE_CLASS int s_mp_sub(mp_int *a, mp_int *b, mp_int *c); +TOMMATH_STORAGE_CLASS MODULE_SCOPE int s_mp_add(mp_int *a, mp_int *b, mp_int *c); +TOMMATH_STORAGE_CLASS MODULE_SCOPE int s_mp_sub(mp_int *a, mp_int *b, mp_int *c); #define s_mp_mul(a, b, c) s_mp_mul_digs(a, b, c, (a)->used + (b)->used + 1) -TOMMATH_STORAGE_CLASS int fast_s_mp_mul_digs(mp_int *a, mp_int *b, mp_int *c, int digs); -TOMMATH_STORAGE_CLASS int s_mp_mul_digs(mp_int *a, mp_int *b, mp_int *c, int digs); -TOMMATH_STORAGE_CLASS int fast_s_mp_mul_high_digs(mp_int *a, mp_int *b, mp_int *c, int digs); -TOMMATH_STORAGE_CLASS int s_mp_mul_high_digs(mp_int *a, mp_int *b, mp_int *c, int digs); -TOMMATH_STORAGE_CLASS int fast_s_mp_sqr(mp_int *a, mp_int *b); -TOMMATH_STORAGE_CLASS int s_mp_sqr(mp_int *a, mp_int *b); -TOMMATH_STORAGE_CLASS int mp_karatsuba_mul(mp_int *a, mp_int *b, mp_int *c); -TOMMATH_STORAGE_CLASS int mp_toom_mul(mp_int *a, mp_int *b, mp_int *c); -TOMMATH_STORAGE_CLASS int mp_karatsuba_sqr(mp_int *a, mp_int *b); -TOMMATH_STORAGE_CLASS int mp_toom_sqr(mp_int *a, mp_int *b); -TOMMATH_STORAGE_CLASS int fast_mp_invmod(mp_int *a, mp_int *b, mp_int *c); -TOMMATH_STORAGE_CLASS int mp_invmod_slow (mp_int * a, mp_int * b, mp_int * c); -TOMMATH_STORAGE_CLASS int fast_mp_montgomery_reduce(mp_int *a, mp_int *m, mp_digit mp); -TOMMATH_STORAGE_CLASS int mp_exptmod_fast(mp_int *G, mp_int *X, mp_int *P, mp_int *Y, int mode); -TOMMATH_STORAGE_CLASS int s_mp_exptmod (mp_int * G, mp_int * X, mp_int * P, mp_int * Y, int mode); -TOMMATH_STORAGE_CLASS void bn_reverse(unsigned char *s, int len); - -extern const char *mp_s_rmap; +TOMMATH_STORAGE_CLASS MODULE_SCOPE int fast_s_mp_mul_digs(mp_int *a, mp_int *b, mp_int *c, int digs); +TOMMATH_STORAGE_CLASS MODULE_SCOPE int s_mp_mul_digs(mp_int *a, mp_int *b, mp_int *c, int digs); +TOMMATH_STORAGE_CLASS MODULE_SCOPE int fast_s_mp_mul_high_digs(mp_int *a, mp_int *b, mp_int *c, int digs); +TOMMATH_STORAGE_CLASS MODULE_SCOPE int s_mp_mul_high_digs(mp_int *a, mp_int *b, mp_int *c, int digs); +TOMMATH_STORAGE_CLASS MODULE_SCOPE int fast_s_mp_sqr(mp_int *a, mp_int *b); +TOMMATH_STORAGE_CLASS MODULE_SCOPE int s_mp_sqr(mp_int *a, mp_int *b); +TOMMATH_STORAGE_CLASS MODULE_SCOPE int mp_karatsuba_mul(mp_int *a, mp_int *b, mp_int *c); +TOMMATH_STORAGE_CLASS MODULE_SCOPE int mp_toom_mul(mp_int *a, mp_int *b, mp_int *c); +TOMMATH_STORAGE_CLASS MODULE_SCOPE int mp_karatsuba_sqr(mp_int *a, mp_int *b); +TOMMATH_STORAGE_CLASS MODULE_SCOPE int mp_toom_sqr(mp_int *a, mp_int *b); +TOMMATH_STORAGE_CLASS MODULE_SCOPE int fast_mp_invmod(mp_int *a, mp_int *b, mp_int *c); +TOMMATH_STORAGE_CLASS MODULE_SCOPE int mp_invmod_slow (mp_int * a, mp_int * b, mp_int * c); +TOMMATH_STORAGE_CLASS MODULE_SCOPE int fast_mp_montgomery_reduce(mp_int *a, mp_int *m, mp_digit mp); +TOMMATH_STORAGE_CLASS MODULE_SCOPE int mp_exptmod_fast(mp_int *G, mp_int *X, mp_int *P, mp_int *Y, int mode); +TOMMATH_STORAGE_CLASS MODULE_SCOPE int s_mp_exptmod (mp_int * G, mp_int * X, mp_int * P, mp_int * Y, int mode); +TOMMATH_STORAGE_CLASS MODULE_SCOPE void bn_reverse(unsigned char *s, int len); + +MODULE_SCOPE const char *mp_s_rmap; #ifdef __cplusplus } @@ -603,6 +606,6 @@ extern const char *mp_s_rmap; /* $Source: /root/tcl/repos-to-convert/tcl/generic/tommath.h,v $ */ -/* $Revision: 1.4 $ */ -/* $Date: 2005/10/08 14:42:45 $ */ +/* $Revision: 1.5 $ */ +/* $Date: 2005/11/27 02:33:49 $ */ |