@@ -12,25 +12,43 @@
12 12 { copied = false; pop = false }, 1000)" :class="copied && 'copied'">Copy link Copied!
/* This header file defines the external interface to the custom Scripting
13 13 { copied = false; pop = false }, 1000)" :class="copied && 'copied'">Copy link Copied!
** Language (TH) interpreter. TH is very similar to TCL but is not an
14 14 { copied = false; pop = false }, 1000)" :class="copied && 'copied'">Copy link Copied!
** exact clone.
15 15 { copied = false; pop = false }, 1000)" :class="copied && 'copied'">Copy link Copied!
*/
16 16 { copied = false; pop = false }, 1000)" :class="copied && 'copied'">Copy link Copied!
17 { copied = false; pop = false }, 1000)" :class="copied && 'copied'">Copy link Copied!
+ /*
18 { copied = false; pop = false }, 1000)" :class="copied && 'copied'">Copy link Copied!
+ ** Th_output_f() specifies a generic output routine for use by Th_Vtab
19 { copied = false; pop = false }, 1000)" :class="copied && 'copied'">Copy link Copied!
+ ** and friends. Its first argument is the data to write, the second is
20 { copied = false; pop = false }, 1000)" :class="copied && 'copied'">Copy link Copied!
+ ** the number of bytes to write, and the 3rd is an
21 { copied = false; pop = false }, 1000)" :class="copied && 'copied'">Copy link Copied!
+ ** implementation-specific state pointer (may be NULL, depending on
22 { copied = false; pop = false }, 1000)" :class="copied && 'copied'">Copy link Copied!
+ ** the implementation). The return value is the number of bytes output
23 { copied = false; pop = false }, 1000)" :class="copied && 'copied'">Copy link Copied!
+ ** (which may differ from len due to encoding and whatnot). On error
24 { copied = false; pop = false }, 1000)" :class="copied && 'copied'">Copy link Copied!
+ ** a negative value must be returned.
25 { copied = false; pop = false }, 1000)" :class="copied && 'copied'">Copy link Copied!
+ */
26 { copied = false; pop = false }, 1000)" :class="copied && 'copied'">Copy link Copied!
+ typedef int (*Th_output_f)( char const * zData, int len, void * pState );
27 { copied = false; pop = false }, 1000)" :class="copied && 'copied'">Copy link Copied!
+
17 28 { copied = false; pop = false }, 1000)" :class="copied && 'copied'">Copy link Copied!
/*
18 29 { copied = false; pop = false }, 1000)" :class="copied && 'copied'">Copy link Copied!
** Before creating an interpreter, the application must allocate and
19 30 { copied = false; pop = false }, 1000)" :class="copied && 'copied'">Copy link Copied!
** populate an instance of the following structure. It must remain valid
20 31 { copied = false; pop = false }, 1000)" :class="copied && 'copied'">Copy link Copied!
** for the lifetime of the interpreter.
21 32 { copied = false; pop = false }, 1000)" :class="copied && 'copied'">Copy link Copied!
*/
22 33 { copied = false; pop = false }, 1000)" :class="copied && 'copied'">Copy link Copied!
struct Th_Vtab {
23 34 { copied = false; pop = false }, 1000)" :class="copied && 'copied'">Copy link Copied!
void *(*xMalloc)(unsigned int);
24 35 { copied = false; pop = false }, 1000)" :class="copied && 'copied'">Copy link Copied!
void (*xFree)(void *);
36 { copied = false; pop = false }, 1000)" :class="copied && 'copied'">Copy link Copied!
+ struct {
37 { copied = false; pop = false }, 1000)" :class="copied && 'copied'">Copy link Copied!
+ Th_output_f f; /* output handler */
38 { copied = false; pop = false }, 1000)" :class="copied && 'copied'">Copy link Copied!
+ void * pState; /* final argument for xOut() */
39 { copied = false; pop = false }, 1000)" :class="copied && 'copied'">Copy link Copied!
+ char enabled; /* if 0, Th_output() does nothing. */
40 { copied = false; pop = false }, 1000)" :class="copied && 'copied'">Copy link Copied!
+ } out;
25 41 { copied = false; pop = false }, 1000)" :class="copied && 'copied'">Copy link Copied!
};
26 42 { copied = false; pop = false }, 1000)" :class="copied && 'copied'">Copy link Copied!
typedef struct Th_Vtab Th_Vtab;
43 { copied = false; pop = false }, 1000)" :class="copied && 'copied'">Copy link Copied!
+
27 44 { copied = false; pop = false }, 1000)" :class="copied && 'copied'">Copy link Copied!
28 45 { copied = false; pop = false }, 1000)" :class="copied && 'copied'">Copy link Copied!
/*
29 46 { copied = false; pop = false }, 1000)" :class="copied && 'copied'">Copy link Copied!
** Opaque handle for interpeter.
30 47 { copied = false; pop = false }, 1000)" :class="copied && 'copied'">Copy link Copied!
*/
31 48 { copied = false; pop = false }, 1000)" :class="copied && 'copied'">Copy link Copied!
typedef struct Th_Interp Th_Interp;
49 { copied = false; pop = false }, 1000)" :class="copied && 'copied'">Copy link Copied!
+
32 50 { copied = false; pop = false }, 1000)" :class="copied && 'copied'">Copy link Copied!
33 51 { copied = false; pop = false }, 1000)" :class="copied && 'copied'">Copy link Copied!
/*
34 52 { copied = false; pop = false }, 1000)" :class="copied && 'copied'">Copy link Copied!
** Create and delete interpreters.
35 53 { copied = false; pop = false }, 1000)" :class="copied && 'copied'">Copy link Copied!
*/
36 54 { copied = false; pop = false }, 1000)" :class="copied && 'copied'">Copy link Copied!
Th_Interp * Th_CreateInterp(Th_Vtab *pVtab);
@@ -189,10 +207,31 @@
189 207 { copied = false; pop = false }, 1000)" :class="copied && 'copied'">Copy link Copied!
*/
190 208 { copied = false; pop = false }, 1000)" :class="copied && 'copied'">Copy link Copied!
int Th_WrongNumArgs(Th_Interp *interp, const char *zMsg);
191 209 { copied = false; pop = false }, 1000)" :class="copied && 'copied'">Copy link Copied!
192 210 { copied = false; pop = false }, 1000)" :class="copied && 'copied'">Copy link Copied!
typedef struct Th_SubCommand {char *zName; Th_CommandProc xProc;} Th_SubCommand;
193 211 { copied = false; pop = false }, 1000)" :class="copied && 'copied'">Copy link Copied!
int Th_CallSubCommand(Th_Interp*,void*,int,const char**,int*,Th_SubCommand*);
212 { copied = false; pop = false }, 1000)" :class="copied && 'copied'">Copy link Copied!
+
213 { copied = false; pop = false }, 1000)" :class="copied && 'copied'">Copy link Copied!
+ /*
214 { copied = false; pop = false }, 1000)" :class="copied && 'copied'">Copy link Copied!
+ ** Sends the given data through vTab->out.f() if vTab->out.enabled is
215 { copied = false; pop = false }, 1000)" :class="copied && 'copied'">Copy link Copied!
+ ** true, otherwise this is a no-op. Returns 0 or higher on success, *
216 { copied = false; pop = false }, 1000)" :class="copied && 'copied'">Copy link Copied!
+ ** a negative value if vTab->out.f is NULL.
217 { copied = false; pop = false }, 1000)" :class="copied && 'copied'">Copy link Copied!
+ */
218 { copied = false; pop = false }, 1000)" :class="copied && 'copied'">Copy link Copied!
+ int Th_Vtab_output( Th_Vtab *vTab, char const * zData, int len );
219 { copied = false; pop = false }, 1000)" :class="copied && 'copied'">Copy link Copied!
+
220 { copied = false; pop = false }, 1000)" :class="copied && 'copied'">Copy link Copied!
+ /*
221 { copied = false; pop = false }, 1000)" :class="copied && 'copied'">Copy link Copied!
+ ** Sends the given output through pInterp's v-table's output
222 { copied = false; pop = false }, 1000)" :class="copied && 'copied'">Copy link Copied!
+ ** implementation. See Th_Vtab_output() for the argument and
223 { copied = false; pop = false }, 1000)" :class="copied && 'copied'">Copy link Copied!
+ ** return value semantics.
224 { copied = false; pop = false }, 1000)" :class="copied && 'copied'">Copy link Copied!
+ */
225 { copied = false; pop = false }, 1000)" :class="copied && 'copied'">Copy link Copied!
+ int Th_output( Th_Interp *pInterp, char const * zData, int len );
226 { copied = false; pop = false }, 1000)" :class="copied && 'copied'">Copy link Copied!
+
227 { copied = false; pop = false }, 1000)" :class="copied && 'copied'">Copy link Copied!
+ /*
228 { copied = false; pop = false }, 1000)" :class="copied && 'copied'">Copy link Copied!
+ ** Th_output_f() implementation which sends its output to either pState
229 { copied = false; pop = false }, 1000)" :class="copied && 'copied'">Copy link Copied!
+ ** (which must be NULL or a (FILE*)) or stdout (if pState is NULL).
230 { copied = false; pop = false }, 1000)" :class="copied && 'copied'">Copy link Copied!
+ */
231 { copied = false; pop = false }, 1000)" :class="copied && 'copied'">Copy link Copied!
+ int Th_output_f_FILE( char const * zData, int len, void * pState );
232 { copied = false; pop = false }, 1000)" :class="copied && 'copied'">Copy link Copied!
+
194 233 { copied = false; pop = false }, 1000)" :class="copied && 'copied'">Copy link Copied!
195 234 { copied = false; pop = false }, 1000)" :class="copied && 'copied'">Copy link Copied!
#ifdef TH_USE_SQLITE
196 235 { copied = false; pop = false }, 1000)" :class="copied && 'copied'">Copy link Copied!
#include "stddef.h" /* size_t */
197 236 { copied = false; pop = false }, 1000)" :class="copied && 'copied'">Copy link Copied!
extern void *fossil_realloc(void *p, size_t n);
198 237 { copied = false; pop = false }, 1000)" :class="copied && 'copied'">Copy link Copied!
199 238 { copied = false; pop = false }, 1000)" :class="copied && 'copied'">Copy link Copied!