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