[PATCH] use pathname-directory instead of directory-namestring in daase.lisp

7 views
Skip to first unread message

Qian Yun

unread,
Jan 29, 2024, 8:22:24 AM1/29/24
to fricas-devel
This change is required by Allegro CL.

For a string STR1 (such as "INT"), (directory-namestring STR1)
returns "" for other Lisps, but Allegro returns "./".

Anyway, for the use case in daase.lisp, "pathname-directory"
is more appropriate: it returns nil if the argument contains
no directory part.

The other usage of "directory-namestring" in daase is fine,
because the argument is valid path.

- Qian

diff --git a/src/interp/daase.lisp b/src/interp/daase.lisp
index 97d50a8c..87213a72 100644
--- a/src/interp/daase.lisp
+++ b/src/interp/daase.lisp
@@ -488,7 +488,7 @@ database.
; system files is only the filename and extension. for user files it
; contains the full pathname. when the database is first opened the
; sourcefile slot contains system names. the lookup function
-; has to prefix the |$spadroot| information if the directory-namestring is
+; has to prefix the |$spadroot| information if the pathname-directory is
; null (we don't know the real root at database build time).
; a object-hash table is set up to look up nrlib and ao information.
; this slot is empty until a user does a )library call. we remember
@@ -790,7 +790,7 @@ database.
(sourcefile (setf (|database-sourcefile| struct) data))))
(case key ; fixup the special cases
(sourcefile
- (when (and data (string= (directory-namestring data) "")
+ (when (and data (null (pathname-directory data))
(string= (pathname-type data) "spad"))
(setq data
(concatenate 'string |$spadroot| "/../../src/algebra/" data))))
@@ -801,11 +801,11 @@ database.
(object ; fix up system object pathname
(if (consp data)
(setq data
- (if (string= (directory-namestring (car data)) "")
+ (if (null (pathname-directory (car data)))
(concatenate 'string |$spadroot| "/algebra/" (car data)
"." |$lisp_bin_filetype|)
(car data)))
- (when (and data (string= (directory-namestring data) ""))
+ (when (and data (null (pathname-directory data)))
(setq data (concatenate 'string |$spadroot| "/algebra/" data
"." |$lisp_bin_filetype|)))))))
data))

Waldek Hebisch

unread,
Feb 6, 2024, 8:42:16 PM2/6/24
to fricas...@googlegroups.com
On Mon, Jan 29, 2024 at 09:22:20PM +0800, Qian Yun wrote:
> This change is required by Allegro CL.
>
> For a string STR1 (such as "INT"), (directory-namestring STR1)
> returns "" for other Lisps, but Allegro returns "./".
>
> Anyway, for the use case in daase.lisp, "pathname-directory"
> is more appropriate: it returns nil if the argument contains
> no directory part.
>
> The other usage of "directory-namestring" in daase is fine,
> because the argument is valid path.

OK.

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