Re: Using regular CL packages in STELLA-systems
"Magnus Malm" <[email protected]> Fri, 19 Oct 2007 11:41:24 +0200
| Newsgroups | gmane.comp.ai.powerloom |
|---|---|
| Message-ID | <[email protected]> |
Thanks alot for the quick answer Hans. This solved my problem right away. :) 2007/10/19, Hans Chalupsky <[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 > > Regards, -- Magnus Malm _______________________________________________ powerloom-forum mailing list [email protected] http://mailman.isi.edu/mailman/listinfo/powerloom-forum