build
stamp-h.in
config.h.in
+deb-build
/* -*-java-*-
*
- * $Id: AnagGUI.java,v 1.5 2002/08/11 12:58:09 mdw Exp $
+ * $Id: AnagGUI.java,v 1.6 2003/11/29 23:38:37 mdw Exp $
*
* Front-end GUI
*
/*----- Revision history --------------------------------------------------*
*
* $Log: AnagGUI.java,v $
+ * Revision 1.6 2003/11/29 23:38:37 mdw
+ * Debianization.
+ *
* Revision 1.5 2002/08/11 12:58:09 mdw
* Added support for regular expression matching, if supported by the C
* library.
});
add(b, g);
- b = new Button("Regexp");
+ b = new Button("Regular expression");
b.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) { getlist("-regexp"); }
});
add(b, g);
+ b = new Button("Perl regexp");
+ b.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) { getlist("-pcre"); }
+ });
+ add(b, g);
+
+ b = new Button("Monoalphabetic");
+ b.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) { getlist("-mono"); }
+ });
+ add(b, g);
+
b = new Button("Trackword");
b.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) { getlist("-trackword"); }
## -*-makefile-*-
##
-## $Id: Makefile.am,v 1.9 2003/09/15 02:48:55 mdw Exp $
+## $Id: Makefile.am,v 1.10 2003/11/29 23:38:37 mdw Exp $
##
## Makefile for Anag
##
##----- Revision history ----------------------------------------------------
##
## $Log: Makefile.am,v $
+## Revision 1.10 2003/11/29 23:38:37 mdw
+## Debianization.
+##
## Revision 1.9 2003/09/15 02:48:55 mdw
## Monoalphabetic match filter.
##
java_DATA = @JARFILES@
anag_SOURCES = \
- anag.c anag.h wildcard.c anagram.c mono.c trackword.c regexp.c util.c
+ anag.c anag.h util.c \
+ wildcard.c anagram.c mono.c trackword.c regexp.c pcre.c
EXTRA_anag_SOURCES = regexp.c
anag.jar: AnagGUI.class
- jar cf anag.jar Anag*.class
+ jar cfm anag.jar $(srcdir)/anag.manifest Anag*.class Whinge*.class
doszip: distdir
rm -f $(PACKAGE).zip
zip -qlr $(PACKAGE).zip $(distdir)
rm -rf $(distdir)
-EXTRA_DIST = AnagGUI.java anag-gui
+EXTRA_DIST = \
+ AnagGUI.java anag-gui.in \
+ debian/control debian/changelog debian/copyright debian/rules \
+ debian/anag-gui-java.postinst debian/anag-gui-java.prerm \
+ debian/anag-gui-tk.postinst debian/anag-gui-tk.prerm
+
CLEANFILES = *.class *.jar
##----- That's all, folks ---------------------------------------------------
/* -*-c-*-
*
- * $Id: acconfig.h,v 1.1 2001/02/04 17:14:42 mdw Exp $
+ * $Id: acconfig.h,v 1.2 2003/11/29 23:38:37 mdw Exp $
*
* Configuration header for Anag
*
/*----- Revision history --------------------------------------------------*
*
* $Log: acconfig.h,v $
+ * Revision 1.2 2003/11/29 23:38:37 mdw
+ * Debianization.
+ *
* Revision 1.1 2001/02/04 17:14:42 mdw
* Initial checkin
*
/* Define this to be your default wordlist location. */
#define DICTIONARY "/usr/dict/words"
+/* Define this if you have (and want to use) the Perl-Compatible Regular
+ * Expression (PCRE) library. */
+#define HAVE_PCRE
+
@BOTTOM@
/*----- That's all, folks -------------------------------------------------*/
trackword Trackword t
mono Monoalphabetic m
regexp "Regular expression" r
+ pcre "Perl regexp" p
} {
button .b-$opt -text $text \
-underline [string first $mnem [string tolower $text]] \
/* -*-c-*-
*
- * $Id: anag.c,v 1.6 2003/09/15 02:48:54 mdw Exp $
+ * $Id: anag.c,v 1.7 2003/11/29 23:38:37 mdw Exp $
*
* Main driver for anag
*
/*----- Revision history --------------------------------------------------*
*
* $Log: anag.c,v $
+ * Revision 1.7 2003/11/29 23:38:37 mdw
+ * Debianization.
+ *
* Revision 1.6 2003/09/15 02:48:54 mdw
* Monoalphabetic match filter.
*
-regexp REGEXP matches with an (extended) regular expression\n\
"
#endif
+#ifdef HAVE_PCRE
+"\
+-pcre REGEXP matches with a Perl-like regular expression\n\
+"
+#endif
"\
\n\
These simple tests can be combined using the operators `-a', `-o' and `-n'\n\
(for `and', `or' and `not'; they may also be written `&', `|' and `!' if\n\
you like), and grouped using parentheses `(' and `)'.\n\
-", fp);
+", fp); /*"*/
}
/*----- The options parser ------------------------------------------------*/
O_HELP, O_VERSION, O_USAGE,
O_FILE,
O_AND, O_OR, O_NOT, O_LPAREN, O_RPAREN,
- O_ANAG, O_SUBG, O_WILD, O_TRACK, O_REGEXP, O_MONO,
+ O_ANAG, O_SUBG, O_WILD, O_TRACK, O_REGEXP, O_PCRE, O_MONO,
O_EOF
};
#ifdef HAVE_REGCOMP
{ "regexp", 1, 0, O_REGEXP },
#endif
+#ifdef HAVE_PCRE
+ { "pcre", 1, 0, O_PCRE },
+#endif
/* --- End marker --- */
#ifdef HAVE_REGCOMP
case O_REGEXP: *nn = regexp(p->a + 1); break;
#endif
+#ifdef HAVE_PCRE
+ case O_PCRE: *nn = pcrenode(p->a + 1); break;
+#endif
case O_MONO: *nn = mono(p->a + 1); break;
default: die("syntax error near `%s': unexpected token", *p->a);
}
/* -*-c-*-
*
- * $Id: anag.h,v 1.3 2003/09/15 02:48:55 mdw Exp $
+ * $Id: anag.h,v 1.4 2003/11/29 23:38:37 mdw Exp $
*
* External definitions for Anag
*
/*----- Revision history --------------------------------------------------*
*
* $Log: anag.h,v $
+ * Revision 1.4 2003/11/29 23:38:37 mdw
+ * Debianization.
+ *
* Revision 1.3 2003/09/15 02:48:55 mdw
* Monoalphabetic match filter.
*
extern node *trackword(const char *const */*av*/);
extern node *mono(const char *const */*av*/);
extern node *regexp(const char *const */*av*/);
+extern node *pcrenode(const char *const */*av*/);
/*----- Error reporting ---------------------------------------------------*/
-dnl -*-fundamental-*-
+dnl -*-m4-*-
dnl
-dnl $Id: configure.in,v 1.3 2002/08/11 12:59:00 mdw Exp $
+dnl $Id: configure.in,v 1.4 2003/11/29 23:38:37 mdw Exp $
dnl
dnl Configuration script
dnl
dnl ----- Revision history --------------------------------------------------
dnl
dnl $Log: configure.in,v $
+dnl Revision 1.4 2003/11/29 23:38:37 mdw
+dnl Debianization.
+dnl
dnl Revision 1.3 2002/08/11 12:59:00 mdw
dnl New Tcl/Tk interface; regular expression support.
dnl
AM_CONFIG_HEADER(config.h)
AC_PROG_CC
mdw_GCC_FLAGS
+
AC_CHECK_PROGS([JAVAC], [jikes javac], [none])
if test "$JAVAC" = "none"; then
AC_MSG_WARN([No Java compiler found])
else
JARFILES="anag.jar"
fi
+AC_SUBST([JARFILES])
+
AC_CHECK_PROGS([WISH], [wish wish8], [none])
if test "$WISH" = "none"; then
AC_MSG_WARN([No Tcl/Tk interpreter found])
else
TKPROGS="anag-gui"
fi
+AC_SUBST([TKPROGS])
+
EXTNODE=""
AC_CHECK_FUNCS([regcomp])
-AC_SUBST([JARFILES])
-AC_SUBST([TKPROGS])
+mdw_CHECK_MANYLIBS([pcre_fullinfo], [pcre], [AC_DEFINE([HAVE_PCRE])])
+
AC_ARG_WITH(dictionary,
[ --with-dictionary=DICT set default word list to be DICT],
[DICTIONARY=$withval],
[DICTIONARY="/usr/dict/words"])
AC_DEFINE_UNQUOTED([DICTIONARY], ["$DICTIONARY"])
AC_SUBST([DICTIONARY])
+
mdw_DEFINE_PATHS([
ANAG=mdw_PATH([${bindir}])/mdw_PROG([anag])
])
+
AC_SUBST([ANAG])
AC_OUTPUT(Makefile anag-gui)
--- /dev/null
+files tmp substvars *.substvars *.debhelper
+anag anag-gui-tk anag-gui-java
--- /dev/null
+#! /bin/sh
+set -e
+update-alternatives --install \
+ /usr/bin/anag-gui anag-gui /usr/bin/anag-gui-java 10
+#DEBHELPER#
--- /dev/null
+#! /bin/sh
+set -e
+update-alternatives --remove anag-gui /usr/bin/anag-gui-java
+#DEBHELPER#
\ No newline at end of file
--- /dev/null
+#! /bin/sh
+set -e
+/usr/bin/java -jar /usr/share/anag-gui-java/anag.jar "$@"
--- /dev/null
+#! /bin/sh
+set -e
+update-alternatives --install \
+ /usr/bin/anag-gui anag-gui /usr/bin/anag-gui-tk 20
+#DEBHELPER#
--- /dev/null
+#! /bin/sh
+set -e
+update-alternatives --remove anag-gui /usr/bin/anag-gui-tk
+#DEBHELPER#
--- /dev/null
+anag (1.1.0) experimental; urgency=low
+
+ * Debianization!
+
+ -- Mark Wooding <mdw@nsict.org> Wed, 12 Nov 2003 00:02:31 +0000
--- /dev/null
+Source: anag
+Section: text
+Priority: extra
+Maintainer: Mark Wooding <mdw@nsict.org>
+Standards-Version: 3.1.1
+
+Package: anag
+Architecture: any
+Depends: ${shlibs:Depends}
+Recommends: wordlist
+Suggests: anag-gui
+Description: A simple wordgame tool
+ Anag can solve simple wordgame puzzles, such as anagrams, crosswords,
+ and trackwords. It has a powerful command-line syntax, reminiscent of
+ `find'.
+ .
+ This is just the command-line program. There are graphical user
+ interfaces for it.
+
+Package: anag-gui-tk
+Architecture: all
+Depends: anag, wish
+Provides: anag-gui
+Description: A simple wordgame tool
+ Anag can solve simple wordgame puzzles, such as anagrams, crosswords,
+ and trackwords. It has a powerful command-line syntax, reminiscent of
+ `find'.
+ .
+ This is the Tcl/Tk graphical interface.
+
+Package: anag-gui-java
+Architecture: all
+Depends: anag, java-virtual-machine
+Provides: anag-gui
+Description: A simple wordgame tool
+ Anag can solve simple wordgame puzzles, such as anagrams, crosswords,
+ and trackwords. It has a powerful command-line syntax, reminiscent of
+ `find'.
+ .
+ This is the Java graphical interface.
--- /dev/null
+anag is copyright (c) 2003 Straylight/Edgeware.
+
+anag is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+anag is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have a copy of the GNU General Public License in
+/usr/share/common-licenses/GPL; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+USA.
--- /dev/null
+#! /usr/bin/make -f
+
+export DH_COMPAT = 4
+
+build:
+ rm -rf build deb-build
+ mkdir deb-build
+ cd deb-build; ../configure \
+ --prefix=/usr \
+ --with-dictionary=/usr/share/dict/words
+ make -C deb-build JAVAC=jikes-kaffe
+ touch build
+
+clean:
+ dh_clean
+ rm -rf deb-build build
+
+install: build
+ dh_clean
+ make -C deb-build install DESTDIR=`pwd`/debian/anag
+ mkdir -p debian/anag-gui-java/usr/share/anag-gui-java
+ mv debian/anag/usr/share/java/anag.jar \
+ debian/anag-gui-java/usr/share/anag-gui-java
+ rmdir debian/anag/usr/share/java
+ mkdir -p debian/anag-gui-java/usr/bin
+ cp debian/anag-gui-java.sh debian/anag-gui-java/usr/bin/anag-gui-java
+ mkdir -p debian/anag-gui-tk/usr/bin
+ mv debian/anag/usr/bin/anag-gui \
+ debian/anag-gui-tk/usr/bin/anag-gui-tk
+
+binary-indep:
+ dh_testdir -i
+ dh_testroot -i
+ dh_compress -i
+ dh_installdocs -i
+ dh_gencontrol -i
+ dh_fixperms -i
+ dh_installdeb -i
+ dh_md5sums -i
+ dh_builddeb -i
+
+binary-arch:
+ dh_testdir -a
+ dh_testroot -a
+ dh_compress -a
+ dh_installdocs -a
+ dh_strip -a
+ dh_shlibdeps -a
+ dh_gencontrol -a
+ dh_fixperms -a
+ dh_installdeb -a
+ dh_md5sums -a
+ dh_builddeb -a
+
+binary: install binary-indep binary-arch
+
+source:
+ rm -rf deb-build/*.tar.gz deb-build/=deb=
+ make -C deb-build dist
+ mkdir deb-build/=deb=
+ cd deb-build/=deb=; tar xvfz ../*.tar.gz
+ d=`pwd`; cd ..; dpkg-source -i -b $$d/deb-build/=deb=/*
+ rm -rf deb-build/=deb=
+
+.PHONY: binary binary-arch binary-indep clean install source
--- /dev/null
+/* -*-c-*-
+ *
+ * $Id: pcre.c,v 1.1 2003/11/29 23:38:37 mdw Exp $
+ *
+ * Matches Perl-compatible regular expressions
+ *
+ * (c) 2002 Mark Wooding
+ */
+
+/*----- Licensing notice --------------------------------------------------*
+ *
+ * This file is part of Anag: a simple wordgame helper.
+ *
+ * Anag is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Anag is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Anag; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+/*----- Revision history --------------------------------------------------*
+ *
+ * $Log: pcre.c,v $
+ * Revision 1.1 2003/11/29 23:38:37 mdw
+ * Debianization.
+ *
+ */
+
+/*----- Header files ------------------------------------------------------*/
+
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#ifndef HAVE_PCRE
+ extern int dummy;
+#else
+
+#include "anag.h"
+#include <pcre.h>
+
+/*----- Data structures ---------------------------------------------------*/
+
+typedef struct node_pcre {
+ node n;
+ const char *s;
+ pcre *rx;
+ pcre_extra *rx_study;
+ int *ovec;
+ int ovecsz;
+} node_pcre;
+
+/*----- Main code ---------------------------------------------------------*/
+
+/* --- Node matcher --- */
+
+static int n_pcre(node *nn, const char *p, size_t sz)
+{
+ node_pcre *n = (node_pcre *)nn;
+ int e;
+
+ e = pcre_exec(n->rx, n->rx_study, p, sz, 0, 0, n->ovec, n->ovecsz);
+ if (e >= 0)
+ return (1);
+ if (e == PCRE_ERROR_NOMATCH)
+ return (0);
+ die("unexpected PCRE error code %d", e);
+ return (-1);
+}
+
+/* --- Node creation --- */
+
+node *pcrenode(const char *const *av)
+{
+ node_pcre *n = xmalloc(sizeof(*n));
+ const char *e;
+ int eo;
+ int c;
+
+ n->n.func = n_pcre;
+ if ((n->rx = pcre_compile(av[0], PCRE_CASELESS, &e, &eo, 0)) == 0)
+ die("bad regular expression `%s': %s", av[0], e);
+ n->rx_study = pcre_study(n->rx, 0, &e);
+ if (e)
+ die("error studying pattern `%s': %s", av[0], e);
+ pcre_fullinfo(n->rx, n->rx_study, PCRE_INFO_BACKREFMAX, &c);
+ n->ovecsz = c * 2;
+ n->ovec = xmalloc(n->ovecsz * sizeof(*n->ovec));
+ return (&n->n);
+}
+
+/*----- That's all, folks -------------------------------------------------*/
+
+#endif