Version 0 of Tcl_Obj types list

Updated 2004-02-16 20:12:49

SS Feb162004 - In the process of writing the GC for the refereces 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. Note that the program matches for '&tcl[a-z\]Type', so types that are defined but are never used for object creations directly should not be included in the list.

This is the list of types defined in the .c and .h files.

 tclArrayHashKeyType
 tclArraySearchType
 tclBooleanType
 tclByteArrayType
 tclByteCodeType
 tclCmdNameType
 tclDictType
 tclDoubleType
 tclEndOffsetType
 tclEnsembleCmdType
 tclForeachInfoType
 tclFsPathType
 tclIndexType
 tclIntType
 tclListType
 tclLocalVarNameType
 tclNsNameType
 tclNsVarNameType
 tclObjHashKeyType
 tclOneWordHashKeyType
 tclParsedVarNameType
 tclProcBodyType
 tclRegexpType
 tclStringHashKeyType
 tclStringType
 tclWideIntType

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]}]
 foreach f $files {
     set fd [open $f]
     set text [read $fd]
     close $fd
     set types [regexp -all -inline {&tcl[A-z]+Type} $text]
     foreach t $types {
        set type([string range $t 1 end]) {}
     }
 }
 set list [lsort [array names type]]
 foreach e $list {  
     puts $e
 }