From def57348c1b3e855e0ab72b4c019a429f866427a Mon Sep 17 00:00:00 2001 From: Yuichi Nishiwaki Date: Sun, 6 Apr 2014 10:29:49 +0900 Subject: [PATCH] [refactor] auto escape library filenames --- etc/libemb.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/etc/libemb.py b/etc/libemb.py index 34e28bf3..6960f822 100644 --- a/etc/libemb.py +++ b/etc/libemb.py @@ -4,14 +4,22 @@ from collections import OrderedDict outfn = 'src/load_piclib.c' +libs = [ + 'piclib/built-in.scm', + 'piclib/srfi/1.scm', + 'piclib/srfi/26.scm', + 'piclib/srfi/95.scm', +] + if os.path.exists(outfn): os.remove(outfn) piclibs = OrderedDict() -piclibs['piclib/built-in.scm'] = 'piclib_built_in' -piclibs['piclib/srfi/1.scm'] = 'piclib_srfi_1' -piclibs['piclib/srfi/26.scm'] = 'piclib_srfi_26' -piclibs['piclib/srfi/95.scm'] = 'piclib_srfi_95' +for lib in libs: + vname = lib[:-4] + vname = re.sub(r'/', r'_', vname) + vname = re.sub(r'-', r'_', vname) + piclibs[lib] = vname def escape_scm(infn, outfn, vname): with open(outfn, 'a') as output: