[uim-commit] r1976 - branches/r5rs/sigscheme/script
kzk at freedesktop.org
kzk at freedesktop.org
Thu Nov 3 06:50:24 PST 2005
Author: kzk
Date: 2005-11-03 06:50:20 -0800 (Thu, 03 Nov 2005)
New Revision: 1976
Added:
branches/r5rs/sigscheme/script/functable-footer.txt
branches/r5rs/sigscheme/script/functable-header.txt
Modified:
branches/r5rs/sigscheme/script/build_func_table.rb
Log:
* sigscheme/script/build_func_table.rb
- change to output whole functable definition file
* sigscheme/script/functable-header.txt
- new file
* sigscheme/script/functable-footer.txt
- new file
Modified: branches/r5rs/sigscheme/script/build_func_table.rb
===================================================================
--- branches/r5rs/sigscheme/script/build_func_table.rb 2005-11-03 14:08:13 UTC (rev 1975)
+++ branches/r5rs/sigscheme/script/build_func_table.rb 2005-11-03 14:50:20 UTC (rev 1976)
@@ -85,6 +85,7 @@
end
def search_declare_function(filename)
+ puts " /* #{filename} */"
IO.readlines(filename).each{ |line|
if line.strip =~ /DECLARE_FUNCTION\(\"(\S+)\",\s*((Syntax|Procedure|Reduction)\S+)\);/
scm_func = $1
@@ -102,7 +103,7 @@
c_func = guess_c_funcname(scm_func, type)
- puts "{ \"#{scm_func}\", #{c_func}, #{reg_func} },"
+ puts " { \"#{scm_func}\", (ScmBuiltinFunc)#{c_func}, (ScmRegisterFunc)#{reg_func} },"
end
}
end
@@ -111,22 +112,88 @@
search_declare_function(filename)
end
+def null_entry()
+ puts " {NULL, NULL, NULL}"
+end
-def build_table_of_all_c_file
- Dir.foreach("./") { |file|
- if (file != "." && file != ".." && /[\w].\.c/ =~ file)
- build_table(file)
- end
+def print_tableheader(tablename)
+ puts "struct builtin_func_info #{tablename}[] = {"
+end
+
+def print_tablefooter()
+ puts "};"
+ puts ""
+end
+
+def build_functable(tablename, filelist)
+ print_tableheader(tablename)
+ filelist.each { |filename|
+ build_table(filename)
}
+ null_entry()
+ print_tablefooter
end
+def print_header()
+ IO.readlines("./script/functable-header.txt").each { |line|
+ puts line
+ }
+end
+def print_footer()
+ IO.readlines("script/functable-footer.txt").each { |line|
+ puts line
+ }
+end
+
+
+
+
######################################################################
-if ARGV.empty?
- puts "usage: ruby build_func_table.rb filename1 filename2 ..."
-else
- ARGV.each{ |filename|
- build_table(filename)
- }
-end
+# Header
+print_header
+
+
+# R5RS
+build_functable("r5rs_func_info_table",
+ ["eval.c", "io.c", "operations.c", "sigscheme.c"])
+
+# SRFI-1
+build_functable("srfi1_func_info_table",
+ ["operations-srfi1.c"])
+
+# SRFI-2
+build_functable("srfi2_func_info_table",
+ ["operations-srfi2.c"])
+
+# SRFI-6
+build_functable("srfi6_func_info_table",
+ ["operations-srfi6.c"])
+
+# SRFI-8
+build_functable("srfi8_func_info_table",
+ ["operations-srfi8.c"])
+
+# SRFI-23
+build_functable("srfi23_func_info_table",
+ ["operations-srfi23.c"])
+
+# SRFI-34
+build_functable("srfi34_func_info_table",
+ ["operations-srfi34.c"])
+
+# SRFI-38
+build_functable("srfi38_func_info_table",
+ ["operations-srfi38.c"])
+
+# SRFI-60
+build_functable("srfi60_func_info_table",
+ ["operations-srfi60.c"])
+
+# SIOD
+build_functable("siod_func_info_table",
+ ["operations-siod.c"])
+
+# Footer
+print_footer
Added: branches/r5rs/sigscheme/script/functable-footer.txt
===================================================================
--- branches/r5rs/sigscheme/script/functable-footer.txt 2005-11-03 14:08:13 UTC (rev 1975)
+++ branches/r5rs/sigscheme/script/functable-footer.txt 2005-11-03 14:50:20 UTC (rev 1976)
@@ -0,0 +1 @@
+#endif /* __SIGSCHEME_FUNCTABLE_H */
Added: branches/r5rs/sigscheme/script/functable-header.txt
===================================================================
--- branches/r5rs/sigscheme/script/functable-header.txt 2005-11-03 14:08:13 UTC (rev 1975)
+++ branches/r5rs/sigscheme/script/functable-header.txt 2005-11-03 14:50:20 UTC (rev 1976)
@@ -0,0 +1,59 @@
+/*===========================================================================
+ * FileName : sigschemefunctable.h
+ * About : built-in function table
+ *
+ * Copyright (C) 2005 by Kazuki Ohta (mover at hct.zaq.ne.jp)
+ *
+ * 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.
+===========================================================================*/
+#ifndef __SIGSCHEME_FUNCTABLE_H
+#define __SIGSCHEME_FUNCTABLE_H
+
+/*=======================================
+ System Include
+=======================================*/
+
+/*=======================================
+ Local Include
+=======================================*/
+
+/*=======================================
+ Type Definitions
+=======================================*/
+typedef ScmObj (*ScmBuiltinFunc)(void);
+typedef void (*ScmRegisterFunc)(const char *name, ScmBuiltinFunc func);
+
+struct builtin_func_info {
+ const char *funcname;
+ ScmBuiltinFunc c_func;
+ ScmRegisterFunc reg_func;
+};
+
+/*=======================================
+ Builtin Function Tables
+=======================================*/
More information about the uim-commit
mailing list