home *** CD-ROM | disk | FTP | other *** search
/ PC World 2002 May / PCWorld_2002-05_cd.bin / Software / TemaCD / activetcltk / ActiveTcl8.3.4.1-8.win32-ix86.exe / ActiveTcl8.3.4.1-win32-ix86 / include / itcl.h < prev    next >
Encoding:
C/C++ Source or Header  |  2001-10-22  |  5.5 KB  |  186 lines

  1. /*
  2.  * ------------------------------------------------------------------------
  3.  *      PACKAGE:  [incr Tcl]
  4.  *  DESCRIPTION:  Object-Oriented Extensions to Tcl
  5.  *
  6.  *  [incr Tcl] provides object-oriented extensions to Tcl, much as
  7.  *  C++ provides object-oriented extensions to C.  It provides a means
  8.  *  of encapsulating related procedures together with their shared data
  9.  *  in a local namespace that is hidden from the outside world.  It
  10.  *  promotes code re-use through inheritance.  More than anything else,
  11.  *  it encourages better organization of Tcl applications through the
  12.  *  object-oriented paradigm, leading to code that is easier to
  13.  *  understand and maintain.
  14.  *  
  15.  *  ADDING [incr Tcl] TO A Tcl-BASED APPLICATION:
  16.  *
  17.  *    To add [incr Tcl] facilities to a Tcl application, modify the
  18.  *    Tcl_AppInit() routine as follows:
  19.  *
  20.  *    1) Include this header file near the top of the file containing
  21.  *       Tcl_AppInit():
  22.  *
  23.  *         #include "itcl.h"
  24.  *
  25.  *    2) Within the body of Tcl_AppInit(), add the following lines:
  26.  *
  27.  *         if (Itcl_Init(interp) == TCL_ERROR) {
  28.  *             return TCL_ERROR;
  29.  *         }
  30.  * 
  31.  *    3) Link your application with libitcl.a
  32.  *
  33.  *    NOTE:  An example file "tclAppInit.c" containing the changes shown
  34.  *           above is included in this distribution.
  35.  *  
  36.  * ========================================================================
  37.  *  AUTHOR:  Michael J. McLennan
  38.  *           Bell Labs Innovations for Lucent Technologies
  39.  *           mmclennan@lucent.com
  40.  *           http://www.tcltk.com/itcl
  41.  *
  42.  *       modified for Stubs 5/20/1999 by 
  43.  *           David Gravereaux <davygrvy@bigfoot.com>
  44.  *
  45.  *     RCS:  $Id: itcl.h,v 1.16 2001/09/16 15:02:41 davygrvy Exp $
  46.  * ========================================================================
  47.  *           Copyright (c) 1993-1998  Lucent Technologies, Inc.
  48.  * ------------------------------------------------------------------------
  49.  * See the file "license.terms" for information on usage and redistribution
  50.  * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
  51.  */
  52. #ifndef ITCL_H
  53. #define ITCL_H
  54.  
  55. #include "tcl.h"
  56.  
  57. #define ITCL_VERSION "3.2"
  58. #define ITCL_PATCH_LEVEL "3.2.1"
  59. #define ITCL_MAJOR_VERSION 3
  60. #define ITCL_MINOR_VERSION 2
  61. #define ITCL_RELEASE_LEVEL 1
  62.  
  63. /* 
  64.  * A special definition used to allow this header file to be included 
  65.  * in resource files so that they can get obtain version information from
  66.  * this file.  Resource compilers don't like all the C stuff, like typedefs
  67.  * and procedure declarations, that occur below.
  68.  */
  69.  
  70. #ifndef RC_INVOKED
  71.  
  72. #undef TCL_STORAGE_CLASS
  73. #ifdef BUILD_itcl
  74. # define TCL_STORAGE_CLASS DLLEXPORT
  75. #else
  76. # ifdef USE_ITCL_STUBS
  77. #  define TCL_STORAGE_CLASS
  78. # else
  79. #  define TCL_STORAGE_CLASS DLLIMPORT
  80. # endif
  81. #endif
  82.  
  83. #ifndef TCL_NEWEXTERN
  84. #   ifdef __cplusplus
  85. #    define OLDEXTERN extern "C" TCL_STORAGE_CLASS
  86. #   else
  87. #    define OLDEXTERN extern TCL_STORAGE_CLASS
  88. #   endif
  89. #   undef EXTERN
  90. #   define EXTERN(a) OLDEXTERN a
  91. #endif
  92.  
  93. /*
  94.  * Protection levels:
  95.  *
  96.  * ITCL_PUBLIC    - accessible from any namespace
  97.  * ITCL_PROTECTED - accessible from namespace that imports in "protected" mode
  98.  * ITCL_PRIVATE   - accessible only within the namespace that contains it
  99.  */
  100. #define ITCL_PUBLIC           1
  101. #define ITCL_PROTECTED        2
  102. #define ITCL_PRIVATE          3
  103. #define ITCL_DEFAULT_PROTECT  4
  104.  
  105.  
  106. /*
  107.  *  Generic stack.
  108.  */
  109. typedef struct Itcl_Stack {
  110.     ClientData *values;          /* values on stack */
  111.     int len;                     /* number of values on stack */
  112.     int max;                     /* maximum size of stack */
  113.     ClientData space[5];         /* initial space for stack data */
  114. } Itcl_Stack;
  115.  
  116. #define Itcl_GetStackSize(stackPtr) ((stackPtr)->len)
  117.  
  118. /*
  119.  *  Generic linked list.
  120.  */
  121. struct Itcl_List;
  122. typedef struct Itcl_ListElem {
  123.     struct Itcl_List* owner;     /* list containing this element */
  124.     ClientData value;            /* value associated with this element */
  125.     struct Itcl_ListElem *prev;  /* previous element in linked list */
  126.     struct Itcl_ListElem *next;  /* next element in linked list */
  127. } Itcl_ListElem;
  128.  
  129. typedef struct Itcl_List {
  130.     int validate;                /* validation stamp */
  131.     int num;                     /* number of elements */
  132.     struct Itcl_ListElem *head;  /* previous element in linked list */
  133.     struct Itcl_ListElem *tail;  /* next element in linked list */
  134. } Itcl_List;
  135.  
  136. #define Itcl_FirstListElem(listPtr) ((listPtr)->head)
  137. #define Itcl_LastListElem(listPtr)  ((listPtr)->tail)
  138. #define Itcl_NextListElem(elemPtr)  ((elemPtr)->next)
  139. #define Itcl_PrevListElem(elemPtr)  ((elemPtr)->prev)
  140. #define Itcl_GetListLength(listPtr) ((listPtr)->num)
  141. #define Itcl_GetListValue(elemPtr)  ((elemPtr)->value)
  142.  
  143. /*
  144.  *  Token representing the state of an interpreter.
  145.  */
  146. typedef struct Itcl_InterpState_ *Itcl_InterpState;
  147.  
  148.  
  149. /*
  150.  * Include the public function declarations that are accessible via
  151.  * the stubs table.
  152.  */
  153.  
  154. #include "itclDecls.h"
  155.  
  156.  
  157. /*
  158.  * Itcl_InitStubs is used by extensions like Itk that can be linked
  159.  * against the itcl stubs library.  If we are not using stubs
  160.  * then this reduces to package require.
  161.  */
  162.  
  163. #ifdef USE_ITCL_STUBS
  164.  
  165. #ifdef __cplusplus
  166. extern "C"
  167. #endif
  168. CONST char *    Itcl_InitStubs _ANSI_ARGS_((Tcl_Interp *interp,
  169.                 char *version, int exact));
  170. #else
  171. #define Itcl_InitStubs(interp, version, exact) \
  172.       Tcl_PkgRequire(interp, "Itcl", version, exact)
  173. #endif
  174.  
  175. /*
  176.  * Public functions that are not accessible via the stubs table.
  177.  */
  178.  
  179.  
  180. #endif /* RC_INVOKED */
  181.  
  182. #undef TCL_STORAGE_CLASS
  183. #define TCL_STORAGE_CLASS DLLIMPORT
  184.  
  185. #endif /* ITCL_H */
  186.