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

 

 


SWU_emptyStringList

Some SAA calls (SAA_expressionGetStrings, for instance), require pointers to arrays of strings, where the length of each string in the array is known in advance. SW_emptyStringList builds the Tcl analogue of such an array. You pass it a list of lengths, Li, and it returns a list of strings, where the ith string has Li characters. You can then pass the name of this list of strings to any SAA function which expects a pointer to an array of string of these lengths.

package require SWU

SWU_emptyStringList elementLengths [ extraChar ]

elementLengths
A tcl list or c array ID, where elements of the list or c array represent the various lengths of the (Return Value's) list's elements.
extraChar
An optional parameter. If it is non-zero value then extra character will be added to the each element of return list and if elementLengths is a cArray then each element of the array will be incremented. If  elementLengths is a list, it remains unchanged.  This is usefull for building null terminated strings.
You can add room for the terminating null and correct the cArray of the strings length when you create the strings.

Return Value

A tcl list consisting of strings (filled with "x"s), each of the specified length.

Examples

  • Allocate and retrieve the current scene:
    set curSceneID [SAA_AllocScene]
    SAA_sceneGetCurrent $curSceneID
  • Retrieve the element sphere1 from the current scene:
    package require SW
    set elementID [SW_name2Element sphere1 $curSceneID]
  • Retrieve the number of expressions that reference the track name nvisib:
    set trackname nvisib
    SAA_elementGetNbExpressions $curSceneID $elementID trackname FALSE nbExpr
  • Retrieve the expressions that reference the track name nvisib:
    set exprID [SAA_AllocElem]
    SAA_elementGetExpressions $curSceneID $elementID trackname FALSE $nbExpr $exprID
  • Retrieve the number of local variables in an expression:
    SAA_expressionGetNbVars $curSceneID $exprID nbVars
  • Retrieve the string length of variable names, variable strings and expression strings:
    set varNameLens [SAA_AllocInteger $nbVars]
    set varStrLens [SAA_AllocInteger $nbVars]
    SAA_expressionGetStringLengths $curSceneID \
    $exprID $nbVars $varNameLens $varStrLens exprStrLen
  • Since lengths do not include a terminal null, increase their values:
    incr exprStrLen
  • Create lists to pass into SAA_expressionGetStrings. Set extraChar to 1 to increase length's values and add an extra character:
    set varNames [ SWU_emptyStringList $varNameLens 1 ]
    set varStrs [ SWU_emptyStringList $varStrLens 1 ]
  • Retrieve variable names, variable strings and expression string:
    SAA_expressionGetStrings $curSceneID $exprID $nbVars $varNameLens \
    $varStrLens $exprStrLen varNames varStrs exprStr
    puts "Names of the local variables are $varNames"
    puts "Strings of the local variables are $varStrs"
    puts "expression string is $exprStr"

Behaviors Overview ] Behavior Evaluate ] Behavior Edit ] Debugger ] Console ] Find ] SAA Library ] SW library ] SWC library ] SWN library index ] SWU library ] Attributes Index ] Scripting Examples ]

copyright Video-Collage Inc.