From bebf0454f609132c9de5705f9a7b7f720438dd5e Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 4 Mar 2021 09:42:47 +0000 Subject: cleanup genStubs.tcl, e.g. "==" -> "eq" and "!=" -> "ne". No change in output --- tools/genStubs.tcl | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/tools/genStubs.tcl b/tools/genStubs.tcl index 67b5112..814d154 100644 --- a/tools/genStubs.tcl +++ b/tools/genStubs.tcl @@ -4,7 +4,7 @@ # interface. # # -# Copyright (c) 1998-1999 by Scriptics Corporation. +# Copyright (c) 1998-1999 Scriptics Corporation. # Copyright (c) 2007 Daniel A. Steffen # # See the file "license.terms" for information on usage and redistribution @@ -194,7 +194,7 @@ proc genStubs::declare {args} { set decl [parseDecl $decl] foreach platform $platformList { - if {$decl != ""} { + if {$decl ne ""} { set stubs($curName,$platform,$index) $decl if {![info exists stubs($curName,$platform,lastNum)] \ || ($index > $stubs($curName,$platform,lastNum))} { @@ -243,8 +243,9 @@ proc genStubs::rewriteFile {file text} { return } set in [open ${file} r] + fconfigure $in -eofchar "\032 {}" -encoding utf-8 set out [open ${file}.new w] - fconfigure $out -translation lf + fconfigure $out -translation lf -encoding utf-8 while {![eof $in]} { set line [gets $in] @@ -465,7 +466,9 @@ proc genStubs::makeDecl {name decl index} { } set line "$scspec $rtype" set count [expr {2 - ([string length $line] / 8)}] - append line [string range "\t\t\t" 0 $count] + if {$count >= 0} { + append line [string range "\t\t\t" 0 $count] + } set pad [expr {24 - [string length $line]}] if {$pad <= 0} { append line " " @@ -552,7 +555,7 @@ proc genStubs::makeMacro {name decl index} { append lfname [string range $fname 1 end] set text "#ifndef $fname\n#define $fname \\\n\t(" - if {$args == ""} { + if {$args eq ""} { append text "*" } append text "${name}StubsPtr->$lfname)" @@ -579,14 +582,14 @@ proc genStubs::makeSlot {name decl index} { append lfname [string range $fname 1 end] set text " " - if {$args == ""} { + if {$args eq ""} { append text $rtype " *" $lfname "; /* $index */\n" return $text } if {$rtype ne "void"} { regsub -all void $rtype VOID rtype } - if {[string range $rtype end-8 end] == "__stdcall"} { + if {[string range $rtype end-8 end] eq "__stdcall"} { append text [string trim [string range $rtype 0 end-9]] " (__stdcall *" $lfname ") " } else { append text $rtype " (*" $lfname ") " @@ -1004,7 +1007,7 @@ proc genStubs::emitHeader {name} { } append text "\ntypedef struct ${capName}Stubs {\n" append text " int magic;\n" - if {$epoch != ""} { + if {$epoch ne ""} { append text " int epoch;\n" append text " int revision;\n" } @@ -1053,7 +1056,7 @@ proc genStubs::emitInit {name textVar} { } append text "\n${capName}Stubs ${name}Stubs = \{\n" append text " TCL_STUB_MAGIC,\n" - if {$epoch != ""} { + if {$epoch ne ""} { set CAPName [string toupper $name] append text " ${CAPName}_STUBS_EPOCH,\n" append text " ${CAPName}_STUBS_REVISION,\n" @@ -1132,7 +1135,7 @@ proc genStubs::init {} { set outDir [lindex $argv 0] foreach file [lrange $argv 1 end] { - source $file + source -encoding utf-8 $file } foreach name [lsort [array names interfaces]] { @@ -1154,7 +1157,7 @@ proc genStubs::init {} { # Results: # Returns any values that were not assigned to variables. -if {[string length [namespace which lassign]] == 0} { +if {[namespace which lassign] ne ""} { proc lassign {valueList args} { if {[llength $args] == 0} { error "wrong # args: should be \"lassign list varName ?varName ...?\"" -- cgit v0.12 From 3f89004e3770f9777b2c028f268d0e8cda84172c Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 4 Mar 2021 09:53:10 +0000 Subject: Add some more unused entries to the stub table, keeping up with the table size increase of higher Tcl versions --- generic/tcl.decls | 7 ++++++- generic/tclDecls.h | 27 ++++++++++++++++++++++++--- generic/tclInt.decls | 1 + generic/tclPlatDecls.h | 10 ++++++++++ generic/tclStubInit.c | 10 +++++++++- generic/tclTomMath.decls | 1 - 6 files changed, 50 insertions(+), 6 deletions(-) diff --git a/generic/tcl.decls b/generic/tcl.decls index 6510249..50e9465 100644 --- a/generic/tcl.decls +++ b/generic/tcl.decls @@ -21,6 +21,7 @@ library tcl interface tcl hooks {tclPlat tclInt tclIntPlat} +scspec EXTERN # Declare each of the functions in the public Tcl interface. Note that # the an index should never be reused for a different function in order @@ -2110,7 +2111,7 @@ declare 579 { # ----- BASELINE -- FOR -- 8.5.0 ----- # -declare 649 { +declare 656 { void TclUnusedStubEntry(void) } @@ -2150,6 +2151,9 @@ declare 1 macosx { const char *bundleName, const char *bundleVersion, int hasResourceFile, int maxPathLen, char *libraryPath) } +declare 2 macosx { + void TclUnusedStubEntry(void) +} ############################################################################## @@ -2191,6 +2195,7 @@ export { export { TclTomMathStubs *tclTomMathStubsPtr (fool checkstubs) } + # Local Variables: # mode: tcl # End: diff --git a/generic/tclDecls.h b/generic/tclDecls.h index a5b7ec1..3651a3b 100644 --- a/generic/tclDecls.h +++ b/generic/tclDecls.h @@ -3481,9 +3481,16 @@ EXTERN void Tcl_AppendPrintfToObj(Tcl_Obj *objPtr, /* Slot 646 is reserved */ /* Slot 647 is reserved */ /* Slot 648 is reserved */ +/* Slot 649 is reserved */ +/* Slot 650 is reserved */ +/* Slot 651 is reserved */ +/* Slot 652 is reserved */ +/* Slot 653 is reserved */ +/* Slot 654 is reserved */ +/* Slot 655 is reserved */ #ifndef TclUnusedStubEntry_TCL_DECLARED #define TclUnusedStubEntry_TCL_DECLARED -/* 649 */ +/* 656 */ EXTERN void TclUnusedStubEntry(void); #endif @@ -4170,7 +4177,14 @@ typedef struct TclStubs { VOID *reserved646; VOID *reserved647; VOID *reserved648; - void (*tclUnusedStubEntry) (void); /* 649 */ + VOID *reserved649; + VOID *reserved650; + VOID *reserved651; + VOID *reserved652; + VOID *reserved653; + VOID *reserved654; + VOID *reserved655; + void (*tclUnusedStubEntry) (void); /* 656 */ } TclStubs; extern TclStubs *tclStubsPtr; @@ -6592,9 +6606,16 @@ extern TclStubs *tclStubsPtr; /* Slot 646 is reserved */ /* Slot 647 is reserved */ /* Slot 648 is reserved */ +/* Slot 649 is reserved */ +/* Slot 650 is reserved */ +/* Slot 651 is reserved */ +/* Slot 652 is reserved */ +/* Slot 653 is reserved */ +/* Slot 654 is reserved */ +/* Slot 655 is reserved */ #ifndef TclUnusedStubEntry #define TclUnusedStubEntry \ - (tclStubsPtr->tclUnusedStubEntry) /* 649 */ + (tclStubsPtr->tclUnusedStubEntry) /* 656 */ #endif #endif /* defined(USE_TCL_STUBS) && !defined(USE_TCL_STUB_PROCS) */ diff --git a/generic/tclInt.decls b/generic/tclInt.decls index 892f977..df39bef 100644 --- a/generic/tclInt.decls +++ b/generic/tclInt.decls @@ -17,6 +17,7 @@ library tcl # Define the unsupported generic interfaces. interface tclInt +scspec EXTERN # Declare each of the functions in the unsupported internal Tcl # interface. These interfaces are allowed to changed between versions. diff --git a/generic/tclPlatDecls.h b/generic/tclPlatDecls.h index ef23c84..16e8af0 100644 --- a/generic/tclPlatDecls.h +++ b/generic/tclPlatDecls.h @@ -75,6 +75,11 @@ EXTERN int Tcl_MacOSXOpenVersionedBundleResources( int hasResourceFile, int maxPathLen, char *libraryPath); #endif +#ifndef TclUnusedStubEntry_TCL_DECLARED +#define TclUnusedStubEntry_TCL_DECLARED +/* 2 */ +EXTERN void TclUnusedStubEntry(void); +#endif #endif /* MACOSX */ typedef struct TclPlatStubs { @@ -88,6 +93,7 @@ typedef struct TclPlatStubs { #ifdef MAC_OSX_TCL /* MACOSX */ int (*tcl_MacOSXOpenBundleResources) (Tcl_Interp *interp, CONST char *bundleName, int hasResourceFile, int maxPathLen, char *libraryPath); /* 0 */ int (*tcl_MacOSXOpenVersionedBundleResources) (Tcl_Interp *interp, CONST char *bundleName, CONST char *bundleVersion, int hasResourceFile, int maxPathLen, char *libraryPath); /* 1 */ + void (*tclUnusedStubEntry) (void); /* 2 */ #endif /* MACOSX */ } TclPlatStubs; @@ -122,6 +128,10 @@ extern TclPlatStubs *tclPlatStubsPtr; #define Tcl_MacOSXOpenVersionedBundleResources \ (tclPlatStubsPtr->tcl_MacOSXOpenVersionedBundleResources) /* 1 */ #endif +#ifndef TclUnusedStubEntry +#define TclUnusedStubEntry \ + (tclPlatStubsPtr->tclUnusedStubEntry) /* 2 */ +#endif #endif /* MACOSX */ #endif /* defined(USE_TCL_STUBS) && !defined(USE_TCL_STUB_PROCS) */ diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c index 1a83752..6968d89 100644 --- a/generic/tclStubInit.c +++ b/generic/tclStubInit.c @@ -675,6 +675,7 @@ TclPlatStubs tclPlatStubs = { #ifdef MAC_OSX_TCL /* MACOSX */ Tcl_MacOSXOpenBundleResources, /* 0 */ Tcl_MacOSXOpenVersionedBundleResources, /* 1 */ + TclUnusedStubEntry, /* 2 */ #endif /* MACOSX */ }; @@ -1446,7 +1447,14 @@ TclStubs tclStubs = { NULL, /* 646 */ NULL, /* 647 */ NULL, /* 648 */ - TclUnusedStubEntry, /* 649 */ + NULL, /* 649 */ + NULL, /* 650 */ + NULL, /* 651 */ + NULL, /* 652 */ + NULL, /* 653 */ + NULL, /* 654 */ + NULL, /* 655 */ + TclUnusedStubEntry, /* 656 */ }; /* !END!: Do not edit above this line. */ diff --git a/generic/tclTomMath.decls b/generic/tclTomMath.decls index dfb6956..56993f2 100644 --- a/generic/tclTomMath.decls +++ b/generic/tclTomMath.decls @@ -17,7 +17,6 @@ library tcl # Define the unsupported generic interfaces. interface tclTomMath -# hooks {tclTomMathInt} scspec EXTERN # Declare each of the functions in the Tcl tommath interface -- cgit v0.12