On Tue, Mar 16, 2021 at 08:55:02PM +0800, Qian Yun wrote:
> The patch is here, discussions are welcome.  If my idea is accepted,
> I can refine the patch a bit more.
> 
> It uses "argv[0]" to determine the path of "FRICASsys" binary,
> not very reliable, but portable.
> 
> So the logic is to use env var "FRICAS" first if it exists,
> then use "newroot" if it is passed as function argument,
> then use "$spadroot" which is build time value, use if it still exists,
> then use the parent directory of "FRICASsys", if it contains
> "algebra/compress.daase".

In general that is very reasonable.  I would probably look
at "algebra/interp.daase" as it is more fundamental.  I am
not sure if we always have "argv[0]" (more precisely, if
setting argv[0] to null is merely perverse or illegal).

> diff --git a/src/interp/util.lisp b/src/interp/util.lisp
> index e0466835..a2133e31 100644
> --- a/src/interp/util.lisp
> +++ b/src/interp/util.lisp
> @@ -108,8 +108,16 @@ where the [[${FRICAS}]] variable points to installed
> tree.
>  ;;; and default to the {\bf \$spadroot} variable (which was the value
>  ;;; of the {\bf FRICAS} shell variable at build time) if we can't.
>  (defun initroot (&optional (newroot nil))
> -  (reroot (or (|getEnv| "FRICAS") newroot $spadroot
> -              (error "setenv FRICAS or (setq $spadroot)"))))
> +  (reroot (or (|getEnv| "FRICAS") newroot
> +              (cond
> +               ((|fricas_probe_file| $spadroot) $spadroot)
> +               ((|fricas_probe_file|
> +                 (concatenate 'string (directory-namestring (car
> (|getCLArgs|)))
> +                              "/../algebra/compress.daase"))
> +                (concatenate 'string (directory-namestring (car
> (|getCLArgs|)))
> +                             "/../"))
> +               (t (error "setenv FRICAS or (setq $spadroot)")))
> +              )))
> 
>  ;;; Gnu Common Lisp (GCL) (at least 2.6.[78]) requires some changes
>  ;;; to the default memory setup to run FriCAS efficiently.
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "FriCAS - computer algebra system" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/fricas-devel/23d5ab5e-c663-9b6c-91b4-d834c10736ac%40gmail.com.

-- 
                              Waldek Hebisch

-- 
You received this message because you are subscribed to the Google Groups 
"FriCAS - computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/fricas-devel/20210317141534.GA31626%40math.uni.wroc.pl.

Reply via email to