|
|
1.1 ! root 1: ! 2: ! 3: ! 4: ! 5: ! 6: ! 7: ! 8: CHAPTER 5 ! 9: ! 10: ! 11: Input/Output ! 12: ! 13: ! 14: ! 15: ! 16: The following functions are used to read from and write ! 17: to external devices (e.g. files) and programs (through ! 18: pipes). All I/O goes through the lisp data type called the ! 19: port. A port may be open for either reading or writing, but ! 20: usually not both simultaneously (see _f_i_l_e_o_p_e_n ). There are ! 21: only a limited number of ports (20) and they will not be ! 22: reclaimed unless they are _c_l_o_s_ed. All ports are reclaimed ! 23: by a _r_e_s_e_t_i_o call, but this drastic step won't be necessary ! 24: if the program closes what it uses. ! 25: ! 26: If a port argument is not supplied to a function which ! 27: requires one, or if a bad port argument (such as nil) is ! 28: given, then FRANZ LISP will use the default port according ! 29: to this scheme: If input is being done then the default port ! 30: is the value of the symbol piport and if output is being ! 31: done then the default port is the value of the symbol ! 32: poport. Furthermore, if the value of piport or poport is ! 33: not a valid port, then the standard input or standard output ! 34: will be used, respectively. ! 35: ! 36: The standard input and standard output are usually the ! 37: keyboard and terminal display unless your job is running in ! 38: the background and its input or output is connected to a ! 39: pipe. All output which goes to the standard output will ! 40: also go to the port ptport if it is a valid port. Output ! 41: destined for the standard output will not reach the standard ! 42: output if the symbol ^w is non nil (although it will still ! 43: go to ptport if ptport is a valid port). ! 44: ! 45: Some of the functions listed below reference files ! 46: directly. FRANZ LISP has borrowed a convenient shorthand ! 47: notation from /_b_i_n/_c_s_h, concerning naming files. If a file ! 48: name begins with ~ (tilde), and the symbol tilde-expansion ! 49: ! 50: is bound to something other than nil, then FRANZ LISP ! 51: expands the file name. It takes the string of characters ! 52: between the leading tilde, and the first slash as a user- ! 53: name. Then, that initial segment of the filename is ! 54: replaced by the home directory of the user. The null user- ! 55: name is taken to be the current user. ! 56: ! 57: FRANZ LISP keeps a cache of user home directory infor- ! 58: mation, to minimize searching the password file. Tilde- ! 59: expansion is performed in the following functions: _c_f_a_s_l, ! 60: _c_h_d_i_r, _f_a_s_l, _f_f_a_s_l, _f_i_l_e_o_p_e_n, _i_n_f_i_l_e, _l_o_a_d, _o_u_t_f_i_l_e, _p_r_o_b_e_f, ! 61: ! 62: ! 63: Input/Output 5-1 ! 64: ! 65: ! 66: ! 67: ! 68: ! 69: ! 70: ! 71: Input/Output 5-2 ! 72: ! 73: ! 74: _s_y_s:_a_c_c_e_s_s, _s_y_s:_u_n_l_i_n_k. ! 75: ! 76: (cfasl 'st_file 'st_entry 'st_funcname ['st_disc ! 77: ['st_library]]) ! 78: ! 79: RETURNS: t ! 80: ! 81: SIDE EFFECT: This is used to load in a foreign function ! 82: (see 8.4). The object file st_file is ! 83: loaded into the lisp system. St_entry ! 84: should be an entry point in the file just ! 85: loaded. The function binding of the sym- ! 86: bol s_funcname will be set to point to ! 87: st_entry, so that when the lisp function ! 88: s_funcname is called, st_entry will be ! 89: run. st_disc is the discipline to be ! 90: given to s_funcname. st_disc defaults to ! 91: "subroutine" if it is not given or if it ! 92: is given as nil. If st_library is non- ! 93: null, then after st_file is loaded, the ! 94: libraries given in st_library will be ! 95: searched to resolve external references. ! 96: The form of st_library should be something ! 97: like "-lm". The C library (" -lc " ) is ! 98: always searched so when loading in a C ! 99: file you probably won't need to specify a ! 100: library. For Fortran files, you should ! 101: specify "-lF77" and if you are doing any ! 102: I/O, the library entry should be "-lI77 ! 103: -lF77". For Pascal files "-lpc" is ! 104: required. ! 105: ! 106: NOTE: This function may be used to load the output of ! 107: the assembler, C compiler, Fortran compiler, and ! 108: Pascal compiler but NOT the lisp compiler (use ! 109: _f_a_s_l for that). If a file has more than one ! 110: entry point, then use _g_e_t_a_d_d_r_e_s_s to locate and ! 111: setup other foreign functions. ! 112: It is an error to load in a file which has a glo- ! 113: bal entry point of the same name as a global ! 114: entry point in the running lisp. As soon as you ! 115: load in a file with _c_f_a_s_l, its global entry ! 116: points become part of the lisp's entry points. ! 117: Thus you cannot _c_f_a_s_l in the same file twice ! 118: unless you use _r_e_m_o_v_e_a_d_d_r_e_s_s to change certain ! 119: global entry points to local entry points. ! 120: ! 121: ! 122: ! 123: ! 124: ! 125: ! 126: 9 ! 127: ! 128: 9 Printed: January 31, 1984 ! 129: ! 130: ! 131: ! 132: ! 133: ! 134: ! 135: ! 136: Input/Output 5-3 ! 137: ! 138: ! 139: (close 'p_port) ! 140: ! 141: RETURNS: t ! 142: ! 143: SIDE EFFECT: the specified port is drained and closed, ! 144: releasing the port. ! 145: ! 146: NOTE: The standard defaults are not used in this case ! 147: since you probably never want to close the stan- ! 148: dard output or standard input. ! 149: ! 150: (cprintf 'st_format 'xfst_val ['p_port]) ! 151: ! 152: RETURNS: xfst_val ! 153: ! 154: SIDE EFFECT: The UNIX formatted output function printf ! 155: is called with arguments st_format and ! 156: xfst_val. If xfst_val is a symbol then ! 157: its print name is passed to printf. The ! 158: format string may contain characters which ! 159: are just printed literally and it may con- ! 160: tain special formatting commands preceded ! 161: by a percent sign. The complete set of ! 162: formatting characters is described in the ! 163: UNIX manual. Some useful ones are %d for ! 164: printing a fixnum in decimal, %f or %e for ! 165: printing a flonum, and %s for printing a ! 166: character string (or print name of a sym- ! 167: bol). ! 168: ! 169: EXAMPLE: (_c_p_r_i_n_t_f "_P_i _e_q_u_a_l_s %_f" _3._1_4_1_5_9) prints `Pi ! 170: equals 3.14159' ! 171: ! 172: (drain ['p_port]) ! 173: ! 174: RETURNS: nil ! 175: ! 176: SIDE EFFECT: If this is an output port then the charac- ! 177: ters in the output buffer are all sent to ! 178: the device. If this is an input port then ! 179: all pending characters are flushed. The ! 180: default port for this function is the ! 181: default output port. ! 182: ! 183: ! 184: ! 185: ! 186: ! 187: ! 188: ! 189: ! 190: ! 191: 9 ! 192: ! 193: 9 Printed: January 31, 1984 ! 194: ! 195: ! 196: ! 197: ! 198: ! 199: ! 200: ! 201: Input/Output 5-4 ! 202: ! 203: ! 204: (ex [s_filename]) ! 205: (vi [s_filename]) ! 206: (exl [s_filename]) ! 207: (vil [s_filename]) ! 208: ! 209: RETURNS: nil ! 210: ! 211: SIDE EFFECT: The lisp system starts up an editor on the ! 212: file named as the argument. It will try ! 213: appending .l to the file if it can't find ! 214: it. The functions _e_x_l and _v_i_l will load ! 215: the file after you finish editing it. ! 216: These functions will also remember the ! 217: name of the file so that on subsequent ! 218: invocations, you don't need to provide the ! 219: argument. ! 220: ! 221: NOTE: These functions do not evaluate their argument. ! 222: ! 223: (fasl 'st_name ['st_mapf ['g_warn]]) ! 224: ! 225: WHERE: st_mapf and g_warn default to nil. ! 226: ! 227: RETURNS: t if the function succeeded, nil otherwise. ! 228: ! 229: SIDE EFFECT: this function is designed to load in an ! 230: object file generated by the lisp compiler ! 231: Liszt. File names for object files usu- ! 232: ally end in `.o', so _f_a_s_l will append `.o' ! 233: to st_name (if it is not already present). ! 234: If st_mapf is non nil, then it is the name ! 235: of the map file to create. _F_a_s_l writes in ! 236: the map file the names and addresses of ! 237: the functions it loads and defines. Nor- ! 238: mally the map file is created (i.e. trun- ! 239: cated if it exists), but if ! 240: (_s_s_t_a_t_u_s _a_p_p_e_n_d_m_a_p _t) is done then the map ! 241: file will be appended. If g_warn is non ! 242: nil and if a function is loaded from the ! 243: file which is already defined, then a ! 244: warning message will be printed. ! 245: ! 246: NOTE: _f_a_s_l only looks in the current directory for the ! 247: file to load. The function _l_o_a_d looks through a ! 248: user-supplied search path and will call _f_a_s_l if ! 249: it finds a file with the same root name and a ! 250: `.o' extension. In most cases the user would be ! 251: better off using the function _l_o_a_d rather than ! 252: calling _f_a_s_l directly. ! 253: ! 254: ! 255: ! 256: 9 ! 257: ! 258: 9 Printed: January 31, 1984 ! 259: ! 260: ! 261: ! 262: ! 263: ! 264: ! 265: ! 266: Input/Output 5-5 ! 267: ! 268: ! 269: (ffasl 'st_file 'st_entry 'st_funcname ['st_discipline ! 270: ['st_library]]) ! 271: ! 272: RETURNS: the binary object created. ! 273: ! 274: SIDE EFFECT: the Fortran object file st_file is loaded ! 275: into the lisp system. St_entry should be ! 276: an entry point in the file just loaded. A ! 277: binary object will be created and its ! 278: entry field will be set to point to ! 279: st_entry. The discipline field of the ! 280: binary will be set to st_discipline or ! 281: "subroutine" by default. If st_library is ! 282: present and non-null, then after st_file ! 283: is loaded, the libraries given in ! 284: st_library will be searched to resolve ! 285: external references. The form of ! 286: st_library should be something like "-lS ! 287: -ltermcap". In any case, the standard ! 288: Fortran libraries will be searched also to ! 289: resolve external references. ! 290: ! 291: NOTE: in F77 on Unix, the entry point for the fortran ! 292: function foo is named `_foo_'. ! 293: ! 294: (filepos 'p_port ['x_pos]) ! 295: ! 296: RETURNS: the current position in the file if x_pos is ! 297: not given or else x_pos if x_pos is given. ! 298: ! 299: SIDE EFFECT: If x_pos is given, the next byte to be ! 300: read or written to the port will be at ! 301: position x_pos. ! 302: ! 303: (filestat 'st_filename) ! 304: ! 305: RETURNS: a vector containing various numbers which the ! 306: UNIX operating system assigns to files. if ! 307: the file doesn't exist, an error is invoked. ! 308: Use _p_r_o_b_e_f to determine if the file exists. ! 309: ! 310: NOTE: The individual entries can be accesed by mnemonic ! 311: functions of the form filestat:_f_i_e_l_d, where field ! 312: may be any of atime, ctime, dev, gid, ino, ! 313: mode,mtime, nlink, rdev, size, type, uid. See ! 314: the UNIX programmers manual for a more detailed ! 315: description of these quantities. ! 316: ! 317: ! 318: ! 319: ! 320: ! 321: 9 ! 322: ! 323: 9 Printed: January 31, 1984 ! 324: ! 325: ! 326: ! 327: ! 328: ! 329: ! 330: ! 331: Input/Output 5-6 ! 332: ! 333: ! 334: (flatc 'g_form ['x_max]) ! 335: ! 336: RETURNS: the number of characters required to print ! 337: g_form using _p_a_t_o_m. If x_max is given and if ! 338: _f_l_a_t_c determines that it will return a value ! 339: greater than x_max, then it gives up and ! 340: returns the current value it has computed. ! 341: This is useful if you just want to see if an ! 342: expression is larger than a certain size. ! 343: ! 344: (flatsize 'g_form ['x_max]) ! 345: ! 346: RETURNS: the number of characters required to print ! 347: g_form using _p_r_i_n_t. The meaning of x_max is ! 348: the same as for flatc. ! 349: ! 350: NOTE: Currently this just _e_x_p_l_o_d_e's g_form and checks ! 351: its length. ! 352: ! 353: (fileopen 'st_filename 'st_mode) ! 354: ! 355: RETURNS: a port for reading or writing (depending on ! 356: st_mode) the file st_name. ! 357: ! 358: SIDE EFFECT: the given file is opened (or created if ! 359: opened for writing and it doesn't yet ! 360: exist). ! 361: ! 362: NOTE: this function call provides a direct interface to ! 363: the operating system's fopen function. The mode ! 364: may be more than just "r" for read, "w" for write ! 365: or "a" for append. The modes "r+", "w+" and "a+" ! 366: permit both reading and writing on a port pro- ! 367: vided that _f_s_e_e_k is done between changes in ! 368: direction. See the UNIX manual description of ! 369: fopen for more details. This routine does not ! 370: look through a search path for a given file. ! 371: ! 372: (fseek 'p_port 'x_offset 'x_flag) ! 373: ! 374: RETURNS: the position in the file after the function is ! 375: performed. ! 376: ! 377: SIDE EFFECT: this function positions the read/write ! 378: pointer before a certain byte in the file. ! 379: If x_flag is 0 then the pointer is set to ! 380: x_offset bytes from the beginning of the ! 381: file. If x_flag is 1 then the pointer is ! 382: set to x_offset bytes from the current ! 383: location in the file. If x_flag is 2 then ! 384: the pointer is set to x_offset bytes from ! 385: the end of the file. ! 386: 9 ! 387: ! 388: 9 Printed: January 31, 1984 ! 389: ! 390: ! 391: ! 392: ! 393: ! 394: ! 395: ! 396: Input/Output 5-7 ! 397: ! 398: ! 399: (infile 's_filename) ! 400: ! 401: RETURNS: a port ready to read s_filename. ! 402: ! 403: SIDE EFFECT: this tries to open s_filename and if it ! 404: cannot or if there are no ports available ! 405: it gives an error message. ! 406: ! 407: NOTE: to allow your program to continue on a file-not- ! 408: found error, you can use something like: ! 409: (_c_o_n_d ((_n_u_l_l (_s_e_t_q _m_y_p_o_r_t (_c_a_r (_e_r_r_s_e_t (_i_n_f_i_l_e ! 410: _n_a_m_e) _n_i_l)))) ! 411: (_p_a_t_o_m '"_c_o_u_l_d_n'_t _o_p_e_n _t_h_e _f_i_l_e"))) ! 412: which will set myport to the port to read from if ! 413: the file exists or will print a message if it ! 414: couldn't open it and also set myport to nil. To ! 415: simply determine if a file exists, use _p_r_o_b_e_f. ! 416: ! 417: (load 's_filename ['st_map ['g_warn]]) ! 418: ! 419: RETURNS: t ! 420: ! 421: NOTE: The function of _l_o_a_d has changed since previous ! 422: releases of FRANZ LISP and the following descrip- ! 423: tion should be read carefully. ! 424: ! 425: SIDE EFFECT: _l_o_a_d now serves the function of both _f_a_s_l ! 426: and the old _l_o_a_d. _L_o_a_d will search a user ! 427: defined search path for a lisp source or ! 428: object file with the filename s_filename ! 429: (with the extension .l or .o added as ! 430: appropriate). The search path which _l_o_a_d ! 431: uses is the value of (_s_t_a_t_u_s _l_o_a_d-_s_e_a_r_c_h- ! 432: _p_a_t_h). The default is (|.| /usr/lib/lisp) ! 433: which means look in the current directory ! 434: first and then /usr/lib/lisp. The file ! 435: which _l_o_a_d looks for depends on the last ! 436: two characters of s_filename. If ! 437: s_filename ends with ".l" then _l_o_a_d will ! 438: only look for a file name s_filename and ! 439: will assume that this is a FRANZ LISP ! 440: source file. If s_filename ends with ".o" ! 441: then _l_o_a_d will only look for a file named ! 442: s_filename and will assume that this is a ! 443: FRANZ LISP object file to be _f_a_s_led in. ! 444: Otherwise, _l_o_a_d will first look for ! 445: s_filename.o, then s_filename.l and ! 446: finally s_filename itself. If it finds ! 447: s_filename.o it will assume that this is ! 448: an object file, otherwise it will assume ! 449: that it is a source file. An object file ! 450: is loaded using _f_a_s_l and a source file is ! 451: loaded by reading and evaluating each form ! 452: ! 453: ! 454: Printed: January 31, 1984 ! 455: ! 456: ! 457: ! 458: ! 459: ! 460: ! 461: ! 462: Input/Output 5-8 ! 463: ! 464: ! 465: in the file. The optional arguments ! 466: st_map and g_warn are passed to _f_a_s_l ! 467: should _f_a_s_l be called. ! 468: ! 469: NOTE: _l_o_a_d requires a port to open the file s_filename. ! 470: It then lambda binds the symbol piport to this ! 471: port and reads and evaluates the forms. ! 472: ! 473: (makereadtable ['s_flag]) ! 474: ! 475: WHERE: if s_flag is not present it is assumed to be ! 476: nil. ! 477: ! 478: RETURNS: a readtable equal to the original readtable if ! 479: s_flag is non-null, or else equal to the ! 480: current readtable. See chapter 7 for a ! 481: description of readtables and their uses. ! 482: ! 483: (msg [l_option ...] ['g_msg ...]) ! 484: ! 485: NOTE: This function is intended for printing short mes- ! 486: sages. Any of the arguments or options presented ! 487: can be used any number of times, in any order. ! 488: The messages themselves (g_msg) are evaluated, ! 489: and then they are transmitted to _p_a_t_o_m. Typi- ! 490: cally, they are strings, which evaluate to them- ! 491: selves. The options are interpreted specially: ! 492: ! 493: ! 494: ____________________________________________________ ! 495: ! 496: _m_s_g _O_p_t_i_o_n _S_u_m_m_a_r_y ! 497: ! 498: (_P _p__p_o_r_t_n_a_m_e) causes subsequent output to go to the port p_portname ! 499: (port should be opened previously) ! 500: ! 501: _B print a single blank. ! 502: ! 503: (_B '_n__b) evaluate n_b and print that many blanks. ! 504: ! 505: _N print a single by calling _t_e_r_p_r. ! 506: ! 507: (_N '_n__n) evaluate n_n and transmit ! 508: that many newlines to the stream. ! 509: ! 510: _D _d_r_a_i_n the current port. ! 511: ____________________________________________________ ! 512: ! 513: ! 514: ! 515: ! 516: ! 517: 9 ! 518: ! 519: 9 Printed: January 31, 1984 ! 520: ! 521: ! 522: ! 523: ! 524: ! 525: ! 526: ! 527: Input/Output 5-9 ! 528: ! 529: ! 530: (nwritn ['p_port]) ! 531: ! 532: RETURNS: the number of characters in the buffer of the ! 533: given port but not yet written out to the file ! 534: or device. The buffer is flushed automati- ! 535: cally when filled, or when _t_e_r_p_r is called. ! 536: ! 537: (outfile 's_filename ['st_type]) ! 538: ! 539: RETURNS: a port or nil ! 540: ! 541: SIDE EFFECT: this opens a port to write s_filename. If ! 542: st_type is given and if it is a symbol or ! 543: string whose name begins with `a', then ! 544: the file will be opened in append mode, ! 545: that is the current contents will not be ! 546: lost and the next data will be written at ! 547: the end of the file. Otherwise, the file ! 548: opened is truncated by _o_u_t_f_i_l_e if it ! 549: existed beforehand. If there are no free ! 550: ports, outfile returns nil. If one cannot ! 551: write on s_filename, an error is sig- ! 552: nalled. ! 553: ! 554: (patom 'g_exp ['p_port]) ! 555: ! 556: RETURNS: g_exp ! 557: ! 558: SIDE EFFECT: g_exp is printed to the given port or the ! 559: default port. If g_exp is a symbol or ! 560: string, the print name is printed without ! 561: any escape characters around special char- ! 562: acters in the print name. If g_exp is a ! 563: list then _p_a_t_o_m has the same effect as ! 564: _p_r_i_n_t. ! 565: ! 566: (pntlen 'xfs_arg) ! 567: ! 568: RETURNS: the number of characters needed to print ! 569: xfs_arg. ! 570: ! 571: (portp 'g_arg) ! 572: ! 573: RETURNS: t iff g_arg is a port. ! 574: ! 575: ! 576: ! 577: ! 578: ! 579: ! 580: ! 581: ! 582: 9 ! 583: ! 584: 9 Printed: January 31, 1984 ! 585: ! 586: ! 587: ! 588: ! 589: ! 590: ! 591: ! 592: Input/Output 5-10 ! 593: ! 594: ! 595: (pp [l_option] s_name1 ...) ! 596: ! 597: RETURNS: t ! 598: ! 599: SIDE EFFECT: If s_name_i has a function binding, it is ! 600: pretty-printed, otherwise if s_name_i has a ! 601: value then that is pretty-printed. Nor- ! 602: mally the output of the pretty-printer ! 603: goes to the standard output port poport. ! 604: The options allow you to redirect it. ! 605: ! 606: ! 607: ____________________________________________________ ! 608: ! 609: _P_P _O_p_t_i_o_n _S_u_m_m_a_r_y ! 610: ! 611: (_F _s__f_i_l_e_n_a_m_e) direct future printing to s_filename ! 612: ! 613: (_P _p__p_o_r_t_n_a_m_e) causes output to go to the port p_portname ! 614: (port should be opened previously) ! 615: ! 616: (_E _g__e_x_p_r_e_s_s_i_o_n) evaluate g_expression and don't print ! 617: ____________________________________________________ ! 618: ! 619: ! 620: ! 621: ! 622: (princ 'g_arg ['p_port]) ! 623: ! 624: EQUIVALENT TO: patom. ! 625: ! 626: (print 'g_arg ['p_port]) ! 627: ! 628: RETURNS: nil ! 629: ! 630: SIDE EFFECT: prints g_arg on the port p_port or the ! 631: default port. ! 632: ! 633: (probef 'st_file) ! 634: ! 635: RETURNS: t iff the file st_file exists. ! 636: ! 637: NOTE: Just because it exists doesn't mean you can read ! 638: it. ! 639: ! 640: ! 641: ! 642: ! 643: ! 644: ! 645: ! 646: ! 647: 9 ! 648: ! 649: 9 Printed: January 31, 1984 ! 650: ! 651: ! 652: ! 653: ! 654: ! 655: ! 656: ! 657: Input/Output 5-11 ! 658: ! 659: ! 660: (pp-form 'g_form ['p_port]) ! 661: ! 662: RETURNS: t ! 663: ! 664: SIDE EFFECT: g_form is pretty-printed to the port ! 665: p_port (or poport if p_port is not given). ! 666: This is the function which _p_p uses. _p_p- ! 667: _f_o_r_m does not look for function defini- ! 668: tions or values of variables, it just ! 669: prints out the form it is given. ! 670: ! 671: NOTE: This is useful as a top-level-printer, c.f. _t_o_p- ! 672: _l_e_v_e_l in Chapter 6. ! 673: ! 674: (ratom ['p_port ['g_eof]]) ! 675: ! 676: RETURNS: the next atom read from the given or default ! 677: port. On end of file, g_eof (default nil) is ! 678: returned. ! 679: ! 680: (read ['p_port ['g_eof]]) ! 681: ! 682: RETURNS: the next lisp expression read from the given ! 683: or default port. On end of file, g_eof ! 684: (default nil) is returned. ! 685: ! 686: NOTE: An error will occur if the reader is given an ill ! 687: formed expression. The most common error is too ! 688: many right parentheses (note that this is not ! 689: considered an error in Maclisp). ! 690: ! 691: (readc ['p_port ['g_eof]]) ! 692: ! 693: RETURNS: the next character read from the given or ! 694: default port. On end of file, g_eof (default ! 695: nil) is returned. ! 696: ! 697: (readlist 'l_arg) ! 698: ! 699: RETURNS: the lisp expression read from the list of ! 700: characters in l_arg. ! 701: ! 702: ! 703: ! 704: ! 705: ! 706: ! 707: ! 708: ! 709: ! 710: ! 711: ! 712: 9 ! 713: ! 714: 9 Printed: January 31, 1984 ! 715: ! 716: ! 717: ! 718: ! 719: ! 720: ! 721: ! 722: Input/Output 5-12 ! 723: ! 724: ! 725: (removeaddress 's_name1 ['s_name2 ...]) ! 726: ! 727: RETURNS: nil ! 728: ! 729: SIDE EFFECT: the entries for the s_name_i in the Lisp ! 730: symbol table are removed. This is useful ! 731: if you wish to _c_f_a_s_l or _f_f_a_s_l in a file ! 732: twice, since it is illegal for a symbol in ! 733: the file you are loading to already exist ! 734: in the lisp symbol table. ! 735: ! 736: (resetio) ! 737: ! 738: RETURNS: nil ! 739: ! 740: SIDE EFFECT: all ports except the standard input, out- ! 741: put and error are closed. ! 742: ! 743: (setsyntax 's_symbol 's_synclass ['ls_func]) ! 744: ! 745: RETURNS: t ! 746: ! 747: SIDE EFFECT: this sets the code for s_symbol to sx_code ! 748: in the current readtable. If s_synclass ! 749: is _m_a_c_r_o or _s_p_l_i_c_i_n_g then ls_func is the ! 750: associated function. See Chapter 7 on ! 751: the reader for more details. ! 752: ! 753: (sload 's_file) ! 754: ! 755: SIDE EFFECT: the file s_file (in the current directory) ! 756: is opened for reading and each form is ! 757: read, printed and evaluated. If the form ! 758: is recognizable as a function definition, ! 759: only its name will be printed, otherwise ! 760: the whole form is printed. ! 761: ! 762: NOTE: This function is useful when a file refuses to ! 763: load because of a syntax error and you would like ! 764: to narrow down where the error is. ! 765: ! 766: (tab 'x_col ['p_port]) ! 767: ! 768: SIDE EFFECT: enough spaces are printed to put the cur- ! 769: sor on column x_col. If the cursor is ! 770: beyond x_col to start with, a _t_e_r_p_r is ! 771: done first. ! 772: ! 773: ! 774: ! 775: ! 776: ! 777: 9 ! 778: ! 779: 9 Printed: January 31, 1984 ! 780: ! 781: ! 782: ! 783: ! 784: ! 785: ! 786: ! 787: Input/Output 5-13 ! 788: ! 789: ! 790: (terpr ['p_port]) ! 791: ! 792: RETURNS: nil ! 793: ! 794: SIDE EFFECT: a terminate line character sequence is ! 795: sent to the given port or the default ! 796: port. This will also drain the port. ! 797: ! 798: (terpri ['p_port]) ! 799: ! 800: EQUIVALENT TO: terpr. ! 801: ! 802: (tilde-expand 'st_filename) ! 803: ! 804: RETURNS: a symbol whose pname is the tilde-expansion of ! 805: the argument, (as discussed at the beginning ! 806: of this chapter). If the argument does not ! 807: begin with a tilde, the argument itself is ! 808: returned. ! 809: ! 810: (tyi ['p_port]) ! 811: ! 812: RETURNS: the fixnum representation of the next charac- ! 813: ter read. On end of file, -1 is returned. ! 814: ! 815: (tyipeek ['p_port]) ! 816: ! 817: RETURNS: the fixnum representation of the next charac- ! 818: ter to be read. ! 819: ! 820: NOTE: This does not actually read the character, it ! 821: just peeks at it. ! 822: ! 823: (tyo 'x_char ['p_port]) ! 824: ! 825: RETURNS: x_char. ! 826: ! 827: SIDE EFFECT: the character whose fixnum representation ! 828: is x_code, is printed as a on the given ! 829: output port or the default output port. ! 830: ! 831: (untyi 'x_char ['p_port]) ! 832: ! 833: SIDE EFFECT: x_char is put back in the input buffer so ! 834: a subsequent _t_y_i or _r_e_a_d will read it ! 835: first. ! 836: ! 837: NOTE: a maximum of one character may be put back. ! 838: ! 839: ! 840: ! 841: ! 842: 9 ! 843: ! 844: 9 Printed: January 31, 1984 ! 845: ! 846: ! 847: ! 848: ! 849: ! 850: ! 851: ! 852: Input/Output 5-14 ! 853: ! 854: ! 855: (username-to-dir 'st_name) ! 856: ! 857: RETURNS: the home directory of the given user. The ! 858: result is stored, to avoid unnecessarily ! 859: searching the password file. ! 860: ! 861: (zapline) ! 862: ! 863: RETURNS: nil ! 864: ! 865: SIDE EFFECT: all characters up to and including the ! 866: line termination character are read and ! 867: discarded from the last port used for ! 868: input. ! 869: ! 870: NOTE: this is used as the macro function for the semi- ! 871: colon character when it acts as a comment charac- ! 872: ter. ! 873: ! 874: ! 875: ! 876: ! 877: ! 878: ! 879: ! 880: ! 881: ! 882: ! 883: ! 884: ! 885: ! 886: ! 887: ! 888: ! 889: ! 890: ! 891: ! 892: ! 893: ! 894: ! 895: ! 896: ! 897: ! 898: ! 899: ! 900: ! 901: ! 902: ! 903: ! 904: ! 905: ! 906: ! 907: 9 ! 908: ! 909: 9 Printed: January 31, 1984 ! 910: ! 911: ! 912:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.