1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-12-19 03:52:17 +00:00

Finally update from 2.0 to 2.1. "Heavy Patching Zone" ensures WARNS=5

cleanliness in the main library (diffs to be sent to the vendor as in
the past).

The installed library is now called libWN, as vendor's build would call
it, rather than libwn2, as the previous version of the port called it.
This may upset the client port of p5 -- the maintainer is notified and
awaits this commit.

PR:	ports/90323
Submitted by: clsung
This commit is contained in:
Mikhail Teterin 2006-01-16 03:48:42 +00:00
parent 360872c2f7
commit 8ebfc55a6e
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=153618
24 changed files with 2486 additions and 166 deletions

View File

@ -6,7 +6,7 @@
#
PORTNAME= WordNet
PORTVERSION= 2.0
PORTVERSION= 2.1
CATEGORIES= textproc
MASTER_SITES= ftp://ftp.cogsci.princeton.edu/pub/wordnet/${PORTVERSION}/ \
http://www.cogsci.princeton.edu/${PORTVERSION}/ \
@ -17,14 +17,6 @@ COMMENT= Dictionaries and thesauri with devel. libraries (C, TCL) and browsers
LIB_DEPENDS= tk${TCL_VER}:${PORTSDIR}/x11-toolkits/tk${TCL_VER}
# The vendor packages up a lot of useless precompiled binaries
# for a few platforms with the source code. Do not extract them:
EXTRACT_AFTER_ARGS= | ${TAR} -xf - --exclude '*/bin/*' \
--exclude '*/lib/solaris/*' \
--exclude '*/lib/linux/*' \
--exclude '*/lib/irix/*' \
--exclude '*/*.[ao]'
TCL_DVER?= 8.4
TCL_VER= ${TCL_DVER:C/\.//}
SCRIPTS_ENV+= TCL_DVER=${TCL_DVER} VER=${PORTVERSION}
@ -35,15 +27,8 @@ REINPLACE_ARGS= -i ""
INSTALLS_SHLIB= yes
post-patch:
${REINPLACE_CMD} -e 's,/usr/local,${PREFIX},g' \
-e 's,_VER_,${PORTVERSION},g' ${WRKSRC}/include/wnconsts.h \
${WRKSRC}/src/wnb/wnb
${REINPLACE_CMD} -e 's,/usr/local/WordNet-2.1,${DATADIR},g' \
${WRKSRC}/src/wnb ${WRKSRC}/doc/man/*.?
${REINPLACE_CMD} -e 's, *\\n,\\n,' ${WRKSRC}/include/wn.h
.include <bsd.port.pre.mk>
.for s in 1 3 5 7
MAN$s!= ${MAKE} -f ${FILESDIR}/man.Makefile -V MAN$s
.endfor
MANCOMPRESSED= maybe
.include <bsd.port.post.mk>
.include <bsd.port.mk>

View File

@ -1,2 +1,3 @@
MD5 (WordNet-2.0.tar.gz) = 42faaf63f391bb1e13f59ca83490634d
SIZE (WordNet-2.0.tar.gz) = 12847598
MD5 (WordNet-2.1.tar.gz) = 081aa25baaccac602cebb61f6cb949e7
SHA256 (WordNet-2.1.tar.gz) = 8ed7ec24377d114c6db326a6f114d6e22afb85cc37f7f1386831b6d8f114784d
SIZE (WordNet-2.1.tar.gz) = 11441476

View File

@ -1,8 +1,10 @@
# $FreeBSD$
SUBDIR= include \
dict \
lib \
lib/wnres \
src \
man
dict \
doc/man
.include <bsd.subdir.mk>

View File

@ -1,8 +1,8 @@
WN_INSTALLDIR= ${PREFIX}/share/WordNet-${VER}
WN_FILES= data.noun data.verb data.adj data.adv index.noun \
index.verb index.adj index.adv noun.exc verb.exc \
adj.exc adv.exc index.sense cntlist.rev \
cntlist lexnames sentidx.vrb sents.vrb
WN_INSTALLDIR= ${PREFIX}/share/WordNet
WN_FILES= adj.exc adv.exc cntlist cntlist.rev data.adj \
data.adv data.noun data.verb frames.vrb index.adj \
index.adv index.noun index.sense index.verb \
noun.exc sentidx.vrb sents.vrb verb.Framestext verb.exc
all: $(WN_FILES)
@ -13,11 +13,10 @@ ${WN_INSTALLDIR}:
INSTALLED+= ${WN_INSTALLDIR}/$f
${WN_INSTALLDIR}/$f: $f
${INSTALL} -C -o ${BINOWN} -g ${BINGRP} \
$f ${WN_INSTALLDIR}/$f
${BSD_INSTALL_DATA} $f ${WN_INSTALLDIR}/$f
.endfor
install: ${WN_INSTALLDIR} ${INSTALLED}
NOOBJ= noobj
NO_OBJ= noobj
.include <bsd.prog.mk>

View File

@ -1,7 +1,6 @@
WN_INSTALLDIR = ${PREFIX}/include/WordNet-${VER}
WN_INSTALLDIR = ${PREFIX}/include/WordNet
WN_FILES= license.h setutil.h wn.h wnconsts.h wnglobal.h \
wnhelp.h wnrtl.h wntypes.h
WN_FILES= wn.h wngrind.h
all: $(WN_FILES)
@ -12,6 +11,6 @@ install: ${WN_INSTALLDIR}
${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 \
${WN_FILES} ${WN_INSTALLDIR}/
NOOBJ= noobj
NO_OBJ= noobj
.include <bsd.prog.mk>

View File

@ -1,15 +0,0 @@
--- include/wnconsts.h Fri Feb 27 13:54:53 1998
+++ include/wnconsts.h Sat Feb 26 16:11:51 2000
@@ -15,6 +15,10 @@
/* Platform specific path and filename specifications */
#ifdef UNIX
#define DICTDIR "/dict"
-#define DEFAULTPATH "/usr/local/WordNet-_VER_/dict"
-#define DEFAULTBIN "/usr/local/WordNet-_VER_/bin"
+#ifndef DEFAULTPATH
+#define DEFAULTPATH "/usr/local/share/WordNet-_VER_"
+#endif
+#ifndef DEFAULTBIN
+#define DEFAULTBIN "/usr/local/bin"
+#endif

View File

@ -1,7 +1,286 @@
--- src/lib/wnutil.c Thu Feb 19 12:15:09 1998
+++ src/lib/wnutil.c Sat Feb 26 16:14:08 2000
@@ -10,3 +10,3 @@
#ifdef UNIX
--- lib/wnutil.c Fri May 6 13:17:39 2005
+++ lib/wnutil.c Wed Dec 21 16:04:36 2005
@@ -15,5 +15,5 @@
#ifdef __unix__
#ifndef __MACH__
-#include <malloc.h>
+#include <stdlib.h>
#endif
#endif
@@ -25,5 +25,5 @@
#include "wn.h"
-static int do_init();
+static int do_init(void);
static char msgbuf[256]; /* buffer for constructing error messages */
@@ -37,5 +37,5 @@
/* Initialization functions */
-static void closefps();
+static void closefps(void);
int wninit(void)
@@ -46,7 +46,6 @@
if (!done) {
- if (env = getenv("WNDBVERSION")) {
- wnrelease = strdup(env); /* set release */
- assert(wnrelease);
+ if ((env = getenv("WNDBVERSION"))) {
+ wnrelease = env; /* set release */
}
openerr = do_init();
@@ -68,7 +67,6 @@
closefps();
- if (env = getenv("WNDBVERSION")) {
- wnrelease = strdup(env); /* set release */
- assert(wnrelease);
+ if ((env = getenv("WNDBVERSION"))) {
+ wnrelease = env; /* set release */
}
openerr = do_init();
@@ -248,4 +246,20 @@
}
+char *strtolower2(const char *from, char *to)
+{
+
+ char *t = to;
+
+ do {
+ if(*from >= 'A' && *from <= 'Z')
+ *t = *from++ + 32;
+ else if(*from == '(')
+ *t = '\0';
+ else
+ *t = *from++;
+ } while (*t++);
+ return(to);
+}
+
/* Convert string passed to lower case */
@@ -276,11 +290,24 @@
/* Return pointer code for pointer type characer passed. */
-int getptrtype(char *ptrstr)
+unsigned short
+getptrtype(const char *ptrstr, char **end)
{
- register int i;
+ unsigned short i;
+ const char *ptype, *pstr;
for(i = 1; i <= MAXPTR; i++) {
- if(!strcmp(ptrstr, ptrtyp[i]))
+ ptype = ptrtyp[i];
+ pstr = ptrstr;
+ while (*pstr == *ptype && *ptype) {
+ pstr++;
+ ptype++;
+ }
+ if (*ptype == '\0' &&
+ (*pstr == '\n' || *pstr == ' ' || *pstr == '\0')) {
+ if (end)
+ *(const char **)end = pstr;
return(i);
+ }
}
+ fprintf(stderr, "Could not find the type of %s\n", ptrstr);
return(0);
}
@@ -288,5 +315,6 @@
/* Return part of speech code for string passed */
-int getpos(char *s)
+int
+getpos(const char *s)
{
switch (*s) {
@@ -310,5 +338,6 @@
/* Return synset type code for string passed. */
-int getsstype(char *s)
+int
+getsstype(const char *s)
{
switch (*s) {
@@ -332,5 +361,6 @@
/* Pass in string for POS, return corresponding integer value */
-int StrToPos(char *str)
+int
+StrToPos(const char *str)
{
if (!strcmp(str, "noun"))
@@ -389,5 +419,6 @@
/* Return synset for sense key passed. */
-SynsetPtr GetSynsetForSense(char *sensekey)
+SynsetPtr
+GetSynsetForSense(const char *sensekey)
{
long offset;
@@ -405,7 +436,8 @@
/* Find offset of sense key in data file */
-long GetDataOffset(char *sensekey)
+long
+GetDataOffset(const char *sensekey)
{
- char *line;
+ const char *line;
/* Pass in encoded sense string, return byte offset of corresponding
@@ -426,5 +458,6 @@
/* Find polysemy count for sense key passed. */
-int GetPolyCount(char *sensekey)
+int
+GetPolyCount(const char *sensekey)
{
IndexPtr idx;
@@ -443,5 +476,6 @@
/* Return word part of sense key */
-char *GetWORD(char *sensekey)
+const char *
+GetWORD(const char *sensekey)
{
static char word[100];
@@ -457,5 +491,6 @@
/* Return POS code for sense key passed. */
-int GetPOS(char *sensekey)
+int
+GetPOS(const char *sensekey)
{
int pos;
@@ -470,5 +505,6 @@
/* Reconstruct synset from synset pointer and return ptr to buffer */
-char *FmtSynset(SynsetPtr synptr, int defn)
+const char *
+FmtSynset(SynsetPtr synptr, int defn)
{
int i;
@@ -542,27 +578,8 @@
}
-/* Search for string and/or baseform of word in database and return
- index structure for word if found in database. */
-
-IndexPtr GetValidIndexPointer(char *word, int pos)
-{
- IndexPtr idx;
- char *morphword;
-
- idx = getindex(word, pos);
-
- if (idx == NULL) {
- if ((morphword = morphstr(word, pos)) != NULL)
- while (morphword) {
- if ((idx = getindex(morphword, pos)) != NULL) break;
- morphword = morphstr(NULL, pos);
- }
- }
- return (idx);
-}
-
/* Return sense number in database for word and lexsn passed. */
-int GetWNSense(char *word, char *lexsn)
+int
+GetWNSense(const char *word, const char *lexsn)
{
SnsIndexPtr snsidx;
@@ -578,7 +595,8 @@
/* Return parsed sense index entry for sense key passed. */
-SnsIndexPtr GetSenseIndex(char *sensekey)
+SnsIndexPtr
+GetSenseIndex(const char *sensekey)
{
- char *line;
+ const char *line;
char buf[256], loc[9];
SnsIndexPtr snsidx = NULL;
@@ -608,5 +626,6 @@
int GetTagcnt(IndexPtr idx, int sense)
{
- char *sensekey, *line;
+ char *sensekey;
+ const char *line;
char buf[256];
int snum, cnt = 0;
@@ -632,10 +651,11 @@
}
-char *GetOffsetForKey(unsigned int key)
+const char *
+GetOffsetForKey(unsigned int key)
{
unsigned int rkey;
char ckey[7];
static char loc[11] = "";
- char *line;
+ const char *line;
char searchdir[256], tmpbuf[256];
@@ -657,10 +677,10 @@
}
-
-unsigned int GetKeyForOffset(char *loc)
+unsigned int
+GetKeyForOffset(const char *loc)
{
unsigned int key;
char rloc[11] = "";
- char *line;
+ const char *line;
char searchdir[256], tmpbuf[256];
@@ -681,8 +701,9 @@
}
-char *SetSearchdir()
+const char *
+SetSearchdir()
{
- static char searchdir[256];
- char *env;
+ char *searchdir;
+ const char *env;
/* Find base directory for database. If set, use WNSEARCHDIR.
@@ -690,14 +711,17 @@
if ((env = getenv("WNSEARCHDIR")) != NULL)
- strcpy(searchdir, env);
- else if ((env = getenv("WNHOME")) != NULL)
+ return(env);
+ else if ((env = getenv("WNHOME")) != NULL) {
+ searchdir = malloc(strlen(env) + sizeof(DICTDIR));
sprintf(searchdir, "%s%s", env, DICTDIR);
- else
- strcpy(searchdir, DEFAULTPATH);
-
- return(searchdir);
+ return(searchdir);
+ } else
+ return(DEFAULTPATH);
}
-int default_display_message(char *msg)
+#ifndef __GNUC__
+# define __unused
+#endif
+int default_display_message(const char *msg __unused)
{
return(-1);
@@ -727,3 +751,2 @@
return (loc - strstr_stringstart);
}
-

View File

@ -1,17 +1,28 @@
--- src/wnb/stubs.c Fri Nov 14 17:01:44 1997
+++ src/wnb/stubs.c Sat Feb 26 20:09:19 2000
@@ -24,3 +24,2 @@
--- src/stubs.c Wed Jul 6 14:49:05 2005
+++ src/stubs.c Sun Jan 15 07:16:57 2006
@@ -12,8 +12,7 @@
#include <string.h>
#include <tcl.h>
-#include <tk.h>
#include <wn.h>
@@ -37,5 +36,4 @@
int wn_findvalidsearches (ClientData clientData, Tcl_Interp *interp,
-static Id = "$Id: stubs.c,v 1.7 2005/04/29 19:01:57 wn Exp $";
+__FBSDID("$Id: stubs.c,v 1.7 2005/04/29 19:01:57 wn Exp $");
static char resultbuf[SEARCHBUF];
@@ -34,24 +33,24 @@
*/
-int wn_findvalidsearches (ClientData clientData, Tcl_Interp *interp,
- int argc, char *argv[]) {
+ int argc, Tcl_Obj *objv[]) {
+static int
+wn_findvalidsearches (ClientData clientData, Tcl_Interp *interp,
+ int argc, Tcl_Obj * const objv[]) {
unsigned int bitfield;
- static char bitfieldstr[32];
char *morph;
@@ -43,9 +41,10 @@
- char *morph;
+ const char *morph;
int pos;
if (argc != 3) {
- interp -> result =
- "usage: findvalidsearches searchword partofspeechnum";
@ -27,18 +38,24 @@
+ bitfield = is_defined (Tcl_GetString(objv[1]), pos);
+ if ((morph = morphstr (Tcl_GetString(objv[1]), pos)) != NULL) {
do {
@@ -54,4 +53,3 @@
bitfield |= is_defined (morph, pos);
} while ((morph = morphstr (NULL, pos)) != NULL);
}
- sprintf (bitfieldstr, "%u", bitfield);
- interp -> result = bitfieldstr;
+ Tcl_SetObjResult(interp, Tcl_NewIntObj(bitfield));
return TCL_OK;
@@ -67,14 +65,11 @@
int wn_bit (ClientData clientData, Tcl_Interp *interp,
}
@@ -64,17 +63,15 @@
*/
-int wn_bit (ClientData clientData, Tcl_Interp *interp,
- int argc, char *argv[]) {
- unsigned int bitfield;
- static char bitfieldstr[32];
+ int argc, Tcl_Obj *objv[]) {
+static int
+wn_bit (ClientData clientData, Tcl_Interp *interp,
+ int argc, Tcl_Obj * const objv[]) {
int whichbit;
if (argc != 2) {
- interp -> result = "usage: bit bitnum";
@ -53,16 +70,193 @@
+ return TCL_ERROR;
+ Tcl_SetObjResult(interp, Tcl_NewIntObj(bit(whichbit)));
return TCL_OK;
@@ -275,5 +270,5 @@
}
@@ -85,8 +82,9 @@
*/
-int wn_search (ClientData clientData, Tcl_Interp *interp,
- int argc, char *argv[]) {
+static int
+wn_search (ClientData clientData, Tcl_Interp *interp,
+ int argc, const char * argv[]) {
int pos, searchtype, sense;
- char *morph;
+ const char *morph;
if (argc != 5) {
interp -> result =
@@ -112,6 +110,7 @@
*/
-int wn_glosses (ClientData clientData, Tcl_Interp *interp,
- int argc, char *argv[]) {
+static int
+wn_glosses (ClientData clientData, Tcl_Interp *interp,
+ int argc, const char *argv[]) {
if (argc != 2) {
interp -> result = "usage: glosses [1 | 0]";
@@ -127,6 +126,7 @@
*/
-int wn_fileinfo (ClientData clientData, Tcl_Interp *interp,
- int argc, char *argv[]) {
+static int
+wn_fileinfo (ClientData clientData, Tcl_Interp *interp,
+ int argc, const char *argv[]) {
if (argc != 2) {
interp -> result = "usage: fileinfo [1 | 0]";
@@ -142,6 +142,7 @@
*/
-int wn_byteoffset (ClientData clientData, Tcl_Interp *interp,
- int argc, char *argv[]) {
+static int
+wn_byteoffset (ClientData clientData, Tcl_Interp *interp,
+ int argc, const char *argv[]) {
if (argc != 2) {
interp -> result = "usage: byteoffset [1 | 0]";
@@ -157,11 +158,15 @@
*/
-int wn_senseflag (ClientData clientData, Tcl_Interp *interp,
- int argc, char *argv[]) {
+static int
+wn_senseflag (ClientData clientData, Tcl_Interp *interp,
+ int argc, Tcl_Obj * const objv[]) {
if (argc != 2) {
- interp -> result = "usage: senseflag [1 | 0]";
+ Tcl_WrongNumArgs(interp, 0, objv, "?1|0?");
return TCL_ERROR;
}
- wnsnsflag = atoi (argv[1]);
+ if (Tcl_GetBooleanFromObj(interp, objv[1], &argc) != TCL_OK)
+ return TCL_ERROR;
+
+ wnsnsflag = argc; /* argc got recycled here */
return TCL_OK;
}
@@ -172,6 +177,7 @@
*/
-int wn_contextualhelp (ClientData clientData, Tcl_Interp *interp,
- int argc, char *argv[]) {
+static int
+wn_contextualhelp (ClientData clientData, Tcl_Interp *interp,
+ int argc, Tcl_Obj * const objv[]) {
int pos, searchtype;
if (argc != 3) {
@@ -179,7 +185,9 @@
return TCL_ERROR;
}
- pos = atoi (argv[1]);
- searchtype = atoi (argv[2]);
- interp -> result = helptext[pos][searchtype];
+ if (Tcl_GetIntFromObj(interp, objv[1], &pos) != TCL_OK ||
+ Tcl_GetIntFromObj(interp, objv[2], &searchtype) != TCL_OK)
+ return TCL_ERROR;
+ /* Dropping const-ness below is Ok, because TCL_STATIC tells Tcl to DTRT */
+ Tcl_SetResult(interp, (char *)helptext[pos][searchtype], TCL_STATIC);
return TCL_OK;
}
@@ -188,6 +196,7 @@
*/
-int wn_reopendb (ClientData clientData, Tcl_Interp *interp,
- int argc, char *argv[]) {
+static int
+wn_reopendb (ClientData clientData, Tcl_Interp *interp,
+ int argc, Tcl_Obj * const objv[]) {
if (argc != 1) {
interp -> result = "usage: reopendb";
@@ -202,6 +211,7 @@
*/
-int wn_abortsearch (ClientData clientData, Tcl_Interp *interp,
- int argc, char *argv[]) {
+static int
+wn_abortsearch (ClientData clientData, Tcl_Interp *interp,
+ int argc, Tcl_Obj * const objv[]) {
if (argc != 1) {
interp -> result = "usage: abortsearch";
@@ -212,4 +222,20 @@
}
+/* Return text of the license. The license is compiled in anyway, so
+** there is not point in keeping another copy in a separate file.
+*/
+static int
+wn_license(ClientData clientData, Tcl_Interp *interp,
+ int objc, Tcl_Obj * const objv[]) {
+ if (objc != 1) {
+ Tcl_WrongNumArgs(interp, 0, objv, "no arguments");
+ return TCL_ERROR;
+ }
+ /* Dropping the const is Ok, as we supply TCL_STATIC to TCL API */
+ Tcl_SetResult(interp, (char *)license, TCL_STATIC);
+ return TCL_OK;
+}
+
+
/* This is a callback function invoked by the WordNet search engine every so
** often, to allow the interface to respond to events (especially the pressing
@@ -217,5 +242,6 @@
*/
-void tkwn_doevents (void) {
+static void
+tkwn_doevents (void) {
while (Tcl_DoOneEvent (TCL_WINDOW_EVENTS | TCL_DONT_WAIT) != 0) {}
}
@@ -226,5 +252,6 @@
*/
-int tkwn_displayerror (char *msg) {
+static int
+tkwn_displayerror (const char *msg) {
#ifdef _WINDOWS
MessageBeep (MB_ICONEXCLAMATION);
@@ -232,5 +259,5 @@
MB_ICONEXCLAMATION | MB_OK | MB_TASKMODAL | MB_SETFOREGROUND);
#else
- fprintf (stderr, "%s", msg);
+ fputs(msg, stderr);
#endif
return -1;
@@ -246,25 +273,26 @@
display_message = tkwn_displayerror;
wninit ();
- Tcl_CreateCommand (interp, "findvalidsearches", (void *)
+ Tcl_CreateObjCommand (interp, "findvalidsearches", (void *)
+ Tcl_CreateObjCommand (interp, "findvalidsearches",
wn_findvalidsearches, (ClientData) NULL, (Tcl_CmdDeleteProc *) NULL);
- Tcl_CreateCommand (interp, "bit", (void *) wn_bit, (ClientData) NULL,
+ Tcl_CreateObjCommand (interp, "bit", (void *) wn_bit, (ClientData) NULL,
+ Tcl_CreateObjCommand (interp, "bit", wn_bit, (ClientData) NULL,
(Tcl_CmdDeleteProc *) NULL);
@@ -295,3 +290,3 @@
- Tcl_CreateCommand (interp, "search", (void *) wn_search, (ClientData)
+ Tcl_CreateCommand (interp, "search", wn_search, (ClientData)
NULL, (Tcl_CmdDeleteProc *) NULL);
- Tcl_CreateCommand (interp, "glosses", (void *) wn_glosses, (ClientData)
+ Tcl_CreateCommand (interp, "glosses", wn_glosses, (ClientData)
NULL, (Tcl_CmdDeleteProc *) NULL);
- Tcl_CreateCommand (interp, "fileinfo", (void *) wn_fileinfo, (ClientData)
+ Tcl_CreateCommand (interp, "fileinfo", wn_fileinfo, (ClientData)
NULL, (Tcl_CmdDeleteProc *) NULL);
- Tcl_CreateCommand (interp, "byteoffset", (void *) wn_byteoffset,
+ Tcl_CreateCommand (interp, "byteoffset", wn_byteoffset,
(ClientData) NULL, (Tcl_CmdDeleteProc *) NULL);
- Tcl_CreateCommand (interp, "senseflag", (void *) wn_senseflag,
+ Tcl_CreateObjCommand (interp, "senseflag", wn_senseflag,
(ClientData) NULL, (Tcl_CmdDeleteProc *) NULL);
- Tcl_CreateCommand (interp, "contextualhelp", (void *) wn_contextualhelp,
+ Tcl_CreateObjCommand (interp, "contextualhelp", wn_contextualhelp,
(ClientData) NULL, (Tcl_CmdDeleteProc *) NULL);
- Tcl_CreateCommand (interp, "reopendb", (void *) wn_reopendb, (ClientData)
+ Tcl_CreateObjCommand (interp, "reopendb", wn_reopendb, (ClientData)
NULL, (Tcl_CmdDeleteProc *) NULL);
- Tcl_CreateCommand (interp, "abortsearch", (void *) wn_abortsearch,
+ Tcl_CreateObjCommand (interp, "abortsearch", wn_abortsearch,
(ClientData) NULL, (Tcl_CmdDeleteProc *) NULL);
- return TCL_OK;
+ return Tcl_PkgProvide(interp, "Wordnet", "2.0");
+ Tcl_CreateObjCommand (interp, "wnlicense", wn_license,
+ (ClientData) NULL, (Tcl_CmdDeleteProc *) NULL);
+ return Tcl_PkgProvide(interp, "Wordnet", "2.1");
}
-

View File

@ -1,5 +1,5 @@
--- src/wnb/wnb Sun Feb 22 12:49:56 1998
+++ src/wnb/wnb Sat Feb 26 19:52:42 2000
--- src/wnb Sun Feb 22 12:49:56 1998
+++ src/wnb Sat Feb 26 19:52:42 2000
@@ -629,2 +626,6 @@
-text "Based upon an earlier X Window version by\nBrian Gustafson."] \
+ [label .aboutbox.top.right.textmi \

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +0,0 @@
--- src/wnb/wnb Tue Aug 20 11:54:54 2002
+++ src/wnb/wnb Tue Aug 20 11:57:02 2002
@@ -99,3 +96,3 @@
if {[lsearch -exact [array names env] WNHOME] == -1} {
- set resourcedir "/usr/local/WordNet-2.0/lib/wnres"
+ set resourcedir "/usr/local/share/WordNet-2.0/wnres"
} else {

View File

@ -1,12 +1,30 @@
--- src/lib/morph.c Tue Jul 15 10:41:55 2003
+++ src/lib/morph.c Tue Feb 17 15:50:51 2004
@@ -45,27 +45,28 @@
--- lib/morph.c Fri May 6 13:17:39 2005
+++ lib/morph.c Tue Dec 20 23:21:44 2005
@@ -19,7 +19,7 @@
#endif
-static char *Id = "$Id: morph.c,v 1.66 2005/03/18 18:14:24 wn Exp $";
+__FBSDID("$Id: morph.c,v 1.66 2005/03/18 18:14:24 wn Exp $");
-static char *sufx[] ={
+static const char *sufx[] ={
/* Noun suffixes */
"s", "ses", "xes", "zes", "ches", "shes", "men", "ies",
@@ -30,5 +30,5 @@
};
-static char *addr[] ={
+static const char *addr[] ={
/* Noun endings */
"", "s", "x", "z", "ch", "sh", "man", "y",
@@ -43,35 +43,36 @@
static char msgbuf[256];
-#define NUMPREPS 15
static struct {
char *str;
- char *str;
+ const char *str;
int strlen;
-} prepositions[NUMPREPS] = {
- "to", 2,
@ -46,7 +64,41 @@
+
static FILE *exc_fps[NUMPARTS + 1];
@@ -207,5 +208,6 @@
-static int do_init();
-static int strend(char *, char *);
-static char *wordbase(char *, int);
-static int hasprep(char *, int);
-static char *exc_lookup(char *, int);
-static char *morphprep(char *);
+static int do_init(void);
+static int strend(const char *, const char *);
+static const char *wordbase(const char *, int);
+static int hasprep(const char *, unsigned int);
+static const char *exc_lookup(const char *, int);
+static const char *morphprep(const char *);
/* Open exception list files */
@@ -167,13 +168,15 @@
with NULL argument return additional baseforms for original string. */
-char *morphstr(char *origstr, int pos)
+const char *
+morphstr(const char *origstr, int pos)
{
static char searchstr[WORDBUF], str[WORDBUF];
static int svcnt, svprep;
- char word[WORDBUF], *tmp;
+ char word[WORDBUF];
+ const char *tmp;
int cnt, st_idx = 0, end_idx;
int prep;
- char *end_idx1, *end_idx2;
- char *append;
+ const char *end_idx1, *end_idx2;
+ const char *append;
if (pos == SATELLITE)
@@ -230,5 +233,6 @@
strncpy(word, str + st_idx, end_idx - st_idx);
word[end_idx - st_idx] = '\0';
- if(tmp = morphword(word, pos))
@ -54,7 +106,7 @@
+ if(tmp)
strcat(searchstr,tmp);
else
@@ -215,5 +217,6 @@
@@ -238,5 +242,6 @@
}
- if(tmp = morphword(strcpy(word, str + st_idx), pos))
@ -62,21 +114,81 @@
+ if(tmp)
strcat(searchstr,tmp);
else
@@ -248,6 +251,5 @@
char *tmp, tmpbuf[WORDBUF], *end;
@@ -264,13 +269,14 @@
/* Try to find baseform (lemma) of individual word in POS */
-char *morphword(char *word, int pos)
+const char *
+morphword(const char *word, int pos)
{
int offset, cnt;
int i;
static char retval[WORDBUF];
- char *tmp, tmpbuf[WORDBUF], *end;
+ char tmpbuf[WORDBUF];
+ const char *tmp, *end;
- sprintf(retval,"");
- sprintf(tmpbuf, "");
+ retval[0] = tmpbuf[0] = '\0';
end = "";
@@ -343,5 +345,4 @@
@@ -315,7 +321,7 @@
}
-static int strend(char *str1, char *str2)
+static int strend(const char *str1, const char *str2)
{
- char *pt1;
+ const char *pt1;
if(strlen(str2) >= strlen(str1))
@@ -329,5 +335,6 @@
}
-static char *wordbase(char *word, int ender)
+static const char *
+wordbase(const char *word, int ender)
{
char *pt1;
@@ -344,10 +351,10 @@
}
-static int hasprep(char *s, int wdcnt)
+static int hasprep(const char *s, unsigned int wdcnt)
{
/* Find a preposition in the verb string and return its
corresponding word number. */
- int i, wdnum;
+ unsigned int i, wdnum;
for (wdnum = 2; wdnum <= wdcnt; wdnum++) {
@@ -362,9 +369,9 @@
}
-static char *exc_lookup(char *word, int pos)
+static const char *
+exc_lookup(const char *word, int pos)
{
static char line[WORDBUF], *beglp, *endlp;
char *excline;
- char *excline;
- int found = 0;
+ const char *excline;
if (exc_fps[pos] == NULL)
@@ -385,5 +386,6 @@
@@ -394,7 +401,8 @@
}
-static char *morphprep(char *s)
+static const char *
+morphprep(const char *s)
{
- char *rest, *exc_word, *lastwd = NULL, *last;
+ const char *rest, *exc_word, *lastwd = NULL, *last;
int i, offset, cnt;
char word[WORDBUF], end[WORDBUF];
@@ -408,5 +416,6 @@
last = strrchr(s, '_');
if (rest != last) { /* more than 2 words */
- if (lastwd = morphword(last + 1, NOUN)) {

View File

@ -0,0 +1,268 @@
Clean out the unused functions. Improve and const-ify, what remains.
--- lib/binsrch.c Fri May 6 13:17:38 2005
+++ lib/binsrch.c Sun Jan 15 11:43:36 2006
@@ -5,8 +5,9 @@
*/
+#include "wn.h"
#include <stdio.h>
#include <string.h>
-static char *Id = "$Id: binsrch.c,v 1.15 2005/02/01 16:46:43 wn Rel $";
+__FBSDID("$Id: binsrch.c,v 1.15 2005/02/01 16:46:43 wn Rel $");
/* Binary search - looks for the key passed at the start of a line
@@ -14,5 +15,4 @@
a buffer containing the line in the file. */
-#define KEY_LEN (1024)
#define LINE_LEN (1024*25)
@@ -25,201 +25,61 @@
#undef getc
-char *read_index(long offset, FILE *fp) {
- char *linep;
+const char *
+read_index(long offset, FILE *fp) {
- linep = line;
line[0] = '0';
- fseek( fp, offset, SEEK_SET );
- fgets(linep, LINE_LEN, fp);
+ fseek(fp, offset, SEEK_SET);
+ fgets(line, LINE_LEN, fp);
return(line);
}
-char *bin_search(char *searchkey, FILE *fp)
+static int
+sign(int number)
{
- int c;
- long top, mid, bot, diff;
- char *linep, key[KEY_LEN];
- int length;
-
- diff=666;
- linep = line;
- line[0] = '\0';
-
- fseek(fp, 0L, 2);
- top = 0;
- bot = ftell(fp);
- mid = (bot - top) / 2;
-
- do {
- fseek(fp, mid - 1, 0);
- if(mid != 1)
- while((c = getc(fp)) != '\n' && c != EOF);
- last_bin_search_offset = ftell( fp );
- fgets(linep, LINE_LEN, fp);
- length = (int)(strchr(linep, ' ') - linep);
- strncpy(key, linep, length);
- key[length] = '\0';
- if(strcmp(key, searchkey) < 0) {
- top = mid;
- diff = (bot - top) / 2;
- mid = top + diff;
- }
- if(strcmp(key, searchkey) > 0) {
- bot = mid;
- diff = (bot - top) / 2;
- mid = top + diff;
- }
- } while((strcmp(key, searchkey)) && (diff != 0));
-
- if(!strcmp(key, searchkey))
- return(line);
- else
- return(NULL);
+ if (number > 0)
+ return 1;
+ if (number < 0)
+ return -1;
+ return 0;
}
-
-static long offset;
-static int bin_search_key(char *searchkey, FILE *fp)
+const char *
+bin_search(const char *searchkey, FILE *fp)
{
- int c;
- long top, mid, bot, diff;
- char *linep, key[KEY_LEN];
- int length, offset1, offset2;
-
- /* do binary search to find correct place in file to insert line */
-
- diff=666;
- linep = line;
- line[0] = '\0';
-
- fseek(fp, 0L, 2);
- top = 0;
- bot = ftell(fp);
- if (bot == 0) {
- offset = 0;
- return(0); /* empty file */
- }
- mid = (bot - top) / 2;
-
- /* If only one line in file, don't work through loop */
-
- length = 0;
- rewind(fp);
- while((c = getc(fp)) != '\n' && c != EOF)
- line[length++] = c;
- if (getc(fp) == EOF) { /* only 1 line in file */
- length = (int)(strchr(linep, ' ') - linep);
- strncpy(key, linep, length);
- key[length] = '\0';
- if(strcmp(key, searchkey) > 0) {
- offset = 0;
- return(0); /* line with key is not found */
- } else if (strcmp(key, searchkey) < 0) {
- offset = ftell(fp);
- return(0); /* line with key is not found */
- } else {
- offset = 0;
- return(1); /* line with key is found */
+ int c;
+ long top, mid, bot; /* should be off_t */
+ int length, keylen;
+
+ fseek(fp, 0L, 2);
+ bot = ftell(fp);
+ mid = bot / 2;
+ keylen = strlen(searchkey);
+
+ for (top = 0; bot - top >= 2; mid = (top + bot) / 2) {
+ fseek(fp, mid - 1, 0);
+ if(mid != 1)
+ while((c = getc(fp)) != '\n' && c != EOF);
+ last_bin_search_offset = ftell(fp);
+ if (fgets(line, LINE_LEN, fp) == NULL)
+ return(NULL);
+ length = strchr(line, ' ') - line;
+ switch (sign(strncmp(line, searchkey, length))) {
+ case 0:
+ /* a match up to the length! */
+ if (length == keylen)
+ return(line);
+ if (length > keylen)
+ /* the word read is longer than ours */
+ goto up;
+ /* FALLTHROUGH */
+ case -1:
+ top = mid;
+ continue;
+ case 1:
+ up:
+ bot = mid;
+ }
}
- }
-
- do {
- fseek(fp, mid - 1, 0);
- if(mid != 1)
- while((c = getc(fp)) != '\n' && c != EOF);
- offset1 = ftell(fp); /* offset at start of line */
- if (fgets(linep, LINE_LEN, fp) != NULL) {
- offset2 = ftell(fp); /* offset at start of next line */
- length = (int)(strchr(linep, ' ') - linep);
- strncpy(key, linep, length);
- key[length] = '\0';
- if(strcmp(key, searchkey) < 0) { /* further in file */
- top = mid;
- diff = (bot - top) / 2;
- mid = top + diff;
- offset = offset2;
- }
- if(strcmp(key, searchkey) > 0) { /* earlier in file */
- bot = mid;
- diff = (bot - top) / 2;
- mid = top + diff;
- offset = offset1;
- }
- } else {
- bot = mid;
- diff = (bot - top) / 2;
- mid = top + diff;
- }
- } while((strcmp(key, searchkey)) && (diff != 0));
-
- if(!strcmp(key, searchkey)) {
- offset = offset1; /* get to start of current line */
- return(1); /* line with key is found */
- } else
- return(0); /* line with key is not found */
-}
-
-/* Copy contents from one file to another. */
-
-void copyfile(FILE *fromfp, FILE *tofp)
-{
- int c;
-
- while ((c = getc(fromfp)) != EOF)
- putc(c, tofp);
-}
-
-/* Function to replace a line in a file. Returns the original line,
- or NULL in case of error. */
-
-char *replace_line(char *new_line, char *searchkey, FILE *fp)
-{
- FILE *tfp; /* temporary file pointer */
-
- if (!bin_search_key(searchkey, fp))
- return(NULL); /* line with key not found */
-
- if ((tfp = tmpfile()) == NULL)
- return(NULL); /* could not create temp file */
- fseek(fp, offset, 0);
- fgets(line, LINE_LEN, fp); /* read original */
- copyfile(fp, tfp);
- if (fseek(fp, offset, 0) == -1)
- return(NULL); /* could not seek to offset */
- fprintf(fp, new_line); /* write line */
- rewind(tfp);
- copyfile(tfp, fp);
-
- fclose(tfp);
- fflush(fp);
-
- return(line);
-}
-
-/* Find location to insert line at in file. If line with this
- key is already in file, return NULL. */
-
-char *insert_line(char *new_line, char *searchkey, FILE *fp)
-{
- FILE *tfp;
-
- if (bin_search_key(searchkey, fp))
return(NULL);
-
- if ((tfp = tmpfile()) == NULL)
- return(NULL); /* could not create temp file */
- if (fseek(fp, offset, 0) == -1)
- return(NULL); /* could not seek to offset */
- copyfile(fp, tfp);
- if (fseek(fp, offset, 0) == -1)
- return(NULL); /* could not seek to offset */
- fprintf(fp, new_line); /* write line */
- rewind(tfp);
- copyfile(tfp, fp);
-
- fclose(tfp);
- fflush(fp);
-
- return(new_line);
}

View File

@ -0,0 +1,279 @@
--- include/wn.h Wed Jul 6 14:48:44 2005
+++ include/wn.h Wed Dec 21 17:24:58 2005
@@ -31,5 +31,7 @@
#else
#define DICTDIR "/dict"
+#ifndef DEFAULTPATH
#define DEFAULTPATH "/usr/local/WordNet-2.1/dict"
+#endif
#define DATAFILE "%s/data.%s"
#define INDEXFILE "%s/index.%s"
@@ -152,12 +154,12 @@
#define IMMED_POSTNOMINAL IPADJ
-extern char *wnrelease; /* WordNet release/version number */
+extern const char *wnrelease; /* WordNet release/version number */
-extern char *lexfiles[]; /* names of lexicographer files */
-extern char *ptrtyp[]; /* pointer characters */
-extern char *partnames[]; /* POS strings */
-extern char partchars[]; /* single chars for each POS */
-extern char *adjclass[]; /* adjective class strings */
-extern char *frametext[]; /* text of verb frames */
+extern const char *lexfiles[]; /* names of lexicographer files */
+extern const char *ptrtyp[]; /* pointer characters */
+extern const char *partnames[]; /* POS strings */
+extern const char partchars[]; /* single chars for each POS */
+extern const char *adjclass[]; /* adjective class strings */
+extern const char *frametext[]; /* text of verb frames */
/* Data structures used by search code functions. */
@@ -173,5 +175,5 @@
unsigned long *offset; /* offsets of synsets containing word */
int ptruse_cnt; /* number of pointers used */
- int *ptruse; /* pointers used */
+ short *ptruse; /* pointers used */
} Index;
@@ -180,5 +182,5 @@
/* Structure for data file synset */
typedef struct ss {
- long hereiam; /* current file position */
+ unsigned long hereiam; /* current file position */
int sstype; /* type of ADJ synset */
int fnum; /* file number that synset comes from */
@@ -191,8 +193,8 @@
int ptrcount; /* number of pointers */
int *ptrtyp; /* pointer types */
- long *ptroff; /* pointer offsets */
+ unsigned long *ptroff; /* pointer offsets */
int *ppos; /* pointer part of speech */
- int *pto; /* pointer 'to' fields */
- int *pfrm; /* pointer 'from' fields */
+ unsigned short *pto; /* pointer 'to' fields */
+ unsigned short *pfrm; /* pointer 'from' fields */
int fcount; /* number of verb frames */
int *frmid; /* frame numbers */
@@ -218,5 +220,5 @@
char *sensekey; /* sense key */
char *word; /* word string */
- long loc; /* synset offset */
+ unsigned long loc; /* synset offset */
int wnsense; /* WordNet sense number */
int tag_cnt; /* number of semantic tags to sense */
@@ -268,6 +270,6 @@
Default function provided in library returns -1 */
-extern int default_display_message(char *);
-extern int (*display_message)(char *);
+int default_display_message(const char *);
+int (*display_message)(const char *);
@@ -282,5 +284,5 @@
/* Primry search algorithm for use with user interfaces */
-extern char *findtheinfo(char *, int, int, int);
+const char *findtheinfo(const char *, int, int, int);
/* Primary search algorithm for use with programs (returns data structure) */
@@ -289,27 +291,27 @@
/* Set bit for each search type that is valid for the search word
passed and return bit mask. */
-extern unsigned int is_defined(char *, int);
+extern unsigned int is_defined(const char *, int);
/* Set bit for each POS that search word is in. 0 returned if
word is not in WordNet. */
-extern unsigned int in_wn(char *, int);
+unsigned int in_wn(const char *, int);
/* Find word in index file and return parsed entry in data structure.
Input word must be exact match of string in database. */
-extern IndexPtr index_lookup(char *, int);
+IndexPtr index_lookup(const char *, int);
/* 'smart' search of index file. Find word in index file, trying different
techniques - replace hyphens with underscores, replace underscores with
hyphens, strip hyphens and underscores, strip periods. */
-extern IndexPtr getindex(char *, int);
-extern IndexPtr parse_index(long, int, char *);
+extern IndexPtr getindex(const char *, int);
+extern IndexPtr parse_index(long, int, const char *);
/* Read synset from data file at byte offset passed and return parsed
entry in data structure. */
-extern SynsetPtr read_synset(int, long, char *);
+extern SynsetPtr read_synset(int, long, const char *);
/* Read synset at current byte offset in file and return parsed entry
in data structure. */
-extern SynsetPtr parse_synset(FILE *, int, char *);
+extern SynsetPtr parse_synset(FILE *, int, const char *);
/* Free a synset linked list allocated by findtheinfo_ds() */
@@ -324,22 +326,22 @@
/* Recursive search algorithm to trace a pointer tree and return results
in linked list of data structures. */
-SynsetPtr traceptrs_ds(SynsetPtr, int, int, int);
+SynsetPtr traceptrs_ds(SynsetPtr, int, int);
/* Do requested search on synset passed, returning output in buffer. */
-extern char *do_trace(SynsetPtr, int, int, int);
+const char *do_trace(SynsetPtr, int, int, int);
/*** Morphology functions (morph.c) ***/
/* Open exception list files */
-extern int morphinit();
+int morphinit(void);
/* Close exception list files and reopen */
-extern int re_morphinit();
+int re_morphinit(void);
/* Try to find baseform (lemma) of word or collocation in POS. */
-extern char *morphstr(char *, int);
+const char *morphstr(const char *, int);
/* Try to find baseform (lemma) of individual word in POS. */
-extern char *morphword(char *, int);
+const char *morphword(const char *, int);
/*** Utility functions (wnutil.c) ***/
@@ -347,9 +349,9 @@
/* Top level function to open database files, initialize wn_filenames,
and open exeception lists. */
-extern int wninit();
+int wninit(void);
/* Top level function to close and reopen database files, initialize
wn_filenames and open exception lists. */
-extern int re_wninit();
+int re_wninit(void);
/* Count the number of underscore or space separated words in a string. */
@@ -358,4 +360,5 @@
/* Convert string to lower case remove trailing adjective marker if found */
extern char *strtolower(char *);
+char *strtolower2(const char *from, char *to);
/* Convert string passed to lower case */
@@ -366,14 +369,14 @@
/* Return pointer code for pointer type characer passed. */
-extern int getptrtype(char *);
+unsigned short getptrtype(const char *, char **end);
/* Return part of speech code for string passed */
-extern int getpos(char *);
+int getpos(const char *);
/* Return synset type code for string passed. */
-extern int getsstype(char *);
+int getsstype(const char *);
/* Reconstruct synset from synset pointer and return ptr to buffer */
-extern char *FmtSynset(SynsetPtr, int);
+const char *FmtSynset(SynsetPtr, int);
/* Find string for 'searchstr' as it is in index file */
@@ -381,37 +384,34 @@
/* Pass in string for POS, return corresponding integer value */
-extern int StrToPos(char *);
+int StrToPos(const char *);
/* Return synset for sense key passed. */
-extern SynsetPtr GetSynsetForSense(char *);
+SynsetPtr GetSynsetForSense(const char *);
/* Find offset of sense key in data file */
-extern long GetDataOffset(char *);
+long GetDataOffset(const char *);
/* Find polysemy (collins) count for sense key passed. */
-extern int GetPolyCount(char *);
+int GetPolyCount(const char *);
/* Return word part of sense key */
-extern char *GetWORD(char *);
+const char *GetWORD(const char *);
/* Return POS code for sense key passed. */
-extern int GetPOS(char *);
+int GetPOS(const char *);
/* Convert WordNet sense number passed of IndexPtr entry to sense key. */
extern char *WNSnsToStr(IndexPtr, int);
-/* Search for string and/or baseform of word in database and return
- index structure for word if found in database. */
-extern IndexPtr GetValidIndexPointer(char *, int);
-
/* Return sense number in database for word and lexsn passed. */
-int GetWNSense(char *, char *);
+int GetWNSense(const char *, const char *);
-SnsIndexPtr GetSenseIndex(char *);
+SnsIndexPtr GetSenseIndex(const char *);
+void FreeSenseIndex(SnsIndexPtr);
-char *GetOffsetForKey(unsigned int);
-unsigned int GetKeyForOffset(char *);
+const char *GetOffsetForKey(unsigned int);
+unsigned int GetKeyForOffset(const char *);
-char *SetSearchdir();
+const char *SetSearchdir(void);
/* Return number of times sense is tagged */
@@ -435,17 +435,6 @@
/* General purpose binary search function to search for key as first
item on line in open file. Item is delimited by space. */
-extern char *bin_search(char *, FILE *);
-extern char *read_index(long, FILE *);
-
-/* Copy contents from one file to another. */
-extern void copyfile(FILE *, FILE *);
-
-/* Function to replace a line in a file. Returns the original line,
- or NULL in case of error. */
-extern char *replace_line(char *, char *, FILE *);
-
-/* Find location to insert line at in file. If line with this
- key is already in file, return NULL. */
-extern char *insert_line(char *, char *, FILE *);
+const char *bin_search(const char *, FILE *);
+const char *read_index(long, FILE *);
#ifdef __cplusplus
@@ -453,7 +453,8 @@
#endif
-extern char **helptext[NUMPARTS + 1];
+const char * const * helptext[NUMPARTS + 1];
-static char *license = "\
+#ifdef DEFINE_LICENSE /* should live in wn.c */
+const char license[] = "\
This software and database is being provided to you, the LICENSEE, by \n\
Princeton University under the following license. By obtaining, using \n\
@@ -486,5 +487,5 @@
Princeton University and LICENSEE agrees to preserve same. \n"
;
-
+#if 0 /* { */
static char dblicense[] = "\
1 This software and database is being provided to you, the LICENSEE, by \n\
@@ -518,6 +519,9 @@
29 Princeton University and LICENSEE agrees to preserve same. \n"
;
-
#define DBLICENSE_SIZE (sizeof(dblicense))
+#endif /* } */
+#else /* } { */
+extern const char license[];
+#endif /* } */
#endif /*_WN_*/

View File

@ -0,0 +1,57 @@
This patch makes wnb use man(1) to access its own man-pages instead
of relying on textual copies of them being in the $resourcedir.
Similarly, it looks for the compiled-in license instead of opening
its textual copy.
These leave wn.xbm as the only "resource" file, thus removing the need
for a separate resource directory. FreeBSD port installs all -- the
dictionaries and the bitmap into ${PREFIX}/share/WordNet.
-mi
--- src/wnb Tue Jun 7 15:19:22 2005
+++ src/wnb Sun Jan 15 07:42:38 2006
@@ -103,9 +100,15 @@
if {$tcl_platform(platform) == "unix"} {
- if {[lsearch -exact [array names env] WNHOME] == -1} {
- set resourcedir "/usr/local/WordNet-2.1/lib/wnres"
- } else {
- set resourcedir "$env(WNHOME)/lib/wnres"
+ set resourcedirs {
+ /usr/local/WordNet-2.1
+ /usr/local/WordNet-2.1/lib/wnres
+ }
+ if {[info exists env(WNHOME)]} {
+ lappend resourcedirs $env(WNHOME) $env(WNHOME)/lib/wnres
}
+ foreach resourcedir $resourcedirs {
+ if {[file exists $resourcedir/wn.xbm]} break
+ }
+ unset resourcedirs
set configfile "$env(HOME)/.wnrc"
if [ file exists $configfile ] {
@@ -575,7 +578,19 @@
.$w.top.text configure \
-state normal
- set fileid [open $filename "r"]
- set filetext [read $fileid]
- close $fileid
+ switch -glob -- $filename {
+ *.man {
+ set manpage [file tail $filename]
+ set manpage [string range $manpage 0 end-4]
+ set fileid [open "|man $manpage"]
+ } */license.txt {
+ set filetext [wnlicense]
+ } default {
+ set fileid [open $filename]
+ }
+ }
+ if {[info exists fileid]} {
+ set filetext [read $fileid]
+ close $fileid
+ }
regsub -all ".\b" $filetext "" filetext
.$w.top.text insert end $filetext

View File

@ -0,0 +1,37 @@
--- lib/wnglobal.c Fri May 6 13:17:39 2005
+++ lib/wnglobal.c Tue Dec 20 23:29:54 2005
@@ -11,9 +11,9 @@
#endif
-char *wnrelease = "2.1";
+const char *wnrelease = "2.1";
/* Lexicographer file names and numbers */
-char *lexfiles[] = {
+const char *lexfiles[] = {
"adj.all", /* 0 */
"adj.pert", /* 1 */
@@ -65,5 +65,5 @@
/* Pointer characters and searches */
-char *ptrtyp[]={
+const char *ptrtyp[] = {
"", /* 0 not used */
"!", /* 1 ANTPTR */
@@ -110,11 +110,11 @@
};
-char *partnames[]={ "", "noun", "verb", "adj", "adv", NULL };
-char partchars[] = " nvara"; /* add char for satellites to end */
-char *adjclass[] = { "", "(p)", "(a)", "(ip)" };
+const char *partnames[]={ "", "noun", "verb", "adj", "adv", NULL };
+const char partchars[] = " nvara"; /* add char for satellites to end */
+const char *adjclass[] = { "", "(p)", "(a)", "(ip)" };
/* Text of verb sentence frames */
-char *frametext[] = {
+const char *frametext[] = {
"",
"Something ----s",

View File

@ -0,0 +1,43 @@
--- lib/wnhelp.c Fri May 6 13:17:39 2005
+++ lib/wnhelp.c Wed Dec 21 17:25:27 2005
@@ -7,4 +7,5 @@
/* $Id: wnhelp.c,v 1.14 2005/02/01 17:03:46 wn Rel $ */
+#define DEFINE_LICENSE
#include "wn.h"
@@ -239,5 +240,5 @@
";
-static char *nounhelps[] = {
+static const char *nounhelps[] = {
hyper_help,
relatives_help,
@@ -259,5 +260,5 @@
};
-static char *verbhelps[] = {
+static const char *verbhelps[] = {
hyper_help,
relatives_help,
@@ -276,5 +277,5 @@
};
-static char *adjhelps[] = {
+static const char *adjhelps[] = {
/* SIMPTR */
"Display synonyms and synsets related to synsets containing \n\
@@ -351,5 +352,5 @@
};
-static char *advhelps[] = {
+static const char *advhelps[] = {
/* SIMPTR */
"Display synonyms and synsets related to synsets containing \n\
@@ -370,5 +371,5 @@
};
-char **helptext[NUMPARTS + 1] = {
+const char * const *helptext[NUMPARTS + 1] = {
NULL, nounhelps, verbhelps, adjhelps, advhelps
};

View File

@ -0,0 +1,17 @@
--- lib/wnrtl.c Fri May 6 13:17:39 2005
+++ lib/wnrtl.c Wed Dec 21 00:21:04 2005
@@ -8,5 +8,5 @@
#include "wn.h"
-static char *Id = "$Id: wnrtl.c,v 1.8 2005/01/27 17:33:54 wn Rel $";
+__FBSDID("$Id: wnrtl.c,v 1.8 2005/01/27 17:33:54 wn Rel $");
/* Search code variables and flags */
@@ -43,6 +43,5 @@
Default function provided in library returns -1 */
-int default_display_message(char *);
-int (*display_message)(char *) = default_display_message;
+int (*display_message)(const char *) = default_display_message;
/*

View File

@ -1,3 +0,0 @@
SUBDIR= lib wn wnb
.include <bsd.subdir.mk>

View File

@ -1,13 +1,14 @@
SRCS= binsrch.c morph.c search.c setutil.c wnglobal.c \
SRCS= binsrch.c morph.c search.c wnglobal.c \
wnhelp.c wnrtl.c wnutil.c
CFLAGS+= -DUNIX -DDEFAULTPATH="\"${PREFIX}/share/WordNet-${VER}\"" \
CFLAGS+= -DUNIX -DDEFAULTPATH="\"${PREFIX}/share/WordNet\""\
-DDEFAULTBIN="\"${PREFIX}/bin\""
CFLAGS+= -I${.CURDIR}/../../include
CFLAGS+= -I${.CURDIR:H}/include
LIB= wn2
SHLIB_MAJOR= 0
LIB= WN
WARNS= 5
SHLIB_MAJOR= 2
NOPROFILE= True
LIBDIR= ${PREFIX}/lib

View File

@ -1,11 +1,11 @@
PROG= wn
NOMAN= True # man pages installed separately
NO_MAN= True # man pages installed separately
CFLAGS+= -DUNIX -DDEFAULTPATH="\"${PREFIX}/share/WordNet-${VER}\"" \
CFLAGS+= -DUNIX -DDEFAULTPATH="\"${PREFIX}/share/WordNet\"" \
-DDEFAULTBIN="\"${PREFIX}/bin\""
CFLAGS+= -I${.CURDIR}/../../include
LDADD+= -L../lib -lwn2
CFLAGS+= -I${.CURDIR:H}/include
LDADD+= -L../lib -lWN
BINDIR= ${PREFIX}/bin

View File

@ -3,16 +3,18 @@ TCL_DVER?= 8.4
TCL_VER= ${TCL_DVER:S/.//g}
TCL_INCDIR?= ${PREFIX}/include/tcl${TCL_DVER}
CFLAGS+= -DUNIX -DDEFAULTPATH="\"${PREFIX}/share/WordNet-${VER}\"" \
-DDEFAULTBIN="\"${PREFIX}/bin\""
CFLAGS+= -DUNIX -DDEFAULTPATH="\"${PREFIX}/share/WordNet\"" \
-DDEFAULTBIN="\"${PREFIX}/bin\"" -DHAVE_LANGINFO_CODESET
CFLAGS+= -I${.CURDIR}/../../include -I$(TCL_INCDIR)
LDADD= -L../lib -lwn2 -L${PREFIX}/lib -ltcl${TCL_VER} -ltk${TCL_VER}
LDADD= -L.. -lWN -L${PREFIX}/lib -ltcl${TCL_VER} # -ltk${TCL_VER}
SHLIB_NAME= libtclwn2.so.0
SRCS= stubs.c
.PATH: ${.CURDIR:H:H}/src
all: pkgIndex.tcl
pkgIndex.tcl:
@ -21,18 +23,14 @@ pkgIndex.tcl:
> pkgIndex.tcl
LIBDIR= ${PREFIX}/lib
RESDIR= ${PREFIX}/share/WordNet-${VER}/wnres
RESDIR= ${PREFIX}/share/WordNet/
${LIBDIR} ${RESDIR} ${LIBDIR}/tcl${TCL_DVER}/Wordnet:
mkdir -p ${.TARGET}
beforeinstall: ${LIBDIR} ${RESDIR} ${LIBDIR}/tcl${TCL_DVER}/Wordnet
${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 \
pkgIndex.tcl ${LIBDIR}/tcl${TCL_DVER}/Wordnet
${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 \
${.CURDIR}/../lib/wnres/license.txt \
${.CURDIR}/../lib/wnres/*.xbm ${RESDIR}
${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 755 \
wnb ${PREFIX}/bin
${BSD_INSTALL_DATA} pkgIndex.tcl ${LIBDIR}/tcl${TCL_DVER}/Wordnet
${BSD_INSTALL_DATA} ${.CURDIR}/*.xbm ${RESDIR}
${BSD_INSTALL_SCRIPT} ${.CURDIR:H:H}/src/wnb ${PREFIX}/bin
.include <bsd.lib.mk>

View File

@ -1,40 +1,33 @@
bin/wnb
bin/wn
include/WordNet-%%VER%%/license.h
include/WordNet-%%VER%%/setutil.h
include/WordNet-%%VER%%/wn.h
include/WordNet-%%VER%%/wnconsts.h
include/WordNet-%%VER%%/wnglobal.h
include/WordNet-%%VER%%/wnhelp.h
include/WordNet-%%VER%%/wnrtl.h
include/WordNet-%%VER%%/wntypes.h
lib/libwn2.a
lib/libwn2.so.0
lib/libwn2.so
include/WordNet/wn.h
include/WordNet/wngrind.h
lib/libWN.a
lib/libWN.so.2
lib/libWN.so
lib/libtclwn2.so.0
lib/libtclwn2.so
lib/tcl%%TCL_DVER%%/Wordnet/pkgIndex.tcl
share/WordNet-%%VER%%/adj.exc
share/WordNet-%%VER%%/adv.exc
share/WordNet-%%VER%%/cntlist
share/WordNet-%%VER%%/cntlist.rev
share/WordNet-%%VER%%/data.adj
share/WordNet-%%VER%%/data.adv
share/WordNet-%%VER%%/data.noun
share/WordNet-%%VER%%/data.verb
share/WordNet-%%VER%%/index.adj
share/WordNet-%%VER%%/index.adv
share/WordNet-%%VER%%/index.noun
share/WordNet-%%VER%%/index.sense
share/WordNet-%%VER%%/index.verb
share/WordNet-%%VER%%/lexnames
share/WordNet-%%VER%%/noun.exc
share/WordNet-%%VER%%/sentidx.vrb
share/WordNet-%%VER%%/sents.vrb
share/WordNet-%%VER%%/verb.exc
share/WordNet-%%VER%%/wnres/license.txt
share/WordNet-%%VER%%/wnres/wn.xbm
@dirrm include/WordNet-%%VER%%
share/WordNet/adj.exc
share/WordNet/adv.exc
share/WordNet/cntlist
share/WordNet/cntlist.rev
share/WordNet/data.adj
share/WordNet/data.adv
share/WordNet/data.noun
share/WordNet/data.verb
share/WordNet/frames.vrb
share/WordNet/index.adj
share/WordNet/index.adv
share/WordNet/index.noun
share/WordNet/index.sense
share/WordNet/index.verb
share/WordNet/noun.exc
share/WordNet/sentidx.vrb
share/WordNet/sents.vrb
share/WordNet/verb.exc
share/WordNet/verb.Framestext
share/WordNet/wn.xbm
@dirrm include/WordNet
@dirrm lib/tcl%%TCL_DVER%%/Wordnet
@dirrm share/WordNet-%%VER%%/wnres
@dirrm share/WordNet-%%VER%%
@dirrm share/WordNet

View File

@ -1,12 +1,27 @@
#!/bin/sh
for mf in ${FILESDIR}/*Makefile ; do \
dir=${WRKSRC}/`basename $mf | sed -e s%Makefile%% -e 's%\.%/%g'` ; \
dir=`basename $mf | sed -e s%Makefile%% -e 's%\.%/%g'`
case "$dir" in
"man/")
dir=doc/man/
;;
"src/lib/")
dir=lib/
;;
"src/wn/")
dir=src/
;;
"src/wnb/")
dir=lib/wnres/
;;
esac
dir=${WRKSRC}/$dir
test -f ${dir}Makefile.orig && continue
mv ${dir}Makefile ${dir}Makefile.orig ; \
cp -p $mf ${dir}Makefile ; \
test -f ${dir}Makefile && mv ${dir}Makefile ${dir}Makefile.orig
cp -p $mf ${dir}Makefile
done
patch -d ${WRKSRC}/src/wnb -p << EOPATCH
patch -d ${WRKSRC}/src -p << EOPATCH
Configuring the wnb script to call the right wish-binary directly
--- wnb Sun Feb 22 12:49:56 1998
+++ wnb Sat Feb 26 17:41:06 2000