SS Feb162004 - In the process of writing the GC for the references package, I needed to know what
Tcl_Obj types aren't able to represent a valid reference. Numerical types are an example, but I wanted the full list of types defined inside the core. To reach the goal I wrote the little script at the end of the page, that I hope is sane enough to provide the full list.
This is the list of types defined in the .c and .h files under the /generic directory. For every type there is the
C symbol name, and the name to pass to the
Tcl_GetObjType function to get the pointer to the type stucture.
For tcl8.6.1:
| C Symbol | Name |
|---|
| assembleCodeType | "assemblecode" |
| dictIteratorType | "dictIterator" |
| encodingType | "encoding" |
| exprCodeType | "exprcode" |
| indexType | "index" |
| lambdaType | "lambdaExpr" |
| levelReferenceType | "levelReference" |
| localVarNameType | "localVarName" |
| nsNameType | "nsName" |
| oldBooleanType | "boolean" |
| substCodeType | "substcode" |
| tclBignumType | "bignum" |
| tclBooleanType | "booleanString" |
| tclByteArrayType | "bytearray" |
| tclByteCodeType | "bytecode" |
| tclChannelType | "channel" |
| tclCmdNameType | "cmdName" |
| tclDictType | "dict" |
| tclDoubleType | "double" |
| tclEnsembleCmdType | "ensembleCommand" |
| tclFsPathType | "path" |
| tclInstNameType | "instname" |
| tclIntType | "int" |
| tclListType | "list" |
| tclNsVarNameType | "namespaceVarName" |
| tclParsedVarNameType | "parsedVarName" |
| tclProcBodyType | "procbody" |
| tclRegexpType | "regexp" |
| tclStringType | "string" |
| tclWideIntType | "wideInt" |
For tk8.6.1:
| C Symbol | Name |
|---|
| mmObjType | "mm" |
| optionObjType | "option" |
| pixelObjType | "pixel" |
| styleObjType | "style" |
| tkBitmapObjType | "bitmap" |
| tkBorderObjType | "border" |
| tkColorObjType | "color" |
| tkFontObjType | "font" |
| tkStateKeyObjType | "statekey" |
| tkTextIndexType | "textindex" |
| windowObjType | "window" |
The following is the script used to get the list. Please report any bug of the script, or additional types defined in well known Tcl extensions!
set files [glob {/home/antirez/SVC/tcltk/CVS/tcl/generic/*.[ch]}]
append re {Tcl_ObjType\s+([A-z]+?)\s+=\s+}
append re \{
append re {\s+"([A-z]+?)"}
foreach f $files {
set fd [open $f]
set text [read $fd]
close $fd
set types [regexp -all -inline $re $text]
foreach {- cname name} $types {
puts [format "%-20.20s \"%s\"" $cname $name]
}
}DKF: Don't forget to list the types defined by Tk as well. And you might want to check for platform-specific types too.