+2006-10-18 Kenichi Handa <handa@m17n.org>
+
+ * input.c (delete_surrounding_text): Be sure to set members
+ preceding_text and following_text to NULL.
+ (shift_state): Save variable values in ic_info->vars_saved.
+ (preedit_commit): Don't print debug information here. Don't
+ change ic_info->keys here.
+ (get_candidate_list): Don't ref plist.
+ (take_action_list): Don't unref return value of
+ get_candidate_list. For undo, reset ic->produced and recover
+ ic_info->vars. Be sure to set ic->candidate_list to NULL after
+ unref it.
+ (init_ic_info): Set ic_info->vars_saved.
+ (fini_ic_info): Unref ic_info->vars_saved.
+ (re_init_ic): Be sure to set ic->candidate_list to NULL after
+ unref it.
+ (filter): Be sure to set members preceding_text and following_text
+ to NULL. Print debug information about produced text. Delete
+ processed keys from ic_info->keys.
+
+ * input.h (MInputContextInfo): New member vars_saved.
+
2006-10-16 Kenichi Handa <handa@m17n.org>
* database.c (mdatabase__update): Fix the way to get db_info.
if (dirname)
{
int len = strlen (dirname);
- MTABLE_MALLOC (dir_info->filename, len + 2, MERROR_DB);
- memcpy (dir_info->filename, dirname, len + 1);
- /* Append PATH_SEPARATOR if DIRNAME doesn't end with it. */
- if (dir_info->filename[len - 1] != PATH_SEPARATOR)
+
+ if (len + MDB_DIR_LEN < PATH_MAX)
{
- dir_info->filename[len] = PATH_SEPARATOR;
- dir_info->filename[++len] = '\0';
+ MTABLE_MALLOC (dir_info->filename, len + 2, MERROR_DB);
+ memcpy (dir_info->filename, dirname, len + 1);
+ /* Append PATH_SEPARATOR if DIRNAME doesn't end with it. */
+ if (dir_info->filename[len - 1] != PATH_SEPARATOR)
+ {
+ dir_info->filename[len] = PATH_SEPARATOR;
+ dir_info->filename[++len] = '\0';
+ }
+ dir_info->len = len;
+ dir_info->status = MDB_STATUS_AUTO;
}
- dir_info->len = len;
- dir_info->status = MDB_STATUS_AUTO;
+ else
+ dir_info->status = MDB_STATUS_DISABLED;
}
else
dir_info->status = MDB_STATUS_DISABLED;
: (tags[j] != Mnil && tags[j] != tags2[j]))
break;
if (j == 4)
- register_database (tags2, load_database, globbuf->gl_pathv[i], 1);
+ register_database (tags2, load_database, globbuf->gl_pathv[i],
+ MDB_STATUS_AUTO);
}
M17N_OBJECT_UNREF (plist);
}
char path[PATH_MAX + 1];
MDatabaseInfo *dir_info;
struct stat statbuf;
+ int rescan = 0;
+
+ /* Update elements of mdatabase__dir_list. */
+ MPLIST_DO (plist, mdatabase__dir_list)
+ {
+ dir_info = MPLIST_VAL (plist);
+ if (dir_info->filename)
+ {
+ enum MDatabaseStatus status;
+
+ if (stat (dir_info->filename, &statbuf) == 0
+ && (statbuf.st_mode & S_IFDIR))
+ status = ((dir_info->time >= statbuf.st_mtime)
+ ? MDB_STATUS_EXPLICIT : MDB_STATUS_AUTO);
+ else
+ status = MDB_STATUS_DISABLED;
+
+ if (dir_info->status != status)
+ {
+ dir_info->status = status;
+ rescan = 1;
+ }
+ else if (dir_info->status == MDB_STATUS_AUTO)
+ rescan = 1;
+ }
+ }
+
+ if (! rescan)
+ return;
/* At first, mark all databases defined automatically from mdb.dir
file(s) as "disabled". */
}
}
- /* Update elements of mdatabase__dir_list. */
- MPLIST_DO (plist, mdatabase__dir_list)
- {
- dir_info = MPLIST_VAL (plist);
- dir_info->status = ((dir_info->filename
- && stat (dir_info->filename, &statbuf) == 0
- && (statbuf.st_mode & S_IFDIR))
- ? MDB_STATUS_AUTO : MDB_STATUS_DISABLED);
- }
-
MPLIST_DO (plist, mdatabase__dir_list)
{
MDatabaseInfo *dir_info = MPLIST_VAL (plist);
continue;
if (stat (path, &statbuf) < 0)
continue;
- if (dir_info->time >= statbuf.st_mtime)
- continue;
dir_info->time = statbuf.st_mtime;
if (! (fp = fopen (path, "r")))
continue;
}
else
{
- register_database (tags, load_database, path, 1);
+ register_database (tags, load_database, path, MDB_STATUS_AUTO);
}
}
M17N_OBJECT_UNREF (pl);
tags[0] = tag0, tags[1] = tag1, tags[2] = tag2, tags[3] = tag3;
if (! loader)
loader = load_database;
- mdb = register_database (tags, loader, extra_info, 0);
+ mdb = register_database (tags, loader, extra_info, MDB_STATUS_EXPLICIT);
return mdb;
}