[uim-commit] r931 - trunk/uim

tkng at freedesktop.org tkng at freedesktop.org
Sun Jul 3 04:47:06 PDT 2005


Author: tkng
Date: 2005-07-03 04:45:50 -0700 (Sun, 03 Jul 2005)
New Revision: 931

Modified:
   trunk/uim/uim-module-manager.c
Log:
* uim/uim-module-manager.c:
 -(write_loader_scm): New procedure to write loader.scm.
 -(write_installed_modules_scm): New procedure to write installed-modules.scm.


Modified: trunk/uim/uim-module-manager.c
===================================================================
--- trunk/uim/uim-module-manager.c	2005-07-03 11:18:57 UTC (rev 930)
+++ trunk/uim/uim-module-manager.c	2005-07-03 11:45:50 UTC (rev 931)
@@ -43,6 +43,8 @@
 #include "uim-compat-scm.h"
 
 #define MODULE_LIST_FILENAME UIM_DATADIR"/modules"
+#define LOADER_SCM_FILENAME  UIM_DATADIR"/loader.scm"
+#define INSTALLED_MODULES_SCM_FILENAME  UIM_DATADIR"/loader.scm"
 
 static void
 print_usage(void)
@@ -109,6 +111,40 @@
   return uim_scm_t();
 }
 
+static uim_lisp
+write_loader_scm(uim_lisp str)
+{
+  FILE *fp = fopen(LOADER_SCM_FILENAME, "w");
+
+  if(!fp) {
+    perror("Failed to open loader.scm");
+    return uim_scm_f();
+  }
+
+  fputs("# This is an automatically generated file. DO NOT EDIT.\n\n", fp);
+
+  fputs(uim_scm_refer_c_str(str), fp);
+  fclose(fp);
+  return uim_scm_t();
+}
+
+static uim_lisp
+write_installed_modules_scm(uim_lisp str)
+{
+  FILE *fp = fopen(INSTALLED_MODULES_SCM_FILENAME, "w");
+
+  if(!fp) {
+    perror("Failed to open loader.scm");
+    return uim_scm_f();
+  }
+
+  fputs("# This is an automatically generated file. DO NOT EDIT.\n\n", fp);
+
+  fputs(uim_scm_refer_c_str(str), fp);
+  fclose(fp);
+  return uim_scm_t();
+}
+
 int
 main(int argc, char *argv[]) {
   int registerp;
@@ -143,6 +179,10 @@
 
   uim_scm_init_subr_0("read-module-list", read_module_list);
   uim_scm_init_subr_2("write-module-list", write_module_list);
+
+  uim_scm_init_subr_1("write-loader.scm", write_loader_scm);
+  uim_scm_init_subr_1("write-installed-modules.scm", write_installed_modules_scm);
+
   uim_scm_require_file("uim-module-manager.scm");
 
   if(registerp == 1) {



More information about the uim-commit mailing list