31 lines
44 KiB
Plaintext
31 lines
44 KiB
Plaintext
1
|
||
|
||
Medley for the Novice, Release 2.0
|
||
1
|
||
|
||
Medley for the Novice, Release 2.0
|
||
4. HOW TO USE FILES
|
||
1
|
||
|
||
4. HOW TO USE FILES
|
||
1
|
||
|
||
|
||
"4"4. HOW TO USE FILES
|
||
6
|
||
|
||
Types of Files(FILES NIL Files NIL (NIL) 1 SUBNAME TYPES% OF SUBTEXT types% of)
|
||
1
|
||
|
||
A program file(PROGRAM% FILE NIL Program% file NIL (NIL) 1)(FILES NIL Files NIL (NIL) 1 SUBNAME PROGRAM SUBTEXT program), or Lisp file, contains a series of expressions that can be read and evaluated by the Lisp interpreter. These expressions can include function or macro definitions, variables and their values, properties of variables, and so on. How to save Interlisp-D expressions on these files is explained in Chapter 7. Loading a file is explained in the Simple Commands for Manipulating Files section below.
|
||
Not all files, however, have Lisp expressions stored on them. For example, TEdit files(FILES NIL Files NIL (NIL) 1 SUBNAME TEDIT SUBTEXT TEdit)(TEDIT% FILES NIL TEdit% files NIL (NIL) 1) store text; sketches are stored on files made with the package Sketch , or can be incorporated into TEdit files. These files are not loaded directly into the environment, but are accessed with the package used to create them, such as TEdit or Sketch.
|
||
When you name(FILES NIL Files NIL (NIL) 1 SUBNAME NAMING% CONVENTIONS SUBTEXT naming% conventions) a file, there are conventions that you should follow. These conventions allow you to tell the type of file by the extension to its name.
|
||
If a file contains: Then:
|
||
Lisp expressions It should not have an extension or have the extension .LISP(LISP (File Name Extension) .LISP NIL (NIL) 1)(.LISP (File Name Extension) NIL NIL (NIL) 1). For example, a file called MYCODE should contain Lisp expressions.
|
||
Compiled Code It should have the extension .LCOM(LCOM (File Name Extension) .LCOM NIL (NIL) 1)(.LCOM (File Name Extension) NIL NIL (NIL) 1) or .DFASL(DFASL (File Name Extension) .DFASL NIL (NIL) 1)(.DFASL (File Name Extension) NIL NIL (NIL) 1). For example, a file called MYCODE.DFASL should contain compiled code.
|
||
A Sketch Its extension should be .SKETCH(SKETCH (File Name Extension) .SKETCH NIL (NIL) 1)(.SKETCH (File Name Extension) NIL NIL (NIL) 1). For example, a file called MOUNTAINS.SKETCH should contain a Sketch.
|
||
Text It should have the extension .TEDIT(TEDIT (File Name Extension) .TEDIT NIL (NIL) 1)(.TEDIT (File Name Extension) NIL NIL (NIL) 1). For example, a file called REPORT.TEDIT should contain text that can be edited with the editor TEDIT.
|
||
Directories(DIRECTORIES NIL Directories NIL (NIL) 1)
|
||
1
|
||
|
||
This section focuses on how you can find files, and how you can easily manipulate files. To see all the files listed on a device, use the function DIR. For example, to see what files are stored in your current directory, type:
|
||
(DIR *.*)
|
||
Partial directory listings can be gotten by specifying a file name, rather than just a device name. The wildcard character * can be used to match any number of unknown characters. For example, the command (DIR T*) will list the names of all files that begin with the letter T. An example using the wildcard is shown in Figure 4-1.
|
||
|