[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Eliot-dev] eliot/dic alist.c alist.h automaton.c automaton...
From: |
eliot-dev |
Subject: |
[Eliot-dev] eliot/dic alist.c alist.h automaton.c automaton... |
Date: |
Sun, 01 Jan 2006 19:51:00 +0000 |
CVSROOT: /cvsroot/eliot
Module name: eliot
Branch:
Changes by: Antoine Fraboulet <address@hidden> 06/01/01 19:51:00
Modified files:
dic : alist.c alist.h automaton.c automaton.h
compdic.c dic.c dic.h dic_internals.h
dic_search.c dic_search.h hashtable.c
hashtable.h listdic.c regexp.c regexp.h
regexpmain.c
Log message:
- small typo fix in comments
- add doxygen file description
- revert Dic_chr / board_search patch
returning the character instead of the code
was a HUGE performance penalty
The dictionary must use codes, the board must be
made to use codes instead of dic using tiles.
- add Dic_char and Dic_char_lookup as temporary
fixes for board_search. Should modify Board and Cross class
instead.
- create dic_code_t type
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/eliot/eliot/dic/alist.c.diff?tr1=1.3&tr2=1.4&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/eliot/eliot/dic/alist.h.diff?tr1=1.3&tr2=1.4&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/eliot/eliot/dic/automaton.c.diff?tr1=1.11&tr2=1.12&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/eliot/eliot/dic/automaton.h.diff?tr1=1.10&tr2=1.11&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/eliot/eliot/dic/compdic.c.diff?tr1=1.6&tr2=1.7&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/eliot/eliot/dic/dic.c.diff?tr1=1.9&tr2=1.10&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/eliot/eliot/dic/dic.h.diff?tr1=1.11&tr2=1.12&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/eliot/eliot/dic/dic_internals.h.diff?tr1=1.5&tr2=1.6&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/eliot/eliot/dic/dic_search.c.diff?tr1=1.14&tr2=1.15&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/eliot/eliot/dic/dic_search.h.diff?tr1=1.10&tr2=1.11&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/eliot/eliot/dic/hashtable.c.diff?tr1=1.4&tr2=1.5&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/eliot/eliot/dic/hashtable.h.diff?tr1=1.5&tr2=1.6&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/eliot/eliot/dic/listdic.c.diff?tr1=1.6&tr2=1.7&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/eliot/eliot/dic/regexp.c.diff?tr1=1.11&tr2=1.12&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/eliot/eliot/dic/regexp.h.diff?tr1=1.11&tr2=1.12&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/eliot/eliot/dic/regexpmain.c.diff?tr1=1.10&tr2=1.11&r1=text&r2=text
Patches:
Index: eliot/dic/alist.c
diff -u eliot/dic/alist.c:1.3 eliot/dic/alist.c:1.4
--- eliot/dic/alist.c:1.3 Fri Nov 4 20:00:06 2005
+++ eliot/dic/alist.c Sun Jan 1 19:51:00 2006
@@ -8,7 +8,7 @@
/* the Free Software Foundation; either version 2 of the License, or */
/* (at your option) any later version. */
/* */
-/* Elit is distributed in the hope that it will be useful, */
+/* Eliot 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. */
Index: eliot/dic/alist.h
diff -u eliot/dic/alist.h:1.3 eliot/dic/alist.h:1.4
--- eliot/dic/alist.h:1.3 Fri Nov 4 20:00:06 2005
+++ eliot/dic/alist.h Sun Jan 1 19:51:00 2006
@@ -8,7 +8,7 @@
/* the Free Software Foundation; either version 2 of the License, or */
/* (at your option) any later version. */
/* */
-/* Elit is distributed in the hope that it will be useful, */
+/* Eliot 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. */
Index: eliot/dic/automaton.c
diff -u eliot/dic/automaton.c:1.11 eliot/dic/automaton.c:1.12
--- eliot/dic/automaton.c:1.11 Sat Nov 5 17:56:22 2005
+++ eliot/dic/automaton.c Sun Jan 1 19:51:00 2006
@@ -8,7 +8,7 @@
/* the Free Software Foundation; either version 2 of the License, or */
/* (at your option) any later version. */
/* */
-/* Elit is distributed in the hope that it will be useful, */
+/* Eliot 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. */
@@ -17,6 +17,13 @@
/* along with this program; if not, write to the Free Software */
/* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+/**
+ * \file automaton.c
+ * \brief (Non)Deterministic Finite Automaton for Regexp
+ * \author Antoine Fraboulet
+ * \date 2005
+ */
+
#include "config.h"
#include <assert.h>
#include <string.h>
Index: eliot/dic/automaton.h
diff -u eliot/dic/automaton.h:1.10 eliot/dic/automaton.h:1.11
--- eliot/dic/automaton.h:1.10 Sat Nov 5 17:56:22 2005
+++ eliot/dic/automaton.h Sun Jan 1 19:51:00 2006
@@ -8,7 +8,7 @@
/* the Free Software Foundation; either version 2 of the License, or */
/* (at your option) any later version. */
/* */
-/* Elit is distributed in the hope that it will be useful, */
+/* Eliot 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. */
Index: eliot/dic/compdic.c
diff -u eliot/dic/compdic.c:1.6 eliot/dic/compdic.c:1.7
--- eliot/dic/compdic.c:1.6 Fri Nov 4 20:00:06 2005
+++ eliot/dic/compdic.c Sun Jan 1 19:51:00 2006
@@ -8,7 +8,7 @@
/* the Free Software Foundation; either version 2 of the License, or */
/* (at your option) any later version. */
/* */
-/* Elit is distributed in the hope that it will be useful, */
+/* Eliot 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. */
@@ -17,6 +17,13 @@
/* along with this program; if not, write to the Free Software */
/* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+/**
+ * \file compdic.c
+ * \brief Program used to compress a dictionary
+ * \author Antoine Fraboulet
+ * \date 1999
+ */
+
#include <time.h>
#include <sys/types.h>
#include <sys/stat.h>
Index: eliot/dic/dic.c
diff -u eliot/dic/dic.c:1.9 eliot/dic/dic.c:1.10
--- eliot/dic/dic.c:1.9 Sat Dec 24 18:42:44 2005
+++ eliot/dic/dic.c Sun Jan 1 19:51:00 2006
@@ -8,7 +8,7 @@
/* the Free Software Foundation; either version 2 of the License, or */
/* (at your option) any later version. */
/* */
-/* Elit is distributed in the hope that it will be useful, */
+/* Eliot 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. */
@@ -17,6 +17,13 @@
/* along with this program; if not, write to the Free Software */
/* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+/**
+ * \file dic.c
+ * \brief Dawg dictionary
+ * \author Antoine Fraboulet
+ * \date 2002
+ */
+
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -117,14 +124,10 @@
}
-char
+dic_code_t
Dic_chr(Dictionary d, dic_elt_t e)
{
- char c = (d->dawg[e]).chr;
- if (c)
- return c + 'A' - 1;
- else
- return 0;
+ return (dic_code_t)(d->dawg[e]).chr;
}
@@ -141,9 +144,8 @@
return (d->dawg[e]).term;
}
-
unsigned int
-Dic_lookup(Dictionary d, dic_elt_t root, char* s)
+Dic_lookup(Dictionary d, dic_elt_t root, dic_code_t* s)
{
unsigned int p;
begin:
@@ -170,3 +172,45 @@
return 0;
}
+/*
**************************************************************************** */
+/*
**************************************************************************** */
+/*
**************************************************************************** */
+/*
**************************************************************************** */
+
+char
+Dic_char(Dictionary d, dic_elt_t e)
+{
+ char c = (d->dawg[e]).chr;
+ if (c)
+ return c + 'A' - 1;
+ else
+ return 0;
+}
+
+unsigned int
+Dic_char_lookup(Dictionary d, dic_elt_t root, char* s)
+{
+ unsigned int p;
+begin:
+ if (! *s)
+ return root;
+ if (! Dic_succ(d, root))
+ return 0;
+ p = Dic_succ(d, root);
+ do
+ {
+ if (Dic_char(d, p) == *s)
+ {
+ root = p;
+ s++;
+ goto begin;
+ }
+ else if (Dic_last(d, p))
+ {
+ return 0;
+ }
+ p = Dic_next(d, p);
+ } while (1);
+
+ return 0;
+}
Index: eliot/dic/dic.h
diff -u eliot/dic/dic.h:1.11 eliot/dic/dic.h:1.12
--- eliot/dic/dic.h:1.11 Sat Dec 24 18:42:44 2005
+++ eliot/dic/dic.h Sun Jan 1 19:51:00 2006
@@ -8,7 +8,7 @@
/* the Free Software Foundation; either version 2 of the License, or */
/* (at your option) any later version. */
/* */
-/* Elit is distributed in the hope that it will be useful, */
+/* Eliot 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. */
@@ -43,6 +43,7 @@
typedef struct _Dictionary* Dictionary;
typedef unsigned int dic_elt_t;
+typedef unsigned char dic_code_t;
/**
* Dictionary creation and loading from a file
@@ -58,11 +59,11 @@
int Dic_destroy(Dictionary dic);
/**
- * Dic_chr returns the character associated with an element
- * (in the range ['A'-'Z']), or the null character ('\0').
- * @returns ASCII code for the character
+ * Dic_chr returns the character code associated with an element,
+ * codes may range from 0 to 31. 0 is the null character.
+ * @returns code for the encoded character
*/
-char Dic_chr (Dictionary dic, dic_elt_t elt);
+dic_code_t Dic_chr (Dictionary dic, dic_elt_t elt);
/**
* Returns a boolean to show if there is another available
@@ -104,15 +105,42 @@
* from the given root node by walking the dictionary tree
* @params dic : valid dictionary
* @params root : starting dictionary node for the search
+ * @params pattern : string encoded according to the dictionary codes,
+ * the pattern must be null ('\0') terminated
+ * @returns 0 if the string cannot be matched otherwise returns the
+ * element that results from walking the dictionary according to the
+ * pattern
+ */
+unsigned int Dic_lookup(Dictionary dic, dic_elt_t root, dic_code_t* pattern);
+
+ /**
+ * Dic_char returns the character associated with an element
+ * (in the range ['A'-'Z']), or the null character ('\0').
+ * @returns ASCII code for the character
+ */
+char Dic_char (Dictionary dic, dic_elt_t elt);
+
+ /**
+ * Find the dictionary element matching the pattern starting
+ * from the given root node by walking the dictionary tree
+ * @params dic : valid dictionary
+ * @params root : starting dictionary node for the search
* @params pattern : string made of uppercase characters in the range
* ['A'-'Z']. The pattern must be null ('\0') terminated
* @returns 0 if the string cannot be matched otherwise returns the
* element that results from walking the dictionary according to the
* pattern
*/
-unsigned int Dic_lookup(Dictionary dic, dic_elt_t root, char* pattern);
+unsigned int Dic_char_lookup(Dictionary dic, dic_elt_t root, char* pattern);
#if defined(__cplusplus)
}
#endif
#endif /* _DIC_H_ */
+
+/// Local Variables:
+/// mode: c++
+/// mode: hs-minor
+/// c-basic-offset: 4
+/// indent-tabs-mode: nil
+/// End:
Index: eliot/dic/dic_internals.h
diff -u eliot/dic/dic_internals.h:1.5 eliot/dic/dic_internals.h:1.6
--- eliot/dic/dic_internals.h:1.5 Fri Nov 4 20:00:06 2005
+++ eliot/dic/dic_internals.h Sun Jan 1 19:51:00 2006
@@ -8,7 +8,7 @@
/* the Free Software Foundation; either version 2 of the License, or */
/* (at your option) any later version. */
/* */
-/* Elit is distributed in the hope that it will be useful, */
+/* Eliot 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. */
@@ -18,14 +18,14 @@
/* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
/**
- * \file dic_internals.h
+ * \file dic_internals.h
* \brief Internal dictionary structures
* \author Antoine Fraboulet
* \date 2002
*/
-#ifndef _DIC_INTERNALS_H
-#define _DIC_INTERNALS_H
+#ifndef _DIC_INTERNALS_H_
+#define _DIC_INTERNALS_H_
#if defined(__cplusplus)
extern "C"
{
Index: eliot/dic/dic_search.c
diff -u eliot/dic/dic_search.c:1.14 eliot/dic/dic_search.c:1.15
--- eliot/dic/dic_search.c:1.14 Sat Nov 5 17:56:22 2005
+++ eliot/dic/dic_search.c Sun Jan 1 19:51:00 2006
@@ -8,7 +8,7 @@
/* the Free Software Foundation; either version 2 of the License, or */
/* (at your option) any later version. */
/* */
-/* Elit is distributed in the hope that it will be useful, */
+/* Eliot 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. */
Index: eliot/dic/dic_search.h
diff -u eliot/dic/dic_search.h:1.10 eliot/dic/dic_search.h:1.11
--- eliot/dic/dic_search.h:1.10 Fri Nov 4 20:00:06 2005
+++ eliot/dic/dic_search.h Sun Jan 1 19:51:00 2006
@@ -8,7 +8,7 @@
/* the Free Software Foundation; either version 2 of the License, or */
/* (at your option) any later version. */
/* */
-/* Elit is distributed in the hope that it will be useful, */
+/* Eliot 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. */
@@ -18,7 +18,7 @@
/* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
/**
- * \file dic_search.h
+ * \file dic_search.h
* \brief Dictionary lookup functions
* \author Antoine Fraboulet
* \date 2002
Index: eliot/dic/hashtable.c
diff -u eliot/dic/hashtable.c:1.4 eliot/dic/hashtable.c:1.5
--- eliot/dic/hashtable.c:1.4 Fri Nov 4 20:00:06 2005
+++ eliot/dic/hashtable.c Sun Jan 1 19:51:00 2006
@@ -8,7 +8,7 @@
/* the Free Software Foundation; either version 2 of the License, or */
/* (at your option) any later version. */
/* */
-/* Elit is distributed in the hope that it will be useful, */
+/* Eliot 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. */
@@ -17,6 +17,13 @@
/* along with this program; if not, write to the Free Software */
/* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+/**
+ * \file hashtable.c
+ * \brief Simple hashtable type
+ * \author Antoine Fraboulet
+ * \date 1999
+ */
+
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
Index: eliot/dic/hashtable.h
diff -u eliot/dic/hashtable.h:1.5 eliot/dic/hashtable.h:1.6
--- eliot/dic/hashtable.h:1.5 Sat Nov 5 17:56:22 2005
+++ eliot/dic/hashtable.h Sun Jan 1 19:51:00 2006
@@ -8,7 +8,7 @@
/* the Free Software Foundation; either version 2 of the License, or */
/* (at your option) any later version. */
/* */
-/* Elit is distributed in the hope that it will be useful, */
+/* Eliot 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. */
Index: eliot/dic/listdic.c
diff -u eliot/dic/listdic.c:1.6 eliot/dic/listdic.c:1.7
--- eliot/dic/listdic.c:1.6 Sat Dec 24 16:49:26 2005
+++ eliot/dic/listdic.c Sun Jan 1 19:51:00 2006
@@ -8,7 +8,7 @@
/* the Free Software Foundation; either version 2 of the License, or */
/* (at your option) any later version. */
/* */
-/* Elit is distributed in the hope that it will be useful, */
+/* Eliot 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. */
@@ -17,6 +17,13 @@
/* along with this program; if not, write to the Free Software */
/* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+/**
+ * \file listdic.c
+ * \brief Program used to list a dictionary
+ * \author Antoine Fraboulet
+ * \date 1999
+ */
+
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
Index: eliot/dic/regexp.c
diff -u eliot/dic/regexp.c:1.11 eliot/dic/regexp.c:1.12
--- eliot/dic/regexp.c:1.11 Sat Nov 5 17:56:22 2005
+++ eliot/dic/regexp.c Sun Jan 1 19:51:00 2006
@@ -8,7 +8,7 @@
/* the Free Software Foundation; either version 2 of the License, or */
/* (at your option) any later version. */
/* */
-/* Elit is distributed in the hope that it will be useful, */
+/* Eliot 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. */
@@ -19,7 +19,7 @@
/**
* \file regexp.c
- * \brief Regular Expression fonctions
+ * \brief Regular Expression functions
* \author Antoine Fraboulet
* \date 2005
*/
Index: eliot/dic/regexp.h
diff -u eliot/dic/regexp.h:1.11 eliot/dic/regexp.h:1.12
--- eliot/dic/regexp.h:1.11 Sat Nov 5 17:56:22 2005
+++ eliot/dic/regexp.h Sun Jan 1 19:51:00 2006
@@ -8,7 +8,7 @@
/* the Free Software Foundation; either version 2 of the License, or */
/* (at your option) any later version. */
/* */
-/* Elit is distributed in the hope that it will be useful, */
+/* Eliot 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. */
@@ -19,7 +19,7 @@
/**
* \file regexp.h
- * \brief Regular Expression fonctions
+ * \brief Regular Expression functions
* \author Antoine Fraboulet
* \date 2005
*/
@@ -151,3 +151,10 @@
}
#endif
#endif /* _TREE_H_ */
+
+/// Local Variables:
+/// mode: c++
+/// mode: hs-minor
+/// c-basic-offset: 4
+/// indent-tabs-mode: nil
+/// End:
Index: eliot/dic/regexpmain.c
diff -u eliot/dic/regexpmain.c:1.10 eliot/dic/regexpmain.c:1.11
--- eliot/dic/regexpmain.c:1.10 Sat Nov 5 17:56:22 2005
+++ eliot/dic/regexpmain.c Sun Jan 1 19:51:00 2006
@@ -8,7 +8,7 @@
/* the Free Software Foundation; either version 2 of the License, or */
/* (at your option) any later version. */
/* */
-/* Elit is distributed in the hope that it will be useful, */
+/* Eliot 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. */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Eliot-dev] eliot/dic alist.c alist.h automaton.c automaton...,
eliot-dev <=