[uim-commit] r216 - trunk/uim
yamaken@freedesktop.org
yamaken@freedesktop.org
Mon Jan 10 01:49:45 PST 2005
Author: yamaken
Date: 2005-01-10 01:49:42 -0800 (Mon, 10 Jan 2005)
New Revision: 216
Modified:
trunk/uim/Makefile.am
trunk/uim/siod.h
trunk/uim/slib.c
trunk/uim/uim-compat-scm.c
trunk/uim/uim-scm.c
trunk/uim/uim-scm.h
Log:
* This commit encapsulates Siod dependency into uim-scm module. All
global symbols defined in slib.c listed below have been hidden to
resolve namespace pollution. Now all global symbols of libuim.so has
uim_ prefix. Try objdump -TC libuim.so|egrep -v '(\*UND\*| uim_)'
Although all direct linking to Siod functions and variables have
been removed, uim/*.[ch] and scm/*.scm are still depending on Siod
specific behaviors, and uim-scm API provides some Siod specific
interfaces. More elaborations of uim-scm API is required before
providing alternative Scheme interpreter such as
uim-scm-tinyscheme.c or uim-scm-gauche.c.
* uim/siod.h
- (number2string, string2number, caaar, caadr, cadar, caddr, cdaar,
cdadr, cddar, cdddr, apply1, siod_verbose_level): Remove
- (siod_init, siod_quit, set_repl_hooks, get_c_string,
get_c_string_dim, get_c_int, nlength, get_c_pointer, cons, car,
cdr, setcar, intcons, eql, symcons, symbol_boundp, symbol_value,
symbol_to_string, rintern, closure, ptrcons, init_subr,
init_subr_0, init_subr_1, init_subr_2, init_subr_2n, init_subr_3,
init_subr_4, init_subr_5, init_lsubr, init_fsubr, init_msubr,
delq, set_eval_hooks, leval, symbolconc, lprin1f, lread, lreadtk,
lreadf, require, strcons, equal, set_fatal_exit_hook, intern,
gc_protect, siod_gc_protect_stack, siod_gc_unprotect_stack,
siod_repl_c_string_entered, repl_c_string, siod_return_value,
reverse, nreverse, cadr, caar, cdar, cddr, siod_true_value,
siod_false_value, lapply, listn, must_malloc, get_c_file,
last_c_errmsg, llast_c_errmsg, siod_c_provide, funcall1, funcall2,
siod_set_lib_path): Make static. Should be moved into slib.c
* uim/slib.c
- (siod_verbose_level): Make static
- (get_c_int, nlength, siod_set_lib_path, strcons, repl_c_string,
siod_repl_c_string_entered, set_repl_hooks, siod_return_value,
set_fatal_exit_hook, siod_gc_protect_stack,
siod_gc_unprotect_stack, get_c_string, get_c_string_dim, cons,
car, cdr, setcar, intcons, equal, eql, symcons, symbol_boundp,
symbol_value, symbol_to_string, must_malloc, rintern, intern,
closure, gc_protect, get_c_pointer, ptrcons, init_subr,
init_subr_0, init_subr_1, init_subr_2, init_subr_2n, init_subr_3,
init_subr_4, init_subr_5, init_lsubr, init_fsubr, init_msubr,
set_eval_hooks, leval, lapply, reverse, symbolconc, lprin1f,
lread, lreadf, lreadtk, delq, siod_c_provide, require, get_c_file,
nreverse, caar, cadr, cdar, cddr, siod_true_value,
siod_false_value, last_c_errmsg, llast_c_errmsg, funcall1,
funcall2, listn, siod_quit, siod_init): Make static
* uim/uim-scm.c
- Revise the header comment about Scheme interpreter
- Include slib.c and uim-compat-scm.c
- (true_sym, false_sym): Make static
- (string_equal): Remove to replace with same function defined in
slib.c
- (uim_scm_string_equal): Adapt to string_equal() defined in slib.c
- (uim_scm_init): Remove initialization of string=?
* uim/uim-scm.h
- (true_sym, false_sym): Remove
- (TRUEP, FALSEP, NTRUEP, NFALSEP): Rewrite without true_sym and
false_sym
* uim/uim-compat-scm.c
- (uim_scm_symbol_value_str, uim_scm_symbol_value): Replace
false_sym with uim_scm_f()
* uim/Makefile.am
- (EXTRA_DIST): Add slib.c and uim-compat-scm.c
- (libuim_la_SOURCES): Remove slib.c and uim-compat-scm.c
Modified: trunk/uim/Makefile.am
===================================================================
--- trunk/uim/Makefile.am 2005-01-10 08:09:57 UTC (rev 215)
+++ trunk/uim/Makefile.am 2005-01-10 09:49:42 UTC (rev 216)
@@ -1,6 +1,6 @@
AUTOMAKE_OPTIONS = foreign
-EXTRA_DIST = config.h.in iso-639-1.def
+EXTRA_DIST = config.h.in iso-639-1.def slib.c uim-compat-scm.c
uim_defs = -DSCM_FILES=\"$(datadir)/uim\"
@@ -11,8 +11,8 @@
pkginclude_HEADERS = uim.h uim-util.h uim-helper.h uim-im-switcher.h uim-scm.h plugin.h
-libuim_la_SOURCES = uim.c uim-scm.c uim-func.c uim-key.c uim-util.c \
- slib.c siod.h context.h gettext.h \
+libuim_la_SOURCES = uim.c uim-scm.c uim-util.c uim-func.c uim-key.c \
+ siod.h context.h gettext.h \
uim-helper.c uim-helper-client.c \
prime.c \
intl.c \
@@ -27,7 +27,6 @@
if COMPAT_SCM
pkginclude_HEADERS += uim-compat-scm.h
- libuim_la_SOURCES += uim-compat-scm.c
endif
if COMPAT_CUSTOM
Modified: trunk/uim/siod.h
===================================================================
--- trunk/uim/siod.h 2005-01-10 08:09:57 UTC (rev 215)
+++ trunk/uim/siod.h 2005-01-10 09:49:42 UTC (rev 216)
@@ -205,98 +205,86 @@
#define TKBUFFERN 5120
-void siod_init (int argc, char **argv, int warnflag, FILE *);
-void siod_quit (void);
+static void siod_init (int argc, char **argv, int warnflag, FILE *);
+static void siod_quit (void);
-void set_repl_hooks (void (*puts_f) (char *),
- LISP (*read_f) (void),
- LISP (*eval_f) (LISP),
- void (*print_f) (LISP));
-char *get_c_string (LISP x);
-char *get_c_string_dim (LISP x, long *);
-int get_c_int (LISP x);
-long nlength(LISP x);
-void *get_c_pointer (LISP x);
+static void set_repl_hooks (void (*puts_f) (char *),
+ LISP (*read_f) (void),
+ LISP (*eval_f) (LISP),
+ void (*print_f) (LISP));
+static char *get_c_string (LISP x);
+static char *get_c_string_dim (LISP x, long *);
+static int get_c_int (LISP x);
+static long nlength(LISP x);
+static void *get_c_pointer (LISP x);
-LISP cons (LISP x, LISP y);
-LISP car (LISP x);
-LISP cdr (LISP x);
-LISP setcar (LISP cell, LISP value);
-LISP intcons (int x);
-LISP eql (LISP x, LISP y);
-LISP symcons (char *pname, LISP vcell);
-LISP symbol_boundp (LISP x, LISP env);
-LISP symbol_value (LISP x, LISP env);
-LISP symbol_to_string (LISP x, LISP env);
-LISP rintern (const char *name);
-LISP closure (LISP env, LISP code);
-LISP ptrcons (void *ptr);
+static LISP cons (LISP x, LISP y);
+static LISP car (LISP x);
+static LISP cdr (LISP x);
+static LISP setcar (LISP cell, LISP value);
+static LISP intcons (int x);
+static LISP eql (LISP x, LISP y);
+static LISP symcons (char *pname, LISP vcell);
+static LISP symbol_boundp (LISP x, LISP env);
+static LISP symbol_value (LISP x, LISP env);
+static LISP symbol_to_string (LISP x, LISP env);
+static LISP rintern (const char *name);
+static LISP closure (LISP env, LISP code);
+static LISP ptrcons (void *ptr);
-void init_subr (char *name, long type, SUBR_FUNC fcn);
-void init_subr_0 (char *name, LISP (*fcn) (void));
-void init_subr_1 (char *name, LISP (*fcn) (LISP));
-void init_subr_2 (char *name, LISP (*fcn) (LISP, LISP));
-void init_subr_2n (char *name, LISP (*fcn) (LISP, LISP));
-void init_subr_3 (char *name, LISP (*fcn) (LISP, LISP, LISP));
-void init_subr_4 (char *name, LISP (*fcn) (LISP, LISP, LISP, LISP));
-void init_subr_5 (char *name, LISP (*fcn) (LISP, LISP, LISP, LISP, LISP));
-void init_lsubr (char *name, LISP (*fcn) (LISP));
-void init_fsubr (char *name, LISP (*fcn) (LISP, LISP));
-void init_msubr (char *name, LISP (*fcn) (LISP *, LISP *));
+static void init_subr (char *name, long type, SUBR_FUNC fcn);
+static void init_subr_0 (char *name, LISP (*fcn) (void));
+static void init_subr_1 (char *name, LISP (*fcn) (LISP));
+static void init_subr_2 (char *name, LISP (*fcn) (LISP, LISP));
+static void init_subr_2n (char *name, LISP (*fcn) (LISP, LISP));
+static void init_subr_3 (char *name, LISP (*fcn) (LISP, LISP, LISP));
+static void init_subr_4 (char *name, LISP (*fcn) (LISP, LISP, LISP, LISP));
+static void init_subr_5 (char *name, LISP (*fcn) (LISP, LISP, LISP, LISP, LISP));
+static void init_lsubr (char *name, LISP (*fcn) (LISP));
+static void init_fsubr (char *name, LISP (*fcn) (LISP, LISP));
+static void init_msubr (char *name, LISP (*fcn) (LISP *, LISP *));
-LISP delq (LISP elem, LISP l);
-void set_eval_hooks (long type, LISP (*fcn) (LISP, LISP *, LISP *));
-LISP leval (LISP x, LISP env);
-LISP symbolconc (LISP args);
-LISP lprin1f (LISP exp, FILE * f);
-LISP lread (LISP);
-LISP lreadtk (char *, long j);
-LISP lreadf (FILE * f);
-LISP require (LISP fname);
-LISP strcons (long length, const char *data);
-LISP equal (LISP, LISP);
-void set_fatal_exit_hook (void (*fcn) (void));
-LISP intern (LISP x);
-void gc_protect (LISP * location); /* exported as temporary solution for custom API */
+static LISP delq (LISP elem, LISP l);
+static void set_eval_hooks (long type, LISP (*fcn) (LISP, LISP *, LISP *));
+static LISP leval (LISP x, LISP env);
+static LISP symbolconc (LISP args);
+static LISP lprin1f (LISP exp, FILE * f);
+static LISP lread (LISP);
+static LISP lreadtk (char *, long j);
+static LISP lreadf (FILE * f);
+static LISP require (LISP fname);
+static LISP strcons (long length, const char *data);
+static LISP equal (LISP, LISP);
+static void set_fatal_exit_hook (void (*fcn) (void));
+static LISP intern (LISP x);
+static void gc_protect (LISP * location);
#if (NESTED_REPL_C_STRING)
-void siod_gc_protect_stack(LISP *stack_start);
-void siod_gc_unprotect_stack(LISP *stack_start);
+static void siod_gc_protect_stack(LISP *stack_start);
+static void siod_gc_unprotect_stack(LISP *stack_start);
#else
-int siod_repl_c_string_entered (void);
+static int siod_repl_c_string_entered (void);
#endif
-long repl_c_string (const char *, long want_init, long want_print);
-LISP siod_return_value (void);
-LISP reverse (LISP);
-LISP nreverse (LISP);
-LISP number2string (LISP, LISP, LISP, LISP);
-LISP string2number (LISP, LISP);
-LISP cadr (LISP);
-LISP caar (LISP);
-LISP cdar (LISP);
-LISP cddr (LISP);
-LISP caaar (LISP);
-LISP caadr (LISP);
-LISP cadar (LISP);
-LISP caddr (LISP);
-LISP cdaar (LISP);
-LISP cdadr (LISP);
-LISP cddar (LISP);
-LISP cdddr (LISP);
-LISP siod_true_value (void);
-LISP siod_false_value (void);
-LISP lapply (LISP fcn, LISP args);
-LISP listn (long n,...);
-char *must_malloc (unsigned long size);
-FILE *get_c_file (LISP p, FILE * deflt);
-char *last_c_errmsg (int);
-LISP llast_c_errmsg (int);
-void siod_c_provide(const char *);
+static long repl_c_string (const char *, long want_init, long want_print);
+static LISP siod_return_value (void);
+static LISP reverse (LISP);
+static LISP nreverse (LISP);
+static LISP cadr (LISP);
+static LISP caar (LISP);
+static LISP cdar (LISP);
+static LISP cddr (LISP);
+static LISP siod_true_value (void);
+static LISP siod_false_value (void);
+static LISP lapply (LISP fcn, LISP args);
+static LISP listn (long n,...);
+static char *must_malloc (unsigned long size);
+static FILE *get_c_file (LISP p, FILE * deflt);
+static char *last_c_errmsg (int);
+static LISP llast_c_errmsg (int);
+static void siod_c_provide(const char *);
-LISP funcall1 (LISP, LISP);
-LISP funcall2 (LISP, LISP, LISP);
-LISP apply1 (LISP, LISP, LISP);
+static LISP funcall1 (LISP, LISP);
+static LISP funcall2 (LISP, LISP, LISP);
-extern long siod_verbose_level;
-void siod_set_lib_path(const char *);
+static void siod_set_lib_path(const char *);
#endif /* __SIOD_H__ */
Modified: trunk/uim/slib.c
===================================================================
--- trunk/uim/slib.c 2005-01-10 08:09:57 UTC (rev 215)
+++ trunk/uim/slib.c 2005-01-10 09:49:42 UTC (rev 216)
@@ -187,7 +187,7 @@
#endif /* DEBUG_SCM */
/* exported global symbol */
-long siod_verbose_level;
+static long siod_verbose_level;
static LISP sym_t;
/* Added by Spencer Kimball for script-fu shit 6/3/97 */
static FILE *siod_output;
@@ -448,7 +448,7 @@
return (NULL);
}
-int
+static int
get_c_int (LISP x)
{
if NINTNUMP
@@ -456,7 +456,7 @@
return ((long) INTNM (x));
}
-long
+static long
nlength (LISP obj)
{
LISP l;
@@ -659,7 +659,7 @@
return (NIL);
}
-void
+static void
siod_set_lib_path(const char *path)
{
siod_lib = path;
@@ -885,7 +885,7 @@
}
}
-LISP
+static LISP
strcons (long length, const char *data)
{
LISP s;
@@ -1271,7 +1271,7 @@
lprint (x, NIL);
}
-long
+static long
repl_c_string (const char *str,
long want_init, long want_print)
{
@@ -1299,14 +1299,14 @@
}
#if (!NESTED_REPL_C_STRING)
-int
+static int
siod_repl_c_string_entered (void)
{
return repl_c_string_entered;
}
#endif
-void
+static void
set_repl_hooks (void (*puts_f) (char *),
LISP (*read_f) (void),
LISP (*eval_f) (LISP),
@@ -1318,7 +1318,7 @@
repl_print = print_f;
}
-LISP
+static LISP
siod_return_value (void)
{
return repl_return_val;
@@ -1337,7 +1337,7 @@
return (1);
}
-void
+static void
set_fatal_exit_hook (void (*fcn) (void))
{
fatal_exit_hook = fcn;
@@ -1369,7 +1369,7 @@
}
#if (NESTED_REPL_C_STRING)
-void
+static void
siod_gc_protect_stack(LISP *stack_start)
{
if (!stack_start_ptr) {
@@ -1378,7 +1378,7 @@
}
}
-void
+static void
siod_gc_unprotect_stack(LISP *stack_start)
{
if (stack_start_ptr == stack_start)
@@ -1407,7 +1407,7 @@
return (intcons (stack_size));
}
-char *
+static char *
get_c_string (LISP x)
{
if TYPEP
@@ -1421,7 +1421,7 @@
return (NULL);
}
-char *
+static char *
get_c_string_dim (LISP x, long *len)
{
switch (TYPE (x))
@@ -1454,7 +1454,7 @@
my_err ("ran out of storage", NIL);
}
-LISP
+static LISP
cons (LISP x, LISP y)
{
LISP z;
@@ -1473,7 +1473,7 @@
return (NIL);
}
-LISP
+static LISP
car (LISP x)
{
switch TYPE
@@ -1488,7 +1488,7 @@
}
}
-LISP
+static LISP
cdr (LISP x)
{
switch TYPE
@@ -1503,7 +1503,7 @@
}
}
-LISP
+static LISP
setcar (LISP cell, LISP value)
{
if NCONSP
@@ -1511,7 +1511,7 @@
return (CAR (cell) = value);
}
-LISP
+static LISP
intcons (int x)
{
LISP z;
@@ -1708,7 +1708,7 @@
return (my_err ("improper list to assoc", alist));
}
-LISP
+static LISP
equal (LISP a, LISP b)
{
struct user_type_hooks *p;
@@ -1751,7 +1751,7 @@
return (NIL);
}
-LISP
+static LISP
eql (LISP x, LISP y)
{
if EQ
@@ -1802,7 +1802,7 @@
return (append2 (car (l), append (cdr (l))));
}
-LISP
+static LISP
symcons (char *pname, LISP vcell)
{
LISP z;
@@ -1827,7 +1827,7 @@
return (my_err ("unbound variable", v));
}
-LISP
+static LISP
symbol_boundp (LISP x, LISP env)
{
LISP tmp;
@@ -1842,7 +1842,7 @@
return (sym_t);
}
-LISP
+static LISP
symbol_value (LISP x, LISP env)
{
LISP tmp;
@@ -1857,7 +1857,7 @@
return (tmp);
}
-LISP
+static LISP
symbol_to_string (LISP x, LISP env)
{
LISP tmp;
@@ -1871,7 +1871,7 @@
}
-char *
+static char *
must_malloc (unsigned long size)
{
char *tmp;
@@ -1964,13 +1964,13 @@
return NIL;
}
-LISP
+static LISP
rintern (const char *name)
{
return (gen_intern (name));
}
-LISP
+static LISP
intern (LISP name)
{
return (rintern (get_c_string (name)));
@@ -1986,7 +1986,7 @@
return (z);
}
-LISP
+static LISP
closure (LISP env, LISP code)
{
LISP z;
@@ -2007,8 +2007,7 @@
protected_registers = reg;
}
-/* exported as temporary solution for custom API */
-/* static */ void
+static void
gc_protect (LISP * location)
{
gc_protect_n (location, 1);
@@ -2170,14 +2169,15 @@
gput_st (f, ">");
}
-void *get_c_pointer (LISP x)
+static void *
+get_c_pointer (LISP x)
{
if POINTERP
(x) my_err ("not a C pointer", x);
return (x->storage_as.c_pointer.data);
}
-LISP
+static LISP
ptrcons (void *ptr)
{
LISP x;
@@ -2273,67 +2273,67 @@
set_print_hooks (tc_c_pointer, pointer_prin1);
}
-void
+static void
init_subr (char *name, long type, SUBR_FUNC fcn)
{
setvar (rintern (name), subrcons (type, name, fcn), NIL);
}
-void
+static void
init_subr_0 (char *name, LISP (*fcn) (void))
{
init_subr (name, tc_subr_0, (SUBR_FUNC) fcn);
}
-void
+static void
init_subr_1 (char *name, LISP (*fcn) (LISP))
{
init_subr (name, tc_subr_1, (SUBR_FUNC) fcn);
}
-void
+static void
init_subr_2 (char *name, LISP (*fcn) (LISP, LISP))
{
init_subr (name, tc_subr_2, (SUBR_FUNC) fcn);
}
-void
+static void
init_subr_2n (char *name, LISP (*fcn) (LISP, LISP))
{
init_subr (name, tc_subr_2n, (SUBR_FUNC) fcn);
}
-void
+static void
init_subr_3 (char *name, LISP (*fcn) (LISP, LISP, LISP))
{
init_subr (name, tc_subr_3, (SUBR_FUNC) fcn);
}
-void
+static void
init_subr_4 (char *name, LISP (*fcn) (LISP, LISP, LISP, LISP))
{
init_subr (name, tc_subr_4, (SUBR_FUNC) fcn);
}
-void
+static void
init_subr_5 (char *name, LISP (*fcn) (LISP, LISP, LISP, LISP, LISP))
{
init_subr (name, tc_subr_5, (SUBR_FUNC) fcn);
}
-void
+static void
init_lsubr (char *name, LISP (*fcn) (LISP))
{
init_subr (name, tc_lsubr, (SUBR_FUNC) fcn);
}
-void
+static void
init_fsubr (char *name, LISP (*fcn) (LISP, LISP))
{
init_subr (name, tc_fsubr, (SUBR_FUNC) fcn);
}
-void
+static void
init_msubr (char *name, LISP (*fcn) (LISP *, LISP *))
{
init_subr (name, tc_msubr, (SUBR_FUNC) fcn);
@@ -2749,7 +2749,7 @@
return (cons (cons (formals, actuals), env));
}
-void
+static void
set_eval_hooks (long type, LISP (*fcn) (LISP, LISP *, LISP *))
{
struct user_type_hooks *p;
@@ -2764,7 +2764,7 @@
}
/* main evaluator */
-LISP
+static LISP
leval (LISP x, LISP env)
{
LISP tmp, arg1;
@@ -2969,7 +2969,7 @@
return rval;
}
-LISP
+static LISP
lapply (LISP fcn, LISP args)
{
struct user_type_hooks *p;
@@ -3271,7 +3271,7 @@
return (form);
}
-LISP
+static LISP
reverse (LISP l)
{
LISP n, p;
@@ -3381,7 +3381,7 @@
return (NIL);
}
-LISP
+static LISP
symbolconc (LISP args)
{
long size;
@@ -3577,7 +3577,7 @@
return (NIL);
}
-LISP
+static LISP
lprin1f (LISP exp, FILE * f)
{
struct gen_printio s;
@@ -3588,7 +3588,7 @@
return (NIL);
}
-LISP
+static LISP
lread (LISP f)
{
return (lreadf (get_c_file (f, stdin)));
@@ -3608,7 +3608,7 @@
ungetc (c, f);
}
-LISP
+static LISP
lreadf (FILE * f)
{
struct gen_readio s;
@@ -3618,7 +3618,7 @@
return (readtl (&s));
}
-LISP
+static LISP
lreadtk (char *buffer, long j)
{
int flag;
@@ -3697,7 +3697,7 @@
return (result);
}
-LISP
+static LISP
delq (LISP elem, LISP l)
{
if NULLP
@@ -3745,7 +3745,7 @@
return (NIL);
}
-void
+static void
siod_c_provide(const char *name)
{
provide(rintern(name));
@@ -3764,7 +3764,7 @@
1));
}
-LISP
+static LISP
require (LISP fname)
{
LISP sym;
@@ -3801,7 +3801,7 @@
return (TYPEP (x, tc_string) ? sym_t : NIL);
}
-FILE *
+static FILE *
get_c_file (LISP p, FILE * deflt)
{
if (NULLP (p) && deflt)
@@ -3886,7 +3886,7 @@
return (NIL);
}
-LISP
+static LISP
nreverse (LISP x)
{
LISP newp, oldp, nextp;
@@ -3922,25 +3922,25 @@
return (intcons (myrealtime ()));
}
-LISP
+static LISP
caar (LISP x)
{
return (car (car (x)));
}
-LISP
+static LISP
cadr (LISP x)
{
return (car (cdr (x)));
}
-LISP
+static LISP
cdar (LISP x)
{
return (cdr (car (x)));
}
-LISP
+static LISP
cddr (LISP x)
{
return (cdr (cdr (x)));
@@ -3979,19 +3979,19 @@
return (NIL);
}
-LISP
+static LISP
siod_true_value (void)
{
return (sym_t);
}
-LISP
+static LISP
siod_false_value (void)
{
return (sym_f);
}
-char *
+static char *
last_c_errmsg (int num)
{
int xerrno = (num < 0) ? errno : num;
@@ -4006,7 +4006,7 @@
return ((char *) errmsg);
}
-LISP
+static LISP
llast_c_errmsg (int num)
{
int xerrno = (num < 0) ? errno : num;
@@ -4311,7 +4311,7 @@
return (sym_t);
}
-LISP
+static LISP
funcall1 (LISP fcn, LISP a1)
{
switch TYPE
@@ -4335,7 +4335,7 @@
}
}
-LISP
+static LISP
funcall2 (LISP fcn, LISP a1, LISP a2)
{
switch TYPE
@@ -4417,7 +4417,7 @@
return (nreverse (result));
}
-LISP
+static LISP
listn (long n,...)
{
LISP result, ptr;
@@ -4545,6 +4545,7 @@
init_subr_1 ("string-dimension", string_dim);
init_lsubr ("string-append", string_append);
init_subr_1 ("string->integer",string2integer);
+ init_subr_2 ("string=?",string_equal);
init_subr_2 ("eval", leval);
init_subr_2 ("apply", lapply);
init_fsubr ("define", leval_define);
@@ -4638,7 +4639,7 @@
init_slib_version ();
}
-void
+static void
siod_quit (void)
{
int i;
@@ -4668,7 +4669,7 @@
free(inums);
}
-void
+static void
siod_init (int argc, char **argv, int warnflag, FILE *fp)
{
int k;
Modified: trunk/uim/uim-compat-scm.c
===================================================================
--- trunk/uim/uim-compat-scm.c 2005-01-10 08:09:57 UTC (rev 215)
+++ trunk/uim/uim-compat-scm.c 2005-01-10 09:49:42 UTC (rev 216)
@@ -95,7 +95,7 @@
uim_scm_symbol_value_str(const char *symbol_str)
{
uim_lisp stack_start;
- uim_lisp val_ = false_sym;
+ uim_lisp val_ = uim_scm_f();
char *val;
uim_scm_gc_protect_stack(&stack_start);
@@ -148,7 +148,7 @@
if TRUEP((uim_lisp)symbol_boundp(symbol_str_, NIL)) {
return (uim_lisp)symbol_value(symbol_str_, NIL);
} else {
- return (uim_lisp)false_sym;
+ return uim_scm_f();
}
}
Modified: trunk/uim/uim-scm.c
===================================================================
--- trunk/uim/uim-scm.c 2005-01-10 08:09:57 UTC (rev 215)
+++ trunk/uim/uim-scm.c 2005-01-10 09:49:42 UTC (rev 216)
@@ -42,29 +42,24 @@
#include "uim-compat-scm.h"
#include "context.h"
-#if 0
/*
- To avoid namespace pollution, all siod functions should be static
- and wrapped into uim-scm.c by direct inclusion rather than linked
- via public symbols. After uim_scm_* abstraction, the Scheme
- interpreter implementation can be switched to another one such as
- uim-scm-tinyscheme.c or uim-scm-gauche.c. But uim/*.[hc] and
+ To avoid namespace pollution, all siod functions are defined as
+ static and wrapped into uim-scm.c by direct inclusion rather than
+ linked via public symbols. After elaboration of uim-scm API, the
+ Scheme interpreter implementation can be switched to another one
+ such as uim-scm-tinyscheme.c or uim-scm-gauche.c. But uim/*.[hc] and
scm/*.scm are still depending on siod in several ways. At least full
test suite for *.scm files are required to migrate to another Scheme
- implementation. -- YamaKen 2004-12-21
+ implementation. -- YamaKen 2004-12-21, 2005-01-10
*/
#include "slib.c"
+#ifdef UIM_COMPAT_SCM
+#include "uim-compat-scm.c"
#endif
-static uim_lisp string_equal(uim_lisp x, uim_lisp y);
-
-#if 1
-/* will be deprecated. use uim_scm_t() and uim_scm_f() for new design */
-uim_lisp true_sym;
-uim_lisp false_sym;
-
+static uim_lisp true_sym;
+static uim_lisp false_sym;
static uim_lisp protected_arg0;
-#endif
static int uim_siod_fatal;
static FILE *uim_output = NULL;
@@ -278,26 +273,10 @@
return EQ(a, b);
}
-static uim_lisp
-string_equal(uim_lisp x, uim_lisp y)
-{
- long xl, yl;
- char *xs, *ys;
- xs = get_c_string_dim((LISP)x, &xl);
- ys = get_c_string_dim((LISP)y, &yl);
- if (xl != yl) {
- return uim_scm_f();
- }
- if (!strncmp(xs, ys, xl)) {
- return uim_scm_t();
- }
- return uim_scm_f();
-}
-
uim_bool
uim_scm_string_equal(uim_lisp a, uim_lisp b)
{
- return NFALSEP(string_equal(a, b));
+ return NFALSEP((uim_lisp)string_equal((LISP)a, (LISP)b));
}
uim_lisp
@@ -504,8 +483,6 @@
protected_arg0 = uim_scm_f();
uim_scm_gc_protect(&protected_arg0);
-
- uim_scm_init_subr_2("string=?", string_equal);
}
void
Modified: trunk/uim/uim-scm.h
===================================================================
--- trunk/uim/uim-scm.h 2005-01-10 08:09:57 UTC (rev 215)
+++ trunk/uim/uim-scm.h 2005-01-10 09:49:42 UTC (rev 216)
@@ -65,17 +65,11 @@
*/
typedef struct uim_opaque * uim_lisp;
-#if 1
-/* will be deprecated. use uim_scm_t() and uim_scm_f() for new design */
-extern uim_lisp true_sym;
-extern uim_lisp false_sym;
-#endif
-
-#define TRUEP(x) (uim_scm_eq(x, true_sym))
-#define FALSEP(x) (uim_scm_eq(x, false_sym))
+#define TRUEP(x) (uim_scm_eq(x, uim_scm_t()))
+#define FALSEP(x) (uim_scm_eq(x, uim_scm_f()))
-#define NTRUEP(x) (!uim_scm_eq(x, true_sym))
-#define NFALSEP(x) (!uim_scm_eq(x, false_sym))
+#define NTRUEP(x) (!uim_scm_eq(x, uim_scm_t()))
+#define NFALSEP(x) (!uim_scm_eq(x, uim_scm_f()))
/* 'uim_scm' prefix is not appropriate for these functions... any ideas? */
More information about the Uim-commit
mailing list