XEROX PORT-CLFILE 2 4 1 PORT-CLFILE 1 4 By: Johannes A. G. M. Koomen (Koomen.wbst@Xerox.COM or Koomen@CS.Rochester.EDU) October 7, 1987 Partly based on work by: Pablo Ghenis (Ghenis.pasa@Xerox.COM) Larry Masinter (Masinter.PA@Xerox.COM) SUMMARY: Load or write plain-text Common Lisp source code files DESCRIPTION Using standard Common Lisp source files in the Xerox Lisp environment has two drawbacks. First, loading these files causes all the filed objects to be defined but not recorded, so that one cannot use the File Manager to remake the file. Secondly, standard Common Lisp source files are expected (by non-Xerox Common Lisp systems) to be in plain-text format, without font control characters or File Manager information, so files produced by the File Manager are not portable. The PORT-CLFILE package provides two capabilities, namely loading a plain-text Common Lisp source file such that the File Manager is informed of its contents (i.e., a COMS list is created for the file); and writing a plain-text Common Lisp source file based on a File Manager COMS list so that it can be loaded by non-Xerox Common Lisp systems. DETAILS (IMPORT-CLFILE filepath) [Function] Loads a standard Common Lisp source file, recording on fileCOMS the various objects loaded. Note that ";" comments are preserved, but multi-line comments are not joined. If the first line in the file is a comment beginning with "-*-" it is assumed to a be a mode line, indicating the syntax (readtable) to use in reading the file and the package into which the filed symbols should be interned: the special variables *READTABLE*, *PACKAGE* and *READ-BASE* and the file's MAKEFILE-ENVIRONMENT property are set according to the mode line. They environment variables default to "XCL", "USER" and 10, respectively. If the load is successful, one may execute (MAKEFILE file) to create a Xerox Lisp version of the original Common Lisp file. IMPORT-CLFILE returns theFile Manager name forthe file. (EXPORT-CLFILE filepath &OPTIONAL (linelength 72)) [Function] Creates a standard Common Lisp source file (filepath.LISP) using commands contained in fileCOMS. The first line will be a mode line based on the file's MAKEFILE-ENVIRONMENT property, indicating the syntax (readtable), package and print base. These default to "LISP", "USER" and 10, respectively. All comments are printed in standard Common Lisp style. No font control characters are inserted. Some Interlisp forms (FNS, INITVARS etc) are converted to nearly equivalent Common Lisp forms, although the translation is not exact. EXPORT-CLFILE returns the full name of the file just created. Notes & Caveats Although it may appear as if (EXPORT-CLFILE (IMPORT-CLFILE filepath)) is functionally equivalent to COPYFILE, the resulting file is formatted rather differently from the original, especially given the currently somewhat brain damaged prettyprinting of Common Lisp definers (the default smaller linelength helps a bit, but not enough). IMPORT-CLFILE uses standard Xerox Lisp READ, which is sensitive to the dispatch macros #+ and #- under a CommonLisp readtable. Hence, this conditional input is not preserved on the resulting COMS. For best results, a file to be exported using EXPORT-CLFILE probably should only contain standard Common Lisp constructs... (LIST ((PAGE NIL (PAPERSIZE LETTER STARTINGPAGE# 208) (0 0 612 792) ((FOLIO NIL (PARALOOKS (QUAD CENTERED) CHARLOOKS (SUPERSCRIPT 0 INVISIBLE OFF SELECTPOINT OFF PROTECTED OFF SIZE 10 FAMILY MODERN OVERLINE OFF STRIKEOUT OFF UNDERLINE OFF EXPANSION REGULAR SLOPE REGULAR WEIGHT MEDIUM INVERTED OFF USERINFO NIL STYLE NIL) FORMATINFO NIL) (174 36 288 36) NIL) (HEADING NIL (HEADINGTYPE RUNNINGHEAD) (84 744 528 36) NIL) (TEXT NIL NIL (84 96 456 600) NIL))) (PAGE NIL (PAPERSIZE NIL . LETTER) (0 0 612 792) ((FOLIO NIL (PARALOOKS (QUAD CENTERED) CHARLOOKS (SUPERSCRIPT 0 INVISIBLE OFF SELECTPOINT OFF PROTECTED OFF SIZE 10 FAMILY MODERN OVERLINE OFF STRIKEOUT OFF UNDERLINE OFF EXPANSION REGULAR SLOPE REGULAR WEIGHT MEDIUM INVERTED OFF USERINFO NIL STYLE NIL) FORMATINFO NIL) (174 36 288 36) NIL) (HEADING NIL (HEADINGTYPE RUNNINGHEAD) (84 744 528 36) NIL) (TEXT NIL NIL (84 96 456 600) NIL))) (PAGE NIL (PAPERSIZE NIL . LETTER) (0 0 612 792) ((FOLIO NIL (PARALOOKS (QUAD CENTERED) CHARLOOKS (SUPERSCRIPT 0 INVISIBLE OFF SELECTPOINT OFF PROTECTED OFF SIZE 10 FAMILY MODERN OVERLINE OFF STRIKEOUT OFF UNDERLINE OFF EXPANSION REGULAR SLOPE REGULAR WEIGHT MEDIUM INVERTED OFF USERINFO NIL STYLE NIL) FORMATINFO NIL) (174 36 288 36) NIL) (HEADING NIL (HEADINGTYPE RUNNINGHEAD) (84 744 528 36) NIL) (TEXT NIL NIL (84 96 456 600) NIL))))).ÈÈ(È(È (È(ŠŠ8(ŠŠ8DÈÈ PAGEHEADING RUNNINGHEADMODERN MODERN MODERN MODERN MODERNLOGO  HRULE.GETFNMODERN  HRULE.GETFNMODERN  HRULE.GETFNMODERN   HRULE.GETFNMODERN  HRULE.GETFNMODERN Pd9 ÜŸ¶%?TOÆ| ö=zº