> 
> Finally, I've implemented full support of eval in CL arguments. You
> may find it here http://github.com/mbait/fricas/tree/arg_values Just
> build and try "axiom -eval ")set" -nosman". However, one issue still
> remains - at least sbcl doesn't allow to pass a string with spaces, it
> splits the string onto separate args. I don't know whether this is the
> same for all Lisp-s.
>

Trying on sbcl-based FriCAS:

bash-3.2$ ax-build26/target/x86_64-unknown-linux/bin/AXIOMsys --eval "foo bar"
Checking for foreign routines
AXIOM=NIL
spad-lib="/lib/libspad.so"
                 FriCAS (AXIOM fork) Computer Algebra System 
                         Version: FriCAS 2010-09-22
              Timestamp: Saturday December 4, 2010 at 11:53:04 
-----------------------------------------------------------------------------
   Issue )copyright to view copyright notices.
   Issue )summary for a summary of useful system commands.
   Issue )quit to leave FriCAS and return to shell.
-----------------------------------------------------------------------------
 
(1) -> )lisp sb-ext::*posix-argv*

Value = ("ax-build26/target/x86_64-unknown-linux/bin/AXIOMsys" "--eval"
         "foo bar")

I see string with space inside, so something else is probably
responsible for splitting arguments.

Actually, sbcl seem to be easy case, it seems to behave better than
its docomentation suggests.  clisp and Closuse CL are problematic.

AFAICS if you give only one argument Closuse CL treats it as name of
image (this make no sense for executable, but is still done...).
Also Closuse CL treats many things which start with '-' and single
letter as its option.  In particluar it wants to take over '--eval'.
One has to put '--' on command line to stop Closuse CL from
searching the rest of command line for its arguments.

clisp seem to be worse (it signals errors for anyting it does not
recognize), but also for clisp '--' in command line protects rest
of command line form beeing treated as an argument.

To the moment I did not check ecl and gcl, but I think that we need
'--' in command line.  Then command line parsing code in AXIOMsys
should remove '--'.

> On Wed, Jan 12, 2011 at 10:27 AM, Alexander Solovets
> <[email protected]> wrote:
> > I'd wirte "--eval" argument extraction too if I knew how to process
> > lists in Boot in terms of Lisp (car and cdr). Also, please, notice
> > that the various Lisp dialects may return CL list both with 0th
> > argument and without it, so extraction function should take that into
> > account.
> >
> > On Wed, Jan 12, 2011 at 10:20 AM, Alexander Solovets
> > <[email protected]> wrote:
> >> Here is the patch providing access to command-line arguments for
> >> various Lisp-s(excluding poplog)
> >> https://github.com/mbait/fricas/commit/488721e72aa495103cfc09475a0e4a706=
> ef682ac
> >>
> >> On Wed, Jan 12, 2011 at 3:52 AM, Waldek Hebisch
> >> <[email protected]> wrote:
> >>> Andrey G. Grozin wrote:
> >>>>
> >>>> On Mon, 10 Jan 2011, Waldek Hebisch wrote:
> >>>> > Yes, that is useful. =A0I think that 'pre' is too unspecific, what
> >>>> > about 'FRICAS_PREINIT' and '--preinit'? =A0Also I similar way we can
> >>>> > add 'FRICAS_EVAL_LISP' and '--eval-lisp' to evaluate arbitrary
> >>>> > piece of Lisp code. =A0And maybe 'FRICAS_EVAL' and '--eval' for
> >>>> > interpreter input. =A0The execution order would be Lisp, then
> >>>> > preinit then eval.
> >>>> It seems that --eval provides all the necessary functionality.
> >>>> --eval ')lisp (lisp-code)'
> >>>> --eval ')read something.input'
> >>>> The file something.input can contain )lisp lines
> >>>> All possibilities are covered.
> >>>>
> >>>> This should be evaluated after .fricas.input but before an interactive
> >>>> session, so that something.input could adjust things from .fricas.inpu=
> t
> >>>> for the purpose of the present session (for example, a session from
> >>>> TeXmacs or from emacs).
> >>>>
> >>>
> >>> The following (minimally tested) patch implements 'FRICAS_EVAL' in
> >>> AXIOMsys:
> >>>
> >>>
> >>> Index: src/interp/int-top.boot
> >>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> >>> --- src/interp/int-top.boot =A0 =A0 (revision 972)
> >>> +++ src/interp/int-top.boot =A0 =A0 (working copy)
> >>> @@ -93,11 +93,17 @@
> >>> =A0$ncmMacro :=3D =A0 =A0 =A0 =A0 =A0 =A0NIL
> >>> =A0$ncmPhase :=3D =A0 =A0 =A0NIL
> >>>
> >>> +do_pre_eval() =3D=3D
> >>> + =A0 =A0ec :=3D getEnv('"FRICAS__EVAL")
> >>> + =A0 =A0if ec then
> >>> + =A0 =A0 =A0 =A0CATCH('SPAD__READER, CATCH('top__level, parseAndEvalSt=
> r ec))
> >>> +
> >>> =A0spad() =3D=3D
> >>> =A0 -- starts the interpreter, read in profiles, etc.
> >>> =A0 $PrintCompilerMessageIfTrue: local
> >>> =A0 setOutputAlgebra "%initialize%"
> >>> =A0 readSpadProfileIfThere()
> >>> + =A0do_pre_eval()
> >>> =A0 runspad()
> >>> =A0 'EndOfSpad
> >>>
> >>>
> >>> --
> >>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0Waldek Hebis=
> ch
> >>> [email protected]
> >>>
> >>> --
> >>> You received this message because you are subscribed to the Google Grou=
> ps "FriCAS - computer algebra system" group.
> >>> To post to this group, send email to [email protected].
> >>> To unsubscribe from this group, send email to fricas-devel+unsubscribe@=
> googlegroups.com.
> >>> For more options, visit this group at http://groups.google.com/group/fr=
> icas-devel?hl=3Den.
> >>>
> >>>
> >>
> >
> 
> --=20
> You received this message because you are subscribed to the Google Groups "=
> FriCAS - computer algebra system" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to fricas-devel+unsubscribe@goog=
> legroups.com.
> For more options, visit this group at http://groups.google.com/group/fricas=
> -devel?hl=3Den.
> 
> 


-- 
                              Waldek Hebisch
[email protected] 

-- 
You received this message because you are subscribed to the Google Groups 
"FriCAS - computer algebra system" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/fricas-devel?hl=en.

Reply via email to