struct BOGUS:
name "char*" Label "char[80]" nrow "int" type "PIXDATATYPE" mask "MASK*" hdr "HDR" all_mask "MASK[10]"
We followed these rules in designing these functions:
<dervish> schemaGetFullFromType BOGUS {BOGUS STRUCT 384 7} {name char 1 NULL 0} {Label char 0 80 4} {nrow int 0 NULL 84} {type PIXDATATYPE 0 NULL 88} {mask MASK 1 NULL 92} {hdr HDR 0 NULL 96} {all_mask MASK 0 10 104} <dervish> schemaPrintFullFromType BOGUS BOGUS STRUCT 384 7 name char 1 NULL 0 Label char 0 80 4 nrow int 0 NULL 84 type PIXDATATYPE 0 NULL 88 mask MASK 1 NULL 92 hdr HDR 0 NULL 96 all_mask MASK 0 10 104 <dervish> schemaGetFromType BOGUS {name char*} {Label {char[80]}} {nrow int} {type PIXDATATYPE} {mask MASK*} {hdr HDR} {all_mask {MASK[10]}} <dervish> schemaPrintFromType BOGUS name char* Label {char[80]} nrow int type PIXDATATYPE mask MASK* hdr HDR all_mask {MASK[10]} <dervish> schemaKindGetFromType BOGUS STRUCT <dervish> schemaKindGet h1.name PRIM <dervish> cTypeGet h1 BOGUS <dervish> cTypeGet h1.Label char<80> <dervish> cTypeGet h1.mask MASK* <dervish> cTypeGet h1.hdr HDR
Numerous other small functions have been written to facilitate the use of the followings functions (eg. handlePtr, handleType, etc...).
<dervish> handlePrint h1 0x104fe660 REGION <dervish> handlePrint h1.hdr 0x104fe69c HDR <dervish> handlePrint h1.mask 0x104fe690 PTR <dervish> handleNameGet 0x104fe660 h1
As a reminder a handle expression can have a type cast. This allow you to give specify how Dervish is to interpret what the handle is pointing to!
<dervish> exprGet h0 {name h0} {Label {This is a label}} {nrow 10} {type {(enum) TYPE_U16}} {mask 0x14095dc28} {hdr ...} {all_mask 0x14094efc0} <dervish> exprGet -recurse -nostring h0 {name 0x14095d9a8} {Label 0x14094ef50} {nrow 10} {type {(enum) TYPE_U16}} {mask 0x14095dc28} {hdr {{modCnt 100} {hdrVec 0x0}}} {all_mask 0x14094efc0} <dervish> exprGet -header -unfold -enum h0 {type BOGUS} {name h0} {Label {This is a label}} {nrow 10} {type TYPE_U16} {mask 0x14095dc28} {hdr ...} {all_mask {{<0> ...} {<1> ...} {<2> ...}}} <dervish> exprGet -header -unfold -enum -recurse h0 {type BOGUS} {name h0} {Label {This is a label}} {nrow 10} {type TYPE_U16} {mask 0x14095dc28} {hdr {{modCnt 100} {hdrVec 0x0}}} {all_mask {{<0> {{name all_mask_0} {nrow 10} {ncol 1} {rows 0x0} {row0 0} {col0 0} {prvt 0x0}}} {<1> {{name all_mask_1} {nrow 20} {ncol 2} {rows 0x0} {row0 0} {col0 0} {prvt 0x0}}} {<2> {{name all_mask_2} {nrow 30} {ncol 3} {rows 0x0} {row0 0} {col0 0} {prvt 0x0}}}}} <dervish> exprGet -flat -unfold -recurse -enum -nolabel h0 {type BOGUS} {name h0} {Label {This is a label}} {nrow 10} {type TYPE_U16} {mask 0x14095dc28} {hdr {{modCnt 100} {hdrVec 0x0}}} {all_mask {{<0> {{name all_mask_0} {nrow 10} {ncol 1} {rows 0x0} {row0 0} {col0 0} {prvt 0x0}}} {<1> {{name all_mask_1} {nrow 20} {ncol 2} {rows 0x0} {row0 0} {col0 0} {prvt 0x0}}} {<2> {{name all_mask_2} {nrow 30} {ncol 3} {rows 0x0} {row0 0} {col0 0} {prvt 0x0}}}}} <dervish> exprGet h0.Label {This is a label} <dervish> exprGet -nostring h0.Label 0x14095d9a8 <dervish> exprGet -header h0.Label {type STR} {This is a label} <dervish> exprGet -header -nostring h0.Label {type STR} 0x14094ef50 <dervish> exprGet h0.nrow 10 <dervish> exprGet -header h0.nrow {type INT} 10 <dervish> exprPrint h1 (h0).name "h0" (h0).Label "This is a label" (h0).nrow 10 (h0).type (enum) TYPE_U16 (h0).mask (handle)h1 (h0).hdr ... (h0).all_mask 0x14094efc0 <dervish> exprPrint -recurse -nostring h1 (h0).name 0x14095d9a8 (h0).Label 0x14094ef50 (h0).nrow 10 (h0).type (enum) TYPE_U16 (h0).mask (handle)h1 (h0).hdr.modCnt 100 (h0).hdr.hdrVec 0x0 (h0).all_mask 0x14094efc0 <dervish> exprPrint -header -unfold -enum h1 (h0).name "h0" (h0).Label "This is a label" (h0).nrow 10 (h0).type TYPE_U16 (h0).mask (handle)h1 (h0).hdr ... (h0).all_mask<0> ... (h0).all_mask<1> ... (h0).all_mask<2> ...And with h0.f being an array defined as followed: float f<5><4><3>
<dervish> exprPrint -header -unfold h0.f h0.f PTR (h0.f).<0><0><0> 0 (h0.f).<0><0><1> 0 (h0.f).<0><0><2> 0 (h0.f).<0><1><0> 0 (h0.f).<0><1><1> 0 (h0.f).<0><1><2> 0 (h0.f).<0><2><0> 0 etc ... <dervish> exprPrint -header -unfold -flat h0.f h0.f PTR h0.f 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 <dervish> exprPrint -header -unfold -limited 2 h0.f h0.f PTR (h0.f).<0> 0 0 0 0 0 0 0 0 0 0 0 0 (h0.f).<1> 0 0 0 0 0 0 0 0 0 0 0 0 (h0.f).<2> 0 0 0 0 0 0 0 0 0 0 0 0 (h0.f).<3> 0 0 0 0 0 0 0 0 0 0 0 0 (h0.f).<4> 0 0 0 0 0 0 0 0 0 0 0 0 <dervish> exprPrint -header -unfold -limited 1 h0.f h0.f PTR (h0.f).<0><0> 0 0 0 (h0.f).<0><1> 0 0 0 (h0.f).<0><2> 0 0 0 (h0.f).<0><3> 0 0 0 (h0.f).<1><0> 0 0 0 (h0.f).<1><1> 0 0 0 (h0.f).<1><2> 0 0 0 (h0.f).<1><3> 0 0 0 (h0.f).<2><0> 0 0 0 (h0.f).<2><1> 0 0 0 (h0.f).<2><2> 0 0 0 (h0.f).<2><3> 0 0 0 (h0.f).<3><0> 0 0 0 (h0.f).<3><1> 0 0 0 (h0.f).<3><2> 0 0 0 (h0.f).<3><3> 0 0 0 (h0.f).<4><0> 0 0 0 (h0.f).<4><1> 0 0 0 (h0.f).<4><2> 0 0 0 (h0.f).<4><3> 0 0 0
Examples:
<dervish> handleSet $header { 100 0x109283091 } <dervish> handleSet $region { Name 100 100 TYPE_U16 0x01298301 0x0 0x 0x01298301 0x0 0x0 0x0 0x0 0x0 10 10 { 50 0x119823 } 0x987126 }
When character strings are returned as part of an array of character strings ( char* or char[] ), they are quoted to allow Tcl lists to represent the array. This behaviour can cause a problem. Consider a character string which contains one or more quote characters (open or close brace ({})) that is returned as part of an array of character strings (here, the field contains 2 character strings per row):
<dervish> exprGet h1 {name {abc}def}} {value {0}}Problems will occur when trying to access one of the array elements. Consider:
<dervish> set x [exprGet h1.name] {name {abc}def}} {value {0}} <dervish> lindex $x 0 Error: list element in braces followed by "def}" instead of space
NOTE:
If exprGet were to quote the brace with a backslash
(\), behaviour would not be as expected. Consider:
<dervish> set x [exprGet h1.name]
{abc\}def} {xyz}
<dervish> string index [lindex $x 0] 3
\
Notice that the backslash (\) is treated by Tcl as part of the
string rather than quoting the character following it.
schemaGetFullFromType <type> schemaGetFull <handle expr> schemaGet <handle expr> schemaGetFromType <type> schemaPrint <handle expr> schemaPrintFromType <type> schemaKindGetFromType <type> schemaKindGet <handle expr> (NA) cTypeGet <handle expr> See also the discussion on object schema
handlePrint <handle expr> handleGet <handle expr> handleNameGet <address> And more ...
exprGet [-enum] [-flat] [-header] [-nostring] [-recurse] [-unfold] <handle expr> exprPrint [-enum] [-flat] [-header] [-noname] [-noquote] [-nostring] [-recurse] [-unfold] <handle expr>
handleSet <handle expr> <value> handleSetFromHandle <handle expr> <handle expression>
Return a nested keyed list of the value of an handle expression. See the overview on exprGet for more details.
Note well that two or higher dimensional arrays are treated as if they are really pointers to pointers (to pointers...) rather than C's rather useless n-dimensional arrays (e.g. float cc[4][5]). This will be fixed when I get a chance to work on the schema package a little more.
Print the value(s) of an expression involving an handle. The result is a formatted version of the result returned by exprGet. See the overview on exprPrint for more details.
exprGet used to return strings between double quotes. Now exprGet puts curly brackets - { ... } - around the string when necessary.
If you used to get a string directly by
exprGet h5.Labeland then removed manually the double quotes, you might find the following instruction useful:
lindex [exprGet h0.Label] 0This will return the string without the curly brackets.
Old Syntax | Replacing Syntax | Example |
---|---|---|
exprPrintAsArray <array> <dimension> | exprPrint -unfold (array definition)<array> | exprPrint -unfold (INT<10><10>)h1.rows |
exprPrintMember <handle> <elem> | exprPrint <handle.elem> | exprPrint h1.ncol |
structsPrint <handle expr> | exprPrint -header -enum -recurse <handle expr> | exprPrint -header -enum -recurse h1 |
structPrint <handle expr> | exprPrint -noquote <handle expr> | exprPrint -noquote h1 |
structGet <handle expr> | exprGet -noquote <handle expr> | exprGet -noquote h1 |
exprPrint <handle expr> | exprPrint -noquote -noname <handle expr> | exprPrint -noquote -noname h1 |
membersGet <handle expr> | exprGet -header <handle expr> | exprGet -header h1 |
memberGet <handle> <member> | exprGet <handle.member> | exprGet h1.nrow |
exprSet <handle expression> | handleSet <handle expression> | handleSet h1.vec<2> 4 |
arraySet <handle expression> <array member> <values> | handleSet <handle expression> <values> | handleSet h1.name<2> {this is a label} |
arrayShow <handle-expression> <array-member> | exprGet -unfold -flat -enum <handle-expression.array-member> | exprGet -unfold -flat -enum h1.name |
ptype <handle> | handleType <handle> | handleType h1 |
typeGet <type> | None. Use -enum if necessary |
"(h1).j <0> 0"rather than
"(h1).j<0> 0"for a one element array ! (who cares?!)