@@ -1,11 +1,9 @@
/* This header file defines the external interface to the custom Scripting
-** Language (TH) interpreter used to create test cases for SQLiteRT. The
-** interpreted language and API are both based on Tcl.
-*/
-
-typedef unsigned char uchar;
+** Language (TH) interpreter. TH is very similar to TCL but is not an
+** exact clone.
+*/
/*
** Before creating an interpreter, the application must allocate and
** populate an instance of the following structure. It must remain valid
@@ -40,34 +38,34 @@
**
** * If iFrame is +ve, then the nth frame from the bottom of the stack.
** An iFrame value of 1 means the toplevel (global) frame.
*/
-int Th_Eval(Th_Interp *interp, int iFrame, const uchar *zProg, int nProg);
+int Th_Eval(Th_Interp *interp, int iFrame, const char *zProg, int nProg);
/*
** Evaluate a TH expression. The result is stored in the
** interpreter result.
*/
-int Th_Expr(Th_Interp *interp, const uchar *, int);
+int Th_Expr(Th_Interp *interp, const char *, int);
/*
** Access TH variables in the current stack frame. If the variable name
** begins with "::", the lookup is in the top level (global) frame.
*/
-int Th_GetVar(Th_Interp *, const uchar *, int);
-int Th_SetVar(Th_Interp *, const uchar *, int, const uchar *, int);
-int Th_LinkVar(Th_Interp *, const uchar *, int, int, const uchar *, int);
-int Th_UnsetVar(Th_Interp *, const uchar *, int);
-
-typedef int (*Th_CommandProc)(Th_Interp *, void *, int, const uchar **, int *);
+int Th_GetVar(Th_Interp *, const char *, int);
+int Th_SetVar(Th_Interp *, const char *, int, const char *, int);
+int Th_LinkVar(Th_Interp *, const char *, int, int, const char *, int);
+int Th_UnsetVar(Th_Interp *, const char *, int);
+
+typedef int (*Th_CommandProc)(Th_Interp *, void *, int, const char **, int *);
/*
** Register new commands.
*/
int Th_CreateCommand(
Th_Interp *interp,
const char *zName,
- /* int (*xProc)(Th_Interp *, void *, int, const uchar **, int *), */
+ /* int (*xProc)(Th_Interp *, void *, int, const char **, int *), */
Th_CommandProc xProc,
void *pContext,
void (*xDel)(Th_Interp *, void *)
);
@@ -74,9 +72,9 @@
/*
** Delete or rename commands.
*/
-int Th_RenameCommand(Th_Interp *, const uchar *, int, const uchar *, int);
+int Th_RenameCommand(Th_Interp *, const char *, int, const char *, int);
/*
** Push a new stack frame (local variable context) onto the interpreter
** stack, call the function supplied as parameter xCall with the two
@@ -107,17 +105,17 @@
/*
** Set and get the interpreter result.
*/
-int Th_SetResult(Th_Interp *, const uchar *, int);
-const uchar *Th_GetResult(Th_Interp *, int *);
-uchar *Th_TakeResult(Th_Interp *, int *);
+int Th_SetResult(Th_Interp *, const char *, int);
+const char *Th_GetResult(Th_Interp *, int *);
+char *Th_TakeResult(Th_Interp *, int *);
/*
** Set an error message as the interpreter result. This also
** sets the global stack-trace variable $::th_stack_trace.
*/
-int Th_ErrorMessage(Th_Interp *, const char *, const uchar *, int);
+int Th_ErrorMessage(Th_Interp *, const char *, const char *, int);
/*
** Access the memory management functions associated with the specified
** interpreter.
@@ -127,32 +125,30 @@
/*
** Functions for handling TH lists.
*/
-int Th_ListAppend(Th_Interp *, uchar **, int *, const uchar *, int);
-int Th_SplitList(Th_Interp *, const uchar *, int, uchar ***, int **, int *);
+int Th_ListAppend(Th_Interp *, char **, int *, const char *, int);
+int Th_SplitList(Th_Interp *, const char *, int, char ***, int **, int *);
-int Th_StringAppend(Th_Interp *, uchar **, int *, const uchar *, int);
+int Th_StringAppend(Th_Interp *, char **, int *, const char *, int);
/*
** Functions for handling numbers and pointers.
*/
-int Th_ToInt(Th_Interp *, const uchar *, int, int *);
-int Th_ToDouble(Th_Interp *, const uchar *, int, double *);
-int Th_ToPtr(Th_Interp *, const uchar *, int, void **);
+int Th_ToInt(Th_Interp *, const char *, int, int *);
+int Th_ToDouble(Th_Interp *, const char *, int, double *);
int Th_SetResultInt(Th_Interp *, int);
int Th_SetResultDouble(Th_Interp *, double);
-int Th_SetResultPtr(Th_Interp *, void *);
/*
** Drop in replacements for the corresponding standard library functions.
*/
-int th_strlen(const unsigned char *);
-int th_isdigit(unsigned char);
-int th_isspace(unsigned char);
-int th_isalnum(unsigned char);
-int th_isspecial(unsigned char);
-uchar *th_strdup(Th_Interp *interp, const uchar *z, int n);
+int th_strlen(const char *);
+int th_isdigit(char);
+int th_isspace(char);
+int th_isalnum(char);
+int th_isspecial(char);
+char *th_strdup(Th_Interp *interp, const char *z, int n);
/*
** Interfaces to register the language extensions.
*/
@@ -167,20 +163,20 @@
typedef struct Th_Hash Th_Hash;
typedef struct Th_HashEntry Th_HashEntry;
struct Th_HashEntry {
void *pData;
- uchar *zKey;
+ char *zKey;
int nKey;
Th_HashEntry *pNext; /* Internal use only */
};
Th_Hash *Th_HashNew(Th_Interp *);
void Th_HashDelete(Th_Interp *, Th_Hash *);
void Th_HashIterate(Th_Interp*,Th_Hash*,void (*x)(Th_HashEntry*, void*),void*);
-Th_HashEntry *Th_HashFind(Th_Interp*, Th_Hash*, const uchar*, int, int);
+Th_HashEntry *Th_HashFind(Th_Interp*, Th_Hash*, const char*, int, int);
/*
** Useful functions from th_lang.c.
*/
int Th_WrongNumArgs(Th_Interp *interp, const char *zMsg);
typedef struct Th_SubCommand {char *zName; Th_CommandProc xProc;} Th_SubCommand;
-int Th_CallSubCommand(Th_Interp*,void*,int,const uchar**,int*,Th_SubCommand*);
+int Th_CallSubCommand(Th_Interp*,void*,int,const char**,int*,Th_SubCommand*);