Imported Upstream version 2.0

parents
This diff is collapsed.
Sergey Poznyakoff gray@gnu.org.ua
Wojciech Polak polak@gnu.org
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
# This file is part of GNU Dico
# Copyright (C) 1998-2000, 2008, 2009 Sergey Poznyakoff
#
# GNU Dico 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 3, or (at your option)
# any later version.
#
# GNU Dico 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 GNU Dico. If not, see <http://www.gnu.org/licenses/>.
ACLOCAL_AMFLAGS = -I m4 -I am
SUBDIRS=include utils gnu lib libltdl dicod modules dico tests doc po
#FIXME: add these when ready: makedict client fonts
EXTRA_DIST = ChangeLog.2008
dist-hook:
tar -C $(srcdir) -c -f - --exclude-vcs app dicoweb | \
tar -C $(distdir) -x -f -
gen_start_date = 2008-05-05
.PHONY: ChangeLog
ChangeLog:
if test -d .git; then \
$(top_srcdir)/build-aux/gitlog-to-changelog \
--since=$(gen_start_date) | \
sed '/<unknown>$$/d' | fmt -s > ChangeLog; \
echo " " >> ChangeLog; \
echo "Local Variables:" >> ChangeLog; \
echo "mode: change-log" >> ChangeLog; \
echo "version-control: never" >> ChangeLog; \
echo "buffer-read-only: t" >> ChangeLog; \
echo "End:" >> ChangeLog; \
fi
This diff is collapsed.
GNU Dico NEWS -- history of user-visible changes. 2009-03-29
Copyright (C) 2008, 2009 Sergey Poznyakoff
See the end of file for copying conditions.
Please send Dico bug reports to <bug-dico@gnu.org.ua>
Version 2.0, 2009-03-29
Initial version.
=========================================================================
Copyright information:
Copyright (C) 2008, 2009 Sergey Poznyakoff
Permission is granted to anyone to make or distribute verbatim copies
of this document as received, in any medium, provided that the
copyright notice and this permission notice are preserved,
thus giving the recipient permission to redistribute in turn.
Permission is granted to distribute modified versions
of this document, or of portions of it,
under the above conditions, provided also that they
carry prominent notices stating who last changed them.
Local variables:
mode: outline
paragraph-separate: "[ ]*$"
eval: (add-hook 'write-file-hooks 'time-stamp)
time-stamp-start: "changes. "
time-stamp-format: "%:y-%02m-%02d"
time-stamp-end: "\n"
end:
GNU Dico README
Copyright (C) 2008, 2009 Sergey Poznyakoff
* Introduction
==============
This file contains brief information about configuring, testing
and running GNU Dico. It is *not* intended as a replacement
for the documentation, it is provided as a brief reference only.
The (almost) complete documentation for Dico is available in
doc/ subdirectory. To read it without installing the package
run `info -f doc/dico.info'. After the package is installed
the documentation can be accessed running `info Dico'. Invoking
`info dico' and `info dicod' (with lower-case `d') will show you a
concise description of the command line syntax (similar to a man-page
style) of `dico' and `dicod' programs, correspondingly.
An online copy of the documentation in various formats is available
at http://dico.man.gnu.org.ua.
* Overview
==========
Dico is an implementation of DICT server (RFC 2229). It is fully
modular: the daemon itself (dicod) provides only the server
functionality, but it knows nothing about database formats. Actual
searches are performed by functions supplied in loadable modules. A
single module can serve one or more databases.
The package includes several modules for searching in different
dictionary databases, among them a module for dict.org databases and a
module for databases in Emacs "outline" format.
A console client program, `dico', is also included.
A module for lookups in Jim Breen's Kanjidic and Edict databases will
be added in future.
* What's in a name?
===================
Dico is informal French for "Dictionary". It is pronounced "Deekoh",
with the stress on the last syllable.
* Current state
===============
The dicod daemon is completely implemented. It provides all the
functionality required by RFC 2229, including SASL authentication.
The package comes with the following database modules:
- dictorg
This module handles databases in dict.org format.
- guile
An abstract layer for interfacing with database modules written in
Guile.
- python
An abstract layer for interfacing with database modules written in
Python.
- outline
Support for databases in Emacs outline format. This module is
designed mostly as an example and for testing purposes.
* Building
==========
As usual:
$ ./configure
$ make
$ make install
See INSTALL for the generic configure instructions. The rest of this
section describes configuration options and variables specific for
Dico.
** Default Preprocessor
------------------------
The runtime configuration system uses `m4' to preprocess the
configuration file. This makes the configuration extremely flexible.
We recommend to use GNU m4 as a preprocessor. However, any other
implementation of `m4' may be used. The `configure' script tries to
determine full file name of the preprocessor binary and the necessary
command line options. In case it makes a wrong guess, you can instruct
it to use a particular preprocessor by using `DEFAULT_PREPROCESSOR'
configuration variable. For example, the following `configure'
invocation instructs it to use `/usr/local/bin/gm4':
$ ./configure DEFAULT_PREPROCESSOR="/usr/local/bin/gm4 -s"
Note the use of `-s' preprocessor option. It instructs `m4' to
produce line directives which help `dicod' produce correct diagnostics
about eventual configuration errors. Unless your `m4' implementation
does not have this feature, we recommend to always use it in
`DEFAULT_PREPROCESSOR' value.
Finally, if you do not wish to use preprocessor at all, you can
disable it using `--without-preprocessor' option to `configure'.
** Default Server
-----------------
Unless given an explicit dictionary server, the client program `dico'
attempts to connect the server `dict://dico.gnu.org.ua'. You may
change this default by defining the DEFAULT_DICT_SERVER variable. For
example, the following command line selects dict.org as the default
server:
$ ./configure DEFAULT_DICT_SERVER=dict.org
** Guile Support
-----------------
The "GNU's Ubiquitous Intelligent Language for Extensions" (Guile)
can be used to write database modules for `dico'. This
requires Guile version 1.8.4 or newer. The `configure' script will
probe for the presence of Guile on your system and automatically enable
its use if its version number is high enough.
If you do not wish to use Guile, use `--without-guile' to disable it.
** Other Configure Settings
----------------------------
The `dicod' daemon uses syslog for diagnostics. The default syslog
facility can be set using `LOG_FACILITY' configuration variable. Its
allowed arguments are `user', `daemon', `auth', `authpriv', `mail',
`cron', and `local0' through `local7'. Case is not significant. In
addition, these words can be prefixed with `log_'.
By default, the `daemon' facility is used.
* Bug reporting.
Send bug reports to <bug-dico@gnu.org>.
* Copyright information:
Copyright (C) 2008, 2009 Sergey Poznyakoff
Permission is granted to anyone to make or distribute verbatim copies
of this document as received, in any medium, provided that the
copyright notice and this permission notice are preserved,
thus giving the recipient permission to redistribute in turn.
Permission is granted to distribute modified versions
of this document, or of portions of it,
under the above conditions, provided also that they
carry prominent notices stating who last changed them.
Local Variables:
mode: outline
paragraph-separate: "[ ]*$"
version-control: never
End:
GNU Dico THANKS file.
Many people further contributed to GNU Dico by reporting problems,
suggesting various improvements or submitting actual code. Here is a list
of these people. Help us keep it complete and exempt of errors.
Karl Berry <karl@freefriends.org>
Wojciech Polak <polak@gnu.org>
Dico TODO list.
* Documentation.
** Add a pointer to ellinika.gnu.org.ua:dict.
* A module for kanjidic/edict.
* X client for the above.
Local variables:
mode: outline
paragraph-separate: "[ ]*$"
end:
This diff is collapsed.
dnl This file is part of GNU mailutils.
dnl Copyright (C) 2003, 2007, 2008 Free Software Foundation, Inc.
dnl
dnl GNU Mailutils is free software; you can redistribute it and/or modify
dnl it under the terms of the GNU General Public License as published by
dnl the Free Software Foundation; either version 3, or (at your option)
dnl any later version.
dnl
dnl GNU Mailutils is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
dnl GNU General Public License for more details.
dnl
dnl You should have received a copy of the GNU General Public License along
dnl with GNU Mailutils; if not, write to the Free Software Foundation,
dnl Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
dnl
AC_DEFUN([MU_CHECK_GSASL],
[AC_CACHE_CHECK([whether to use GNU SASL library],
[mu_cv_lib_gsasl],
[if test "x$mu_cv_lib_gsasl" = x; then
cached=""
mu_cv_lib_gsasl=no
AC_ARG_WITH(gsasl,
AC_HELP_STRING([--with-gsasl], [use libgsasl for SASL authentication]),
[case $withval in
yes|no) wantgsasl=$withval;;
*) AC_MSG_ERROR([bad value for --with-gsasl: $withval]);;
esac],
[wantgsasl=yes])
if test $wantgsasl = yes; then
AC_CHECK_HEADER(gsasl.h,
[:],
[wantgsasl=no])
if test $wantgsasl != no; then
save_LIBS=$LIBS
AC_CHECK_LIB(gsasl, gsasl_init,
[mu_cv_lib_gsasl=-lgsasl],
[mu_cv_lib_gsasl=no])
if test $mu_cv_lib_gsasl != no; then
LIBS="$LIBS $mu_cv_lib_gsasl"
AC_TRY_RUN([
#include <gsasl.h>
int
main()
{
return gsasl_check_version ("$1") == (char*) 0;
}],
[:],
[mu_cv_lib_gsasl=no],
[mu_cv_lib_gsasl=no])
fi
LIBS=$save_LIBS
fi
fi
fi])
if test $mu_cv_lib_gsasl != no; then
AC_SUBST(GSASL_LIBS,$mu_cv_lib_gsasl)
ifelse([$2],,,[$2])
fi])
dnl This file is part of GNU mailutils.
dnl Copyright (C) 2001, 2006, 2007 Free Software Foundation, Inc.
dnl
dnl This program is free software; you can redistribute it and/or modify
dnl it under the terms of the GNU General Public License as published by
dnl the Free Software Foundation; either version 3 of the License, or
dnl (at your option) any later version.
dnl
dnl This program is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
dnl GNU General Public License for more details.
dnl
dnl You should have received a copy of the GNU General Public License
dnl along with this program; if not, write to the Free Software Foundation,
dnl Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
dnl
dnl MU_RESULT_ACTIONS -- generate shell code for the result of a test
dnl $1 -- CVAR -- cache variable to check
dnl $2 -- NAME -- if not empty, used to generate a default value TRUE:
dnl `AC_DEFINE(HAVE_NAME)'
dnl $3 -- TRUE -- what to do if the CVAR is not `no'
dnl $4 -- FALSE -- what to do otherwise; defaults to `:'
dnl
AC_DEFUN([MU_RESULT_ACTIONS], [
[if test "$$1" != "" -a "$$1" != no; then
]ifelse([$3], ,
[AC_DEFINE(HAVE_]translit($2, [a-z ./<>], [A-Z___])[,1,[FIXME])],
[$3])[
else
]ifelse([$4], , [:], [$4])[
fi]])dnl
AC_DEFUN([MU_CHECK_GUILE],
[
if test "x$mu_cv_lib_guile" = x; then
cached=""
AC_PATH_PROG(GUILE_CONFIG, guile-config, no, $PATH)
if test $GUILE_CONFIG = no; then
mu_cv_lib_guile=no
else
GUILE_INCLUDES=`$GUILE_CONFIG compile`
GUILE_LIBS=`$GUILE_CONFIG link`
fi
if test $GUILE_CONFIG != no; then
AC_MSG_CHECKING(for guile version 1.8 or higher)
GUILE_VERSION=`($GUILE_CONFIG --version 2>&1; echo '')|sed -n 's/guile-config [[^0-9]]* \([[0-9]][[0-9]]*\)\.\([[0-9]][[0-9]]*\).*/\1\2/p'`
case "x$GUILE_VERSION" in
x[[0-9]]*)
if test $GUILE_VERSION -lt 18; then
AC_MSG_RESULT([Nope. Version number too low.])
mu_cv_lib_guile=no
else
AC_DEFINE_UNQUOTED(GUILE_VERSION, $GUILE_VERSION,
[Guile version number: MAX*10 + MIN])
AC_MSG_RESULT(OK)
save_LIBS=$LIBS
save_CFLAGS=$CFLAGS
LIBS="$LIBS $GUILE_LIBS"
CFLAGS="$CFLAGS $GUILE_INCLUDES"
AC_TRY_LINK([#include <libguile.h>],
ifelse([$1], , scm_shell(0, NULL);, [$1]),
[mu_cv_lib_guile=yes],
[mu_cv_lib_guile=no])
LIBS=$save_LIBS
CFLAGS=$save_CFLAGS
fi ;;
*) AC_MSG_RESULT(Nope. Unknown version number)
mu_cv_lib_guile=no;;
esac
fi
else
cached=" (cached) "
GUILE_INCLUDES=`$GUILE_CONFIG compile`
GUILE_LIBS=`$GUILE_CONFIG link`
fi
AC_MSG_CHECKING(whether to build guile support)
MU_RESULT_ACTIONS([mu_cv_lib_guile],[LIBGUILE],[$2],[$3])
AC_MSG_RESULT(${cached}$mu_cv_lib_guile)
if test $mu_cv_lib_guile = yes; then
if test $GUILE_VERSION -gt 14; then
LIBS="$LIBS $GUILE_LIBS"
CFLAGS="$CFLAGS $GUILE_INCLUDES"
AC_CHECK_FUNCS(scm_long2num scm_cell scm_list_1 scm_list_n scm_c_define\
scm_c_lookup)
if test $ac_cv_func_scm_cell = no; then
AC_MSG_CHECKING(for inline scm_cell)
AC_TRY_LINK([#include <libguile.h>],
[scm_cell(SCM_EOL, SCM_EOL)],
[ac_cv_func_scm_cell=yes
AC_DEFINE(HAVE_SCM_CELL,1,
Define if you have scm_cell function)])
AC_MSG_RESULT($ac_cv_func_scm_cell)
fi
CFLAGS=$save_CFLAGS
LIBS=$save_LIBS
fi
AC_ARG_WITH([guiledir],
AC_HELP_STRING([--with-guiledir=DIR],
[Specify the directory to install guile modules to]),
[case $withval in
/*) GUILE_SITE=$withval;;
yes) GUILE_SITE=`$GUILE_CONFIG info pkgdatadir`/site;;
*) AC_MSG_ERROR([Argument to --with-guiledir must be an absolute directory name]);;
esac],
[GUILE_SITE=`$GUILE_CONFIG info pkgdatadir`/site
pfx=$prefix
test "x$pfx" = xNONE && pfx=$ac_default_prefix
case $GUILE_SITE in
$pfx/*) ;; # OK
*) AC_MSG_WARN([guile site directory "$GUILE_SITE" lies outside your current prefix ($pfx).])
GUILE_SITE='$(pkgdatadir)/$(VERSION)/guile'
AC_MSG_WARN([Falling back to ${GUILE_SITE} instead. Use --with-guiledir to force using site directory.])
;;
esac])
fi
AC_SUBST(GUILE_SITE)
AC_SUBST(GUILE_INCLUDES)
AC_SUBST(GUILE_LIBS)
])
# -*- coding: utf-8 -*-
#
# This file is part of GNU Dico.
# Copyright (C) 2008, 2009 Wojciech Polak
#
# GNU Dico 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 3, or (at your option)
# any later version.
#
# GNU Dico 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 GNU Dico. If not, see <http://www.gnu.org/licenses/>.
import sys
import re
import socket
import urllib2
import simplejson
from htmlentitydefs import name2codepoint
from xml.dom import minidom
from wit import wiki2text
import dico
__version__ = '1.0'
class DicoModule:
user_agent = 'Mozilla/1.0'
endpoint_match = '/w/api.php?action=opensearch&format=json&search='
endpoint_define = '/wiki/Special:Export/'
ns_mediawiki = 'http://www.mediawiki.org/xml/export-0.3/';
def __init__ (self, *argv):
self.wikihost = argv[0]
socket.setdefaulttimeout (4)
dico.register_markup ('wiki')
def open (self, dbname):
self.dbname = dbname
return True
def close (self):
return True
def descr (self):
return self.wikihost
def info (self):
return False
def define_word (self, word):
url = 'http://%s%s%s' % (self.wikihost, self.endpoint_define,
urllib2.quote (word))
req = urllib2.Request (url)
req.add_header ('User-Agent', self.user_agent)
try:
xml = urllib2.urlopen (req).read ()
except urllib2.URLError:
return False
dom = minidom.parseString (xml)
el = dom.getElementsByTagNameNS (self.ns_mediawiki, 'text')
if len (el):
data = el[0].firstChild.data
if dico.current_markup () != 'wiki':
data = self.__htmlentitydecode (data).encode ('utf_8')
wikiparser = wiki2text.TextWiktionaryMarkup (text=data)
wikiparser.parse ()