Tcl patches. Use [info sharedlibextension] to get file extension rather than hard-coding it]
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@5301 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
445625dc0a
commit
f50eac41ce
25 changed files with 39 additions and 116 deletions
|
|
@ -1,7 +1,6 @@
|
|||
# Plot a 3D function
|
||||
|
||||
catch { load ./gifplot.so gifplot}
|
||||
catch { load ./gifplot.dll gifplot} ;# Windows
|
||||
catch { load ./gifplot[info sharedlibextension] gifplot}
|
||||
|
||||
# Here is the function to plot
|
||||
proc func { x y } {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
catch { load ./gifplot.so }
|
||||
catch { load ./gifplot.dll } ; # Windows
|
||||
catch { load ./gifplot[info sharedlibextension] }
|
||||
source display.tcl
|
||||
set tcl_precision 17
|
||||
set f [FrameBuffer -args 400 400]
|
||||
|
|
|
|||
|
|
@ -1,8 +1,7 @@
|
|||
# Draw some simple shapes
|
||||
puts "Drawing some basic shapes"
|
||||
|
||||
catch { load ./simple.so simple}
|
||||
catch { load ./simple.dll simple} ;# Windows
|
||||
catch { load ./simple[info sharedlibextension] simple}
|
||||
|
||||
set cmap [new_ColorMap]
|
||||
set f [new_FrameBuffer 400 400]
|
||||
|
|
|
|||
|
|
@ -4,8 +4,7 @@
|
|||
# created by SWIG. In this case, all of our C++ classes
|
||||
# get converted into function calls.
|
||||
|
||||
catch { load ./example.so example}
|
||||
catch { load ./example.dll example} ;# Windows
|
||||
catch { load ./example[info sharedlibextension] example}
|
||||
|
||||
# ----- Object creation -----
|
||||
|
||||
|
|
|
|||
|
|
@ -3,8 +3,7 @@
|
|||
# This file illustrates the high level C++ interface.
|
||||
# In this case C++ classes work kind of like Tk widgets
|
||||
|
||||
catch { load ./example.so example}
|
||||
catch { load ./example.dll example} ;# Windows
|
||||
catch { load ./example[info sharedlibextension] example}
|
||||
|
||||
# ----- Object creation -----
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
# file: example.tcl
|
||||
|
||||
catch { load ./example.so example}
|
||||
catch { load ./example.dll example} ;# Windows
|
||||
catch { load ./example[info sharedlibextension] example}
|
||||
|
||||
puts "ICONST = $ICONST (should be 42)"
|
||||
puts "FCONST = $FCONST (should be 2.1828)"
|
||||
|
|
|
|||
|
|
@ -1,8 +1,6 @@
|
|||
# file: example.tcl
|
||||
|
||||
|
||||
catch { load ./example.so example}
|
||||
catch { load ./example.dll example} ;# Windows
|
||||
catch { load ./example[info sharedlibextension] example}
|
||||
|
||||
# ----- Object creation -----
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
# file: example.tcl
|
||||
|
||||
catch { load ./example.so example}
|
||||
catch { load ./example.dll example} ;# Windows
|
||||
catch { load ./example[info sharedlibextension] example}
|
||||
|
||||
set a 37
|
||||
set b 42
|
||||
|
|
|
|||
|
|
@ -2,17 +2,10 @@
|
|||
# Test various properties of classes defined in separate modules
|
||||
|
||||
puts "Testing the %import directive"
|
||||
catch { load ./base.so base}
|
||||
catch { load ./base.dll base} ;# Windows
|
||||
|
||||
catch { load ./foo.so foo}
|
||||
catch { load ./foo.dll foo} ;# Windows
|
||||
|
||||
catch { load ./bar.so bar}
|
||||
catch { load ./bar.dll bar} ;# Windows
|
||||
|
||||
catch { load ./spam.so spam}
|
||||
catch { load ./spam.dll spam} ;# Windows
|
||||
catch { load ./base[info sharedlibextension] base}
|
||||
catch { load ./foo[info sharedlibextension] foo}
|
||||
catch { load ./bar[info sharedlibextension] bar}
|
||||
catch { load ./spam[info sharedlibextension] spam}
|
||||
|
||||
# Create some objects
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,7 @@
|
|||
# file: example.tcl
|
||||
# Try to load as a dynamic module.
|
||||
|
||||
catch { load ./example.so example}
|
||||
catch { load ./example.dll example} ;# Windows
|
||||
catch { load ./example[info sharedlibextension] example}
|
||||
|
||||
# Call our gcd() function
|
||||
set x 42
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
# Operator overloading example
|
||||
|
||||
catch { load ./example.so example}
|
||||
catch { load ./example.dll example} ;# Windows
|
||||
catch { load ./example[info sharedlibextension] example}
|
||||
|
||||
set a [Complex -args 2 3]
|
||||
set b [Complex -args -5 10]
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
# file: example.tcl
|
||||
|
||||
catch { load ./example.so example}
|
||||
catch { load ./example.dll example} ;# Windows
|
||||
catch { load ./example[info sharedlibextension] example}
|
||||
|
||||
# First create some objects using the pointer library.
|
||||
puts "Testing the pointer library"
|
||||
|
|
|
|||
|
|
@ -2,8 +2,7 @@
|
|||
|
||||
# This file illustrates the manipulation of C++ references in Tcl
|
||||
|
||||
catch { load ./example.so example}
|
||||
catch { load ./example.dll example} ;# Windows
|
||||
catch { load ./example[info sharedlibextension] example}
|
||||
|
||||
# ----- Object creation -----
|
||||
|
||||
|
|
|
|||
|
|
@ -3,4 +3,3 @@
|
|||
|
||||
extern int gcd(int x, int y);
|
||||
extern double Foo;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,7 @@
|
|||
# file: example.tcl
|
||||
# Try to load as a dynamic module.
|
||||
|
||||
catch { load ./example.so example}
|
||||
catch { load ./example.dll example} ;# Windows
|
||||
catch { load ./example[info sharedlibextension] example}
|
||||
|
||||
# Call our gcd() function
|
||||
set x 42
|
||||
|
|
|
|||
|
|
@ -1,8 +1,7 @@
|
|||
# file: example.py
|
||||
# Try to load as a dynamic module.
|
||||
|
||||
catch { load ./example.so example}
|
||||
catch { load ./example.dll example} ;# Windows
|
||||
catch { load ./example[info sharedlibextension] example}
|
||||
|
||||
# Create a couple of a vectors
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
# file: example.tcl
|
||||
|
||||
catch { load ./example.so example} ;# Unix
|
||||
catch { load ./example.dll example} ;# Windows
|
||||
catch { load ./example[info sharedlibextension] example}
|
||||
|
||||
# Try to set the values of some global variables
|
||||
|
||||
|
|
|
|||
|
|
@ -1,12 +1,6 @@
|
|||
|
||||
if { [ string match $tcl_platform(platform) "windows" ] == 1 } {
|
||||
if [ catch { load ./bools.dll bools} err_msg ] {
|
||||
puts stderr "Could not load dll:\n$err_msg"
|
||||
}
|
||||
} else {
|
||||
if [ catch { load ./bools.so bools} err_msg ] {
|
||||
puts stderr "Could not load shared object:\n$err_msg"
|
||||
}
|
||||
if [ catch { load ./bools[info sharedlibextension] bools} err_msg ] {
|
||||
puts stderr "Could not load shared object:\n$err_msg"
|
||||
}
|
||||
|
||||
# bool constant check
|
||||
|
|
|
|||
|
|
@ -1,10 +1,4 @@
|
|||
|
||||
if { [ string match $tcl_platform(platform) "windows" ] == 1 } {
|
||||
if [ catch { load ./import_nomodule.dll import_nomodule} err_msg ] {
|
||||
puts stderr "Could not load dll:\n$err_msg"
|
||||
}
|
||||
} else {
|
||||
if [ catch { load ./import_nomodule.so import_nomodule} err_msg ] {
|
||||
puts stderr "Could not load shared object:\n$err_msg"
|
||||
}
|
||||
if [ catch { load ./import_nomodule[info sharedlibextension] import_nomodule} err_msg ] {
|
||||
puts stderr "Could not load shared object:\n$err_msg"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,24 +1,13 @@
|
|||
|
||||
# This is the imports runtime testcase.
|
||||
|
||||
if { [ string match $tcl_platform(os) Windows* ] == 1 } {
|
||||
if [ catch { load ./imports_a.dll imports_a} err_msg ] { ;# Windows
|
||||
puts stderr "Could not load dll:\n$err_msg"
|
||||
exit 1
|
||||
}
|
||||
if [ catch { load ./imports_b.dll imports_b} err_msg ] { ;# Windows
|
||||
puts stderr "Could not load dll:\n$err_msg"
|
||||
exit 1
|
||||
}
|
||||
} else {
|
||||
if [ catch { load ./imports_a.so imports_a} err_msg ] {
|
||||
puts stderr "Could not load shared object:\n$err_msg"
|
||||
exit 1
|
||||
}
|
||||
if [ catch { load ./imports_b.so imports_b} err_msg ] {
|
||||
puts stderr "Could not load shared object:\n$err_msg"
|
||||
if [ catch { load ./imports_a[info sharedlibextension] imports_a} err_msg ] {
|
||||
puts stderr "Could not load shared object:\n$err_msg"
|
||||
exit 1
|
||||
}
|
||||
}
|
||||
if [ catch { load ./imports_b[info sharedlibextension] imports_b} err_msg ] {
|
||||
puts stderr "Could not load shared object:\n$err_msg"
|
||||
exit 1
|
||||
}
|
||||
|
||||
set x [new_B]
|
||||
|
|
|
|||
|
|
@ -1,12 +1,6 @@
|
|||
|
||||
if { [ string match $tcl_platform(platform) "windows" ] == 1 } {
|
||||
if [ catch { load ./overload_copy.dll overload_copy} err_msg ] {
|
||||
puts stderr "Could not load dll:\n$err_msg"
|
||||
}
|
||||
} else {
|
||||
if [ catch { load ./overload_copy.so overload_copy} err_msg ] {
|
||||
puts stderr "Could not load shared object:\n$err_msg"
|
||||
}
|
||||
if [ catch { load ./overload_copy[info sharedlibextension] overload_copy} err_msg ] {
|
||||
puts stderr "Could not load shared object:\n$err_msg"
|
||||
}
|
||||
|
||||
Foo f
|
||||
|
|
|
|||
|
|
@ -1,12 +1,6 @@
|
|||
|
||||
if { [ string match $tcl_platform(platform) "windows" ] == 1 } {
|
||||
if [ catch { load ./overload_simple.dll overload_simple} err_msg ] {
|
||||
puts stderr "Could not load dll:\n$err_msg"
|
||||
}
|
||||
} else {
|
||||
if [ catch { load ./overload_simple.so overload_simple} err_msg ] {
|
||||
puts stderr "Could not load shared object:\n$err_msg"
|
||||
}
|
||||
if [ catch { load ./overload_simple[info sharedlibextension] overload_simple} err_msg ] {
|
||||
puts stderr "Could not load shared object:\n$err_msg"
|
||||
}
|
||||
|
||||
set f [new_Foo]
|
||||
|
|
|
|||
|
|
@ -1,14 +1,8 @@
|
|||
# Primitive ref testcase. Tests to make sure references to
|
||||
# primitive types are passed by value
|
||||
|
||||
if { [ string match $tcl_platform(platform) "windows" ] == 1 } {
|
||||
if [ catch { load ./primitive_ref.dll primitive_ref} err_msg ] {
|
||||
puts stderr "Could not load dll:\n$err_msg"
|
||||
}
|
||||
} else {
|
||||
if [ catch { load ./primitive_ref.so primitive_ref} err_msg ] {
|
||||
puts stderr "Could not load shared object:\n$err_msg"
|
||||
}
|
||||
if [ catch { load ./primitive_ref[info sharedlibextension] primitive_ref} err_msg ] {
|
||||
puts stderr "Could not load shared object:\n$err_msg"
|
||||
}
|
||||
|
||||
if { [ref_int 3] != 3 } { puts stderr "ref_int failed" }
|
||||
|
|
|
|||
|
|
@ -1,11 +1,5 @@
|
|||
if { [ string match $tcl_platform(platform) "windows" ] == 1 } {
|
||||
if [ catch { load ./reference_global_vars.dll reference_global_vars} err_msg ] {
|
||||
puts stderr "Could not load dll:\n$err_msg"
|
||||
}
|
||||
} else {
|
||||
if [ catch { load ./reference_global_vars.so reference_global_vars} err_msg ] {
|
||||
puts stderr "Could not load shared object:\n$err_msg"
|
||||
}
|
||||
if [ catch { load ./reference_global_vars[info sharedlibextension] reference_global_vars} err_msg ] {
|
||||
puts stderr "Could not load shared object:\n$err_msg"
|
||||
}
|
||||
|
||||
# const class reference variable
|
||||
|
|
|
|||
|
|
@ -2,14 +2,8 @@
|
|||
# This is the union runtime testcase. It ensures that values within a
|
||||
# union embedded within a struct can be set and read correctly.
|
||||
|
||||
if { [ string match $tcl_platform(platform) "windows" ] == 1 } {
|
||||
if [ catch { load ./unions.dll unions} err_msg ] {
|
||||
puts stderr "Could not load dll:\n$err_msg"
|
||||
}
|
||||
} else {
|
||||
if [ catch { load ./unions.so unions} err_msg ] {
|
||||
puts stderr "Could not load shared object:\n$err_msg"
|
||||
}
|
||||
if [ catch { load ./unions[info sharedlibextension] unions} err_msg ] {
|
||||
puts stderr "Could not load shared object:\n$err_msg"
|
||||
}
|
||||
|
||||
# Create new instances of SmallStruct and BigStruct for later use
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue