Skip to content

Instantly share code, notes, and snippets.

@morungos
Created May 15, 2014 19:27
Show Gist options
  • Save morungos/e15390f57140fcc9a58d to your computer and use it in GitHub Desktop.
Save morungos/e15390f57140fcc9a58d to your computer and use it in GitHub Desktop.
--- WordNet-3.0/src/stubs.c 2007-01-04 12:47:55.000000000 -0500
+++ WordNet-3.0.1/src/stubs.c 2014-05-15 15:05:32.000000000 -0400
@@ -40,8 +40,7 @@ int wn_findvalidsearches (ClientData cli
char *morph;
int pos;
if (argc != 3) {
- interp -> result =
- "usage: findvalidsearches searchword partofspeechnum";
+ Tcl_SetResult(interp, "usage: findvalidsearches searchword partofspeechnum", TCL_DYNAMIC);
return TCL_ERROR;
}
pos = atoi (argv[2]);
@@ -52,7 +51,7 @@ int wn_findvalidsearches (ClientData cli
} while ((morph = morphstr (NULL, pos)) != NULL);
}
sprintf (bitfieldstr, "%u", bitfield);
- interp -> result = bitfieldstr;
+ Tcl_SetResult(interp, bitfieldstr, TCL_DYNAMIC);
return TCL_OK;
}
@@ -69,13 +68,13 @@ int wn_bit (ClientData clientData, Tcl_I
static char bitfieldstr[32];
int whichbit;
if (argc != 2) {
- interp -> result = "usage: bit bitnum";
+ Tcl_SetResult(interp, "usage: bit bitnum", TCL_DYNAMIC);
return TCL_ERROR;
}
whichbit = atoi (argv[1]);
bitfield = bit (whichbit);
sprintf (bitfieldstr, "%u", bitfield);
- interp -> result = bitfieldstr;
+ Tcl_SetResult(interp, bitfieldstr, TCL_DYNAMIC);
return TCL_OK;
}
@@ -89,8 +88,7 @@ int wn_search (ClientData clientData, Tc
int pos, searchtype, sense;
char *morph;
if (argc != 5) {
- interp -> result =
- "usage: search searchword partofspeechnum searchtypenum sensenum";
+ Tcl_SetResult(interp, "usage: search searchword partofspeechnum searchtypenum sensenum", TCL_DYNAMIC);
return TCL_ERROR;
}
pos = atoi (argv[2]);
@@ -102,7 +100,7 @@ int wn_search (ClientData clientData, Tc
strcat (resultbuf, findtheinfo (morph, pos, searchtype, sense));
} while ((morph = morphstr (NULL, pos)) != NULL);
}
- interp -> result = resultbuf;
+ Tcl_SetResult(interp, resultbuf, TCL_DYNAMIC);
return TCL_OK;
}
@@ -114,7 +112,7 @@ int wn_search (ClientData clientData, Tc
int wn_glosses (ClientData clientData, Tcl_Interp *interp,
int argc, char *argv[]) {
if (argc != 2) {
- interp -> result = "usage: glosses [1 | 0]";
+ Tcl_SetResult(interp, "usage: glosses [1 | 0]", TCL_DYNAMIC);
return TCL_ERROR;
}
dflag = atoi (argv[1]);
@@ -129,7 +127,7 @@ int wn_glosses (ClientData clientData, T
int wn_fileinfo (ClientData clientData, Tcl_Interp *interp,
int argc, char *argv[]) {
if (argc != 2) {
- interp -> result = "usage: fileinfo [1 | 0]";
+ Tcl_SetResult(interp, "usage: fileinfo [1 | 0]", TCL_DYNAMIC);
return TCL_ERROR;
}
fileinfoflag = atoi (argv[1]);
@@ -144,7 +142,7 @@ int wn_fileinfo (ClientData clientData,
int wn_byteoffset (ClientData clientData, Tcl_Interp *interp,
int argc, char *argv[]) {
if (argc != 2) {
- interp -> result = "usage: byteoffset [1 | 0]";
+ Tcl_SetResult(interp, "usage: byteoffset [1 | 0]", TCL_DYNAMIC);
return TCL_ERROR;
}
offsetflag = atoi (argv[1]);
@@ -159,7 +157,7 @@ int wn_byteoffset (ClientData clientData
int wn_senseflag (ClientData clientData, Tcl_Interp *interp,
int argc, char *argv[]) {
if (argc != 2) {
- interp -> result = "usage: senseflag [1 | 0]";
+ Tcl_SetResult(interp, "usage: senseflag [1 | 0]", TCL_DYNAMIC);
return TCL_ERROR;
}
wnsnsflag = atoi (argv[1]);
@@ -175,12 +173,12 @@ int wn_contextualhelp (ClientData client
int argc, char *argv[]) {
int pos, searchtype;
if (argc != 3) {
- interp -> result = "usage: contextualhelp partofspeechnum searchtypenum";
+ Tcl_SetResult(interp, "usage: contextualhelp partofspeechnum searchtypenum", TCL_DYNAMIC);
return TCL_ERROR;
}
pos = atoi (argv[1]);
searchtype = atoi (argv[2]);
- interp -> result = helptext[pos][searchtype];
+ Tcl_SetResult(interp, helptext[pos][searchtype], TCL_DYNAMIC);
return TCL_OK;
}
@@ -190,7 +188,7 @@ int wn_contextualhelp (ClientData client
int wn_reopendb (ClientData clientData, Tcl_Interp *interp,
int argc, char *argv[]) {
if (argc != 1) {
- interp -> result = "usage: reopendb";
+ Tcl_SetResult(interp, "usage: reopendb", TCL_DYNAMIC);
return TCL_ERROR;
}
re_wninit ();
@@ -204,7 +202,7 @@ int wn_reopendb (ClientData clientData,
int wn_abortsearch (ClientData clientData, Tcl_Interp *interp,
int argc, char *argv[]) {
if (argc != 1) {
- interp -> result = "usage: abortsearch";
+ Tcl_SetResult(interp, "usage: abortsearch", TCL_DYNAMIC);
return TCL_ERROR;
}
abortsearch = 1;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment