annotate CSP2/CSP2_env/env-d9b9114564458d9d-741b3de822f2aaca6c6caa4325c4afce/include/itcl.h @ 69:33d812a61356

planemo upload commit 2e9511a184a1ca667c7be0c6321a36dc4e3d116d
author jpayne
date Tue, 18 Mar 2025 17:55:14 -0400
parents
children
rev   line source
jpayne@69 1 /*
jpayne@69 2 * itcl.h --
jpayne@69 3 *
jpayne@69 4 * This file contains definitions for the C-implemeted part of a Itcl
jpayne@69 5 * this version of [incr Tcl] (Itcl) is a completely new implementation
jpayne@69 6 * based on TclOO extension of Tcl 8.5
jpayne@69 7 * It tries to provide the same interfaces as the original implementation
jpayne@69 8 * of Michael J. McLennan
jpayne@69 9 * Some small pieces of code are taken from that implementation
jpayne@69 10 *
jpayne@69 11 * Copyright (c) 2007 by Arnulf P. Wiedemann
jpayne@69 12 *
jpayne@69 13 * See the file "license.terms" for information on usage and redistribution of
jpayne@69 14 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
jpayne@69 15 */
jpayne@69 16
jpayne@69 17 /*
jpayne@69 18 * ------------------------------------------------------------------------
jpayne@69 19 * PACKAGE: [incr Tcl]
jpayne@69 20 * DESCRIPTION: Object-Oriented Extensions to Tcl
jpayne@69 21 *
jpayne@69 22 * [incr Tcl] provides object-oriented extensions to Tcl, much as
jpayne@69 23 * C++ provides object-oriented extensions to C. It provides a means
jpayne@69 24 * of encapsulating related procedures together with their shared data
jpayne@69 25 * in a local namespace that is hidden from the outside world. It
jpayne@69 26 * promotes code re-use through inheritance. More than anything else,
jpayne@69 27 * it encourages better organization of Tcl applications through the
jpayne@69 28 * object-oriented paradigm, leading to code that is easier to
jpayne@69 29 * understand and maintain.
jpayne@69 30 *
jpayne@69 31 * ADDING [incr Tcl] TO A Tcl-BASED APPLICATION:
jpayne@69 32 *
jpayne@69 33 * To add [incr Tcl] facilities to a Tcl application, modify the
jpayne@69 34 * Tcl_AppInit() routine as follows:
jpayne@69 35 *
jpayne@69 36 * 1) Include this header file near the top of the file containing
jpayne@69 37 * Tcl_AppInit():
jpayne@69 38 *
jpayne@69 39 * #include "itcl.h"
jpayne@69 40 *
jpayne@69 41 * 2) Within the body of Tcl_AppInit(), add the following lines:
jpayne@69 42 *
jpayne@69 43 * if (Itcl_Init(interp) == TCL_ERROR) {
jpayne@69 44 * return TCL_ERROR;
jpayne@69 45 * }
jpayne@69 46 *
jpayne@69 47 * 3) Link your application with libitcl.a
jpayne@69 48 *
jpayne@69 49 * NOTE: An example file "tclAppInit.c" containing the changes shown
jpayne@69 50 * above is included in this distribution.
jpayne@69 51 *
jpayne@69 52 *---------------------------------------------------------------------
jpayne@69 53 */
jpayne@69 54
jpayne@69 55 #ifndef ITCL_H_INCLUDED
jpayne@69 56 #define ITCL_H_INCLUDED
jpayne@69 57
jpayne@69 58 #include <tcl.h>
jpayne@69 59
jpayne@69 60 #if (TCL_MAJOR_VERSION == 8) && defined(TCL_MINOR_VERSION) && (TCL_MINOR_VERSION < 6)
jpayne@69 61 # error Itcl 4 build requires tcl.h from Tcl 8.6 or later
jpayne@69 62 #endif
jpayne@69 63
jpayne@69 64 /*
jpayne@69 65 * For C++ compilers, use extern "C"
jpayne@69 66 */
jpayne@69 67
jpayne@69 68 #ifdef __cplusplus
jpayne@69 69 extern "C" {
jpayne@69 70 #endif
jpayne@69 71
jpayne@69 72 #ifndef TCL_ALPHA_RELEASE
jpayne@69 73 # define TCL_ALPHA_RELEASE 0
jpayne@69 74 #endif
jpayne@69 75 #ifndef TCL_BETA_RELEASE
jpayne@69 76 # define TCL_BETA_RELEASE 1
jpayne@69 77 #endif
jpayne@69 78 #ifndef TCL_FINAL_RELEASE
jpayne@69 79 # define TCL_FINAL_RELEASE 2
jpayne@69 80 #endif
jpayne@69 81
jpayne@69 82 #define ITCL_MAJOR_VERSION 4
jpayne@69 83 #define ITCL_MINOR_VERSION 2
jpayne@69 84 #define ITCL_RELEASE_LEVEL TCL_FINAL_RELEASE
jpayne@69 85 #define ITCL_RELEASE_SERIAL 3
jpayne@69 86
jpayne@69 87 #define ITCL_VERSION "4.2"
jpayne@69 88 #define ITCL_PATCH_LEVEL "4.2.3"
jpayne@69 89
jpayne@69 90
jpayne@69 91 /*
jpayne@69 92 * A special definition used to allow this header file to be included from
jpayne@69 93 * windows resource files so that they can obtain version information.
jpayne@69 94 * RC_INVOKED is defined by default by the windows RC tool.
jpayne@69 95 *
jpayne@69 96 * Resource compilers don't like all the C stuff, like typedefs and function
jpayne@69 97 * declarations, that occur below, so block them out.
jpayne@69 98 */
jpayne@69 99
jpayne@69 100 #ifndef RC_INVOKED
jpayne@69 101
jpayne@69 102 #define ITCL_NAMESPACE "::itcl"
jpayne@69 103
jpayne@69 104 #ifndef ITCLAPI
jpayne@69 105 # if defined(BUILD_itcl)
jpayne@69 106 # define ITCLAPI MODULE_SCOPE
jpayne@69 107 # else
jpayne@69 108 # define ITCLAPI extern
jpayne@69 109 # undef USE_ITCL_STUBS
jpayne@69 110 # define USE_ITCL_STUBS 1
jpayne@69 111 # endif
jpayne@69 112 #endif
jpayne@69 113
jpayne@69 114 #if defined(BUILD_itcl) && !defined(STATIC_BUILD)
jpayne@69 115 # define ITCL_EXTERN extern DLLEXPORT
jpayne@69 116 #else
jpayne@69 117 # define ITCL_EXTERN extern
jpayne@69 118 #endif
jpayne@69 119
jpayne@69 120 ITCL_EXTERN int Itcl_Init(Tcl_Interp *interp);
jpayne@69 121 ITCL_EXTERN int Itcl_SafeInit(Tcl_Interp *interp);
jpayne@69 122
jpayne@69 123 /*
jpayne@69 124 * Protection levels:
jpayne@69 125 *
jpayne@69 126 * ITCL_PUBLIC - accessible from any namespace
jpayne@69 127 * ITCL_PROTECTED - accessible from namespace that imports in "protected" mode
jpayne@69 128 * ITCL_PRIVATE - accessible only within the namespace that contains it
jpayne@69 129 */
jpayne@69 130 #define ITCL_PUBLIC 1
jpayne@69 131 #define ITCL_PROTECTED 2
jpayne@69 132 #define ITCL_PRIVATE 3
jpayne@69 133 #define ITCL_DEFAULT_PROTECT 4
jpayne@69 134
jpayne@69 135 #if (TCL_MAJOR_VERSION == 8) && (TCL_MINOR_VERSION < 7) && !defined(Tcl_Size)
jpayne@69 136 # define Tcl_Size int
jpayne@69 137 #endif
jpayne@69 138
jpayne@69 139 /*
jpayne@69 140 * Generic stack.
jpayne@69 141 */
jpayne@69 142 typedef struct Itcl_Stack {
jpayne@69 143 void **values; /* values on stack */
jpayne@69 144 Tcl_Size len; /* number of values on stack */
jpayne@69 145 Tcl_Size max; /* maximum size of stack */
jpayne@69 146 void *space[5]; /* initial space for stack data */
jpayne@69 147 } Itcl_Stack;
jpayne@69 148
jpayne@69 149 #define Itcl_GetStackSize(stackPtr) ((stackPtr)->len)
jpayne@69 150
jpayne@69 151 /*
jpayne@69 152 * Generic linked list.
jpayne@69 153 */
jpayne@69 154 struct Itcl_List;
jpayne@69 155 typedef struct Itcl_ListElem {
jpayne@69 156 struct Itcl_List* owner; /* list containing this element */
jpayne@69 157 void *value; /* value associated with this element */
jpayne@69 158 struct Itcl_ListElem *prev; /* previous element in linked list */
jpayne@69 159 struct Itcl_ListElem *next; /* next element in linked list */
jpayne@69 160 } Itcl_ListElem;
jpayne@69 161
jpayne@69 162 typedef struct Itcl_List {
jpayne@69 163 int validate; /* validation stamp */
jpayne@69 164 Tcl_Size num; /* number of elements */
jpayne@69 165 struct Itcl_ListElem *head; /* previous element in linked list */
jpayne@69 166 struct Itcl_ListElem *tail; /* next element in linked list */
jpayne@69 167 } Itcl_List;
jpayne@69 168
jpayne@69 169 #define Itcl_FirstListElem(listPtr) ((listPtr)->head)
jpayne@69 170 #define Itcl_LastListElem(listPtr) ((listPtr)->tail)
jpayne@69 171 #define Itcl_NextListElem(elemPtr) ((elemPtr)->next)
jpayne@69 172 #define Itcl_PrevListElem(elemPtr) ((elemPtr)->prev)
jpayne@69 173 #define Itcl_GetListLength(listPtr) ((listPtr)->num)
jpayne@69 174 #define Itcl_GetListValue(elemPtr) ((elemPtr)->value)
jpayne@69 175
jpayne@69 176 /*
jpayne@69 177 * Token representing the state of an interpreter.
jpayne@69 178 */
jpayne@69 179 typedef struct Itcl_InterpState_ *Itcl_InterpState;
jpayne@69 180
jpayne@69 181
jpayne@69 182 /*
jpayne@69 183 * Include all the public API, generated from itcl.decls.
jpayne@69 184 */
jpayne@69 185
jpayne@69 186 #include "itclDecls.h"
jpayne@69 187
jpayne@69 188 #endif /* RC_INVOKED */
jpayne@69 189
jpayne@69 190 /*
jpayne@69 191 * end block for C++
jpayne@69 192 */
jpayne@69 193
jpayne@69 194 #ifdef __cplusplus
jpayne@69 195 }
jpayne@69 196 #endif
jpayne@69 197
jpayne@69 198 #endif /* ITCL_H_INCLUDED */