Improve performance of script validation commit
[jimtcl.git] / make-load-static-exts.tcl
blob9185e7756f6f6396fffa26a1e7a3d8584f323623
1 #!/usr/bin/env tclsh
3 # Usage: make-load-static-exts extname ... >load-static-exts.c
5 # Creates load-static-exts.c based on the configured static extensions
7 # There are some dependencies on static extensions which require
8 # a certain load order. Do this by setting priorities and sorting.
10 array set pri {
11 stdlib 0
12 readdir 1
13 glob 2
14 oo 1
15 tree 2
16 pack 1
17 binary 2
20 foreach i $argv {
21 set p 1
22 if {[info exists pri($i)]} {
23 set p $pri($i)
25 lappend exts [list $p $i]
27 set exts [lsort $exts]
29 puts {
30 /* autogenerated - do not edit */
31 #include "jim.h"
32 #include "jimautoconf.h"
33 int Jim_InitStaticExtensions(Jim_Interp *interp)
35 puts \{
37 foreach e $exts {
38 set ext [lindex $e 1]
39 puts "\textern int Jim_${ext}Init(Jim_Interp *);"
41 foreach e $exts {
42 set ext [lindex $e 1]
43 puts "\tJim_${ext}Init(interp);"
46 puts "\treturn JIM_OK;"
48 puts \}