diff options
Diffstat (limited to 'src/interp')
-rw-r--r-- | src/interp/Makefile.in | 6 | ||||
-rw-r--r-- | src/interp/Makefile.pamphlet | 8 | ||||
-rw-r--r-- | src/interp/as.boot | 4 | ||||
-rw-r--r-- | src/interp/br-data.boot | 13 | ||||
-rw-r--r-- | src/interp/br-saturn.boot | 6 | ||||
-rw-r--r-- | src/interp/br-search.boot | 4 | ||||
-rw-r--r-- | src/interp/c-doc.boot | 12 | ||||
-rw-r--r-- | src/interp/construc.lisp | 8 | ||||
-rw-r--r-- | src/interp/daase.lisp | 10 | ||||
-rw-r--r-- | src/interp/fortcall.boot | 13 | ||||
-rw-r--r-- | src/interp/ht-root.boot | 9 | ||||
-rw-r--r-- | src/interp/i-syscmd.boot | 18 | ||||
-rw-r--r-- | src/interp/nlib.lisp | 30 | ||||
-rw-r--r-- | src/interp/obey.lisp | 8 | ||||
-rw-r--r-- | src/interp/sys-os.boot | 59 | ||||
-rw-r--r-- | src/interp/sys-utility.boot | 15 | ||||
-rw-r--r-- | src/interp/util.lisp | 15 |
17 files changed, 142 insertions, 96 deletions
diff --git a/src/interp/Makefile.in b/src/interp/Makefile.in index 26fd1f92..375a9857 100644 --- a/src/interp/Makefile.in +++ b/src/interp/Makefile.in @@ -18,7 +18,8 @@ LOADSYS= $(axiom_build_bindir)/lisp$(EXEEXT) SAVESYS= interpsys$(EXEEXT) AXIOMSYS= $(axiom_target_bindir)/AXIOMsys$(EXEEXT) -OBJS= vmlisp.$(FASLEXT) hash.$(FASLEXT) \ +OBJS= sys-os.$(FASLEXT) \ + vmlisp.$(FASLEXT) hash.$(FASLEXT) \ diagnostics.$(FASLEXT) sys-driver.$(FASLEXT) \ sys-utility.$(FASLEXT) macros.$(FASLEXT) \ unlisp.$(FASLEXT) \ @@ -758,6 +759,9 @@ sys-utility.$(FASLEXT): sys-utility.boot vmlisp.$(FASLEXT) vmlisp.$(FASLEXT): vmlisp.lisp boot-pkg.$(FASLEXT) $(BOOTSYS) -- --compile --output=$@ --load-directory=. $< +sys-os.$(FASLEXT): sys-os.boot boot-pkg.$(FASLEXT) + $(BOOTSYS) -- --compile --output=$@ --load-directory=. $< + boot-pkg.$(FASLEXT): boot-pkg.lisp $(BOOTSYS) -- --compile --output=$@ $< diff --git a/src/interp/Makefile.pamphlet b/src/interp/Makefile.pamphlet index 93b32464..68acfbf6 100644 --- a/src/interp/Makefile.pamphlet +++ b/src/interp/Makefile.pamphlet @@ -109,7 +109,8 @@ compiled. \subsection{The Spad interpreter and compiler} <<environment>>= -OBJS= vmlisp.$(FASLEXT) hash.$(FASLEXT) \ +OBJS= sys-os.$(FASLEXT) \ + vmlisp.$(FASLEXT) hash.$(FASLEXT) \ diagnostics.$(FASLEXT) sys-driver.$(FASLEXT) \ sys-utility.$(FASLEXT) macros.$(FASLEXT) \ unlisp.$(FASLEXT) \ @@ -1066,12 +1067,15 @@ axext_l.$(FASLEXT): axext_l.lisp foam_l.$(FASLEXT) foam_l.$(FASLEXT): foam_l.lisp vmlisp.$(FASLEXT) $(BOOTSYS) -- --compile --output=$@ --load-directory=. $< -sys-utility.$(FASLEXT): sys-utility.boot vmlisp.$(FASLEXT) +sys-utility.$(FASLEXT): sys-utility.boot vmlisp.$(FASLEXT) sys-os.$(FASLEXT) $(BOOTSYS) -- --compile --output=$@ --load-directory=. $< vmlisp.$(FASLEXT): vmlisp.lisp boot-pkg.$(FASLEXT) $(BOOTSYS) -- --compile --output=$@ --load-directory=. $< +sys-os.$(FASLEXT): sys-os.boot boot-pkg.$(FASLEXT) + $(BOOTSYS) -- --compile --output=$@ --load-directory=. $< + boot-pkg.$(FASLEXT): boot-pkg.lisp $(BOOTSYS) -- --compile --output=$@ $< diff --git a/src/interp/as.boot b/src/interp/as.boot index 2751419a..93286283 100644 --- a/src/interp/as.boot +++ b/src/interp/as.boot @@ -1,6 +1,6 @@ -- Copyright (c) 1991-2002, The Numerical ALgorithms Group Ltd. -- All rights reserved. --- Copyright (C) 2007, Gabriel Dos Reis. +-- Copyright (C) 2007-2008, Gabriel Dos Reis. -- All rights reserved. -- -- Redistribution and use in source and binary forms, with or without @@ -42,7 +42,7 @@ $opHash := MAKE_-HASH_-TABLE() $asyPrint := false asList() == - OBEY '"rm -f temp.text" + removeFile '"temp.text" OBEY '"ls as/*.asy > temp.text" instream := OPEN '"temp.text" lines := [READLINE instream while not EOFP instream] diff --git a/src/interp/br-data.boot b/src/interp/br-data.boot index 58c13a83..86b71b8b 100644 --- a/src/interp/br-data.boot +++ b/src/interp/br-data.boot @@ -1,6 +1,6 @@ -- Copyright (c) 1991-2002, The Numerical ALgorithms Group Ltd. -- All rights reserved. --- Copyright (C) 2007, Gabriel Dos Reis. +-- Copyright (C) 2007-2008, Gabriel Dos Reis. -- All rights reserved. -- -- Redistribution and use in source and binary forms, with or without @@ -94,8 +94,7 @@ buildLibdb(:options) == --called by buildDatabase (database.boot) $machineType = 'RIOS => '"sort -f -T /tmp -y200 _"temp.text_" > _"libdb.text_"" $machineType = 'SPARC => '"sort -f _"temp.text_" > _"libdb.text_"" '"sort _"temp.text_" > _"libdb.text_"" - --OBEY '"mv libdb.text olibdb.text" - RENAME_-FILE('"libdb.text", '"olibdb.text") + renameFile('"libdb.text", '"olibdb.text") deleteFile '"temp.text" buildLibdbConEntry conname == @@ -303,7 +302,7 @@ dbSplitLibdb() == SHUT instream SHUT outstream SHUT comstream - OBEY '"rm olibdb.text" + removeFile '"olibdb.text" dbSplit(line,n,k) == k := charPosition($tick,line,k + 1) @@ -332,10 +331,10 @@ buildGloss() == --called by buildDatabase (database.boot) pathname := STRCONC(systemRootDirectory(),'"/algebra/gloss.text") instream := MAKE_-INSTREAM pathname keypath := '"glosskey.text" - OBEY STRCONC('"rm -f ",keypath) + removeFile keypath outstream:= MAKE_-OUTSTREAM keypath htpath := '"gloss.ht" - OBEY STRCONC('"rm -f ",htpath) + removeFile htpath htstream:= MAKE_-OUTSTREAM htpath defpath := '"glossdef.text" defstream:= MAKE_-OUTSTREAM defpath @@ -783,6 +782,6 @@ extendLocalLibdb conlist == -- called by astran purgeLocalLibdb() == --used for debugging purposes only $newConstructorList := nil - obey '"rm libdb.text" + removeFile '"libdb.text" diff --git a/src/interp/br-saturn.boot b/src/interp/br-saturn.boot index 1a3c653f..32225b11 100644 --- a/src/interp/br-saturn.boot +++ b/src/interp/br-saturn.boot @@ -1,6 +1,6 @@ -- Copyright (c) 1991-2002, The Numerical ALgorithms Group Ltd. -- All rights reserved. --- Copyright (C) 2007, Gabriel Dos Reis. +-- Copyright (C) 2007-2008, Gabriel Dos Reis. -- All rights reserved. -- -- Redistribution and use in source and binary forms, with or without @@ -1629,13 +1629,13 @@ mkButtonBox n == STRCONC('"\buttonbox{", STRINGIMAGE n, '"}") -- SHUT instream -- SHUT outstream -- SHUT comstream ---OBEY '"rm libdb.text" +--removeFile '"libdb.text" dbSort(x,y) == sin := STRINGIMAGE x sout:= STRINGIMAGE y OBEY STRCONC('"sort -f _"",sin,'".text_" > _"", sout, '".text_"") - OBEY STRCONC('"rm ", sin, '".text") + removeFile STRCONC(sin, '".text") -- override in br-util.boot.pamphlet diff --git a/src/interp/br-search.boot b/src/interp/br-search.boot index 3cc6fd86..1949c5ae 100644 --- a/src/interp/br-search.boot +++ b/src/interp/br-search.boot @@ -1,6 +1,6 @@ -- Copyright (c) 1991-2002, The Numerical ALgorithms Group Ltd. -- All rights reserved. --- Copyright (C) 2007, Gabriel Dos Reis. +-- Copyright (C) 2007-2008, Gabriel Dos Reis. -- All rights reserved. -- -- Redistribution and use in source and binary forms, with or without @@ -930,7 +930,7 @@ obey x == getTempPath kind == pathname := mkGrepFile kind - obey STRCONC('"rm -f ", pathname) + removeFile pathname pathname dbWriteLines(s, :options) == diff --git a/src/interp/c-doc.boot b/src/interp/c-doc.boot index 7cc35056..e04fb69a 100644 --- a/src/interp/c-doc.boot +++ b/src/interp/c-doc.boot @@ -1,6 +1,6 @@ --- Copyright (c) 1991-2002, The Numerical ALgorithms Group Ltd. +-- Copyright (c) 1991-2002, The Numerical Algorithms Group Ltd. -- All rights reserved. --- Copyright (C) 2007, Gabriel Dos Reis. +-- Copyright (C) 2007-2008, Gabriel Dos Reis. -- All rights reserved. -- -- Redistribution and use in source and binary forms, with or without @@ -15,7 +15,7 @@ -- the documentation and/or other materials provided with the -- distribution. -- --- - Neither the name of The Numerical ALgorithms Group Ltd. nor the +-- - Neither the name of The Numerical Algorithms Group Ltd. nor the -- names of its contributors may be used to endorse or promote products -- derived from this software without specific prior written permission. -- @@ -1215,14 +1215,14 @@ checkAlphabetic c == --======================================================================= docreport(nam) == --creates a report for person "nam" using file "whofiles" - OBEY '"rm docreport.input" + removeFile '"docreport.input" OBEY STRCONC('"echo _")bo setOutStream('",STRINGIMAGE nam,'")_" > temp.input") OBEY '"cat docreport.header temp.input > docreport.input" OBEY STRCONC('"awk '/",STRINGIMAGE nam,'"/ {printf(_")co %s.spad\n_",$2)}' whofiles > temp.input") OBEY '"cat docreport.input temp.input > temp1.input" OBEY '"cat temp1.input docreport.trailer > docreport.input" - OBEY '"rm temp.input" - OBEY '"rm temp1.input" + removeFile '"temp.input" + removeFile '"temp1.input" SETQ(_/EDITFILE,'"docreport.input") _/RQ() diff --git a/src/interp/construc.lisp b/src/interp/construc.lisp index 6e8e1373..3d5aeca0 100644 --- a/src/interp/construc.lisp +++ b/src/interp/construc.lisp @@ -133,8 +133,8 @@ (concatenate 'string (|systemRootDirectory|) "/../../int/algebra/" (string name) ".NRLIB/code.lsp"))) (let (masterindex blanks index newindex (space (* 22 (length innames)))) (setq newindex space) - (system::system (concatenate 'string "rm -r " (libname outname))) - (system::system (concatenate 'string "mkdir " (libname outname))) + (|removeFile| (libname outname)) + (|checkMkdir| (libname outname)) (with-open-file (out (indexname outname) :direction :output) (setq blanks (make-string space :initial-element #\ )) (write blanks :stream out) ; reserve space for the masterindex @@ -239,7 +239,7 @@ ((equal (elt (string mode) 0) #\O) (setq fullname (make-full-namestring (cdr file) 'LISPLIB)) (case (directory? fullname) - (-1 (makedir fullname)) + (-1 (|checkMkdir| fullname)) (0 (error (format nil "~s is an existing file, not a library" fullname))) (otherwise)) (multiple-value-setq (stream indextable) (get-io-index-stream fullname)) @@ -336,7 +336,7 @@ (labels ( (SRCSCAN () (let (spads) - (system:chdir src) + (|changeDirectory| src) (setq spads (directory "*.spad")) (dolist (spad spads) (srcabbrevs spad)) nil)) diff --git a/src/interp/daase.lisp b/src/interp/daase.lisp index 57732417..88f599e2 100644 --- a/src/interp/daase.lisp +++ b/src/interp/daase.lisp @@ -817,7 +817,7 @@ #+:CCL (dolist (a args) (check-module-exists a)) (|extendLocalLibdb| |$newConlist|) - (system::chdir original-directory) + (|changeDirectory| original-directory) (tersyscommand)) ;; check-module-exists looks to see if a module exists in one of the current @@ -870,9 +870,9 @@ (values only dir noexpose))) (processDir (dirarg thisdir) (let (allfiles skipasos) - (system:chdir (string dirarg)) + (|changeDirectory| (string dirarg)) (setq allfiles (directory "*")) - (system:chdir thisdir) + (|changeDirectory| thisdir) (values (mapcan #'(lambda (f) (when (string-equal (pathname-type f) "NRLIB") @@ -1237,7 +1237,7 @@ (|systemRootDirectory|) "/algebra/" name))) - (when erase? (system::system (concatenate 'string "rm -f " filename))) + (when erase? (|removeFile| filename)) filename)) ;; rewrite this so it works in mnt @@ -1249,7 +1249,7 @@ ;; (setq filename (concatenate 'string daase "/algebra/" name)) ;; (format t " Using local database ~a.." filename)) ;; (setq filename (concatenate 'string $spadroot "/algebra/" name))) -;; (when erase? (system::system (concatenate 'string "rm -f " filename))) +;; (when erase? (|removeFile| filename)) ;; filename)) diff --git a/src/interp/fortcall.boot b/src/interp/fortcall.boot index f89a67ca..4d7fa940 100644 --- a/src/interp/fortcall.boot +++ b/src/interp/fortcall.boot @@ -1,6 +1,6 @@ --- Copyright (c) 1991-2002, The Numerical ALgorithms Group Ltd. +-- Copyright (c) 1991-2002, The Numerical Algorithms Group Ltd. -- All rights reserved. --- Copyright (C) 2007, Gabriel Dos Reis. +-- Copyright (C) 2007-2008, Gabriel Dos Reis. -- All rights reserved. -- -- Redistribution and use in source and binary forms, with or without @@ -15,7 +15,7 @@ -- the documentation and/or other materials provided with the -- distribution. -- --- - Neither the name of The Numerical ALgorithms Group Ltd. nor the +-- - Neither the name of The Numerical Algorithms Group Ltd. nor the -- names of its contributors may be used to endorse or promote products -- derived from this software without specific prior written permission. -- @@ -680,9 +680,8 @@ fortCall(objFile,data,results) == tmpFile2 := generateResultsName() SYSTEM STRCONC(objFile," < ",tmpFile1," > ",tmpFile2) results := readData(tmpFile2,results) - -- SYSTEM STRCONC("rm -f ",tmpFile1," ",tmpFile2) - PROBE_-FILE(tmpFile1) and DELETE_-FILE(tmpFile1) - PROBE_-FILE(tmpFile2) and DELETE_-FILE(tmpFile2) + removeFile tmpFile1 + removeFile tmpFile2 results invokeNagman(objFiles,nfile,args,dummies,decls,results,actual) == @@ -693,7 +692,7 @@ invokeNagman(objFiles,nfile,args,dummies,decls,results,actual) == results,decls,inFirstNotSecond(args,dummies),actual) -- Tidy up asps -- if objFiles then SYSTEM STRCONC("rm -f ",addSpaces objFiles) - for fn in objFiles repeat PROBE_-FILE(fn) and DELETE_-FILE(fn) + for fn in objFiles repeat removeFile fn result diff --git a/src/interp/ht-root.boot b/src/interp/ht-root.boot index b81501a1..59099875 100644 --- a/src/interp/ht-root.boot +++ b/src/interp/ht-root.boot @@ -1,6 +1,6 @@ --- Copyright (c) 1991-2002, The Numerical ALgorithms Group Ltd. +-- Copyright (c) 1991-2002, The Numerical Algorithms Group Ltd. -- All rights reserved. --- Copyright (C) 2007, Gabriel Dos Reis. +-- Copyright (C) 2007-2008, Gabriel Dos Reis. -- All rights reserved. -- -- Redistribution and use in source and binary forms, with or without @@ -15,7 +15,7 @@ -- the documentation and/or other materials provided with the -- distribution. -- --- - Neither the name of The Numerical ALgorithms Group Ltd. nor the +-- - Neither the name of The Numerical Algorithms Group Ltd. nor the -- names of its contributors may be used to endorse or promote products -- derived from this software without specific prior written permission. -- @@ -150,8 +150,7 @@ htGlossPage(htPage,pattern,tryAgain?) == --instream := MAKE_-INSTREAM pathname defstream := MAKE_-INSTREAM STRCONC(systemRootDirectory(),'"/algebra/glossdef.text") lines := gatherGlossLines(results,defstream) - -- OBEY STRCONC('"rm -f ", pathname) - --PROBE_-FILE(pathname) and DELETE_-FILE(pathname) + -- removeFile pathname --SHUT instream heading := pattern = '"" => '"Glossary" diff --git a/src/interp/i-syscmd.boot b/src/interp/i-syscmd.boot index f731ade7..e51b9261 100644 --- a/src/interp/i-syscmd.boot +++ b/src/interp/i-syscmd.boot @@ -1,4 +1,4 @@ --- Copyright (c) 1991-2002, The Numerical ALgorithms Group Ltd. +-- Copyright (c) 1991-2002, The Numerical Algorithms Group Ltd. -- All rights reserved. -- Copyright (C) 2007-2008, Gabriel Dos Reis. -- All rights reserved. @@ -15,7 +15,7 @@ -- the documentation and/or other materials provided with the -- distribution. -- --- - Neither the name of The Numerical ALgorithms Group Ltd. nor the +-- - Neither the name of The Numerical Algorithms Group Ltd. nor the -- names of its contributors may be used to endorse or promote products -- derived from this software without specific prior written permission. -- @@ -259,13 +259,7 @@ listConstructorAbbreviations() == cd args == dir := TRUENAME STRING(car args or '"") -)if %hasFeature KEYWORD::SBCL - SB_-POSIX::CHDIR NAMESTRING dir -)elseif %hasFeature KEYWORD::GCL - SYSTEM::CHDIR NAMESTRING dir -)else - internalError '"don't know how to chdir in this Lisp" -)endif + changeDirectory NAMESTRING dir SETF(_*DEFAULT_-PATHNAME_-DEFAULTS_*, ensureTrailingSlash NAMESTRING dir) sayKeyedMsg("S2IZ0070", [NAMESTRING _*DEFAULT_-PATHNAME_-DEFAULTS_*]) @@ -639,8 +633,7 @@ compileAsharpArchiveCmd args == throwKeyedMsg("S2IL0027",[namestring dir, namestring args]) if isDir ^= 1 then - cmd := STRCONC('"mkdir ", namestring dir) - rc := OBEY cmd + rc := mkdir namestring dir rc ^= 0 => throwKeyedMsg("S2IL0027",[namestring dir, namestring args]) curDir := $CURRENT_-DIRECTORY @@ -1610,8 +1603,7 @@ putHist(x,prop,val,e) == putIntSymTab(x,prop,val,e) histFileErase file == - --OBEY STRCONC('"rm -rf ", file) - PROBE_-FILE(file) and DELETE_-FILE(file) + removeFile file diff --git a/src/interp/nlib.lisp b/src/interp/nlib.lisp index 2d070775..fa788f2a 100644 --- a/src/interp/nlib.lisp +++ b/src/interp/nlib.lisp @@ -1,6 +1,6 @@ -;; Copyright (c) 1991-2002, The Numerical ALgorithms Group Ltd. +;; Copyright (c) 1991-2002, The Numerical Algorithms Group Ltd. ;; All rights reserved. -;; Copyright (C) 2007, Gabriel Dos Reis. +;; Copyright (C) 2007-2008, Gabriel Dos Reis. ;; All rights reserved. ;; ;; Redistribution and use in source and binary forms, with or without @@ -15,7 +15,7 @@ ;; the documentation and/or other materials provided with the ;; distribution. ;; -;; - Neither the name of The Numerical ALgorithms Group Ltd. nor the +;; - Neither the name of The Numerical Algorithms Group Ltd. nor the ;; names of its contributors may be used to endorse or promote products ;; derived from this software without specific prior written permission. ;; @@ -79,7 +79,7 @@ ;;(setq fullname (make-full-namestring (cdr file) 'LISPLIB)) (setq fullname (make-full-namestring (cdr file) 'NIL)) (case (|directoryp| fullname) - (-1 (makedir fullname)) + (-1 (|checkMkdir| fullname)) (0 (error (format nil "~s is an existing file, not a library" fullname))) (otherwise)) (multiple-value-setq (stream indextable) (get-io-index-stream fullname)) @@ -150,12 +150,6 @@ (file-position stream :end) (write-indextable indextable stream))) -;; makedir (fname) fname is a directory name. -(defun makedir (fname) - #+ (and (not :GCL) :COMMON-LISP) (ensure-directories-exist fname) - #+ :GCL (system (concat "mkdir " fname)) - ) - ;; (RREAD key rstream) (defun rread (key rstream &optional (error-val nil error-val-p)) (if (equal (libstream-mode rstream) 'output) (error "not input stream")) @@ -249,9 +243,9 @@ (o (make-pathname :type "o"))) (si::system (format nil "cp ~S ~S" code temp)) (recompile-lib-file-if-necessary temp) - (si::system (format nil "mv ~S ~S~%" + (|renameFile| (namestring (merge-pathnames o temp)) - (namestring (merge-pathnames o code))))) + (namestring (merge-pathnames o code)))) ;; only pack non libraries to avoid lucid file handling problems (let* ((rstream (rdefiostream (list (cons 'file filespec) (cons 'mode 'input)))) (nstream nil) @@ -406,16 +400,6 @@ (some #'(lambda (ft) (make-input-filename file-name ft)) filetypelist))) -;; ($ERASE filearg) -> 0 if succeeds else 1 -(defun $erase (&rest filearg) - (system (concat "rm -rf "(make-full-namestring filearg)))) - -(defun $REPLACE (filespec1 filespec2) - ($erase (setq filespec1 (make-full-namestring filespec1))) - (rename-file (make-full-namestring filespec2) filespec1)) - - - ;;(defun move-file (namestring1 namestring2) ;; (rename-file namestring1 namestring2)) @@ -429,7 +413,7 @@ #+(OR :AKCL (AND :CCL :UNIX)) (defun copy-lib-directory (name1 name2) - (makedir name2) + (|checkMkdir| name2) (system (concat "sh -c 'cp " name1 "/* " name2 "'"))) #+(OR :AKCL (AND :CCL :UNIX)) diff --git a/src/interp/obey.lisp b/src/interp/obey.lisp index f7973dec..6061ce8d 100644 --- a/src/interp/obey.lisp +++ b/src/interp/obey.lisp @@ -1,4 +1,4 @@ -;; Copyright (c) 1991-2002, The Numerical ALgorithms Group Ltd. +;; Copyright (c) 1991-2002, The Numerical Algorithms Group Ltd. ;; All rights reserved. ;; Copyright (C) 2007-2008, Gabriel Dos Reis. ;; All rights reserved. @@ -15,7 +15,7 @@ ;; the documentation and/or other materials provided with the ;; distribution. ;; -;; - Neither the name of The Numerical ALgorithms Group Ltd. nor the +;; - Neither the name of The Numerical Algorithms Group Ltd. nor the ;; names of its contributors may be used to endorse or promote products ;; derived from this software without specific prior written permission. ;; @@ -41,10 +41,6 @@ :arguments (list "-c" S))) #+ (and :lucid :unix) -(defun makedir (fname) - (system:run-aix-program "mkdir" :arguments (list fname))) - -#+ (and :lucid :unix) (defun delete-directory (dirname) (system:run-aix-program "rm" :arguments (list "-r" dirname))) diff --git a/src/interp/sys-os.boot b/src/interp/sys-os.boot new file mode 100644 index 00000000..d46e7741 --- /dev/null +++ b/src/interp/sys-os.boot @@ -0,0 +1,59 @@ +-- Copyright (C) 2007-2008 Gabriel Dos Reis +-- All rights reserved. +-- +-- Redistribution and use in source and binary forms, with or without +-- modification, are permitted provided that the following conditions are +-- met: +-- +-- - Redistributions of source code must retain the above copyright +-- notice, this list of conditions and the following disclaimer. +-- +-- - Redistributions in binary form must reproduce the above copyright +-- notice, this list of conditions and the following disclaimer in +-- the documentation and/or other materials provided with the +-- distribution. +-- +-- - Neither the name of The Numerical ALgorithms Group Ltd. nor the +-- names of its contributors may be used to endorse or promote products +-- derived from this software without specific prior written permission. +-- +-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS +-- IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +-- TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A +-- PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER +-- OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +-- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +-- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +-- +-- + +-- +-- This file contains interface to functionalities required from the +-- hosting operating systems. More to the point, it is mostly +-- a set of interfaces to native routines provided in the +-- supporting C runtime libopen-axiom-core. +-- + +import '"boot-pkg" +)package "BOOT" + +++ change current working directory. +import changeDirectory for + oa__chdir: string -> int -- 0: success, -1: failure + +++ remove file or directory tree. +import removeFile for + oa__unlink: string -> int -- 0: sucess, -1: failure + +++ rename file or directory +import renameFile for + oa__rename: (string,string) -> int -- 0: success, -1 failure + +++ create a directory +import mkdir for + oa__mkdir: string -> int -- 0: sucess, -1: failure. + diff --git a/src/interp/sys-utility.boot b/src/interp/sys-utility.boot index ff8e32cb..07dba9f5 100644 --- a/src/interp/sys-utility.boot +++ b/src/interp/sys-utility.boot @@ -33,6 +33,7 @@ -- This file defines some utility functions common to both the compiler -- and interpreter. +import '"sys-os" import '"vmlisp" )package "BOOT" @@ -146,3 +147,17 @@ makeAbsoluteFilename name == existingFile? file == PROBE_-FILE file +++ original version returned 0 on success, and 1 on failure +++ ??? fix that to return -1 on failure. +$ERASE(:filearg) == + -removeFile MAKE_-FULL_-NAMESTRING filearg + +++ +$REPLACE(filespec1,filespec2) == + $ERASE(filespec1 := MAKE_-FULL_-NAMESTRING filespec1) + renameFile(MAKE_-FULL_-NAMESTRING filespec2, filespec1) + +++ +checkMkdir path == + mkdir path = 0 => true + systemError ['"cannot create directory",:bright path] diff --git a/src/interp/util.lisp b/src/interp/util.lisp index fe54e013..72d6166d 100644 --- a/src/interp/util.lisp +++ b/src/interp/util.lisp @@ -252,8 +252,7 @@ ;; TAGS are useful for finding functions if you run Emacs. We have a ;; set of functions that construct TAGS files for Axiom. (defun make-tags-file () -#+:gcl (system:chdir "/tmp") -#-:gcl (obey (concatenate 'string "cd " "/tmp")) + (|changeDirectory| "/tmp") (obey (concat "etags " (|makeAbsoluteFilename| "../../src/interp/*.lisp"))) (spadtags-from-directory "../../src/interp" "boot") (obey "cat /tmp/boot.TAGS >> /tmp/TAGS")) @@ -710,8 +709,7 @@ (format t "doing directory on ~s...~%" (concatenate 'string mid "/*")) (error "makelib:MID=~a OUT=~a~% these are not set properly~%" mid out)) #+:akcl (compiler::emit-fn nil) -#+:akcl (si::chdir mid) -#-:akcl (obey (concatenate 'string "cd " mid)) + (|changeDirectory| mid) (setq libs (directory "*.NRLIB")) (unless libs (format t "makelib:directory of ~a returned NIL~%" mid) @@ -792,8 +790,7 @@ (if (and src mid) (format t "doing directory on ~s...~%" (concatenate 'string src "/*")) (error "makespad:SRC=~a MID=~a not set properly~%" src mid)) -#+:akcl (si::chdir mid) -#-:akcl (obey (concatenate 'string "cd " mid)) + (|changeDirectory| mid) (setq mntlibs (directory "*.NRLIB")) (unless mntlibs (format t "makespad:directory of ~a returned NIL~%" src) @@ -887,8 +884,7 @@ (READLIBS (algebra) "read the NRLIB directory and return a sorted abbreviation list" (let (libs nrlibs) -#+:akcl (si::chdir algebra) -#-:akcl (obey (concatenate 'string "cd " algebra)) + (|changeDirectory| algebra) (setq nrlibs (directory "*.NRLIB")) (unless nrlibs (error "libcheck: (directory ~s) returned NIL~%" @@ -929,8 +925,7 @@ (values names longnames))) (SRCSCAN () (let (longnames names) -#+:gcl (system::chdir int) -#-:gcl (obey (concatenate 'string "cd " int)) + (|changeDirectory| int) (setq spads (directory "*.spad")) (dolist (spad spads) (multiple-value-setq (short long) (srcabbrevs spad)) |