アットウィキロゴ

Namespace

概要

名前空間に使う構造体の定義
tcl/generic/tclInt.h

メンバー

  • char *name; 名前空間の名前。::は含まれない。globalは""だが、"::"も使える。
  • char *fullName; 名前空間のフルネーム ::から始まる。
  • ClientData clientData; 名前空間に関連つけられた An arbitrary value
  • Tcl_NamespaceDeleteProc *deleteProc; 名前空間を削除するときに呼ばれる関数へのポインタ
  • struct Namespace *parentPtr; 親の名前空間へのポインタ。NULLの時はglobal名前空間を示す。
  • Tcl_HashTable childTable; 子名前空間、文字列によってインデックスされる。
  • long nsId; 名前空間のユニークID
  • Tcl_Interp *interp; 名前空間を含んでいるインタプリタ
  • int flags; 名前空間のフラグ NS_DYING と NS_DEAD
  • int activationCount; TCLコールスタック上にある名前空間に対しての、コールフレーム数。0になるまで、名前空間は解放されない。
  • int refCount; リファレンスカウント。0になるまで名前空間は解放されない。
  • Tcl_HashTable cmdTable; 名前空間に含まれるコマンドテーブル。
  • TclVarHashTable varTable; 名前空間に含まれる変数テーブル
  • char **exportArrayPtr; どのコマンドがexportされているかを記述している文字パターンの配列へのポインタ。string matchスタイルで記述されている。exportパターンがない場合はNULL
  • int numExportPatterns; exportArrayPtrのサイズ
  • int maxExportPatterns; 今アロケートされているexportパターンの数
  • int cmdRefEpoch; 新しいコマンドが、Commandポインターでキャッシュされているこの名前空間
  • int resolverEpoch; 名前の解決のルールが変わったとき、新しいコマンドがバイトコードにコンパイルされたコマンドをシャドウするときにインクリメントされる。
  • Tcl_ResolveCmdProc *cmdResProc; NULLじゃないとき、この手続きはTCLの普通のコマンド解決のメカニズムをオーバーライドする。
  • Tcl_ResolveVarProc *varResProc; NULLじゃないとき、この手続きはTCLの普通の変数の名前解決のメカニズムをオーバーライドする。
  • Tcl_ResolveCompiledVarProc *compiledVarResProc;
  • int exportLookupEpoch; コマンドが名前空間に追加され、名前空間から削除されるか名前空間のexportが変更されたときにインクリメントされる。 TIP#112
  • Tcl_Ensemble *ensembles; 名前空間のトップに実装されている ensembles を含んでいる構造体のリスト
  • Tcl_Obj *unknownHandlerPtr; コマンドの解決に失敗したときのスクリプトフラグメン TIP#181
  • int commandPathLength; explicit pathの長さ
  • NamespacePathEntry *commandPathArray; 名前空間の explicit path の配列
  • NamespacePathEntry *commandPathSourceList; 名前空間を指す path entry のリンクドリスト

ソース

 /*
  * The structure below defines a namespace.
  * Note: the first five fields must match exactly the fields in a
  * Tcl_Namespace structure (see tcl.h). If you change one, be sure to change
  * the other.
  */
 
 typedef struct Namespace {
     char *name;			/* The namespace's simple (unqualified) name.
 				 * This contains no ::'s. The name of the
 				 * global namespace is "" although "::" is an
 				 * synonym. */
     char *fullName;		/* The namespace's fully qualified name. This
 				 * starts with ::. */
     [[ClientData]] clientData;	/* An arbitrary value associated with this
 				 * namespace. */
     [[Tcl_NamespaceDeleteProc]] *deleteProc;
 				/* Procedure invoked when deleting the
 				 * namespace to, e.g., free clientData. */
     struct Namespace *parentPtr;/* Points to the namespace that contains this
 				 * one. NULL if this is the global
 				 * namespace. */
     [[Tcl_HashTable]] childTable;	/* Contains any child namespaces. Indexed by
 				 * strings; values have type (Namespace *). */
     long nsId;			/* Unique id for the namespace. */
     [[Tcl_Interp]] *interp;		/* The interpreter containing this
 				 * namespace. */
     int flags;			/* OR-ed combination of the namespace status
 				 * flags NS_DYING and NS_DEAD listed below. */
     int activationCount;	/* Number of "activations" or active call
 				 * frames for this namespace that are on the
 				 * Tcl call stack. The namespace won't be
 				 * freed until activationCount becomes zero. */
     int refCount;		/* Count of references by namespaceName
 				 * objects. The namespace can't be freed until
 				 * refCount becomes zero. */
     Tcl_HashTable cmdTable;	/* Contains all the commands currently
 				 * registered in the namespace. Indexed by
 				 * strings; values have type (Command *).
 				 * Commands imported by Tcl_Import have
 				 * Command structures that point (via an
 				 * ImportedCmdRef structure) to the Command
 				 * structure in the source namespace's command
 				 * table. */
     TclVarHashTable varTable;	/* Contains all the (global) variables
 				 * currently in this namespace. Indexed by
 				 * strings; values have type (Var *). */
     char **exportArrayPtr;	/* Points to an array of string patterns
 				 * specifying which commands are exported. A
 				 * pattern may include "string match" style
 				 * wildcard characters to specify multiple
 				 * commands; however, no namespace qualifiers
 				 * are allowed. NULL if no export patterns are
 				 * registered. */
     int numExportPatterns;	/* Number of export patterns currently
 				 * registered using "namespace export". */
     int maxExportPatterns;	/* Mumber of export patterns for which space
 				 * is currently allocated. */
     int cmdRefEpoch;		/* Incremented if a newly added command
 				 * shadows a command for which this namespace
 				 * has already cached a Command* pointer; this
 				 * causes all its cached Command* pointers to
 				 * be invalidated. */
     int resolverEpoch;		/* Incremented whenever (a) the name
 				 * resolution rules change for this namespace
 				 * or (b) a newly added command shadows a
 				 * command that is compiled to bytecodes. This
 				 * invalidates all byte codes compiled in the
 				 * namespace, causing the code to be
 				 * recompiled under the new rules.*/
     Tcl_ResolveCmdProc *cmdResProc;
 				/* If non-null, this procedure overrides the
 				 * usual command resolution mechanism in Tcl.
 				 * This procedure is invoked within
 				 * Tcl_FindCommand to resolve all command
 				 * references within the namespace. */
     Tcl_ResolveVarProc *varResProc;
 				/* If non-null, this procedure overrides the
 				 * usual variable resolution mechanism in Tcl.
 				 * This procedure is invoked within
 				 * Tcl_FindNamespaceVar to resolve all
 				 * variable references within the namespace at
 				 * runtime. */
     Tcl_ResolveCompiledVarProc *compiledVarResProc;
 				/* If non-null, this procedure overrides the
 				 * usual variable resolution mechanism in Tcl.
 				 * This procedure is invoked within
 				 * LookupCompiledLocal to resolve variable
 				 * references within the namespace at compile
 				 * time. */
     int exportLookupEpoch;	/* Incremented whenever a command is added to
 				 * a namespace, removed from a namespace or
 				 * the exports of a namespace are changed.
 				 * Allows TIP#112-driven command lists to be
 				 * validated efficiently. */
     Tcl_Ensemble *ensembles;	/* List of structures that contain the details
 				 * of the ensembles that are implemented on
 				 * top of this namespace. */
     [[Tcl_Obj]] *unknownHandlerPtr;	/* A script fragment to be used when command
 				 * resolution in this namespace fails. TIP
 				 * 181. */
     int commandPathLength;	/* The length of the explicit path. */
     [[NamespacePathEntry]] *commandPathArray;
 				/* The explicit path of the namespace as an
 				 * array. */
     NamespacePathEntry *commandPathSourceList;
 				/* Linked list of path entries that point to
 				 * this namespace. */
 } Namespace;
最終更新:2011年11月02日 16:18