[uim-commit] r2229 - in trunk: . scm uim
yamaken at freedesktop.org
yamaken at freedesktop.org
Tue Nov 22 05:42:35 PST 2005
Author: yamaken
Date: 2005-11-22 05:42:31 -0800 (Tue, 22 Nov 2005)
New Revision: 2229
Removed:
trunk/scm/hk.scm
trunk/tables/
trunk/uim/uim-table.c
Modified:
trunk/Makefile.am
trunk/configure.ac
trunk/scm/Makefile.am
trunk/uim/Makefile.am
trunk/uim/uim-internal.h
trunk/uim/uim.c
Log:
* This commit removes obsolete 'table' API and implementation
* configure.ac
- Remove the option --enable-compat-table
* Makefile.am
- (SUBDIRS): Remove 'tables'
* uim/Makefile.am
- (libuim_la_SOURCES): Remove uim-table.c
* uim/uim-internal.h
- (uim_init_table_subrs): Removed
* uim/uim.c
- (uim_init_scm): Remove uim_init_table_subrs()
* scm/Makefile.am
- (SCM_FILES): Remove hk.scm
* tables
* tables/japanese-tutcode.table
* tables/korean-hangul2.table
* tables/japanese-kana.table
* tables/korean-hangul3.table
* tables/japanese-azik.table
* tables/japanese-roma.table
* tables/japanese-tcode.table
* tables/Makefile.am
* scm/hk.scm
* uim/uim-table.c
- Removed
Modified: trunk/Makefile.am
===================================================================
--- trunk/Makefile.am 2005-11-22 13:33:59 UTC (rev 2228)
+++ trunk/Makefile.am 2005-11-22 13:42:31 UTC (rev 2229)
@@ -1,5 +1,5 @@
AUTOMAKE_OPTIONS = foreign
-SUBDIRS = m4 doc replace uim scm gtk qt xim helper po tables test fep examples pixmaps
+SUBDIRS = m4 doc replace uim scm gtk qt xim helper po test fep examples pixmaps
EXTRA_DIST = README.ja INSTALL.ja test.sh.in uim.spec.in \
intltool-extract.in intltool-merge.in intltool-update.in \
uim.pc.in ChangeLog.old uim.desktop autogen.sh RELEASING
Modified: trunk/configure.ac
===================================================================
--- trunk/configure.ac 2005-11-22 13:33:59 UTC (rev 2228)
+++ trunk/configure.ac 2005-11-22 13:42:31 UTC (rev 2229)
@@ -388,14 +388,6 @@
enable_compat_scm="yes"
])
-AC_ARG_ENABLE(compat-table,
- AC_HELP_STRING([--enable-compat-table],
- [enable obsolete table API for hk.scm (broken)]),
- [],
- [
- enable_compat_table="no"
- ])
-
AC_ARG_ENABLE(fep,
AC_HELP_STRING([--disable-fep],
[disable uim-fep]),
@@ -540,7 +532,6 @@
AM_CONDITIONAL(LIBEDIT, test x$use_libedit = xyes)
AM_CONDITIONAL(DEBUG, test x$enable_debug = xyes)
AM_CONDITIONAL(COMPAT_SCM, test x$enable_compat_scm = xyes)
-AM_CONDITIONAL(COMPAT_TABLE, test x$enable_compat_table = xyes)
AM_CONDITIONAL(NEED_SETENV_C, test $ac_cv_func_setenv = no -o $ac_cv_func_unsetenv = no)
AM_CONDITIONAL(NEED_STRSEP_C, test $ac_cv_func_strsep = no)
@@ -735,11 +726,6 @@
[Enable obsolete part of uim-scm API])
fi
-if test x$enable_compat_table = xyes; then
- AC_DEFINE(UIM_COMPAT_TABLE, 1,
- [Enable obsolete table API for hk.scm (broken)])
-fi
-
AH_BOTTOM([/* Include os specific header. */
#include "os_dep.h"])
@@ -779,7 +765,6 @@
qt/Makefile
xim/Makefile
fep/Makefile
- tables/Makefile
test/Makefile
examples/Makefile
examples/uim-custom/Makefile
@@ -818,6 +803,5 @@
DEBUG : ${enable_debug}
COMPAT_SCM : ${enable_compat_scm}
- COMPAT_TABLE : ${enable_compat_table}
])
fi
Modified: trunk/scm/Makefile.am
===================================================================
--- trunk/scm/Makefile.am 2005-11-22 13:33:59 UTC (rev 2228)
+++ trunk/scm/Makefile.am 2005-11-22 13:42:31 UTC (rev 2229)
@@ -32,10 +32,6 @@
scim.scm \
uim-module-manager.scm
-if COMPAT_TABLE
-SCM_FILES += hk.scm
-endif
-
module_names = "pyload"
if ANTHY
module_names += "anthy"
Deleted: trunk/scm/hk.scm
===================================================================
--- trunk/scm/hk.scm 2005-11-22 13:33:59 UTC (rev 2228)
+++ trunk/scm/hk.scm 2005-11-22 13:42:31 UTC (rev 2229)
@@ -1,268 +0,0 @@
-;;;
-;;; Copyright (c) 2003,2004 uim Project http://uim.freedesktop.org/
-;;;
-;;; All rights reserved.
-;;;
-;;; Redistribution and use in source and binary forms, with or without
-;;; modification, are permitted provided that the following conditions
-;;; are met:
-;;; 1. Redistributions of source code must retain the above copyright
-;;; notice, this list of conditions and the following disclaimer.
-;;; 2. Redistributions in binary form must reproduce the above copyright
-;;; notice, this list of conditions and the following disclaimer in the
-;;; documentation and/or other materials provided with the distribution.
-;;; 3. Neither the name of authors nor the names of its contributors
-;;; may be used to endorse or promote products derived from this software
-;;; without specific prior written permission.
-;;;
-;;; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND
-;;; ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-;;; IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-;;; ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE
-;;; FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-;;; DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-;;; OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-;;; HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-;;; LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-;;; OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-;;; SUCH DAMAGE.
-;;;;
-
-; hk-context manage japanese roma -> kana conversion.
-; this conversion is table based, and you can switch inputting
-; method (note, it's merely "inputting method", not "input method")
-
-
-
-; to decrease of typing cost, internal procedure omit "context"
-; table name is held in C code. Same table has same table id.
-(define-record 'hk-context
- '((table-id ())
- (left-string-list ())
- (right-string-list ())))
-(define hk-context-new-internal hk-context-new)
-
-(define hk-context-new
- (lambda (table)
- (let ((res (hk-context-new-internal))
- (table-id (open-table table)))
- (if (> 0 table-id)
- #f
- (begin
- (hk-context-set-table-id! res table-id)
- res)))))
-
-(define hk-left-string-append
- (lambda (hkc str-list)
- (let ((l (car (hk-context-left-string-list hkc))))
- (hk-context-set-left-string-list! hkc '(l str-list))
-)))
-
-
-;;APIs
-
-(define hk-get-left-string
- (lambda (hkc mode)
- (car (hk-context-left-string-list hkc))))
-
-(define hk-get-right-string
- (lambda (hkc)
- (car (hk-context-right-string-list hkc))))
-
-(define hk-push-key!
- (lambda (hkc str state)
- (let ((left (hk-left-string-list hkc))
- (key-list (list (list str) (list str) (list str) (list str))))
- (if left
- (hk-set-left-string-list! hkc (append left (list key-list)))
- (hk-set-left-string-list! hkc (list key-list)))
- (hk-left-string-match hkc)
- )))
-
-(define hk-make-match-list
- (lambda (left)
- (map
- (lambda(l)
- (car (cadr l)))
- left)))
-
-;;¥Þ¥Ã¥Á¥ó¥°ÂоÝ
-;henn¤Ø¤ó
-;henk¤Ø¤ók
-;hena¤Ø¤Ê
-;hennya ¤Ø¤ó¤ä or ¤Ø¤Ë¤ã
-(define hk-left-string-match
- (lambda (hkc)
- (let* ((left (hk-left-string-list hkc))
- (match-list (map
- (lambda(l)
- (car (cadr l)))
- left))
- (shifting (if (> (- (length left) 2) 0)
- (list (nth (- (length left) 2) left))
- ())))
- (if (hk-find-continual? hkc (caar (reverse left)))
- (begin
- (print (list (nth (- (length left) 2) left)))
- (hk-left-string-reduce hkc
- (reverse (cddr (reverse left)))
- shifting; (list (nth (- (length left) 2) left))
- (list (nth (- (length left) 1) left))))
- (begin
- (print (list (nth (- (length left) 1) left)))
- (hk-left-string-reduce hkc
- (reverse (cdr (reverse left)))
- (list (nth (- (length left) 1) left))
- ())))
- (print (hk-left-string-list hkc))
- )))
-
-
-(define hk-left-string-reduce
- (lambda (hkc left shifting rest)
- (let* ((complete (hk-find-complete-matched hkc (hk-make-match-list shifting))))
- (print shifting)
- (if shifting
- (if (hk-find-longer-entry-exist?
- hkc (hk-make-match-list shifting))
- (begin
-; (print (reverse (cdr (reverse left))))
-; (print (append (list (car (reverse left))) shifting))
- (if left
- (hk-left-string-reduce hkc
- (reverse (cdr (reverse left)))
- (append (list (car (reverse left))) shifting)
- rest)
- (hk-left-string-do-reducing hkc left shifting rest complete)))
- (hk-left-string-do-reducing hkc left shifting rest complete))))))
-
-(define hk-left-string-do-reducing
- (lambda (hkc left shifting rest complete)
- (if complete
- (begin
- (hk-set-left-string-list! hkc
- (append left (list complete) rest)))
- (begin
- (let ((short-complete (hk-find-complete-matched hkc (hk-make-match-list
- (cdr
- shifting)))))
- ; (print short-complete)
- (if short-complete
- (hk-set-left-string-list! hkc
- (append left (list (car shifting)) (list short-complete) rest))
- (hk-set-left-string-list! hkc
- (append left shifting rest)))
- )))))
-
-(define hk-make-str-list
- (lambda (str)
- (if str
- (map
- (lambda (s)
- (let ((splitted (string-split s " ")))
- (if splitted
- splitted
- (list s))))
- (string-split str "\t"))
- ())))
-
-; (if (hk-find-continuable? hkc)
-; hk-left-string-matching-rec;ʸ»úÎó¤òÄɲ䷤Ƹ¡º÷
-; ;complete¤ò¸Æ¤Ó¤À¤·¤Æ¡¢ÃÖ´¹
-
-(define hk-left-string-matching-rec
- (lambda (hkc str left)
-()
-))
-
-(define hk-move-cursor
- (lambda (hkc direction)
- (if direction
- (begin
- (if (hk-left-string ac)
- (let ((c (car (hk-left-string hkc))))
- (hk-context-set-left-string!
- hkc (cdr (hk-left-string hkc)))
- (hk-set-right-string! hkc
- (cons c
- (hk-right-string ac))))))
- (begin
- (if (hk-right-string hkc)
- (let ((c (car (hk-right-string hkc))))
- (hk-set-right-string!
- hkc (cdr (hk-right-string hkc)))
- (hk-set-left-string! hkc
- (cons c
- (hk-left-string ac)))))))
- ))
-
-(define hk-input-end
- (lambda (hkc)
- () ))
-
-(define hk-backspace!
- (lambda (hkc)
- (if(> (length (hk-context-left-string hkc)) 0)
- ())
- ))
-
-
-
-(define hk-find-complete-matched
- (lambda (hkc str-list)
- (let ((str #f)
- (table-id (hk-context-table-id hkc)))
- (if str-list
- (begin
- (map (lambda (s)
- ; (print str)
- (if str
- (set! str (string-append str " " s))
- (set! str s)))
- str-list)
- (hk-make-str-list
- (find-entry-matched-complete table-id (string-append str "\t"))))
- #f
- ))))
-
-
-(define hk-find-continual?
- (lambda (hkc str-list)
- (let ((str #f)
- (table-id (hk-context-table-id hkc)))
- (if str-list
- (begin
- (map (lambda (s)
- (if str
- (set! str (string-append str " " s))
- (set! str s)))
- str-list)
- (find-entry-matched-complete table-id (string-append str " ")))
- #f
- ))))
-
-(define hk-find-longer-entry-exist?
- (lambda (hkc str-list)
- (let ((str "")
- (table-id (hk-context-table-id hkc)))
- (if str-list
- (begin
- (map
- (lambda (s)
- (set! str (string-append str " " s)))
- str-list)
- (find-entry-matched-continual table-id str))
- ())
- )))
-
-(define hk-delete!
- (lambda (hkc)
- ()
-))
-
-(define hk-flush!
- (lambda (hkc)
- (hk-context-set-left-string-list! hkc '())
-
-))
-
Modified: trunk/uim/Makefile.am
===================================================================
--- trunk/uim/Makefile.am 2005-11-22 13:33:59 UTC (rev 2228)
+++ trunk/uim/Makefile.am 2005-11-22 13:42:31 UTC (rev 2229)
@@ -28,10 +28,6 @@
#libuim_la_SOURCES += strsep.c
#endif
-if COMPAT_TABLE
-libuim_la_SOURCES += uim-table.c
-endif
-
if COMPAT_SCM
pkginclude_HEADERS += uim-compat-scm.h
endif
Modified: trunk/uim/uim-internal.h
===================================================================
--- trunk/uim/uim-internal.h 2005-11-22 13:33:59 UTC (rev 2228)
+++ trunk/uim/uim-internal.h 2005-11-22 13:42:31 UTC (rev 2229)
@@ -247,9 +247,6 @@
#endif
void uim_init_key_subrs(void);
void uim_init_util_subrs(void);
-#ifdef UIM_COMPAT_TABLE
-void uim_init_table_subrs(void);
-#endif
void uim_init_im_subrs(void);
void uim_init_intl_subrs(void);
Deleted: trunk/uim/uim-table.c
===================================================================
--- trunk/uim/uim-table.c 2005-11-22 13:33:59 UTC (rev 2228)
+++ trunk/uim/uim-table.c 2005-11-22 13:42:31 UTC (rev 2229)
@@ -1,232 +0,0 @@
-/*
-
- Copyright (c) 2003-2005 uim Project http://uim.freedesktop.org/
-
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- 1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
- 3. Neither the name of authors nor the names of its contributors
- may be used to endorse or promote products derived from this software
- without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND
- ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE
- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- SUCH DAMAGE.
-
-*/
-
-#include <stdlib.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/mman.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <unistd.h>
-
-#include "uim-scm.h"
-#include "uim-compat-scm.h"
-#include "siod.h"
-#include "uim-internal.h"
-
-/*This file is for find entry from table such Japanese roma-ji table*/
-
-static struct table_info *tables[16];
-
-struct table_info {
- void *addr;
- size_t size;
- char *filename;
-};
-
-static int
-open_table_internal(const char *fn)
-{
- struct table_info *table;
- struct stat st;
- int fd;
- int i;
- void *addr;
-
- if (lstat(fn, &st) == -1) {
- return 0;
- }
-
- fd = open(fn, O_RDONLY);
- if (fd == -1) {
- return 0;
- }
-
- addr = mmap(0, st.st_size, PROT_READ, MAP_SHARED, fd, 0);
- close(fd);
- if (addr == MAP_FAILED) {
- return 0;
- }
- table = (struct table_info *)malloc(sizeof(struct table_info));
- table->addr = addr;
- table->size = st.st_size;
- table->filename = strdup(fn);
-
- for (i=0;i<16;i++) {
- if (!tables[i]) {
- tables[i] = table;
- return i;
- }
- }
- return 0;
-}
-
-static void
-close_table(struct table_info *table)
-{
- munmap(table->addr, table->size);
- free(table->filename);
- free(table);
-}
-
-static char *
-find_line_head(struct table_info *table, char *from)
-{
- while (table->addr <= (void *)from) {
-
- if ( *from == '\n') {
- from++;
- return from;
- }
- from--;
- }
- return from;
-}
-
-static int
-find_table(const char *fn)
-{
- int i;
- for (i=0;i<16;i++) {
- if (tables[i] && strcmp(tables[i]->filename, fn ) == 0)
- return i;
- }
- return -1;
-}
-
-static char *
-find_next_linefeed(struct table_info *table, char *from)
-{
- while (((char *)(table->addr) + table->size) >= from) {
-
- if ( *from == '\n') {
- return from;
- }
- from++;
- }
- return from;
-}
-
-static char *
-cut_off_line_from_table(struct table_info *table, char *line_head)
-{
- char *line_tail;
- char *line;
- size_t line_size;
-
- line_tail = find_next_linefeed(table, line_head);
-
- line_size = sizeof(char) * (line_tail - line_head);
-
- line = (char *)malloc( line_size + 1 );
-
- memcpy(line, line_head, line_size);
-
- line[line_size] = '\0';
- return line;
-}
-
-/* lenear searching, but it will be enough. */
-
-static LISP
-find_matched_lines_from_table_internal(int table_id, char *str, int flag)
-{
- struct table_info *table = tables[table_id];
- char *p = table->addr;
-
- while (*(p+ strlen(str))) {
-
- if (!strncmp(p, str, strlen(str))) {
- char *tmp = cut_off_line_from_table(table,
- find_line_head(table, p));
- LISP res = strcons(strlen(tmp), tmp);
- /* free(tmp); */
- return res;
- }
-
- if (flag || *(p+ strlen(str)) == '\t') {
- p = find_next_linefeed(table, p);
- }
- p++;
- }
- return NIL;
-
-}
-
-/* Followings are API for scheme */
-
-/* this function will return entry which complete matched which first matched.
- So, if there are plural complete matched entry, latter will simply ignored. */
-
-static LISP
-find_entry_matched_complete(LISP table_id_, LISP str_)
-{
- int table_id = get_c_int(table_id_);
- char *str = get_c_string(str_);
-
- return find_matched_lines_from_table_internal(table_id, str, 1);
-}
-
-/* this function will return NIL if no entry matched.
- This function will not return if matched completely. */
-static LISP
-find_entry_matched_continual(LISP table_id_, LISP str_)
-{
- int table_id = get_c_int(table_id_);
- char *str = get_c_string(str_);
-
- return find_matched_lines_from_table_internal(table_id, str, 0);
-}
-
-
-static LISP
-open_table(LISP filename_)
-{
- char *filename = get_c_string(filename_);
- int table_id;
-
- if ((table_id = find_table(filename))<0) {
- table_id = open_table_internal(filename);
- }
- return intcons(table_id);
-}
-
-void
-uim_init_table_subrs()
-{
- int i;
- for (i=0;i<16;i++) {tables[i] = NULL;}
- init_subr_1("open-table", open_table);
- init_subr_2("find-entry-matched-complete", find_entry_matched_complete);
- init_subr_2("find-entry-matched-continual", find_entry_matched_continual);
-}
Modified: trunk/uim/uim.c
===================================================================
--- trunk/uim/uim.c 2005-11-22 13:33:59 UTC (rev 2228)
+++ trunk/uim/uim.c 2005-11-22 13:42:31 UTC (rev 2229)
@@ -644,10 +644,6 @@
uim_init_plugin();
uim_init_im_subrs();
uim_init_key_subrs();
-#ifdef UIM_COMPAT_TABLE
- uim_init_table_subrs();
-#endif
-
if (is_setugid() == 0) {
scm_files = getenv("LIBUIM_SCM_FILES");
More information about the uim-commit
mailing list