[PATCH] use $spadroot instead of (|getEnv| "FRICAS")

3 views
Skip to first unread message

Qian Yun

unread,
Nov 15, 2023, 5:14:31 AM11/15/23
to fricas-devel
This change has the following advantages:

1. Allows FRICASsys built with ECL to run without $FRICAS.
This failed due to ECL loads database differently.

2. Fix ")summary" and ")copyright" in FRICASsys.

3. $spadroot is canonicalized absolute path, this prevents
errors if we change directory in FriCAS while $FRICAS is relative.

- Qian

diff --git a/src/interp/br-data.boot b/src/interp/br-data.boot
index c1eaa4f6..496e5580 100644
--- a/src/interp/br-data.boot
+++ b/src/interp/br-data.boot
@@ -197,13 +197,13 @@ dbHasExamplePage conname ==
sname := STRINGIMAGE conname
abb := constructor? conname
ucname := UPCASE STRINGIMAGE abb
- pathname :=STRCONC(getEnv
'"FRICAS",'"/share/hypertex/pages/",ucname,'".ht")
+ pathname :=STRCONC($SPADROOT, '"/share/hypertex/pages/", ucname, '".ht")
isExistingFile pathname => INTERN STRCONC(sname,'"XmpPage")
nil

dbReadComments(n) ==
n = 0 => '""
- instream := MAKE_INSTREAM(STRCONC(getEnv('"FRICAS"),
'"/algebra/comdb.text"))
+ instream := MAKE_INSTREAM(STRCONC($SPADROOT, '"/algebra/comdb.text"))
FILE_-POSITION(instream,n)
line := read_line instream
k := dbTickIndex(line,1,1)
diff --git a/src/interp/br-search.boot b/src/interp/br-search.boot
index d67a397f..310340c3 100644
--- a/src/interp/br-search.boot
+++ b/src/interp/br-search.boot
@@ -205,7 +205,7 @@ isFilterDelimiter? c == MEMQ(c,$pmFilterDelimiters)

grepSplit(lines,doc?) ==
if doc? then
- instream2 := OPEN STRCONC(getEnv '"FRICAS",'"/algebra/libdb.text")
+ instream2 := OPEN STRCONC($SPADROOT, '"/algebra/libdb.text")
cons := atts := doms := nil
while lines is [line, :lines] repeat
if doc? then
diff --git a/src/interp/daase.lisp b/src/interp/daase.lisp
index 12f71d31..bcd5f01e 100644
--- a/src/interp/daase.lisp
+++ b/src/interp/daase.lisp
@@ -307,7 +307,7 @@ database.
"call the aldor compiler"
(#| system::system |#
obey
- (concatenate 'string (|getEnv| "FRICAS") "/compiler/bin/aldor "
+ (concatenate 'string $spadroot "/compiler/bin/aldor "
flags " " file)))

(defun resethashtables (display_messages)
@@ -412,7 +412,7 @@ database.
|Integer| |List| |OutputForm|))
(dolist (con constr)
(let ((c (concatenate 'string
- (|getEnv| "FRICAS") "/algebra/"
+ $spadroot "/algebra/"
(string (getdatabase con 'abbreviation)) "."
|$lisp_bin_filetype|)))
(if display_messages
(format t " preloading ~a.." c))
@@ -1426,7 +1426,7 @@ database.

;; following needs to happen inside restart since $FRICAS may change
(defun |createInitializers2| ()
- (let ((asharprootlib (strconc (|getEnv| "FRICAS") "/aldor/lib/")))
+ (let ((asharprootlib (strconc $spadroot "/aldor/lib/")))
(set-file-getter (strconc asharprootlib "runtime"))
(set-file-getter (strconc asharprootlib "lang"))
(set-file-getter (strconc asharprootlib "attrib"))
diff --git a/src/interp/ht-root.boot b/src/interp/ht-root.boot
index 2223fd36..ddef59f0 100644
--- a/src/interp/ht-root.boot
+++ b/src/interp/ht-root.boot
@@ -130,7 +130,7 @@ htGlossPage(htPage,pattern,tryAgain?) ==
grepForm := mkGrepPattern(filter,'none)
$key: local := 'none
results := applyGrep(grepForm,'gloss)
- defstream := MAKE_INSTREAM(STRCONC(getEnv '"FRICAS",
+ defstream := MAKE_INSTREAM(STRCONC($SPADROOT,
'"/algebra/glossdef.text"))
lines := gatherGlossLines(results,defstream)
heading :=
diff --git a/src/interp/htcheck.boot b/src/interp/htcheck.boot
index 55c3e424..a6c768e3 100644
--- a/src/interp/htcheck.boot
+++ b/src/interp/htcheck.boot
@@ -80,7 +80,7 @@ $primitiveHtCommands := '(

buildHtMacroTable() ==
$htMacroTable := MAKE_HASHTABLE('EQUAL)
- fn := CONCAT(getEnv '"FRICAS", '"/share/hypertex/pages/util.ht")
+ fn := CONCAT($SPADROOT, '"/share/hypertex/pages/util.ht")
if PROBE_-FILE(fn) then
instream := MAKE_INSTREAM(fn)
while not EOFP instream repeat
diff --git a/src/interp/i-syscmd.boot b/src/interp/i-syscmd.boot
index 8de90f7b..3b89ad8c 100644
--- a/src/interp/i-syscmd.boot
+++ b/src/interp/i-syscmd.boot
@@ -706,9 +706,9 @@ withAsharpCmd args ==
--% )copyright -- display copyright notice

summary l ==
- OBEY STRCONC ('"cat ",getEnv('"FRICAS"),'"/lib/summary")
+ OBEY STRCONC ('"cat ", $SPADROOT, '"/lib/summary")
copyright () ==
- OBEY STRCONC ('"cat ",getEnv('"FRICAS"),'"/lib/copyright")
+ OBEY STRCONC ('"cat ", $SPADROOT, '"/lib/copyright")

--% )credits -- display credit list

diff --git a/src/interp/util.lisp b/src/interp/util.lisp
index 5e53fa8b..1e81f07d 100644
--- a/src/interp/util.lisp
+++ b/src/interp/util.lisp
@@ -250,7 +250,7 @@ After this function is called the image is clean and
can be saved.
(cond
((load "./exposed" :verbose nil :if-does-not-exist nil)
'|done|)
- ((load (concat (|getEnv| "FRICAS") "/algebra/exposed")
+ ((load (concat $spadroot "/algebra/exposed")
:verbose nil :if-does-not-exist nil)
'|done|)
(t '|failed|) ))

Waldek Hebisch

unread,
Nov 18, 2023, 7:50:28 AM11/18/23
to fricas...@googlegroups.com
On Wed, Nov 15, 2023 at 06:14:26PM +0800, Qian Yun wrote:
> This change has the following advantages:
>
> 1. Allows FRICASsys built with ECL to run without $FRICAS.
> This failed due to ECL loads database differently.
>
> 2. Fix ")summary" and ")copyright" in FRICASsys.
>
> 3. $spadroot is canonicalized absolute path, this prevents
> errors if we change directory in FriCAS while $FRICAS is relative.

I would change '$spadroot' so that we have '$spadroot' in Boot
and |$spadroot| in Lisp. Current use was fine when '$spadroot'
was limited to small ghetto, but it is better to avoid
spadroot/SPADROOT irregularity when usig it in more places.

Concerning your motivation, IMO when using FriCAS FRICAS
environment variable should be defined and be an absolute path.
But if you want the change, then go on.

--
Waldek Hebisch
Reply all
Reply to author
Forward
0 new messages