[uim-commit] r2166 - in branches/r5rs/sigscheme: . script
kzk at freedesktop.org
kzk at freedesktop.org
Fri Nov 18 21:09:40 PST 2005
Author: kzk
Date: 2005-11-18 21:09:36 -0800 (Fri, 18 Nov 2005)
New Revision: 2166
Modified:
branches/r5rs/sigscheme/Makefile.am
branches/r5rs/sigscheme/script/build_func_table.rb
Log:
* sigscheme/Makefile.am
- add scm_decl.rb to BUILD_FUNCTBL_SOURCES
* sigscheme/script/build_func_table.rb
- remove duplicate code and require scm_decl.rb
Modified: branches/r5rs/sigscheme/Makefile.am
===================================================================
--- branches/r5rs/sigscheme/Makefile.am 2005-11-19 04:11:29 UTC (rev 2165)
+++ branches/r5rs/sigscheme/Makefile.am 2005-11-19 05:09:36 UTC (rev 2166)
@@ -18,6 +18,7 @@
BUILD_FUNCTBL = ./script/build_func_table.rb
BUILD_FUNCTBL_SOURCES = \
$(BUILD_FUNCTBL) \
+ ./script/scm_decl.rb
./script/functable-header.txt \
./script/functable-footer.txt
Modified: branches/r5rs/sigscheme/script/build_func_table.rb
===================================================================
--- branches/r5rs/sigscheme/script/build_func_table.rb 2005-11-19 04:11:29 UTC (rev 2165)
+++ branches/r5rs/sigscheme/script/build_func_table.rb 2005-11-19 05:09:36 UTC (rev 2166)
@@ -32,73 +32,8 @@
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#===========================================================================
+require 'script/scm_decl.rb'
-# $1 :prototype ScmObj ScmOp_call_with_values(ScmObj producer, ScmObj consumer, ScmEvalState *eval_state)
-# $2 :ret ScmObj
-# $3 :func ScmOp_call_with_values
-# $4 :prefix Op
-# $5 :func_body call_with_values
-# $6 :args ScmObj producer, ScmObj consumer, ScmEvalState *eval_state
-# $7 :proc call-with-values
-# $8 :register_func ProcedureFixedTailRec2
-# $9 :functype_prefix Procedure
-# $10 :functype_spec FixedTailRec2
-SCM_DECL_RE = /\n((ScmObj)\s+(Scm(Op|Exp)_(\w+))\(([^{]+)\))[ \t]*\n\s*\{[^{}]+DECLARE_FUNCTION\(\s*\"([^\"]+)\"[\s,]+([^\s,]+)\)/m
-
-class String
- def scan_scm_decl
- res = []
- scan(SCM_DECL_RE) { |prototype, ret, func, prefix, func_body, args, proc, register_func, functype_prefix, functype_spec|
- decl = {
- :prototype => prototype.gsub(/\s+/, " "),
- :ret => ret,
- :func => func,
- :prefix => prefix,
- :func_body => func_body,
- :args => args.gsub(/\s+/, " "),
- :proc => proc,
- :register_func => "Scm_Register" + register_func,
- :functype_prefix => functype_prefix,
- :functype_spec => functype_spec,
- }
- res << yield(decl)
- }
- res
- end
-end
-
-def scm_func_table_entry(decl)
- proc, func, register_func = decl.values_at(:proc, :func, :register_func)
- "{ \"#{proc}\", (ScmBuiltinFunc)#{func}, (ScmRegisterFunc)#{register_func} }"
-end
-
-def scm_func_register_exp(decl)
- proc, func, register_func = decl.values_at(:proc, :func, :register_func)
- "#{register_func}(\"#{proc}\", #{func})"
-end
-
-def scm_generate_func_table_body(str)
- str.scan_scm_decl { |decl|
- entry = scm_func_table_entry(decl)
- " #{entry},\n"
- }.join
-end
-
-def scm_generate_func_register_exps(str)
- str.scan_scm_decl { |decl|
- exp = scm_func_register_exp(decl)
- " #{exp};\n"
- }.join
-end
-
-def scm_generate_func_prototypes(str)
- str.scan_scm_decl { |decl|
- "#{decl[:prototype]};\n"
- }.join
-end
-
-#####################################################################
-
def search_declare_function(filename)
puts " /* #{filename} */"
f = File.new(filename)
More information about the uim-commit
mailing list