<?xml version="1.0" encoding="UTF-8" ?><rdf:RDF 
  xmlns="http://purl.org/rss/1.0/"
  xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
  xmlns:atom="http://www.w3.org/2005/Atom"
  xmlns:dc="http://purl.org/dc/elements/1.1/"
  xml:lang="ja">
  <channel rdf:about="http://w.atwiki.jp/natsutan/">
    <title>tcl/tkコードリーディング</title>
    <link>http://w.atwiki.jp/natsutan/</link>
    <atom:link href="https://w.atwiki.jp/natsutan/rss10.xml" rel="self" type="application/rss+xml" />
    <atom:link rel="hub" href="https://pubsubhubbub.appspot.com" />
    <description>tcl/tkコードリーディング</description>

    <dc:language>ja</dc:language>
    <dc:date>2011-11-10T22:14:31+09:00</dc:date>
    <utime>1320930871</utime>

    <items>
      <rdf:Seq>
                <rdf:li rdf:resource="https://w.atwiki.jp/natsutan/pages/74.html" />
                <rdf:li rdf:resource="https://w.atwiki.jp/natsutan/pages/73.html" />
                <rdf:li rdf:resource="https://w.atwiki.jp/natsutan/pages/72.html" />
                <rdf:li rdf:resource="https://w.atwiki.jp/natsutan/pages/71.html" />
                <rdf:li rdf:resource="https://w.atwiki.jp/natsutan/pages/70.html" />
                <rdf:li rdf:resource="https://w.atwiki.jp/natsutan/pages/69.html" />
                <rdf:li rdf:resource="https://w.atwiki.jp/natsutan/pages/68.html" />
                <rdf:li rdf:resource="https://w.atwiki.jp/natsutan/pages/67.html" />
                <rdf:li rdf:resource="https://w.atwiki.jp/natsutan/pages/66.html" />
                <rdf:li rdf:resource="https://w.atwiki.jp/natsutan/pages/65.html" />
              </rdf:Seq>
    </items>
	
		
    
  </channel>
    <item rdf:about="https://w.atwiki.jp/natsutan/pages/74.html">
    <title>TclpInitLock</title>
    <link>https://w.atwiki.jp/natsutan/pages/74.html</link>
    <description>
      * 概要
Win32APIを使って、joinLock, initLock, masterLock の変数を初期化する。
initLockを使ってクリティカルセクションに入って関数を抜ける。

[[tcl/win/tclWinThrd.c]]
* 引数
無し

* 戻り値
無し。

* 処理

　&amp;color(green){initが0でないとき、初期化処理を行う}
　if (!init) {
　　&amp;color(green){initを1に}
　　init = 1;
　　&amp;color(green){joinLock, initLock, masterLock を InitializeCriticalSection で初期化する。InitializeCriticalSectionはWindows API}
　　[[InitializeCriticalSection&gt;http://msdn.microsoft.com/ja-jp/library/cc429223.aspx]](&amp;joinLock);
　　[[InitializeCriticalSection&gt;http://msdn.microsoft.com/ja-jp/library/cc429223.aspx]](&amp;initLock);
　　[[InitializeCriticalSection&gt;http://msdn.microsoft.com/ja-jp/library/cc429223.aspx]](&amp;masterLock);
　}
　&amp;color(green){initLockを使ってクリティカルセクションに入る。}  
　[[EnterCriticalSection&gt;http://msdn.microsoft.com/ja-jp/library/cc429095.aspx]](&amp;initLock);



* ソース
  /*
   *----------------------------------------------------------------------
   *
   * TclpInitLock
   *
   *	This procedure is used to grab a lock that serialize    </description>
    <dc:date>2011-11-10T22:14:31+09:00</dc:date>
    <utime>1320930871</utime>
  </item>
    <item rdf:about="https://w.atwiki.jp/natsutan/pages/73.html">
    <title>tcl/win/tclWinThrd.c</title>
    <link>https://w.atwiki.jp/natsutan/pages/73.html</link>
    <description>
      * 概要


* include
#include &quot;tclWinInt.h&quot;
#include &lt;sys/stat.h&gt;


* 変数宣言

/*
 * This is the master lock used to serialize access to other serialization
 * data structures.
 */

static CRITICAL_SECTION masterLock;
static int init = 0;
#define MASTER_LOCK TclpMasterLock()
#define MASTER_UNLOCK TclpMasterUnlock()


/*
 * This is the master lock used to serialize initialization and finalization
 * of Tcl as a whole.
 */

static CRITICAL_SECTION initLock;

/*
 * allocLock is used by Tcl&#039;s version of malloc for synchronization. For
 * obvious reasons, cannot use any dyamically allocated storage.
 */

#ifdef TCL_THREADS

static struct Tcl_Mutex_ {
    CRITICAL_SECTION crit;
} allocLock;
static Tcl_Mutex allocLockPtr = &amp;allocLock;
static int allocOnce = 0;

#endif /* TCL_THREADS */

/*
 * The joinLock serializes Create- and ExitThread. This is necessary to
 * prevent a race where a new joinable thread exits before the creating thread
 * had the time     </description>
    <dc:date>2011-11-10T22:16:16+09:00</dc:date>
    <utime>1320930976</utime>
  </item>
    <item rdf:about="https://w.atwiki.jp/natsutan/pages/72.html">
    <title>Tcl_Panic</title>
    <link>https://w.atwiki.jp/natsutan/pages/72.html</link>
    <description>
      * 概要
tclStubsPtr-&gt;tcl_Panicの呼び出し

[tcl/generic/tclDecls.h]
*ソース
 #ifndef Tcl_Panic
 #define Tcl_Panic \
	(tclStubsPtr-&gt;tcl_Panic) /* 2 */    </description>
    <dc:date>2011-11-10T21:47:16+09:00</dc:date>
    <utime>1320929236</utime>
  </item>
    <item rdf:about="https://w.atwiki.jp/natsutan/pages/71.html">
    <title>TclInitSubsystems</title>
    <link>https://w.atwiki.jp/natsutan/pages/71.html</link>
    <description>
      * 概要
Tcl内部のサブシステムの初期化

[[generic/tclEvent.c&gt;tcl/generic/tclEvent.c]]
* 引数
無し

* 戻り値
無し

* 処理

　&amp;color(green){inFinalizeが0でなければTclPanicを呼び出す}
　if (inFinalize != 0) {
　　[[Tcl_Panic]](&quot;TclInitSubsystems called while finalizing&quot;);
　}
　&amp;color(green){subsystemsInitialized が0の時初期化を行う}
　if (subsystemsInitialized == 0) {
　　&amp;color(green){TclInitLockでLockに使用する変数の初期化を行い、initLockを使ってクリティカルセクションに入る。}
　　[[TclpInitLock]]();
  	if (subsystemsInitialized == 0) {
  	    /*
  	     * Have to set this bit here to avoid deadlock with the routines
  	     * below us that call into TclInitSubsystems.
  	     */
  
  	    subsystemsInitialized = 1;
  
  	    /*
  	     * Initialize locks used by the memory allocators before anything
  	     * interesting happens so we can use the allocators in the
  	     * implementation of self-initializing locks.
  	     */
  
  	    TclInitThreadStorage();     /* Creates master hash table for
  					 * thread local storage */
  #if USE_T    </description>
    <dc:date>2011-11-10T22:18:07+09:00</dc:date>
    <utime>1320931087</utime>
  </item>
    <item rdf:about="https://w.atwiki.jp/natsutan/pages/70.html">
    <title>tcl/generic/tclEvent.c</title>
    <link>https://w.atwiki.jp/natsutan/pages/70.html</link>
    <description>
      * 概要

* inlude
&quot;tclInt.h&quot;

* 変数宣言

  
  /*
   * The data structure below is used to report background errors. One such
   * structure is allocated for each error; it holds information about the
   * interpreter and the error until an idle handler command can be invoked.
   */
  
  typedef struct BgError {
      [[Tcl_Obj]] *errorMsg;		/* Copy of the error message (the interp&#039;s
  				 * result when the error occurred). */
      Tcl_Obj *returnOpts;	/* Active return options when the error
  				 * occurred */
      struct BgError *nextPtr;	/* Next in list of all pending error reports
  				 * for this interpreter, or NULL for end of
  				 * list. */
  } BgError;
  
  /*
   * One of the structures below is associated with the &quot;tclBgError&quot; assoc data
   * for each interpreter. It keeps track of the head and tail of the list of
   * pending background errors for the interpreter.
   */
  
  typedef struct ErrAssocData {
      [[Tcl_Interp]] *interp;		/* Interp    </description>
    <dc:date>2011-11-10T21:36:32+09:00</dc:date>
    <utime>1320928592</utime>
  </item>
    <item rdf:about="https://w.atwiki.jp/natsutan/pages/69.html">
    <title>ByteCodeStats</title>
    <link>https://w.atwiki.jp/natsutan/pages/69.html</link>
    <description>
      * 概要
バイトコードコンパイラとインタープリタの統計情報
[[tcl/generic/tclInt.h]]

* ソース
 /*
  * The following structure defines for each Tcl interpreter various
  * statistics-related information about the bytecode compiler and
  * interpreter&#039;s operation in that interpreter.
  */ 

 #ifdef TCL_COMPILE_STATS
 typedef struct ByteCodeStats {
     long numExecutions;		/* Number of ByteCodes executed. */
    long numCompilations;	/* Number of ByteCodes created. */
    long numByteCodesFreed;	/* Number of ByteCodes destroyed. */
    long instructionCount[256];	/* Number of times each instruction was
				 * executed. */

    double totalSrcBytes;	/* Total source bytes ever compiled. */
    double totalByteCodeBytes;	/* Total bytes for all ByteCodes. */
    double currentSrcBytes;	/* Src bytes for all current ByteCodes. */
    double currentByteCodeBytes;/* Code bytes in all current ByteCodes. */

    long srcCount[32];		/* Source size distribution: # of srcs of
				 * size [2**(n-1)..2**n), n    </description>
    <dc:date>2011-11-09T18:42:57+09:00</dc:date>
    <utime>1320831777</utime>
  </item>
    <item rdf:about="https://w.atwiki.jp/natsutan/pages/68.html">
    <title>ContLineLoc</title>
    <link>https://w.atwiki.jp/natsutan/pages/68.html</link>
    <description>
      * 概要
[[tcl/generic/tclInt.h]]

* ソース
 /*
  * Structure to record the locations of invisible continuation lines in
  * literal scripts, as character offset from the beginning of the script. Both
  * compiler and direct evaluator use this information to adjust their line
  * counters when tracking through the script, because when it is invoked the
  * continuation line marker as a whole has been removed already, meaning that
  * the \n which was part of it is gone as well, breaking regular line
  * tracking.
  *
  * These structures are allocated and filled by both the function
  * TclSubstTokens() in the file &quot;tclParse.c&quot; and its caller TclEvalEx() in the
  * file &quot;tclBasic.c&quot;, and stored in the thread-global hashtable &quot;lineCLPtr&quot; in
  * file &quot;tclObj.c&quot;. They are used by the functions TclSetByteCodeFromAny() and
  * TclCompileScript(), both found in the file &quot;tclCompile.c&quot;. Their memory is
  * released by the function TclFreeObj(), in the file &quot;tclObj.c&quot;, and also by
    </description>
    <dc:date>2011-11-09T18:16:20+09:00</dc:date>
    <utime>1320830180</utime>
  </item>
    <item rdf:about="https://w.atwiki.jp/natsutan/pages/67.html">
    <title>CmdFrame</title>
    <link>https://w.atwiki.jp/natsutan/pages/67.html</link>
    <description>
      * 概要
コマンドフレームを定義する構造体

      /*
       * Data needed for Eval vs TEBC
       *
       * EXECUTION CONTEXTS and usage of CmdFrame
       *
       * Field	  TEBC		  EvalEx	  EvalObjEx
       * =======	  ====		  ======	  =========
       * level	  yes		  yes		  yes
       * type	  BC/PREBC	  SRC/EVAL	  EVAL_LIST
       * line0	  yes		  yes		  yes
       * framePtr	  yes		  yes		  yes
       * =======	  ====		  ======	  =========
       *
       * =======	  ====		  ======	  ========= union data
       * line1	  -		  yes		  -
       * line3	  -		  yes		  -
       * path	  -		  yes		  -
       * -------	  ----		  ------	  ---------
       * codePtr	  yes		  -		  -
       * pc	  yes		  -		  -
       * =======	  ====		  ======	  =========
       *
       * =======	  ====		  ======	  ========= | union cmd
       * listPtr	  -		  -		  yes	    |
       * -------	  ----		  ------	  --------- |
       * cmd	  yes		  yes		  -	    |
       * cmdlen	  yes		  yes		  -	    |    </description>
    <dc:date>2011-11-09T18:00:21+09:00</dc:date>
    <utime>1320829221</utime>
  </item>
    <item rdf:about="https://w.atwiki.jp/natsutan/pages/66.html">
    <title>Tcl_Time</title>
    <link>https://w.atwiki.jp/natsutan/pages/66.html</link>
    <description>
      * 概要
時刻を表す構造体。epochからの秒数

[[tcl/generic/tcl.h]]

*ソース
 /*
  * The following structure keeps is used to hold a time value, either as an
  * absolute time (the number of seconds from the epoch) or as an elapsed time.
  * On Unix systems the epoch is Midnight Jan 1, 1970 GMT.
  */
 
 typedef struct Tcl_Time {
     long sec;			/* Seconds. */
     long usec;			/* Microseconds. */
 } Tcl_Time;    </description>
    <dc:date>2011-11-08T11:31:37+09:00</dc:date>
    <utime>1320719497</utime>
  </item>
    <item rdf:about="https://w.atwiki.jp/natsutan/pages/65.html">
    <title>ActiveInterpTrace</title>
    <link>https://w.atwiki.jp/natsutan/pages/65.html</link>
    <description>
      * 概要
インタープリターのトレース用

[[tcl/generic/tclInt.h]]
* メンバー
- struct [[ActiveInterpTrace]] *nextPtr; 次のアクティブコマンドトレースへのポインタ
- [[Trace]] *nextTracePtr; このトレースが終わった時、次にチェックする手続き
- int reverseScan;		逆順の時true

* ソース
  /*
   * When an interpreter trace is active (i.e. its associated procedure is
   * executing), one of the following structures is linked into a list
   * associated with the interpreter. The information in the structure is needed
   * in order for Tcl to behave reasonably if traces are deleted while traces
   * are active.
   */
  
  typedef struct ActiveInterpTrace {
      struct ActiveInterpTrace *nextPtr;
  				/* Next in list of all active command traces
  				 * for the interpreter, or NULL if no more. */
      [[Trace]] *nextTracePtr;	/* Next trace to check after current trace
  				 * procedure returns; if this trace gets
  				 * deleted, must update pointer to avoid using
  				 * free&#039;d memory. */
      int reverseScan;		/* Boolean set true when tr    </description>
    <dc:date>2011-11-07T19:55:42+09:00</dc:date>
    <utime>1320663342</utime>
  </item>
  </rdf:RDF>
