vcanim.gif (8357 bytes)valueAndReference
Home ] Sales ] Products ] Services ] Support ] Downloads ]

 

 


Passing Parameters By Value And Reference

TCL has no types, everything is a string. SAAPHIRE is a C language API, so all parameters to the API's functions have types. Any C type whose value can be naturally represented by a string can be passed to SoftWish SAA procedures by value. For example, suppose there were some SAAPHIRE C function:

SAA_dummyByValueFunction (
int a,
float b,
char c)

Then we could call this from SoftWish like this:

SAA_DummyByValueFunction 22 34.7 C

TCL and hence SoftWish, has no pointers. One passes a value by reference by passing the name of the variable containing that value. A C function like:

SAA_dummyByReferenceFunction (
const int *a,
const float *b,
char *c)

would be called from SoftWish like this:

set a 22
set b 34.7
set c C
SAA_dummyByReferenceFunction a b c

Note that we can now also call:

SAA_DummyByValueFunction $a $b $c

with the same effect as our previous call to this function.

There is no C data type for multi-character strings, so they must be passed by reference, like this:

set c manyCharacters
SAA_dummyByReferenceFunction a b c

There is no difference between the string representing a short, an integer and a long value nor is there a difference between the string representing a double and a float value. Consequently SoftWish does not distinguish between shorts, ints and longs, nor does it distinguish floats from doubles.

See Also

Arrays Structures


Whitepaper ] Terms and Conventions ] Release Notes 2.2 ] Problems You May Encounter ] Installation overview ] Installing on Irix ] Installing on Nt ] Licensing ] Scripting ] Utilities and Libraries ] Tools ] Tutorials ]

copyright Video-Collage Inc.