]>
git.zerfleddert.de Git - micropolis/blob - src/tclx/src/tclplus.cc
4 * It also defines C++ classes that can be used to access a Tcl interpreter.
5 * If tcl.h is not already included, it includes it. Tcl.h has macros that
6 * allow it to work with K&R C, ANSI C and C++.
7 *---------------------------------------------------------------------------
8 * Copyright 1992 Karl Lehenbauer and Mark Diekhans.
10 * Permission to use, copy, modify, and distribute this software and its
11 * documentation for any purpose and without fee is hereby granted, provided
12 * that the above copyright notice appear in all copies. Karl Lehenbauer and
13 * Mark Diekhans make no representations about the suitability of this
14 * software for any purpose. It is provided "as is" without express or
16 *---------------------------------------------------------------------------
17 * Based on Tcl C++ classes developed by Parag Patel.
18 *-----------------------------------------------------------------------------
19 * $Id: tcl++.C,v 2.0 1992/10/16 04:51:32 markd Rel $
20 *-----------------------------------------------------------------------------
26 *----------------------------------------------------------------------
28 * TclInterp_cl::CatVarArgs --
30 * Concatenate all of the strings passed via varargs into a single string.
33 * o argPtr (I) - A pointer to the first argument, as returned by va_start.
34 * Should be terminate by a NULL.
37 * A dynamically allocated string.
38 *----------------------------------------------------------------------
41 TclInterp_cl::CatVarArgs (va_list argPtr
)
45 va_list nextArgPtr
= argPtr
;
48 parmPtr
= va_arg (nextArgPtr
, char *);
51 len
+= strlen (parmPtr
);
53 ptr
= (char *) ckalloc (len
+ 1);
57 parmPtr
= va_arg (nextArgPtr
, char *);
60 strcat (ptr
, parmPtr
);
66 *----------------------------------------------------------------------
68 * TclInterp_cl::AppendResult --
70 * Class interface to Tcl_AppendResult (see Tcl documentation for
71 * details). Not inlined since varargs and inline don't work on some C++
73 *----------------------------------------------------------------------
76 TclInterp_cl::AppendResult (const char *p
,
83 strPtr
= CatVarArgs (argPtr
);
84 Tcl_AppendResult (interp
, p
, strPtr
, (char *) NULL
);
90 *----------------------------------------------------------------------
92 * TclInterp_cl::SetErrorCode --
94 * Class interface to Tcl_SetErrorCode (see Tcl documentation for
95 * details). Not inlined since varargs and inline don't work on some C++
97 *----------------------------------------------------------------------
100 TclInterp_cl::SetErrorCode (char *p
,
106 va_start (argPtr
, p
);
107 strPtr
= CatVarArgs (argPtr
);
108 Tcl_SetErrorCode (interp
, p
, strPtr
, (char *) NULL
);
114 *----------------------------------------------------------------------
116 * TclInterp_cl::VarEval --
118 * Class interface to Tcl_VarEval (see Tcl documentation for details).
119 * Not inlined since varargs and inline don't work on some C++ compilers.
120 *----------------------------------------------------------------------
123 TclInterp_cl::VarEval (const char *p
,
130 va_start (argPtr
, p
);
131 strPtr
= CatVarArgs (argPtr
);
132 intResult
= Tcl_VarEval (interp
, (char *) p
, strPtr
, (char *) NULL
);