|
||||
File indexing completed on 2025-01-17 09:55:34
0001 /* 0002 * itcl.h -- 0003 * 0004 * This file contains definitions for the C-implemeted part of a Itcl 0005 * this version of [incr Tcl] (Itcl) is a completely new implementation 0006 * based on TclOO extension of Tcl 8.5 0007 * It tries to provide the same interfaces as the original implementation 0008 * of Michael J. McLennan 0009 * Some small pieces of code are taken from that implementation 0010 * 0011 * Copyright (c) 2007 by Arnulf P. Wiedemann 0012 * 0013 * See the file "license.terms" for information on usage and redistribution of 0014 * this file, and for a DISCLAIMER OF ALL WARRANTIES. 0015 */ 0016 0017 /* 0018 * ------------------------------------------------------------------------ 0019 * PACKAGE: [incr Tcl] 0020 * DESCRIPTION: Object-Oriented Extensions to Tcl 0021 * 0022 * [incr Tcl] provides object-oriented extensions to Tcl, much as 0023 * C++ provides object-oriented extensions to C. It provides a means 0024 * of encapsulating related procedures together with their shared data 0025 * in a local namespace that is hidden from the outside world. It 0026 * promotes code re-use through inheritance. More than anything else, 0027 * it encourages better organization of Tcl applications through the 0028 * object-oriented paradigm, leading to code that is easier to 0029 * understand and maintain. 0030 * 0031 * ADDING [incr Tcl] TO A Tcl-BASED APPLICATION: 0032 * 0033 * To add [incr Tcl] facilities to a Tcl application, modify the 0034 * Tcl_AppInit() routine as follows: 0035 * 0036 * 1) Include this header file near the top of the file containing 0037 * Tcl_AppInit(): 0038 * 0039 * #include "itcl.h" 0040 * 0041 * 2) Within the body of Tcl_AppInit(), add the following lines: 0042 * 0043 * if (Itcl_Init(interp) == TCL_ERROR) { 0044 * return TCL_ERROR; 0045 * } 0046 * 0047 * 3) Link your application with libitcl.a 0048 * 0049 * NOTE: An example file "tclAppInit.c" containing the changes shown 0050 * above is included in this distribution. 0051 * 0052 *--------------------------------------------------------------------- 0053 */ 0054 0055 #ifndef ITCL_H_INCLUDED 0056 #define ITCL_H_INCLUDED 0057 0058 #include <tcl.h> 0059 0060 #if (TCL_MAJOR_VERSION == 8) && (TCL_MINOR_VERSION < 6) 0061 # error Itcl 4 build requires tcl.h from Tcl 8.6 or later 0062 #endif 0063 0064 /* 0065 * For C++ compilers, use extern "C" 0066 */ 0067 0068 #ifdef __cplusplus 0069 extern "C" { 0070 #endif 0071 0072 #ifndef TCL_ALPHA_RELEASE 0073 # define TCL_ALPHA_RELEASE 0 0074 #endif 0075 #ifndef TCL_BETA_RELEASE 0076 # define TCL_BETA_RELEASE 1 0077 #endif 0078 #ifndef TCL_FINAL_RELEASE 0079 # define TCL_FINAL_RELEASE 2 0080 #endif 0081 0082 #define ITCL_MAJOR_VERSION 4 0083 #define ITCL_MINOR_VERSION 2 0084 #define ITCL_RELEASE_LEVEL TCL_FINAL_RELEASE 0085 #define ITCL_RELEASE_SERIAL 2 0086 0087 #define ITCL_VERSION "4.2" 0088 #define ITCL_PATCH_LEVEL "4.2.2" 0089 0090 0091 /* 0092 * A special definition used to allow this header file to be included from 0093 * windows resource files so that they can obtain version information. 0094 * RC_INVOKED is defined by default by the windows RC tool. 0095 * 0096 * Resource compilers don't like all the C stuff, like typedefs and function 0097 * declarations, that occur below, so block them out. 0098 */ 0099 0100 #ifndef RC_INVOKED 0101 0102 #define ITCL_NAMESPACE "::itcl" 0103 0104 #ifndef ITCLAPI 0105 # if defined(BUILD_itcl) 0106 # define ITCLAPI MODULE_SCOPE 0107 # else 0108 # define ITCLAPI extern 0109 # undef USE_ITCL_STUBS 0110 # define USE_ITCL_STUBS 1 0111 # endif 0112 #endif 0113 0114 #if defined(BUILD_itcl) && !defined(STATIC_BUILD) 0115 # define ITCL_EXTERN extern DLLEXPORT 0116 #else 0117 # define ITCL_EXTERN extern 0118 #endif 0119 0120 ITCL_EXTERN int Itcl_Init(Tcl_Interp *interp); 0121 ITCL_EXTERN int Itcl_SafeInit(Tcl_Interp *interp); 0122 0123 /* 0124 * Protection levels: 0125 * 0126 * ITCL_PUBLIC - accessible from any namespace 0127 * ITCL_PROTECTED - accessible from namespace that imports in "protected" mode 0128 * ITCL_PRIVATE - accessible only within the namespace that contains it 0129 */ 0130 #define ITCL_PUBLIC 1 0131 #define ITCL_PROTECTED 2 0132 #define ITCL_PRIVATE 3 0133 #define ITCL_DEFAULT_PROTECT 4 0134 0135 /* 0136 * Generic stack. 0137 */ 0138 typedef struct Itcl_Stack { 0139 ClientData *values; /* values on stack */ 0140 int len; /* number of values on stack */ 0141 int max; /* maximum size of stack */ 0142 ClientData space[5]; /* initial space for stack data */ 0143 } Itcl_Stack; 0144 0145 #define Itcl_GetStackSize(stackPtr) ((stackPtr)->len) 0146 0147 /* 0148 * Generic linked list. 0149 */ 0150 struct Itcl_List; 0151 typedef struct Itcl_ListElem { 0152 struct Itcl_List* owner; /* list containing this element */ 0153 ClientData value; /* value associated with this element */ 0154 struct Itcl_ListElem *prev; /* previous element in linked list */ 0155 struct Itcl_ListElem *next; /* next element in linked list */ 0156 } Itcl_ListElem; 0157 0158 typedef struct Itcl_List { 0159 int validate; /* validation stamp */ 0160 int num; /* number of elements */ 0161 struct Itcl_ListElem *head; /* previous element in linked list */ 0162 struct Itcl_ListElem *tail; /* next element in linked list */ 0163 } Itcl_List; 0164 0165 #define Itcl_FirstListElem(listPtr) ((listPtr)->head) 0166 #define Itcl_LastListElem(listPtr) ((listPtr)->tail) 0167 #define Itcl_NextListElem(elemPtr) ((elemPtr)->next) 0168 #define Itcl_PrevListElem(elemPtr) ((elemPtr)->prev) 0169 #define Itcl_GetListLength(listPtr) ((listPtr)->num) 0170 #define Itcl_GetListValue(elemPtr) ((elemPtr)->value) 0171 0172 /* 0173 * Token representing the state of an interpreter. 0174 */ 0175 typedef struct Itcl_InterpState_ *Itcl_InterpState; 0176 0177 0178 /* 0179 * Include all the public API, generated from itcl.decls. 0180 */ 0181 0182 #include "itclDecls.h" 0183 0184 #endif /* RC_INVOKED */ 0185 0186 /* 0187 * end block for C++ 0188 */ 0189 0190 #ifdef __cplusplus 0191 } 0192 #endif 0193 0194 #endif /* ITCL_H_INCLUDED */
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |