SHA256
1
0
forked from pool/fwnn
fwnn/FreeWnn-1.1.1-a021.dif

456 lines
17 KiB
Plaintext
Raw Normal View History

--- FreeWnn-1.1.1-a021/Wnn/include/jllib.h
+++ FreeWnn-1.1.1-a021/Wnn/include/jllib.h
@@ -248,59 +248,59 @@
#define jl_set_lang(buf, lang) js_set_lang((buf)->env, lang)
/* extern function defines */
-extern struct wnn_buf *jl_open_lang ();
-extern struct wnn_env *jl_connect_lang ();
-extern struct wnn_env *jl_env_get ();
-extern struct wnn_jdata *jl_word_info_e ();
-extern w_char *jl_hinsi_name_e ();
+extern struct wnn_buf *jl_open_lang (const char *, const char *, const char *, const char *, int (*) (const char *), int (*) (const char *), int);
+extern struct wnn_env *jl_connect_lang (const char *, const char *, const char *, const char *, int (*) (const char *), int (*) (const char *), int);
+extern struct wnn_env *jl_env_get (struct wnn_buf *);
+extern struct wnn_jdata *jl_word_info_e (struct wnn_env *, int, int);
+extern w_char *jl_hinsi_name_e (struct wnn_env *, int);
-extern void jl_close ();
-extern int jl_dic_add_e ();
-extern int jl_dic_comment_set_e ();
-extern int jl_dic_delete_e ();
-extern int jl_dic_list_e ();
-extern int jl_dic_save_all_e ();
-extern int jl_dic_save_e ();
-extern int jl_dic_use_e ();
-extern void jl_disconnect ();
-extern void jl_disconnect_if_server_dead ();
-extern void jl_env_set ();
-extern int jl_fuzokugo_get_e ();
-extern int jl_fuzokugo_set_e ();
-extern void jl_get_zenkouho_kanji ();
-extern int jl_hinsi_dicts_e ();
-extern int jl_hinsi_list_e ();
-extern int jl_hinsi_number_e ();
-extern int jl_isconnect_e ();
-extern int jl_kanji_len ();
-extern int jl_kill ();
-extern int jl_nobi_conv ();
-extern int jl_nobi_conv_e2 ();
-extern int jl_param_get_e ();
-extern int jl_param_set_e ();
-extern int jl_ren_conv ();
-extern int jl_set_env_wnnrc ();
-extern int jl_set_env_wnnrc1 ();
-extern int jl_set_jikouho ();
-extern int jl_set_jikouho_dai ();
-extern int jl_tan_conv ();
-extern int jl_update_hindo ();
-extern int jl_word_add_e ();
-extern int jl_word_comment_set_e ();
-extern int jl_word_delete_e ();
-extern int jl_word_search_by_env_e ();
-extern int jl_word_search_e ();
-extern int jl_word_use_e ();
-extern int jl_yomi_len ();
-extern int jl_zenkouho ();
-extern int jl_zenkouho_dai ();
-extern int wnn_get_area ();
+extern void jl_close (struct wnn_buf *);
+extern int jl_dic_add_e (struct wnn_env *, char *, char *, int, int, int, int, char *, char *, int (*) (const char *), int (*) (const char *));
+extern int jl_dic_comment_set_e (struct wnn_env *, int, w_char *);
+extern int jl_dic_delete_e (struct wnn_env *, int);
+extern int jl_dic_list_e (struct wnn_env *, WNN_DIC_INFO **);
+extern int jl_dic_save_all_e (struct wnn_env *);
+extern int jl_dic_save_e (struct wnn_env *, int);
+extern int jl_dic_use_e (struct wnn_env *, int, int);
+extern void jl_disconnect (struct wnn_env *);
+extern void jl_disconnect_if_server_dead (struct wnn_env *);
+extern void jl_env_set (struct wnn_buf *, struct wnn_env *);
+extern int jl_fuzokugo_get_e (struct wnn_env *, char *);
+extern int jl_fuzokugo_set_e (struct wnn_env *, char *);
+extern void jl_get_zenkouho_kanji (struct wnn_buf *, int, w_char *);
+extern int jl_hinsi_dicts_e (struct wnn_env *, int, int **);
+extern int jl_hinsi_list_e (struct wnn_env *, int, w_char *, w_char ***);
+extern int jl_hinsi_number_e (struct wnn_env *, w_char *);
+extern int jl_isconnect_e (struct wnn_env *);
+extern int jl_kanji_len (struct wnn_buf *, int, int);
+extern int jl_kill (struct wnn_buf *, int, int);
+extern int jl_nobi_conv (struct wnn_buf *, int, int, int, int, int);
+extern int jl_nobi_conv_e2 (struct wnn_buf *, struct wnn_env *, int, int, int, int, int);
+extern int jl_param_get_e (struct wnn_env *, struct wnn_param *);
+extern int jl_param_set_e (struct wnn_env *, struct wnn_param *);
+extern int jl_ren_conv (struct wnn_buf *, w_char *, int, int, int);
+extern int jl_set_env_wnnrc (struct wnn_env *, const char *, int (*) (const char *), int (*) (const char *));
+extern int jl_set_env_wnnrc1 (struct wnn_env *, const char *, int (*) (const char *), int (*) (const char *), int);
+extern int jl_set_jikouho (struct wnn_buf *, int);
+extern int jl_set_jikouho_dai (struct wnn_buf *, int);
+extern int jl_tan_conv (struct wnn_buf *, w_char *, int, int, int, int);
+extern int jl_update_hindo (struct wnn_buf *, int, int);
+extern int jl_word_add_e (struct wnn_env *, int, w_char *, w_char *, w_char *, int, int);
+extern int jl_word_comment_set_e (struct wnn_env *, int, int, w_char *);
+extern int jl_word_delete_e (struct wnn_env *, int, int);
+extern int jl_word_search_by_env_e (struct wnn_env *, w_char *, struct wnn_jdata **);
+extern int jl_word_search_e (struct wnn_env *, int, w_char *, struct wnn_jdata **);
+extern int jl_word_use_e (struct wnn_env *, int, int);
+extern int jl_yomi_len (struct wnn_buf *, int, int);
+extern int jl_zenkouho (struct wnn_buf *, int, int, int);
+extern int jl_zenkouho_dai (struct wnn_buf *, int, int, int, int);
+extern int wnn_get_area (struct wnn_buf *, int, int, w_char *, int);
-extern char *wnn_perror ();
-extern char *wnn_perror_lang ();
+extern char *wnn_perror (void);
+extern char *wnn_perror_lang (char *);
#ifdef CONVERT_by_STROKE
-extern void jl_get_zenkouho_yomi ();
+extern void jl_get_zenkouho_yomi (struct wnn_buf *, int, w_char *);
#endif
#endif /* WNN_JLLIB_H */
--- FreeWnn-1.1.1-a021/Wnn/jlib/jl.c
+++ FreeWnn-1.1.1-a021/Wnn/jlib/jl.c
@@ -52,6 +52,7 @@
# include <malloc.h>
# endif
#endif /* STDC_HEADERS */
+#include <stdarg.h>
#include <sys/types.h>
#include <sys/file.h>
#include <sys/stat.h>
@@ -159,7 +160,7 @@
static void make_space_for ();
static void make_space_for_bun ();
static void make_space_for_zenkouho ();
-static void message_out ();
+static void message_out (int (*) (const char *), const char *, ...);
static int ren_conv1 ();
static void set_dai ();
static void set_sho ();
@@ -275,7 +276,7 @@
static struct wnn_env *
find_same_env (js, env_n, lang)
register WNN_JSERVER_ID *js;
- register char *env_n;
+ register const char *env_n;
char *lang;
{
register int k;
@@ -314,7 +315,7 @@
add_new_env (js, env, env_n, server_n, lang)
register WNN_JSERVER_ID *js;
register struct wnn_env *env;
- char *env_n, *server_n, *lang;
+ const char *env_n, *server_n, *lang;
{
register int k;
@@ -435,15 +436,16 @@
struct wnn_env *
jl_connect_lang (env_n, server_n, lang, wnnrc_n, error_handler, message_handler, timeout)
- register char *env_n, *server_n, *wnnrc_n, *lang;
- int (*error_handler) (), (*message_handler) ();
+ register const char *env_n, *server_n, *wnnrc_n, *lang;
+ int (*error_handler) (const char *), (*message_handler) (const char *);
int timeout;
{
register WNN_JSERVER_ID *js = NULL;
struct wnn_env *env;
int env_exist;
char p_lang[16];
- register char *p, *l;
+ register char *p;
+ const char *l;
extern char *getenv ();
extern char *_wnn_get_machine_of_serv_defs ();
@@ -576,8 +578,8 @@
struct wnn_buf *
jl_open_lang (env_n, server_n, lang, wnnrc_n, error_handler, message_handler, timeout)
- char *env_n, *server_n, *wnnrc_n, *lang;
- int (*error_handler) (), (*message_handler) ();
+ const char *env_n, *server_n, *wnnrc_n, *lang;
+ int (*error_handler) (const char *), (*message_handler) (const char *);
int timeout;
{
register int k, dmy;
@@ -1504,7 +1506,7 @@
int prio;
int rw, hrw, rev;
char *pwd_dic, *pwd_hindo;
- int (*error_handler) (), (*message_handler) ();
+ int (*error_handler) (const char *), (*message_handler) (const char *);
{
char tmp[256];
char pwd[WNN_PASSWD_LEN], hpwd[WNN_PASSWD_LEN];
@@ -1519,7 +1521,7 @@
jl_disconnect (env);
return (-1);
}
- if ((int) error_handler == WNN_NO_CREATE || (rw == WNN_DIC_RDONLY))
+ if (error_handler == (int (*) (const char *)) WNN_NO_CREATE || (rw == WNN_DIC_RDONLY))
{
sprintf (tmp, "%s \"%s\" %s", msg_get (wnn_msg_cat, 200, NULL, env->lang), dic_name, msg_get (wnn_msg_cat, 201, NULL, env->lang));
/*
@@ -1533,7 +1535,7 @@
/*
"<22><><EFBFBD><EFBFBD><EFBFBD>ե<EFBFBD><D5A5><EFBFBD><EFBFBD><EFBFBD> \"%s\" <20><>̵<EFBFBD><CCB5><EFBFBD><EFBFBD><E8A1A3><EFBFBD><EFBFBD>?(Y/N)",
*/
- if ((int) error_handler == WNN_CREATE || call_error_handler (error_handler, tmp))
+ if (error_handler == (int (*) (const char *)) WNN_CREATE || call_error_handler (error_handler, tmp))
{
if (create_file (env, dic_name, JISHO, -1, /* -1 is dummy */
pwd_dic, (hindo_name && *hindo_name) ? "" : pwd_hindo, error_handler, message_handler) == -1)
@@ -1558,7 +1560,7 @@
jl_disconnect (env);
return (-1);
}
- if ((int) error_handler == WNN_NO_CREATE || (hrw == WNN_DIC_RDONLY))
+ if (error_handler == (int (*) (const char *)) WNN_NO_CREATE || (hrw == WNN_DIC_RDONLY))
{
sprintf (tmp, "%s \"%s\" %s", msg_get (wnn_msg_cat, 203, NULL, env->lang), hindo_name, msg_get (wnn_msg_cat, 201, NULL, env->lang));
/*
@@ -1572,7 +1574,7 @@
/*
"<22><><EFBFBD>٥ե<D9A5><D5A5><EFBFBD><EFBFBD><EFBFBD> \"%s\" <20><>̵<EFBFBD><CCB5><EFBFBD><EFBFBD><E8A1A3><EFBFBD><EFBFBD>?(Y/N)",
*/
- if ((int) error_handler == WNN_CREATE || call_error_handler (error_handler, tmp))
+ if (error_handler == (int (*) (const char *)) WNN_CREATE || call_error_handler (error_handler, tmp))
{
if (create_file (env, hindo_name, HINDO, fid, "", pwd_hindo, error_handler, message_handler) == -1)
return (-1);
@@ -1601,7 +1603,7 @@
}
else if (wnn_errorno == WNN_HINDO_NO_MATCH)
{
- if ((int) error_handler == WNN_NO_CREATE)
+ if (error_handler == (int (*) (const char *)) WNN_NO_CREATE)
{
return (-1);
}
@@ -1609,7 +1611,7 @@
/*
"<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> \"%s\" <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̵<EFBFBD><CCB5><EFBFBD><EFBFBD><E8A1A3><EFBFBD><EFBFBD>ľ<EFBFBD><C4BE>?(Y/N)",
*/
- if (!((int) error_handler == WNN_CREATE || call_error_handler (error_handler, tmp)))
+ if (!(error_handler == (int (*) (const char *)) WNN_CREATE || call_error_handler (error_handler, tmp)))
{
return (-1);
}
@@ -1685,7 +1687,7 @@
create_pwd_file (env, pwd_file, error_handler, message_handler)
register struct wnn_env *env;
char *pwd_file;
- int (*error_handler) (), (*message_handler) ();
+ int (*error_handler) (const char *), (*message_handler) (const char *);
{
FILE *fp;
char gomi[256];
@@ -2749,17 +2751,17 @@
int
jl_set_env_wnnrc (env, wnnrc_n, error_handler, message_handler)
register struct wnn_env *env;
- char *wnnrc_n;
- int (*error_handler) (), (*message_handler) ();
+ const char *wnnrc_n;
+ int (*error_handler) (const char *), (*message_handler) (const char *);
{
int level = 0;
int x;
wnn_errorno = 0;
- if ((int) error_handler == WNN_CREATE)
+ if (error_handler == (int (*) (const char *)) WNN_CREATE)
{
confirm_state = CREATE_WITHOUT_CONFIRM;
}
- else if ((int) error_handler == WNN_NO_CREATE)
+ else if (error_handler == (int (*) (const char *)) WNN_NO_CREATE)
{
confirm_state = NO_CREATE;
}
@@ -2775,8 +2777,8 @@
int
jl_set_env_wnnrc1 (env, wnnrc_n, error_handler, message_handler, level)
register struct wnn_env *env;
- char *wnnrc_n;
- int (*error_handler) (), (*message_handler) ();
+ const char *wnnrc_n;
+ int (*error_handler) (const char *), (*message_handler) (const char *);
int level;
{
register int num;
@@ -2829,7 +2831,7 @@
{
/* dic_add */
int prio, rdonly, hrdonly, rev;
- int (*error_handler1) () = (int (*)()) 0;
+ int (*error_handler1) (const char *) = (int (*) (const char *)) 0;
expand_expr_all (s[0], env);
if (num < 3 || !REAL_PARAM (s[1]))
{
@@ -2855,11 +2857,11 @@
else if (confirm_state == CREATE_WITHOUT_CONFIRM)
{
- error_handler1 = (int (*)()) WNN_CREATE;
+ error_handler1 = (int (*) (const char *)) WNN_CREATE;
}
else if (confirm_state == NO_CREATE)
{
- error_handler1 = (int (*)()) WNN_NO_CREATE;
+ error_handler1 = (int (*) (const char *)) WNN_NO_CREATE;
}
if (jl_dic_add_e (env, s[0], s[1], rev, prio, rdonly, hrdonly, s[5], s[6], error_handler1, message_handler) == -1 && wnn_errorno != 0)
{
@@ -2990,7 +2992,7 @@
if (*s != '~' && *s != '@')
return (0);
- if ((int) strlen (s) >= EXPAND_PATH_LENGTH)
+ if (strlen (s) >= EXPAND_PATH_LENGTH)
return (-1);
s1 = s;
@@ -3008,12 +3010,12 @@
{
if (*s1)
{
- noerr = expandsuc = (NULL != (u = getpwnam (s1)) && (int) strlen (p = u->pw_dir) + (int) strlen (tmp) < EXPAND_PATH_LENGTH);
+ noerr = expandsuc = (NULL != (u = getpwnam (s1)) && strlen (p = u->pw_dir) + strlen (tmp) < EXPAND_PATH_LENGTH);
}
else
{
- noerr = expandsuc = (NULL != (p = getenv ("HOME")) && (int) strlen (p) + (int) strlen (tmp) < EXPAND_PATH_LENGTH);
+ noerr = expandsuc = (NULL != (p = getenv ("HOME")) && strlen (p) + strlen (tmp) < EXPAND_PATH_LENGTH);
}
}
@@ -3021,13 +3023,13 @@
{ /* then, *s must be '@' */
if (!strcmp (s1, "HOME"))
{
- noerr = expandsuc = (NULL != (p = getenv ("HOME")) && (int) strlen (p) + (int) strlen (tmp) < EXPAND_PATH_LENGTH);
+ noerr = expandsuc = (NULL != (p = getenv ("HOME")) && strlen (p) + strlen (tmp) < EXPAND_PATH_LENGTH);
}
else if (!strcmp (s1, "WNN_DIC_DIR"))
{
char buf[EXPAND_PATH_LENGTH];
expandsuc = 1;
- noerr = (NULL != (p = getenv ("HOME")) && (int) strlen (p) + (int) strlen (tmp) < EXPAND_PATH_LENGTH);
+ noerr = (NULL != (p = getenv ("HOME")) && strlen (p) + strlen (tmp) < EXPAND_PATH_LENGTH);
strcpy (buf, p);
strcat (buf, "/");
@@ -3044,15 +3046,15 @@
}
else if (!strcmp (s1, "LIBDIR"))
{
- noerr = expandsuc = ((int) strlen (p = LIBDIR) + (int) strlen (tmp) < EXPAND_PATH_LENGTH);
+ noerr = expandsuc = (strlen (p = LIBDIR) + strlen (tmp) < EXPAND_PATH_LENGTH);
}
else if (!strcmp (s1, "ENV"))
{ /* Added */
- noerr = expandsuc = (NULL != (p = env_name (env)) && (int) strlen (p) + (int) strlen (tmp) < EXPAND_PATH_LENGTH);
+ noerr = expandsuc = (NULL != (p = env_name (env)) && strlen (p) + strlen (tmp) < EXPAND_PATH_LENGTH);
}
else if (!strcmp (s1, "USR"))
{
- noerr = expandsuc = (NULL != (p = getlogname ()) && (int) strlen (p) + (int) strlen (tmp) < EXPAND_PATH_LENGTH);
+ noerr = expandsuc = (NULL != (p = getlogname ()) && strlen (p) + strlen (tmp) < EXPAND_PATH_LENGTH);
}
else
{ /* @HOME, @LIBDIR @ENV igai ha kaenai */
@@ -3076,7 +3078,7 @@
total = 0;
flag = 0;
- while (*st != NULL)
+ while (*st != 0)
{
if (isdigit (*st))
{
@@ -3135,7 +3137,7 @@
int d;
int fid;
char *pwd_dic, *pwd_hindo;
- int (*error_handler) (), (*message_handler) ();
+ int (*error_handler) (const char *), (*message_handler) (const char *);
{
char pwd[WNN_PASSWD_LEN], hpwd[WNN_PASSWD_LEN];
int rev_dict_type;
@@ -3243,7 +3245,7 @@
make_dir_rec1 (env, path, error_handler, message_handler)
struct wnn_env *env;
register char *path;
- int (*error_handler) (), (*message_handler) ();
+ int (*error_handler) (const char *), (*message_handler) (const char *);
{
char gomi[128];
register char *c;
@@ -3266,7 +3268,7 @@
make_dir1 (env, dirname, error_handler, message_handler)
register struct wnn_env *env;
register char *dirname;
- int (*error_handler) (), (*message_handler) ();
+ int (*error_handler) (const char *), (*message_handler) (const char *);
{
char gomi[128];
if (dirname[0] == C_LOCAL)
@@ -3287,7 +3289,7 @@
return (0); /* dir already exists */
}
}
- if ((int) error_handler != WNN_CREATE)
+ if (error_handler != (int (*) (const char *)) WNN_CREATE)
{
sprintf (gomi, "%s \"%s\" %s%s", msg_get (wnn_msg_cat, 210, NULL, env->lang), dirname, msg_get (wnn_msg_cat, 201, NULL, env->lang), msg_get (wnn_msg_cat, 202, NULL, env->lang));
/*
@@ -3324,8 +3326,8 @@
static int
call_error_handler (error_handler, c)
- int (*error_handler) ();
- char *c;
+ int (*error_handler) (const char *);
+ const char *c;
{
register int x;
x = error_handler (c);
@@ -3340,16 +3342,16 @@
}
static void
-message_out (message_handler, format, s1, s2, s3, s4, s5, s6, s7, s8)
- int (*message_handler) ();
- char *format;
- int s1, s2, s3, s4, s5, s6, s7, s8;
+message_out (int (*message_handler) (const char *), const char *format, ...)
{
char buf[256];
+ va_list args;
if (message_handler)
{
- sprintf (buf, format, s1, s2, s3, s4, s5, s6, s7, s8);
+ va_start (args, format);
+ vsprintf (buf, format, args);
+ va_end (args);
(*message_handler) (buf);
}
}
--- FreeWnn-1.1.1-a021/Wnn/jlib/js.c
+++ FreeWnn-1.1.1-a021/Wnn/jlib/js.c
@@ -979,7 +979,7 @@
free((char *)env);
*/
set_current_js (env->js_id);
- handler_of_jserver_dead (NULL);
+ handler_of_jserver_dead (-1);
snd_env_head (&tmp_env, JS_DISCONNECT);
snd_flush ();
x = get4com ();