Re: Using regular CL packages in STELLA-systems
Hans Chalupsky <[email protected]> Thu, 18 Oct 2007 15:49:40 -0700
| Newsgroups | gmane.comp.ai.powerloom |
|---|---|
| Message-ID | <[email protected]> |
Magnus,
to include calls to a particular target language function in STELLA
code you have to use the `verbatim' construct. Sorry for the lacking
documentation, but there are lots of examples in the
sources/stella/primal.ste file :-). For example:
(defmethod (shift-right INTEGER) ((arg INTEGER) (count INTEGER))
:documentation "Shift `arg' to the right by `count' positions and
0-extend from the left if `arg' is positive or 1-extend if it is
negative. This is an arithmetic shift that preserve the sign of `arg'
and is equivalent to dividing `arg' by 2** `count'."
:globally-inline? TRUE :public? TRUE
(return
(verbatim
:common-lisp (CL:ash arg (CL:the CL:FIXNUM (CL:- count)))
:cpp "(arg >> count)"
:java "(arg >> count)")))
So, there is one entry for each target language. If you only
translate into Lisp, you don't have to supply the others.
Note, that if you only use CL package functions and no special read
syntax, you can supply the expression as a regular cons list.
Otherwise, you have to stick it inside a string. For example:
(defun stella-call-gc ()
(verbatim :common-lisp "#+allegro (excl:gc cl:t)"))
This won't work:
(defun stella-call-gc ()
(verbatim :common-lisp (excl:gc cl:t)))
Note that you have to explicitly qualify all CL symbols, since none of
them are imported into the STELLA package.
Hans
>>>>> Magnus Malm <[email protected]> writes:
> Hello.
> I have recently started to look into PowerLoom and STELLA, as I am trying to
> build a knowledgebase for a planner in a p2p network of robots, cameras,
> etc. What I have is a lisp-interface (cmucl-19d based
> atm) to the actual core functions of the network (getting id's, the
> various components tuple values, etc).
> What I need is a way to call the functions, defined in the interface
> package, in my stella code. I've tried adding the package to
> :required-systems in my defsystem, though I'm not sure what that keyword do
> exactly (Documentation is kind of lacking, sources not counted). All I get
> is a warning about undefined functions.
> In slime's REPL I can invoke the interface functions while in the STELLA
> package just fine. That is, at the REPL I can do, e.g,
STELLA> (<package-name>::<function> ...)
> But if I add e.g. (<package-name>::<function>) to my stella source, I get
> Undefined function |<PACKAGE-NAME>::<FUNCTION>| when I make the system
> and errrors about the same functions that they're undefined when I try to
> run my system.
> So I guess there's something wrong with my stella system and/or the
> translation from stella to cl. Or is it perhaps so that one cannot include
> regular cl packages in a stella-system? If so, are there any other way one
> can communicate with other non-stella packages?
> Any help is deeply appreciated.
> Regards
> --
> Magnus Malm
> Hello.<br><br>I have recently started to look into PowerLoom and STELLA, as I am trying to build a knowledgebase for a planner in a p2p network of robots, cameras, etc. What I have is a lisp-interface (cmucl-19d based atm) to the actual core functions of the network (getting id's, the various components tuple values, etc).
> <br> <br>What I need is a way to call the functions, defined in the interface package, in my stella code. I've tried adding the package to :required-systems in my defsystem, though I'm not sure what that keyword do exactly (Documentation is kind of lacking, sources not counted). All I get is a warning about undefined functions.
> <br><br>In slime's REPL I can invoke the interface functions while in the STELLA package just fine. That is, at the REPL I can do, e.g, <br><br>STELLA>(<package-name>::<function> ...) <br><br>But if I add
> e.g. (<package-name>::<function>) to my stella source, I get Undefined function |<PACKAGE-NAME>::<FUNCTION>| when I make the system and errrors about the same functions that they're undefined when I try to run my system.
> <br><br>So I guess there's something wrong with my stella system and/or the translation from stella to cl. Or is it perhaps so that one cannot include regular cl packages in a stella-system? If so, are there any other way one can communicate with other non-stella packages?
> <br clear="all"><br>Any help is deeply appreciated.<br><br>Regards<br>-- <br>Magnus Malm
> _______________________________________________
> powerloom-forum mailing list
> [email protected]
> http://mailman.isi.edu/mailman/listinfo/powerloom-forum