diff options
Diffstat (limited to 'tools/fix_tommath_h.tcl')
| -rwxr-xr-x | tools/fix_tommath_h.tcl | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/tools/fix_tommath_h.tcl b/tools/fix_tommath_h.tcl index adad734..04bf857 100755 --- a/tools/fix_tommath_h.tcl +++ b/tools/fix_tommath_h.tcl @@ -7,9 +7,6 @@ # # 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.4 2005/12/13 22:43:18 kennykb Exp $ -# #---------------------------------------------------------------------- set f [open [lindex $argv 0] r] @@ -18,17 +15,31 @@ close $f set eat_endif 0 set eat_semi 0 +set def_count 0 foreach line [split $data \n] { - if { !$eat_semi && !$eat_endif } { + if {!$eat_semi && !$eat_endif} { switch -regexp -- $line { {#define BN_H_} { puts $line puts {} - puts "\#include <tclTomMathDecls.h>" + puts "\#include \"tclInt.h\"" + puts "\#include \"tclTomMathDecls.h\"" puts "\#ifndef MODULE_SCOPE" puts "\#define MODULE_SCOPE extern" puts "\#endif" } + {typedef\s+unsigned long\s+mp_digit;} { + # change the second 'typedef unsigned long mp + incr def_count + puts "\#ifndef MP_DIGIT_DECLARED" + if {$def_count == 2} { + puts [string map {long int} $line] + } else { + puts $line + } + puts "\#define MP_DIGIT_DECLARED" + puts "\#endif" + } {typedef.*mp_digit;} { puts "\#ifndef MP_DIGIT_DECLARED" puts $line @@ -62,6 +73,13 @@ foreach line [split $data \n] { puts "\#if 0 /* these are macros in tclTomMathDecls.h */" set eat_endif 1 } + {__x86_64__} { + puts "[string map {__x86_64__ NEVER} $line]\ + /* 128-bit ints fail in too many places */" + } + {#include} { + # remove all includes + } default { puts $line } |
