This is the mail archive of the
kawa@sources.redhat.com
mailing list for the Kawa project.
Re: macros and compilation
- To: per at bothner dot com
- Subject: Re: macros and compilation
- From: Marco Vezzoli <marco dot vezzoli at st dot com>
- Date: Wed, 23 Aug 2000 07:44:44 +0200
- Cc: kawa at sourceware dot cygnus dot com
- References: <m2r97hnwr9.fsf@bothner.com>
per@bothner.com wrote:
>
> Marco Vezzoli <marco.vezzoli@st.com> writes:
>
> > Can I export a macro from a module?
>
> You should be able to.
>
> > I use (module-exports ...) to define exported methods because it's
> > cleaner than read all the file looking for non-private definitions, but
> > this doesn't seems to be the right way.
>
> Why not?
> --
> --Per Bothner
> per@bothner.com http://www.bothner.com/~per/
Maybe it's my fault.
This is the skeleton of the code I try to compile
(module-name <macmod>)
(module-export das-search)
(define-constant debug #t)
(define-syntax das-search
(syntax-rules (* where)
((das-search * where (key value) ...)
(%das-search-all (list `(key . ,value) ...)))
((das-search param where (key value) ...)
(%das-search 'param (list `(key . ,value) ...)))
((das-search param )
(%das-search 'param))))
(define (%das-search param #!optional conditions )
(if (not conditions)
(format debug "searching for ~A " param )
(format debug "searching for ~A where ~S" param conditions)))
(define (%das-search-all conditions)
(format debug "searching for all where ~A\n" conditions))
and this is the error
#|kawa:1|# (compile-file "macmod.scm" "macmod")
kawa.lang.GenericError: read error reading file:
gnu.text.SyntaxException
at kawa.lang.CompileFile.apply2(Compiled Code)
at gnu.mapping.Procedure2.applyN(Compiled Code)
at gnu.expr.ApplyExp.eval(Compiled Code)
at gnu.expr.ModuleExp.evalModule(Compiled Code)
at kawa.Shell.run(Compiled Code)
at kawa.Shell.run(Compiled Code)
at kawa.Shell.run(Compiled Code)
at kawa.repl.main(Compiled Code)
if I comment out the module-export form the compilation runs well.
Compiling with -C yelds
macmod.scm:2:16: 'das-search' exported but never defined
only if there is the module-export form.
I used the compile-file procedure because of some problem I had with the
module system in kawa 1.6.66; I need to load some modules from java and
evaluating a require didn't work; now I use this code
scm=new Scheme();
Scheme.registerEnvironment();
Environment.setCurrent(scm.getEnvironment());
load.loadCompiled("something.zip",Environment.getCurrent());
load.loadCompiled("something_else.zip",Environment.getCurrent());
but this works well with files compiled with compile-file.
I don't know if this kind of compilation preserves modules properties
but I can use the require form without problem in sources.
Please let me know if there is a better way to do this; the goal is to
have a scheme instance with some bindings from compiled sources in order
to perform evaluations; sources are organized in modules without cyclic
dependencies.
--
(--cafe babe--)
Marco Vezzoli marco.vezzoli@st.com
CR&D Intranet Developement STMicroelectronics
tel. +39 039 603 6852 fax. +39 039 603 5055