From fd1bb5e2a2a81897608067cf5b4cfcddd0d0a923 Mon Sep 17 00:00:00 2001 From: nijtmans Date: Mon, 3 May 2010 11:37:32 +0000 Subject: Use "tclIO.h" and "tclTomMathDecls.h" everywhere --- ChangeLog | 8 +++++++ generic/tclIORChan.c | 4 ++-- generic/tclIORTrans.c | 4 ++-- generic/tclTomMath.h | 62 +++++++++++++++++++++++++------------------------ libtommath/tommath.h | 60 +++++++++++++++++++++++------------------------ tools/fix_tommath_h.tcl | 8 +++++-- 6 files changed, 80 insertions(+), 66 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8a41218..036414b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2010-05-03 Jan Nijtmans + + * generic/tclIORChan.c Use "tclIO.h" and "tclTomMathDecls.h" + * generic/tclIORTrans.c everywhere + * generic/tclTomMath.h + * tools/fix_tommath_h.tcl + * libtommath/tommath.h Formatting (# should always be first char on line) + 2010-04-30 Don Porter * generic/tcl.h: Bump patchlevel to 8.6b1.2 to distinguish diff --git a/generic/tclIORChan.c b/generic/tclIORChan.c index 4d9832c..2f4716e 100644 --- a/generic/tclIORChan.c +++ b/generic/tclIORChan.c @@ -15,11 +15,11 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclIORChan.c,v 1.48 2010/04/27 12:36:22 nijtmans Exp $ + * RCS: @(#) $Id: tclIORChan.c,v 1.49 2010/05/03 11:37:56 nijtmans Exp $ */ #include "tclInt.h" -#include +#include "tclIO.h" #include #ifndef EINVAL diff --git a/generic/tclIORTrans.c b/generic/tclIORTrans.c index 608ff88..ae1ffc0 100644 --- a/generic/tclIORTrans.c +++ b/generic/tclIORTrans.c @@ -15,11 +15,11 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclIORTrans.c,v 1.16 2010/04/27 12:36:21 nijtmans Exp $ + * RCS: @(#) $Id: tclIORTrans.c,v 1.17 2010/05/03 11:37:32 nijtmans Exp $ */ #include "tclInt.h" -#include +#include "tclIO.h" #include #ifndef EINVAL diff --git a/generic/tclTomMath.h b/generic/tclTomMath.h index 4e28663..73fd7aa 100644 --- a/generic/tclTomMath.h +++ b/generic/tclTomMath.h @@ -16,17 +16,19 @@ #define BN_H_ #include "tclInt.h" -#include +#include "tclTomMathDecls.h" #ifndef MODULE_SCOPE #define MODULE_SCOPE extern #endif + + #ifndef MIN - #define MIN(x,y) ((x)<(y)?(x):(y)) +# define MIN(x,y) ((x)<(y)?(x):(y)) #endif #ifndef MAX - #define MAX(x,y) ((x)>(y)?(x):(y)) +# define MAX(x,y) ((x)>(y)?(x):(y)) #endif #ifdef __cplusplus @@ -45,9 +47,9 @@ extern "C" { /* detect 64-bit mode if possible */ #if defined(NEVER) /* 128-bit ints fail in too many places */ - #if !(defined(MP_64BIT) && defined(MP_16BIT) && defined(MP_8BIT)) - #define MP_64BIT - #endif +# if !(defined(MP_64BIT) && defined(MP_16BIT) && defined(MP_8BIT)) +# define MP_64BIT +# endif #endif /* some default configurations. @@ -83,19 +85,19 @@ extern "C" { #endif typedef unsigned long mp_word __attribute__ ((mode(TI))); - #define DIGIT_BIT 60 +# define DIGIT_BIT 60 #else /* this is the default case, 28-bit digits */ /* this is to make porting into LibTomCrypt easier :-) */ #ifndef CRYPT - #if defined(_MSC_VER) || defined(__BORLANDC__) +# if defined(_MSC_VER) || defined(__BORLANDC__) typedef unsigned __int64 ulong64; typedef signed __int64 long64; - #else +# else typedef unsigned long long ulong64; typedef signed long long long64; - #endif +# endif #endif #ifndef MP_DIGIT_DECLARED @@ -106,11 +108,11 @@ extern "C" { #ifdef MP_31BIT /* this is an extension that uses 31-bit digits */ - #define DIGIT_BIT 31 +# define DIGIT_BIT 31 #else /* default case is 28-bit digits, defines MP_28BIT as a handy macro to test */ - #define DIGIT_BIT 28 - #define MP_28BIT +# define DIGIT_BIT 28 +# define MP_28BIT #endif #endif @@ -118,25 +120,25 @@ extern "C" { #if 0 /* these are macros in tclTomMathDecls.h */ #ifndef CRYPT /* default to libc stuff */ - #ifndef XMALLOC - #define XMALLOC malloc - #define XFREE free - #define XREALLOC realloc - #define XCALLOC calloc - #else +# ifndef XMALLOC +# define XMALLOC malloc +# define XFREE free +# define XREALLOC realloc +# define XCALLOC calloc +# else /* prototypes for our heap functions */ extern void *XMALLOC(size_t n); extern void *XREALLOC(void *p, size_t n); extern void *XCALLOC(size_t n, size_t s); extern void XFREE(void *p); - #endif +# endif #endif #endif /* otherwise the bits per digit is calculated automatically from the size of a mp_digit */ #ifndef DIGIT_BIT - #define DIGIT_BIT ((int)((CHAR_BIT * sizeof(mp_digit) - 1))) /* bits per digit */ +# define DIGIT_BIT ((int)((CHAR_BIT * sizeof(mp_digit) - 1))) /* bits per digit */ #endif #define MP_DIGIT_BIT DIGIT_BIT @@ -179,11 +181,11 @@ MODULE_SCOPE int KARATSUBA_MUL_CUTOFF, /* default precision */ #ifndef MP_PREC - #ifndef MP_LOW_MEM - #define MP_PREC 32 /* default digits of precision */ - #else - #define MP_PREC 8 /* default digits of precision */ - #endif +# ifndef MP_LOW_MEM +# define MP_PREC 32 /* default digits of precision */ +# else +# define MP_PREC 8 /* default digits of precision */ +# endif #endif /* size of comba arrays, should be at least 2 * 2**(BITS_PER_WORD - BITS_PER_DIGIT*2) */ @@ -615,9 +617,9 @@ int mp_exptmod(mp_int *a, mp_int *b, mp_int *c, mp_int *d); /* number of primes */ #ifdef MP_8BIT - #define PRIME_SIZE 31 +# define PRIME_SIZE 31 #else - #define PRIME_SIZE 256 +# define PRIME_SIZE 256 #endif /* table of first PRIME_SIZE primes */ @@ -833,6 +835,6 @@ MODULE_SCOPE const char *mp_s_rmap; /* $Source: /root/tcl/repos-to-convert/tcl/generic/tclTomMath.h,v $ */ /* Based on Tom's version 1.8 */ -/* $Revision: 1.12 $ */ -/* $Date: 2010/04/27 12:36:21 $ */ +/* $Revision: 1.13 $ */ +/* $Date: 2010/05/03 11:38:18 $ */ diff --git a/libtommath/tommath.h b/libtommath/tommath.h index 82d9814..f869262 100644 --- a/libtommath/tommath.h +++ b/libtommath/tommath.h @@ -24,11 +24,11 @@ #include #ifndef MIN - #define MIN(x,y) ((x)<(y)?(x):(y)) +# define MIN(x,y) ((x)<(y)?(x):(y)) #endif #ifndef MAX - #define MAX(x,y) ((x)>(y)?(x):(y)) +# define MAX(x,y) ((x)>(y)?(x):(y)) #endif #ifdef __cplusplus @@ -47,9 +47,9 @@ extern "C" { /* detect 64-bit mode if possible */ #if defined(__x86_64__) - #if !(defined(MP_64BIT) && defined(MP_16BIT) && defined(MP_8BIT)) - #define MP_64BIT - #endif +# if !(defined(MP_64BIT) && defined(MP_16BIT) && defined(MP_8BIT)) +# define MP_64BIT +# endif #endif /* some default configurations. @@ -76,19 +76,19 @@ extern "C" { typedef unsigned long mp_digit; typedef unsigned long mp_word __attribute__ ((mode(TI))); - #define DIGIT_BIT 60 +# define DIGIT_BIT 60 #else /* this is the default case, 28-bit digits */ /* this is to make porting into LibTomCrypt easier :-) */ #ifndef CRYPT - #if defined(_MSC_VER) || defined(__BORLANDC__) +# if defined(_MSC_VER) || defined(__BORLANDC__) typedef unsigned __int64 ulong64; typedef signed __int64 long64; - #else +# else typedef unsigned long long ulong64; typedef signed long long long64; - #endif +# endif #endif typedef unsigned long mp_digit; @@ -96,35 +96,35 @@ extern "C" { #ifdef MP_31BIT /* this is an extension that uses 31-bit digits */ - #define DIGIT_BIT 31 +# define DIGIT_BIT 31 #else /* default case is 28-bit digits, defines MP_28BIT as a handy macro to test */ - #define DIGIT_BIT 28 - #define MP_28BIT +# define DIGIT_BIT 28 +# define MP_28BIT #endif #endif /* define heap macros */ #ifndef CRYPT /* default to libc stuff */ - #ifndef XMALLOC - #define XMALLOC malloc - #define XFREE free - #define XREALLOC realloc - #define XCALLOC calloc - #else +# ifndef XMALLOC +# define XMALLOC malloc +# define XFREE free +# define XREALLOC realloc +# define XCALLOC calloc +# else /* prototypes for our heap functions */ extern void *XMALLOC(size_t n); extern void *XREALLOC(void *p, size_t n); extern void *XCALLOC(size_t n, size_t s); extern void XFREE(void *p); - #endif +# endif #endif /* otherwise the bits per digit is calculated automatically from the size of a mp_digit */ #ifndef DIGIT_BIT - #define DIGIT_BIT ((int)((CHAR_BIT * sizeof(mp_digit) - 1))) /* bits per digit */ +# define DIGIT_BIT ((int)((CHAR_BIT * sizeof(mp_digit) - 1))) /* bits per digit */ #endif #define MP_DIGIT_BIT DIGIT_BIT @@ -165,11 +165,11 @@ extern int KARATSUBA_MUL_CUTOFF, /* default precision */ #ifndef MP_PREC - #ifndef MP_LOW_MEM - #define MP_PREC 32 /* default digits of precision */ - #else - #define MP_PREC 8 /* default digits of precision */ - #endif +# ifndef MP_LOW_MEM +# define MP_PREC 32 /* default digits of precision */ +# else +# define MP_PREC 8 /* default digits of precision */ +# endif #endif /* size of comba arrays, should be at least 2 * 2**(BITS_PER_WORD - BITS_PER_DIGIT*2) */ @@ -447,9 +447,9 @@ int mp_exptmod(mp_int *a, mp_int *b, mp_int *c, mp_int *d); /* number of primes */ #ifdef MP_8BIT - #define PRIME_SIZE 31 +# define PRIME_SIZE 31 #else - #define PRIME_SIZE 256 +# define PRIME_SIZE 256 #endif /* table of first PRIME_SIZE primes */ @@ -573,7 +573,7 @@ void bn_reverse(unsigned char *s, int len); extern const char *mp_s_rmap; #ifdef __cplusplus - } +} #endif #endif @@ -581,5 +581,5 @@ extern const char *mp_s_rmap; /* $Source: /root/tcl/repos-to-convert/tcl/libtommath/tommath.h,v $ */ /* Based on Tom's version 1.8 */ -/* $Revision: 1.4 $ */ -/* $Date: 2006/12/01 00:31:32 $ */ +/* $Revision: 1.5 $ */ +/* $Date: 2010/05/03 11:40:12 $ */ diff --git a/tools/fix_tommath_h.tcl b/tools/fix_tommath_h.tcl index 9b2d258..47d6447 100755 --- a/tools/fix_tommath_h.tcl +++ b/tools/fix_tommath_h.tcl @@ -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: fix_tommath_h.tcl,v 1.6 2007/02/14 17:59:22 kennykb Exp $ +# RCS: @(#) $Id: fix_tommath_h.tcl,v 1.7 2010/05/03 11:40:06 nijtmans Exp $ # #---------------------------------------------------------------------- @@ -25,7 +25,8 @@ foreach line [split $data \n] { {#define BN_H_} { puts $line puts {} - puts "\#include " + puts "\#include \"tclInt.h\"" + puts "\#include \"tclTomMathDecls.h\"" puts "\#ifndef MODULE_SCOPE" puts "\#define MODULE_SCOPE extern" puts "\#endif" @@ -79,6 +80,9 @@ foreach line [split $data \n] { puts "[string map {__x86_64__ NEVER} $line]\ /* 128-bit ints fail in too many places */" } + {#include} { + # remove all includes + } default { puts $line } -- cgit v0.12