[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Axiom-mail] Aldor compatibility
From: |
Stephen Wilson |
Subject: |
Re: [Axiom-mail] Aldor compatibility |
Date: |
Mon, 20 Sep 2004 03:39:58 -0400 |
User-agent: |
Mutt/1.4.2i |
Hello,
> I have been reading Aldor recently, which I find very nice, and as a
> first project I was happily planning to wrap up some numerical and
> graphical code into aldor (since aldor lacks these), but I was
> recently pointed to axiom, and now have some questions:
What type of code are you working on? I would be quite interested in
knowing.
> 1. What is the extent of compatibility between aldor 1.0.2 as posted
> in www.aldor.org and cvs axiom? Does the current version of aldor
> always generate code that runs in cvs version of axiom? If not, maybe
> it would be a good idea to post a page with the differences and things
> to avoid.
I have not read the docs for quite some time, but the `authoritative'
account as given in the aldor compiler user guide at
www.aldor.org/docs/HTML/chap30.html (aldor.org seems to be down at
this time, so I am unable to verify that this is a proper link) gave a
recipe for interfacing Aldor and Axiom which did not work for
me. Undoubtedly things have changed since the guides writing.
I am unsure as to when and if Aldor will officially support its former
role as a library compiler for Axiom, or when and if Axiom will
officially support Aldor. Perhaps someone else on this list could
comment on this.
However, I have managed to get Aldor and Axiom to cooperate on _very_
simple examples. I cannot give deep advice on as to why this works
since Axiom internals are still a mystery to me. However, this may
provide a means for you to experiment, and as such I hope it is
useful.
The following might seem cryptic and not very clear. I apologize for this,
but time is not on my side at the moment.
Consider the naive factorial function in Aldor:
#include "axllib"
fact(n: Integer): Integer == {
n <= 1 => 1;
res: Integer := 1;
while n > 1 repeat {
res := res * n;
n := prev n;
}
res
}
Say the above is in the file `fact.as'. If you invoke cvs Axiom from
within the same directory as `fact.as' and try to )compile it you may
very well get an error of the form:
(1) -> )compile fact
Compiling AXIOM source code from file /home/steve/tmp/fact.as
using AXIOM-XL compiler and options
-O -Fasy -Fao -Flsp -laxiom -Mno-AXL_W_WillObsolete -DAxiom -Y $AXIOM/algebra
Use the system command )set compiler args to change these
options.
>> System error:
#p"/home/steve/local/opt/axiom/mnt/linux/compiler/bin/" is not of type STRING.
protected-symbol-warn called with (NIL)
I do not know how to compile Aldor files from Axiom, but note the
command line arguments given to the AXIOM-XL (now Aldor) compiler. In
particular note the command line argument `-Y $AXIOM/algebra' The sole
purpose of this is to provide a path to the library
`libaxiom.al'. This is contained in the Axiom source tree under
`axiom/src/share/algebra' but not installed with the system after a
build. Thus, try invoking Aldor as follows, assuming $AXIOMSRC points
to the top level of the Axiom _source_ tree:
aldor -O -Fasy -Fao -Flsp -laxiom -Mno-AXL_W_WillObsolete \
-DAxiom -Y $AXIOMSRC/src/share/algebra fact.as
This should produce three files: fact.asy, fact.ao, and fact.lsp.
Now, within the Aldor distribution comes a file called `runtime.lsp'
under aldor/linux/1.0.2/lib/runtime.lsp. For me, the full path to this
file is /home/steve/local/opt/aldor/linux/1.0.2/lib/runtime.lsp.
I can now invoke Axiom where fact.as and friends were compiled and
say:
(1) -> )library fact
Reading /home/steve/tmp/fact.asy
(1) -> )lisp (load "/home/steve/local/opt/aldor/linux/1.0.3/lib/runtime.lsp")
Value = T
(1) -> fact 4
(1) 24
Type: PositiveInteger
> 2. If I use aldor's import and export keywords for wrapping C and
> fortran code, will it be portable to axiom? Or does axiom have a
> separate ffi?
I'm sorry, but I do not know the answer to this question. I suggest
experimenting with the technique above, though your mileage may vary.
> 3. I know some C, f77 and Scilab but no Octave. I see that one of the
> to-do things is translating octave's numerical code into aldor; which
> kind of routines are missing from aldor and have higher priority?
I am unaware of the Octave -> Aldor translation. The principle Aldor
libraries I am familiar with are libaldor (the standard Aldor library)
and libalgebra (similar in some respects to Axioms mathematical
hierarchy). Both of these are very weak in terms of floating point
numerics. I know there is work underway to improve the
situation. Perhaps with a description of your work I can let you know
how it might fit in with current efforts.
I hope the above is useful to you.
Cheers,
Steve
Re: [Axiom-mail] Aldor compatibility, Mike Dewar, 2004/09/20