Structural Informatics Group (SIG) logo
Home | Projects | Demos | Downloads | Publications | Local Info | About Us | New site
Go to the first, previous, next, last section, table of contents.



type: function (subr)  
location: built-in
source file: xldmem.c  xlimage.c
Common LISP compatible: no
supported on: all machines


(save <file> )
        <file>          -       a string or symbol for the name of the file 


The SAVE function saves the current XLISP workspace (system state) to the specified file. The <file> may be a string or a symbol. If the <file> does not include a '.wks' suffix, it will be extended to be called <file>.wks. The function returns T if the workspace was properly created and saved, NIL is returned otherwise. There can be several saved workspaces. These workspaces can be restored as often as desired.


(defun myfoo (fee fi)                   ; create a function
        (+ fee fi))
(setq myvar 5)                          ; set MYVAR to value 5
myvar                                   ; returns 5
(save 'farp)                            ; save workspace in FARP.wks
(setq myvar "garp")                     ; change MYVAR to "garp"
myvar                                   ; returns "garp"
(restore 'farp)                         ; restore workspace
myvar                                   ; returns 5

BUG: The SAVE function generates a system error if the <file> being created already exists. This <file> will be modified and will not be restorable after restarting XLISP.

NOTE: The saved workspace size is implementation dependent, but can be fairly large.

FILE NAMES: In the PC and DOS world, all file names and extensions ("FOO.BAT") are automatically made uppercase. In using XLISP, this means you don't have to worry about whether the name is "foo.bat", "FOO.BAT" or even "FoO.bAt" - they will all work. However, in other file systems (UNIX in particular), uppercase and lowercase do make a difference. So, in UNIX if you do a (open 'foo-file :direction :output), this will create a file named "FOO-FILE" because XLISP uppercases its symbols. If you do a (open "foo-file" :direction :output), this will create a file named "foo-file" because UNIX doesn't uppercase its file names. Another case is if you do (save 'world), this will create the file "WORLD.wks". So, if you are having trouble with opening and accessing files, check to make sure the file name is in the proper case.

COMMON LISP COMPATIBILITY: The SAVE function is similar in use to the SAVE-WORLD function in Common LISP. The primarily difference is that SAVE-WORLD allows you to restart everything since it creates an executable file. The SAVE function requires you to start XLISP up first and then do a RESTORE. Depending on the operating system that you are using, it is possible to write a SAVE-WORLD equivalent using SAVE, RESTORE and SYSTEM functions.

Go to the first, previous, next, last section, table of contents.