1/* -*- Mode: c++ -*-
2 *
3 *  $Id: xotcl.h,v 1.13 2007/09/18 19:27:33 neumann Exp $
4 *
5 *  Extended Object Tcl (XOTcl)
6 *
7 *  Copyright (C) 1999-2008 Gustaf Neumann, Uwe Zdun
8 *
9 *  This software is based upon MIT Object Tcl by David Wetherall and
10 *  Christopher J. Lindblad, that contains the following copyright
11 *  message:
12 *
13 *  Copyright 1993 Massachusetts Institute of Technology
14 *
15 *  Permission to use, copy, modify, distribute, and sell this
16 *  software and its documentation for any purpose is hereby granted
17 *  without fee, provided that the above copyright notice appear in
18 *  all copies and that both that copyright notice and this permission
19 *  notice appear in supporting documentation, and that the name of
20 *  M.I.T. not be used in advertising or publicity pertaining to
21 *  distribution of the software without specific, written prior
22 *  permission.  M.I.T. makes no representations about the suitability
23 *  of this software for any purpose.  It is provided "as is" without
24 *  express or implied warranty.
25 * */
26
27#ifndef _xotcl_h_
28#define _xotcl_h_
29
30#include "tcl.h"
31
32#undef TCL_STORAGE_CLASS
33#ifdef BUILD_xotcl
34# define TCL_STORAGE_CLASS DLLEXPORT
35#else
36# ifdef USE_XOTCL_STUBS
37#  define TCL_STORAGE_CLASS
38# else
39#  define TCL_STORAGE_CLASS DLLIMPORT
40# endif
41#endif
42
43/* use documented interface to link XOTcl state to an interpreter */
44#define USE_ASSOC_DATA 1
45
46/* new namespace support (post xotcl 1.2.0) */
47#define NAMESPACEINSTPROCS 1
48
49/* activate bytecode support
50#define XOTCL_BYTECODE
51*/
52
53/* activate/deacticate profiling information at the end
54   of running the program
55#define PROFILE
56*/
57
58/* make self, proc and class in instproc and procs
59#define AUTOVARS
60*/
61
62#define KEEP_TCL_CMD_TYPE 1
63
64/* activate/deacticate assert
65#define NDEBUG 1
66*/
67#define NDEBUG 1
68
69/* activate/deacticate memory tracing
70#define XOTCL_MEM_TRACE 1
71#define XOTCL_MEM_COUNT 1
72*/
73
74/*#define REFCOUNTED 1*/
75
76/*
77#define XOTCLOBJ_TRACE 1
78#define REFCOUNT_TRACE 1
79*/
80
81/* turn  tracing output on/off
82#define CALLSTACK_TRACE 1
83#define DISPATCH_TRACE 1
84#define NAMESPACE_TRACE 1
85#define OBJDELETION_TRACE 1
86#define STACK_TRACE 1
87*/
88
89#ifdef XOTCL_MEM_COUNT
90# define DO_FULL_CLEANUP 1
91#endif
92
93#ifdef AOL_SERVER
94# ifndef TCL_THREADS
95#  define TCL_THREADS
96# endif
97#endif
98
99#ifdef TCL_THREADS
100# define DO_CLEANUP
101#endif
102
103#ifdef DO_FULL_CLEANUP
104# define DO_CLEANUP
105#endif
106
107/*
108 * prevent old TCL-versions
109 */
110
111#if TCL_MAJOR_VERSION < 8
112# error Tcl distribution is TOO OLD, we require at least tcl8.0
113#endif
114
115#if TCL_MAJOR_VERSION==8 && TCL_MINOR_VERSION<1
116# define PRE81
117#else
118# if TCL_MAJOR_VERSION==8 && TCL_MINOR_VERSION==1
119#  define V81
120# endif
121#endif
122#if TCL_MAJOR_VERSION==8 && TCL_MINOR_VERSION<2
123# define PRE82
124#endif
125#if TCL_MAJOR_VERSION==8 && TCL_MINOR_VERSION<3
126# define PRE83
127#endif
128#if TCL_MAJOR_VERSION==8 && TCL_MINOR_VERSION<4
129# define PRE84
130#endif
131#if TCL_MAJOR_VERSION==8 && TCL_MINOR_VERSION<5
132# define PRE85
133#endif
134#if TCL_MAJOR_VERSION==8 && TCL_MINOR_VERSION<6
135# define PRE86
136#endif
137
138#if !defined(FORWARD_COMPATIBLE)
139# if defined(PRE85)
140#  define FORWARD_COMPATIBLE 1
141# else
142#  define FORWARD_COMPATIBLE 0
143# endif
144#endif
145
146#define XOTCL_NONLEAF_METHOD (ClientData)0x01
147
148#if defined(PRE86)
149# define CONST86
150# define Tcl_GetErrorLine(interp) (interp)->errorLine
151# define Tcl_NRCallObjProc(interp, proc, cd, objc, objv) \
152  (*(proc))((cd), (interp), (objc), (objv))
153#else
154# define NRE
155#endif
156
157
158/*
159 * A special definition used to allow this header file to be included
160 * in resource files so that they can get obtain version information from
161 * this file.  Resource compilers don't like all the C stuff, like typedefs
162 * and procedure declarations, that occur below.
163 */
164
165#ifndef RC_INVOKED
166
167/*
168#ifdef __cplusplus
169extern "C" {
170#endif
171*/
172
173
174/*
175 * The structures XOTcl_Object and XOTcl_Class define mostly opaque
176 * data structures for the internal use strucures XOTclObject and
177 * XOTclClass (both defined in XOTclInt.h). Modification of elements
178 * visible elements must be mirrored in both incarnations.
179 */
180
181typedef struct XOTcl_Object {
182  Tcl_Obj *cmdName;
183} XOTcl_Object;
184
185typedef struct XOTcl_Class {
186  struct XOTcl_Object object;
187} XOTcl_Class;
188
189
190/*
191 * Include the public function declarations that are accessible via
192 * the stubs table.
193 */
194#include "xotclDecls.h"
195
196/*
197 * Xotcl_InitStubs is used by extensions  that can be linked
198 * against the xotcl stubs library.  If we are not using stubs
199 * then this reduces to package require.
200 */
201
202#ifdef USE_XOTCL_STUBS
203
204# ifdef __cplusplus
205extern "C"
206# endif
207CONST char *
208Xotcl_InitStubs _ANSI_ARGS_((Tcl_Interp *interp, CONST char *version, int exact));
209#else
210# define Xotcl_InitStubs(interp, version, exact) \
211      Tcl_PkgRequire(interp, "XOTcl", version, exact)
212#endif
213
214#endif /* RC_INVOKED */
215
216#undef TCL_STORAGE_CLASS
217#define TCL_STORAGE_CLASS DLLIMPORT
218
219#endif /* _xotcl_h_ */
220