summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorKevin B Kenny <kennykb@acm.org>2005-01-20 19:11:49 (GMT)
committerKevin B Kenny <kennykb@acm.org>2005-01-20 19:11:49 (GMT)
commitfe055cc7da17bb24d96bcb9b6c096dd693829959 (patch)
tree42a1833312ececd5ccdf6a2ec1e65fc4d7e7be7c /tools
parent172eba6b059a50c842e7cf74bb5b736e4b4bddb1 (diff)
downloadtcl-fe055cc7da17bb24d96bcb9b6c096dd693829959.zip
tcl-fe055cc7da17bb24d96bcb9b6c096dd693829959.tar.gz
tcl-fe055cc7da17bb24d96bcb9b6c096dd693829959.tar.bz2
Development checkpoint, see ChangeLog for details
Diffstat (limited to 'tools')
-rwxr-xr-xtools/fix_tommath_h.tcl54
1 files changed, 54 insertions, 0 deletions
diff --git a/tools/fix_tommath_h.tcl b/tools/fix_tommath_h.tcl
new file mode 100755
index 0000000..6468a91
--- /dev/null
+++ b/tools/fix_tommath_h.tcl
@@ -0,0 +1,54 @@
+# fixtommath.tcl --
+#
+# Changes to 'tommath.h' to make it conform with Tcl's linking
+# conventions.
+#
+# Copyright (c) 2005 by Kevin B. Kenny. All rights reserved.
+#
+# 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.1.2.1 2005/01/20 19:13:56 kennykb Exp $
+#
+#----------------------------------------------------------------------
+
+set f [open [lindex $argv 0] r]
+set data [read $f]
+close $f
+
+foreach line [split $data \n] {
+ switch -regexp -- $line {
+ {#define BN_H_} {
+ puts $line
+ puts {}
+ puts "\#ifdef TCL_TOMMATH"
+ puts "\#include <tclTomMath.h>"
+ puts "\#endif"
+ puts "\#ifndef TOMMATH_STORAGE_CLASS"
+ puts "\#define TOMMATH_STORAGE_CLASS extern"
+ puts "\#endif"
+ }
+ {typedef.*mp_digit;} {
+ puts "\#ifndef MP_DIGIT_DECLARED"
+ puts $line
+ puts "\#define MP_DIGIT_DECLARED"
+ puts "\#endif"
+ }
+ {typedef struct} {
+ puts "\#ifndef MP_INT_DECLARED"
+ puts "\#define MP_INT_DECLARED"
+ puts "typedef struct mp_int mp_int;"
+ puts "\#endif"
+ puts "struct mp_int \{"
+ }
+ \}\ mp_int\; {
+ puts "\};"
+ }
+ "^(char|int|void)" {
+ puts "TOMMATH_STORAGE_CLASS $line"
+ }
+ default {
+ puts $line
+ }
+ }
+} \ No newline at end of file