@@ -66,9 +66,9 @@
static int enableOutputCmd(
Th_Interp *interp,
void *p,
int argc,
- const unsigned char **argv,
+ const char **argv,
int *argl
){
if( argc!=2 ){
return Th_WrongNumArgs(interp, "enable_output BOOLEAN");
@@ -105,9 +105,9 @@
static int putsCmd(
Th_Interp *interp,
void *pConvert,
int argc,
- const unsigned char **argv,
+ const char **argv,
int *argl
){
if( argc!=2 ){
return Th_WrongNumArgs(interp, "puts STRING");
@@ -124,9 +124,9 @@
static int wikiCmd(
Th_Interp *interp,
void *p,
int argc,
- const unsigned char **argv,
+ const char **argv,
int *argl
){
if( argc!=2 ){
return Th_WrongNumArgs(interp, "wiki STRING");
@@ -149,17 +149,17 @@
static int htmlizeCmd(
Th_Interp *interp,
void *p,
int argc,
- const unsigned char **argv,
+ const char **argv,
int *argl
){
char *zOut;
if( argc!=2 ){
return Th_WrongNumArgs(interp, "htmlize STRING");
}
zOut = htmlize((char*)argv[1], argl[1]);
- Th_SetResult(interp, (unsigned char*)zOut, -1);
+ Th_SetResult(interp, zOut, -1);
free(zOut);
return TH_OK;
}
@@ -171,13 +171,13 @@
static int dateCmd(
Th_Interp *interp,
void *p,
int argc,
- const unsigned char **argv,
+ const char **argv,
int *argl
){
char *zOut = db_text("??", "SELECT datetime('now')");
- Th_SetResult(interp, (unsigned char*)zOut, -1);
+ Th_SetResult(interp, zOut, -1);
free(zOut);
return TH_OK;
}
@@ -189,9 +189,9 @@
static int hascapCmd(
Th_Interp *interp,
void *p,
int argc,
- const unsigned char **argv,
+ const char **argv,
int *argl
){
if( argc!=2 ){
return Th_WrongNumArgs(interp, "hascap STRING");
@@ -213,34 +213,38 @@
static int comboboxCmd(
Th_Interp *interp,
void *p,
int argc,
- const unsigned char **argv,
+ const char **argv,
int *argl
){
if( argc!=4 ){
return Th_WrongNumArgs(interp, "combobox NAME TEXT-LIST NUMLINES");
}
if( enableOutput ){
int height;
- Blob list, elem, name;
+ Blob name;
int nValue;
const char *zValue;
char *z, *zH;
+ int nElem;
+ int *aszElem;
+ char **azElem;
+ int i;
if( Th_ToInt(interp, argv[3], argl[3], &height) ) return TH_ERROR;
- blob_init(&list, (char*)argv[2], argl[2]);
+ Th_SplitList(interp, argv[2], argl[2], &azElem, &aszElem, &nElem);
blob_init(&name, (char*)argv[1], argl[1]);
zValue = Th_Fetch(blob_str(&name), &nValue);
z = mprintf("<select name=\"%z\" size=\"%d\">",
htmlize(blob_buffer(&name), blob_size(&name)), height);
sendText(z, -1, 0);
free(z);
blob_reset(&name);
- while( blob_token(&list, &elem) ){
- zH = htmlize(blob_buffer(&elem), blob_size(&elem));
- if( zValue && blob_size(&elem)==nValue
- && memcmp(zValue, blob_buffer(&elem), nValue)==0 ){
+ for(i=0; i<nElem; i++){
+ zH = htmlize((char*)azElem[i], aszElem[i]);
+ if( zValue && aszElem[i]==nValue
+ && memcmp(zValue, azElem[i], nValue)==0 ){
z = mprintf("<option value=\"%s\" selected>%s</option>", zH, zH);
}else{
z = mprintf("<option value=\"%s\">%s</option>", zH, zH);
}
@@ -248,9 +252,9 @@
sendText(z, -1, 0);
free(z);
}
sendText("</select>", -1, 0);
- blob_reset(&list);
+ Th_Free(interp, azElem);
}
return TH_OK;
}
@@ -263,12 +267,12 @@
static int linecntCmd(
Th_Interp *interp,
void *p,
int argc,
- const unsigned char **argv,
+ const char **argv,
int *argl
){
- const uchar *z;
+ const char *z;
int size, n, i;
int iMin, iMax;
if( argc!=4 ){
return Th_WrongNumArgs(interp, "linecount STRING MAX MIN");
@@ -324,9 +328,9 @@
*/
void Th_Store(const char *zName, const char *zValue){
Th_FossilInit();
if( zValue ){
- Th_SetVar(g.interp, (uchar*)zName, -1, (uchar*)zValue, strlen(zValue));
+ Th_SetVar(g.interp, (char*)zName, -1, (char*)zValue, strlen(zValue));
}
}
/*
@@ -333,9 +337,9 @@
** Unset a variable.
*/
void Th_Unstore(const char *zName){
if( g.interp ){
- Th_UnsetVar(g.interp, (uchar*)zName, -1);
+ Th_UnsetVar(g.interp, (char*)zName, -1);
}
}
/*
@@ -344,9 +348,9 @@
*/
char *Th_Fetch(const char *zName, int *pSize){
int rc;
Th_FossilInit();
- rc = Th_GetVar(g.interp, (uchar*)zName, -1);
+ rc = Th_GetVar(g.interp, (char*)zName, -1);
if( rc==TH_OK ){
return (char*)Th_GetResult(g.interp, pSize);
}else{
return 0;
@@ -422,9 +426,9 @@
int Th_Render(const char *z){
int i = 0;
int n;
int rc = TH_OK;
- uchar *zResult;
+ char *zResult;
Th_FossilInit();
while( z[i] ){
if( z[i]=='$' && (n = validVarName(&z[i+1]))>0 ){
const char *zVar;
@@ -438,18 +442,18 @@
/* Variables of the form $aaa */
zVar = &z[i+1];
nVar = n;
}
- rc = Th_GetVar(g.interp, (uchar*)zVar, nVar);
+ rc = Th_GetVar(g.interp, (char*)zVar, nVar);
z += i+1+n;
i = 0;
- zResult = (uchar*)Th_GetResult(g.interp, &n);
+ zResult = (char*)Th_GetResult(g.interp, &n);
sendText((char*)zResult, n, n>nVar);
}else if( z[i]=='<' && isBeginScriptTag(&z[i]) ){
sendText(z, i, 0);
z += i+5;
for(i=0; z[i] && (z[i]!='<' || !isEndScriptTag(&z[i])); i++){}
- rc = Th_Eval(g.interp, 0, (const uchar*)z, i);
+ rc = Th_Eval(g.interp, 0, (const char*)z, i);
if( rc!=TH_OK ) break;
z += i;
if( z[0] ){ z += 6; }
i = 0;
@@ -458,9 +462,9 @@
}
}
if( rc==TH_ERROR ){
sendText("<hr><p><font color=\"red\"><b>ERROR: ", -1, 0);
- zResult = (uchar*)Th_GetResult(g.interp, &n);
+ zResult = (char*)Th_GetResult(g.interp, &n);
sendText((char*)zResult, n, 1);
sendText("</b></font></p>", -1, 0);
}else{
sendText(z, i, 0);