ELF EXTENDED LISP FUNCTION LIBRARY for AutoLISP Version 1.1 Documentation and Reference Manual February 6, 1993 _______ ____|__ | (R) --| | |------------------- | ____|__ | Association of | | |_| Shareware |__| o | Professionals -----| | |--------------------- |___|___| MEMBER Mountain Software Autodesk Registered Developer 1579 Nottingham Road Charleston, WV 25314 CIS 70717,3564 Phone: 800-357-2040 304-746-0246 FAX: 304-744-1785 BBS: 304-744-7925 Copyright 1992-95 Mountain Software all rights reserved EXTENDED LISP FUNCTION LIBRARY Table of Contents Using ELF Introduction . . . . . . . . . . . . . . . . . . . . . . . 1 ELF Features . . . . . . . . . . . . . . . . . . . . . . . 1 Installation . . . . . . . . . . . . . . . . . . . . . . . 3 ACAD.ADS . . . . . . . . . . . . . . . . . . . . . . . . . 3 ACAD.LSP . . . . . . . . . . . . . . . . . . . . . . . . . 4 ELF.INI . . . . . . . . . . . . . . . . . . . . . . . . . . 4 Sample Programs . . . . . . . . . . . . . . . . . . . . . . 5 ELFDOS Commands cd . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 change directories; chdir, dcd cls . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 clear (erase) the text screen; c: . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 logs to C: drive; dcopy . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 copy DOS file(s); derase . . . . . . . . . . . . . . . . . . . . . . . . . . 7 erase / delete DOS file(s); ddel dir . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 prints a file directory list; ddir drename . . . . . . . . . . . . . . . . . . . . . . . . . . 7 rename / move file(s); dmove elf . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 displays a list of all ELF commands and functions; ff . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 find file(s) on the AutoCAD library path and DOS path; look . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 display ASCII file(s) to the screen using the ELF browser; mkdir . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 create a directory; md, dmd password . . . . . . . . . . . . . . . . . . . . . . . . . 9 register ELF with your password (obtain from Mountain Software); rmdir . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 remove (delete) a directory; rd, drd sd . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 set default disk drive; dsd symbol . . . . . . . . . . . . . . . . . . . . . . . . . . 10 displays the value of an AutoLISP symbol; ver . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 prints ELF, DOS and AutoCAD version numbers; what . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 a compact "LIST" command to display entity values; AutoLISP Functions Optional Parameters . . . . . . . . . . . . . . . . . . . . 11 Variable Parameters . . . . . . . . . . . . . . . . . . . . 11 ELF Documentation Table of Contents, Page ii Data Types . . . . . . . . . . . . . . . . . . . . . . . . 11 Return Values . . . . . . . . . . . . . . . . . . . . . . . 12 Video Functions box . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 draws a box (rectangle) on the text screen using graphic ascii characters.; (box col row ecol erow attr btype) cls . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 clear text screen to optional color attribute; (cls attr) get_video . . . . . . . . . . . . . . . . . . . . . . . . . 13 get current text screen video parameters; (get_video) printf . . . . . . . . . . . . . . . . . . . . . . . . . . 14 formatted "C" type print to text screen or graphics command prompt area; (printf format ...) prts . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 fast write to text screen at col, row position with optional attribute; (prts col row string attr) puts . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 fast write to text screen at cursor position with optional attribute; (puts string attr) restore_screen . . . . . . . . . . . . . . . . . . . . . . 15 restores a previously captured text screen; (restore_screen) save_screen . . . . . . . . . . . . . . . . . . . . . . . . 15 captures the contents of the text screen to a memory buffer; (save_screen) scr_fill . . . . . . . . . . . . . . . . . . . . . . . . . 15 fill a rectangle of the text screen with a character and color attribute; (scr_fill col row cols rows ch attr) scr_printf . . . . . . . . . . . . . . . . . . . . . . . . 16 formatted "C" type print to text screen using direct video buffer write; (scr_printf format ...) set_color . . . . . . . . . . . . . . . . . . . . . . . . . 16 sets the internal "color" variable for use by subsequent uses of routines which can use the default color (r11); (set_color attr) Cursor Functions get_cursor . . . . . . . . . . . . . . . . . . . . . . . . 17 get cursor size / shape; (get_cursor) getxy . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 get cursor screen coordinates; (getxy) gotoxy . . . . . . . . . . . . . . . . . . . . . . . . . . 17 position the screen cursor; (gotoxy col row) set_cursor . . . . . . . . . . . . . . . . . . . . . . . . 17 set cursor size; start to end scan lines; (set_cursor start end) Window Functions set_menu_help . . . . . . . . . . . . . . . . . . . . . . . 18 sets the user help string list for wmenu; (set_menu_help ) wclose . . . . . . . . . . . . . . . . . . . . . . . . . . 19 ELF Documentation Table of Contents, Page iii closes the top window restoring the screen under the window; (wclose) wcloseall . . . . . . . . . . . . . . . . . . . . . . . . . 19 closes all windows; (wcloseall) wclreol . . . . . . . . . . . . . . . . . . . . . . . . . . 19 erase from window cursor to end of line; (wclreol) wcls . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 clear window to optional color attribute; (wcls attr) werase_line . . . . . . . . . . . . . . . . . . . . . . . . 20 erase a line of text from a window; (werase_line line) wgetstr . . . . . . . . . . . . . . . . . . . . . . . . . . 20 open a window centered on the text screen, prints a prompt on the top border and gets string input.; (wgetstr prompt default length wattr battr btype) wgetdrive . . . . . . . . . . . . . . . . . . . . . . . . . 20 select a disk drive from a menu, all valid drives are listed with their respective drive type (eg removable/floppy, fixed, network, and redirected devices); (wgetdrive col row wattr battr hattr btype) wgetfile . . . . . . . . . . . . . . . . . . . . . . . . . 21 select a file from a menu of DOS files from the current directory. The user can change directories and access all available disk drives.; (wgetfile filespec fileattr col row wattr battr hattr btype) wgetxy . . . . . . . . . . . . . . . . . . . . . . . . . . 22 get window screen position; (wgetxy) wgotoxy . . . . . . . . . . . . . . . . . . . . . . . . . . 22 move window cursor; (wgotoxy col row) winfo . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 gets the top window size and position; (winfo) wmenu . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 opens a centered window and displays a menu. The user can then select one of the displayed items.; (wmenu slist wattr battr hattr btype shadow title) wmsg . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 opens a centered window, displays a message and optionally waits for a keystroke and closes the window; (wmsg str wait attr battr btype) wopen . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 open a window on the text screen with specified location, size, border, and colors; saving the area under the window; (wopen col row cols rows wattr battr btype) wpopup . . . . . . . . . . . . . . . . . . . . . . . . . . 25 open a window centered on the text screen; (wpopup cols rows wattr battr) wprintf . . . . . . . . . . . . . . . . . . . . . . . . . . 26 printf to window at window cursor position; (wprintf format ...) wprts . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 write to window at col, row position with optional attribute; (wprts col row string attr) wputcen . . . . . . . . . . . . . . . . . . . . . . . . . . 26 ELF Documentation Table of Contents, Page iv write a centered string to window at window cursor row position; (wputcen str) wputs . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 write to window at window cursor position with optional attribute; (puts string attr) wscroll . . . . . . . . . . . . . . . . . . . . . . . . . . 27 scroll window text; (wscroll dir start end lines) wshadow . . . . . . . . . . . . . . . . . . . . . . . . . . 27 adds a drop shadow to the top (last opened) window; (wshadow attr) wtitle . . . . . . . . . . . . . . . . . . . . . . . . . . 28 prints on the border of a window in one of 6 positions; (wtitle []) Keyboard Functions getch . . . . . . . . . . . . . . . . . . . . . . . . . . . 28 get a character from the keyboard; (getch) getche . . . . . . . . . . . . . . . . . . . . . . . . . . 29 get a character from the keyboard with echo; (getche) getkey . . . . . . . . . . . . . . . . . . . . . . . . . . 29 get a keystroke from the keyboard; (getkey) kbhit . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 checks the keyboard buffer for a waiting keystroke; (kbhit) key_clear . . . . . . . . . . . . . . . . . . . . . . . . . 30 clears the keyboard buffer of any pending keystrokes; (key_clear) key_ready . . . . . . . . . . . . . . . . . . . . . . . . . 30 returns immediately with a waiting key; (key_ready) key_stat . . . . . . . . . . . . . . . . . . . . . . . . . 30 gets the state of keyboard shift and other special keys; (key_stat) key_stuff . . . . . . . . . . . . . . . . . . . . . . . . . 30 "pushes" keys into the keyboard buffer; (key_stuff str) Directory Functions access . . . . . . . . . . . . . . . . . . . . . . . . . . 31 determines if a file exists and can be accessed by mode; (access path mode) chdir . . . . . . . . . . . . . . . . . . . . . . . . . . . 31 change disk directory; (chdir path) chpath . . . . . . . . . . . . . . . . . . . . . . . . . . 32 change current disk drive and directory; (chpath path) disk_ready . . . . . . . . . . . . . . . . . . . . . . . . 32 verifies that a removable (floppy) drive is ready and readable; (disk_ready drive) disk_type . . . . . . . . . . . . . . . . . . . . . . . . . 32 ; (disk_type drive) disk_valid . . . . . . . . . . . . . . . . . . . . . . . . 32 verifies that a disk drive is a valid device (but not necessarily ready if a removable/floppy drive); (disk_valid drive) erasefile . . . . . . . . . . . . . . . . . . . . . . . . . 33 ELF Documentation Table of Contents, Page v erase file(s); (erasefile filename) file_exists . . . . . . . . . . . . . . . . . . . . . . . . 33 determines if a file exists; (file_exists path) findfirst . . . . . . . . . . . . . . . . . . . . . . . . . 33 finds the first instance of a file who's name and directory attributes match the arguments.; (findfirst filespec attribute) findnext . . . . . . . . . . . . . . . . . . . . . . . . . 34 finds the next occurrence of the file specification and attribute after a findfirst call; (findnext) fullpath . . . . . . . . . . . . . . . . . . . . . . . . . 34 expands a partial path into a full DOS path string; (fullpath path) getdir . . . . . . . . . . . . . . . . . . . . . . . . . . 35 returns a string with the current drive:\path; (getdir) getdiskfree . . . . . . . . . . . . . . . . . . . . . . . . 35 returns size statistics in the specified drive number as a list; (getdiskfree 3) getdisk . . . . . . . . . . . . . . . . . . . . . . . . . . 35 returns the current drive number (A=1, B=2, C=3, etc); (getdisk) load_dirs . . . . . . . . . . . . . . . . . . . . . . . . . 35 returns a list of strings containing file directories from the current directory; (load_dirs) load_drives . . . . . . . . . . . . . . . . . . . . . . . . 36 returns a list of strings containing all valid disk drives; (load_drives) load_files . . . . . . . . . . . . . . . . . . . . . . . . 36 returns a list of strings containing files matching a filespec and directory attribute; (load_files filespec attribute) makepath . . . . . . . . . . . . . . . . . . . . . . . . . 36 Combines the four components into a full DOS path string; (makepath drive dir name ext) mkdir . . . . . . . . . . . . . . . . . . . . . . . . . . . 36 creates a new directory; (mkdir dirname) d i r e c t o r y directory to create rmdir . . . . . . . . . . . . . . . . . . . . . . . . . . . 37 removes (deletes) a directory; (rmdir dirname) setdisk . . . . . . . . . . . . . . . . . . . . . . . . . . 37 logs to the specified disk drive; (setdisk drive) splitpath . . . . . . . . . . . . . . . . . . . . . . . . . 37 splits a DOS path string into its four components; (splitpath path) unlink . . . . . . . . . . . . . . . . . . . . . . . . . . 38 erase file(s); (unlink filename) File Functions copyfile . . . . . . . . . . . . . . . . . . . . . . . . . 38 copies file(s); (copyfile source destination) look . . . . . . . . . . . . . . . . . . . . . . . . . . . 39 ELF Documentation Table of Contents, Page vi displays an ASCII file to screen using the ELF file viewer; (look filespec) movefile . . . . . . . . . . . . . . . . . . . . . . . . . 39 moves / renames file(s); (movefile source destination) read_file . . . . . . . . . . . . . . . . . . . . . . . . . 39 reads an ASCII file and returns a string list from file records. Each line in the text file is parsed into a string and appended to the returned list.; (read_file filespec mode) write_file . . . . . . . . . . . . . . . . . . . . . . . . 39 opens an ASCII file and writes a string list to the file and then closes the file. Each string is placed in the text file as a line of text.; (write_file filespec type) Binary File fclose . . . . . . . . . . . . . . . . . . . . . . . . . . 40 closes a binary file; (fclose ) feof . . . . . . . . . . . . . . . . . . . . . . . . . . . 40 returns nonnil if the end of file has been reached; (feof ferror . . . . . . . . . . . . . . . . . . . . . . . . . . 41 returns nonnil if OS file error indicator has been set; (ferror ) fgetc . . . . . . . . . . . . . . . . . . . . . . . . . . . 41 reads a character (byte) value from a binary file; (fgetc ) fgets . . . . . . . . . . . . . . . . . . . . . . . . . . . 41 reads a string of up to len characters from a binary file; (fgets ) fgetsc . . . . . . . . . . . . . . . . . . . . . . . . . . 41 reads a signed character value from a binary file; (fgetsc ) fgetint . . . . . . . . . . . . . . . . . . . . . . . . . . 42 reads a short integer (2 byte word) value from a binary file; (fgetint ) fgetlong . . . . . . . . . . . . . . . . . . . . . . . . . 42 reads a long integer (4 byte double word) value from a binary file; (fgetlong ) fgetreal . . . . . . . . . . . . . . . . . . . . . . . . . 42 reads a real (8 byte double precision floating point) value from a binary file; (fgetreal ) fopen . . . . . . . . . . . . . . . . . . . . . . . . . . . 43 opens a binary file; (fopen ) fputc . . . . . . . . . . . . . . . . . . . . . . . . . . . 43 writes a character (byte) value to a binary file; (fputc ) fputs . . . . . . . . . . . . . . . . . . . . . . . . . . . 43 writes a string to a binary file; (fputs ) fputint . . . . . . . . . . . . . . . . . . . . . . . . . . 44 writes an integer (2 byte word) value to a binary file; (fputint ) ELF Documentation Table of Contents, Page vii fputlong . . . . . . . . . . . . . . . . . . . . . . . . . 44 writes a long integer (4 byte double word) value to a binary file; (fputlong ) fputreal . . . . . . . . . . . . . . . . . . . . . . . . . 44 writes a real (8 byte double precision floating point) value to a binary file; (fputreal ) frewind . . . . . . . . . . . . . . . . . . . . . . . . . . 44 moves the file pointer to the beginning of the file; (frewind ) fseek . . . . . . . . . . . . . . . . . . . . . . . . . . . 45 moves the file pointer; (fseek ) ftell . . . . . . . . . . . . . . . . . . . . . . . . . . . 45 returns the current position of a binary file pointer; (ftell ) Math Functions | . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46 returns the result of a bitwise OR of the arguments; (| ...) || . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46 returns the result of a logical OR of the arguments; (|| ...) & . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46 returns the result of a bitwise AND of the arguments; (& ...) && . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46 returns the result of a logical AND of the arguments; (&& ...) acos . . . . . . . . . . . . . . . . . . . . . . . . . . . 46 returns the inverse cosine of the argument; (acos rad) asin . . . . . . . . . . . . . . . . . . . . . . . . . . . 47 returns the inverse sine of the argument; (asin rad) ceil . . . . . . . . . . . . . . . . . . . . . . . . . . . 47 returns the smallest integer greater or equal to the argument; (ceil rval) cosh . . . . . . . . . . . . . . . . . . . . . . . . . . . 47 returns the hyperbolic cosine of the argument; (cosh rad) dtr . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47 converts an angle in degrees to radians; (dtr ang) floor . . . . . . . . . . . . . . . . . . . . . . . . . . . 48 returns the largest integer not greater than the argument; (floor rval) hibyte . . . . . . . . . . . . . . . . . . . . . . . . . . 48 returns the upper (most significant) byte of an integer; (hibyte val) int2sc . . . . . . . . . . . . . . . . . . . . . . . . . . 48 converts a signed integer into a signed char; (int2sc val) lobyte . . . . . . . . . . . . . . . . . . . . . . . . . . 48 returns the lower (least significant) byte of an integer; (lobyte val) log10 . . . . . . . . . . . . . . . . . . . . . . . . . . . 49 returns the logarithm to the base 10 of the argument; (log10 x) ELF Documentation Table of Contents, Page viii rand . . . . . . . . . . . . . . . . . . . . . . . . . . . 49 generates a pseudo random number; (rand) round . . . . . . . . . . . . . . . . . . . . . . . . . . . 49 rounds a real value; (round val places) rtd . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49 converts an angle in radians to degrees; (rtd ang) sinh . . . . . . . . . . . . . . . . . . . . . . . . . . . 49 returns the hyperbolic sine of the argument; (sinh rad) srand . . . . . . . . . . . . . . . . . . . . . . . . . . . 50 seeds the random number generator; (srand i) swapb . . . . . . . . . . . . . . . . . . . . . . . . . . . 50 reverses bytes in a (short) integer; (swapb i) tan . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50 returns the trigonometric tangent of the argument; (tan rad) tanh . . . . . . . . . . . . . . . . . . . . . . . . . . . 50 returns the hyperbolic tangent of the argument; (tanh rad) xtoi . . . . . . . . . . . . . . . . . . . . . . . . . . . 51 converts a hex string to an integer; (xtoi s) List Handling Functions bsearch . . . . . . . . . . . . . . . . . . . . . . . . . . 51 located a value in a sorted string, integer or real value list; (bsearch vlist key) delete . . . . . . . . . . . . . . . . . . . . . . . . . . 51 deletes a list or atom from another list; (delete list pos) insert . . . . . . . . . . . . . . . . . . . . . . . . . . 52 inserts a list or atom into another list; (insert list pos item) lfind . . . . . . . . . . . . . . . . . . . . . . . . . . . 52 located a value in an unsorted string, integer or real value list; (lfind vlist key) lsearch . . . . . . . . . . . . . . . . . . . . . . . . . . 52 located a value in a string, integer or real value list; (lsearch vlist key) qsort . . . . . . . . . . . . . . . . . . . . . . . . . . . 53 sorts a string, integer or real value list; or a list of lists; (qsort lst field) replace . . . . . . . . . . . . . . . . . . . . . . . . . . 53 replace a list or atom in a list with another; (replace list pos item) symbol . . . . . . . . . . . . . . . . . . . . . . . . . . 53 Displays the contents of a symbol to the screen using the ELF file/symbol viewer.; (symbol sym) String Handling Functions field . . . . . . . . . . . . . . . . . . . . . . . . . . . 54 returns a substring of str1 from token delimiters in str2 and position.; (field str1 str2 pos) set_edit_help . . . . . . . . . . . . . . . . . . . . . . . 54 sets the user help string list for the function (strget); (set_edit_help ) ELF Documentation Table of Contents, Page ix sprintf . . . . . . . . . . . . . . . . . . . . . . . . . . 54 same as printf except that nothing is printed, the string is returned; (sprintf format ...) strchr . . . . . . . . . . . . . . . . . . . . . . . . . . 55 finds the first occurrence of ch in str and returns a substring starting at that character; (strchr str ch) strcmp . . . . . . . . . . . . . . . . . . . . . . . . . . 55 compares two strings for equality (case sensitive); (strcmp str1 str2) strcspn . . . . . . . . . . . . . . . . . . . . . . . . . . 55 determine the length of the prefix of str1 made entirely of chars not in str2; (strcspn str1 str2) strdate . . . . . . . . . . . . . . . . . . . . . . . . . . 56 returns the current date from the internal clock as a formatted string; (strdate) strdela . . . . . . . . . . . . . . . . . . . . . . . . . . 56 delete all occurrences of chars in str2 from str1; (strdela str1 str2) strget . . . . . . . . . . . . . . . . . . . . . . . . . . 56 edit a string on the text screen with cursor positioning and editing, background mask, color attribute control, and on line help.; (strget str len curpos mask attr ...) stricmp . . . . . . . . . . . . . . . . . . . . . . . . . . 57 compares two strings for equality (case insensitive); (stricmp str1 str2) strncpy . . . . . . . . . . . . . . . . . . . . . . . . . . 58 copies the first n characters of a string; (strncpy str n) strnset . . . . . . . . . . . . . . . . . . . . . . . . . . 58 fills a string; (strnset char len) strpbrk . . . . . . . . . . . . . . . . . . . . . . . . . . 58 returns a substring of the first occurrence of any character of str2 in str1; (strstr str1 str2) strrchr . . . . . . . . . . . . . . . . . . . . . . . . . . 58 finds the last occurrence of ch in str and returns a substring starting at that character; (strrchr str ch) strrev . . . . . . . . . . . . . . . . . . . . . . . . . . 59 returns the string argument with the character order reversed; (strrev str) strspn . . . . . . . . . . . . . . . . . . . . . . . . . . 59 determine the length of the prefix of str1 made entirely of chars in str2; (strspn str1 str2) strstr . . . . . . . . . . . . . . . . . . . . . . . . . . 59 returns a substring of the first occurrence of str2 in str1; (strstr str1 str2) strswap . . . . . . . . . . . . . . . . . . . . . . . . . . 59 swaps all occurrences of char1 with char2 in str; (strswap str char1 char2) strtime . . . . . . . . . . . . . . . . . . . . . . . . . . 60 returns the current time from the internal clock as a formatted string; (strtime) strtok . . . . . . . . . . . . . . . . . . . . . . . . . . 60 returns the first substring of str1 from token delimiters in str2. subsequent calls after the first with no ELF Documentation Table of Contents, Page x arguments will return the second and any further substrings; (strtok str1 str2) strtrim . . . . . . . . . . . . . . . . . . . . . . . . . . 60 trim white space (all char values < '!') from the beginning (left side) and end (right side); and compresses white space within a string to a single space between words; (strtrim str) strtriml . . . . . . . . . . . . . . . . . . . . . . . . . 61 trim white space from the beginning (left side) of a string; (strtriml str) strtrimr . . . . . . . . . . . . . . . . . . . . . . . . . 61 trim white space from the end (right side) of a string; (strtrimr str) tolower . . . . . . . . . . . . . . . . . . . . . . . . . . 61 ; (tolower char) toupper . . . . . . . . . . . . . . . . . . . . . . . . . . 61 ; (toupper char) Character Classification Functions isalnum . . . . . . . . . . . . . . . . . . . . . . . . . . 62 returns a non-zero value if argument is a letter or digit; (isalnum char) isascii . . . . . . . . . . . . . . . . . . . . . . . . . . 62 returns a non-zero value if argument is an ASCII character; (isascii char) iscntl . . . . . . . . . . . . . . . . . . . . . . . . . . 62 returns a non-zero value if argument is a control character; (iscntl char) isdigit . . . . . . . . . . . . . . . . . . . . . . . . . . 62 returns a non-zero value if argument is a numeric digit; (isdigit char) isgraph . . . . . . . . . . . . . . . . . . . . . . . . . . 63 returns a non-zero value if argument is a visible printable character; (isgraph char) islower . . . . . . . . . . . . . . . . . . . . . . . . . . 63 returns a non-zero value if argument is a lower case letter; (islower char) isodigit . . . . . . . . . . . . . . . . . . . . . . . . . 63 returns a non-zero value if argument is an octal digit (0- 7); (isodigit char) isprint . . . . . . . . . . . . . . . . . . . . . . . . . . 63 returns a non-zero value if argument is a printable character; (isprint char) ispunct . . . . . . . . . . . . . . . . . . . . . . . . . . 64 returns a non-zero value if argument is a punctuation character; (ispunct char) isspace . . . . . . . . . . . . . . . . . . . . . . . . . . 64 returns a non-zero value if argument is a white-space character (space, tab, newline, etc); (isspace char) isupper . . . . . . . . . . . . . . . . . . . . . . . . . . 64 returns a non-zero value if argument is an upper case letter; (isupper char) isxdigit . . . . . . . . . . . . . . . . . . . . . . . . . 64 ELF Documentation Table of Contents, Page xi returns a non-zero value if argument is a hexadecimal digit (0-F); (isxdigit char) Entity Creation arc . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65 create an arc entity; (arc cen rad sang eang layer) circle . . . . . . . . . . . . . . . . . . . . . . . . . . 65 create a circle entity; (circle cen rad layer) grid . . . . . . . . . . . . . . . . . . . . . . . . . . . 65 create a grid of line entities; (grid pnt cols rows colwidth rowheight layer) line . . . . . . . . . . . . . . . . . . . . . . . . . . . 66 create a line entity; (line from to layer) point . . . . . . . . . . . . . . . . . . . . . . . . . . . 66 create a point entity; (point pt layer) pline . . . . . . . . . . . . . . . . . . . . . . . . . . . 67 create a polyline entity; (pline vlist layer width flags) rect . . . . . . . . . . . . . . . . . . . . . . . . . . . 67 create a polygon rectangle entity; (rect pt width height layer) solid . . . . . . . . . . . . . . . . . . . . . . . . . . . 67 create a solid entity; (solid pt1 pt2 pt3 pt4 layer) text . . . . . . . . . . . . . . . . . . . . . . . . . . . 68 create a text entity; (text pt str height layer rot obl flg hal val apt) Selection Set . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69 ss_filter . . . . . . . . . . . . . . . . . . . . . . . . . 69 filters a selection set removing all entities except those in a list of entity types; (ss_filter ss slist) ss_move . . . . . . . . . . . . . . . . . . . . . . . . . . 69 uses the AutoCAD dragger to move a selection set; (ss_move ss pt) ss_rotate . . . . . . . . . . . . . . . . . . . . . . . . . 69 uses the AutoCAD dragger to rotate a selection set; (ss_rotate ss pt) ss_scale . . . . . . . . . . . . . . . . . . . . . . . . . 70 uses the AutoCAD dragger to scale a selection set; (ss_scale ss pt) ss_union . . . . . . . . . . . . . . . . . . . . . . . . . 70 merges all entities in two selection sets into a new third selection set; (ss_union ss1 ss2) ss_inters . . . . . . . . . . . . . . . . . . . . . . . . . 70 merges all entities common to two selection sets into a new third selection set; (ss_inters ss1 ss2) ss_diff . . . . . . . . . . . . . . . . . . . . . . . . . . 70 creates a new selection from two selection sets by copying the first and removing entities found in the second from the new selection set.; (ss_diff ss1 ss2) ss_xform . . . . . . . . . . . . . . . . . . . . . . . . . 71 ELF Documentation Table of Contents, Page xii transform entities in a selection set using a transformation matrix; (ss_xform ss mat) Utility / Miscellaneous Functions . . . . . . . . . . . . . . 71 adsdump . . . . . . . . . . . . . . . . . . . . . . . . . . 71 prints the data type and value of an AutoLISP symbol; (adsdump sym) beep . . . . . . . . . . . . . . . . . . . . . . . . . . . 72 sound a beep on the PC speaker for optional frequency and duration; (beep freq duration) clock . . . . . . . . . . . . . . . . . . . . . . . . . . . 72 reads the current internal clock; (clock) exit . . . . . . . . . . . . . . . . . . . . . . . . . . . 72 cancels execution and returns to the Command: prompt; (exit) getver . . . . . . . . . . . . . . . . . . . . . . . . . . 72 returns the ELF, AutoCAD, and DOS version numbers; (getver) last_error . . . . . . . . . . . . . . . . . . . . . . . . 73 returns the last internal error message; (last_error) initialize . . . . . . . . . . . . . . . . . . . . . . . . 73 resets ELF and loads ELF.INI symbols; (initialize) nosound . . . . . . . . . . . . . . . . . . . . . . . . . . 73 turns off the PC speaker after a sound function; (nosound) pause_key . . . . . . . . . . . . . . . . . . . . . . . . . 73 prints "press any key to continue..." and waits for a keystroke; (pause_key) sound . . . . . . . . . . . . . . . . . . . . . . . . . . . 73 turns on the PC speaker at a specified tone frequency; (sound freq) system . . . . . . . . . . . . . . . . . . . . . . . . . . 74 executes a DOS command; (system cmd) wait . . . . . . . . . . . . . . . . . . . . . . . . . . . 74 suspend execution for a specified time duration; (wait ti) Symbols *last_error* . . . . . . . . . . . . . . . . . . . . . . . 74 the last error message string color . . . . . . . . . . . . . . . . . . . . . . . . . . . 74 default color attribute edit_help . . . . . . . . . . . . . . . . . . . . . . . . . 74 string list with user defined help for the (strget) function error_mode . . . . . . . . . . . . . . . . . . . . . . . . 74 controls ELF error message display; 1=display errors,0=no message menu_help . . . . . . . . . . . . . . . . . . . . . . . . . 75 string list with user defined help for the (wmenu) function Copyright . . . . . . . . . . . . . . . . . . . . . . . . . 76 Trademark . . . . . . . . . . . . . . . . . . . . . . . . . 76 Elf Documentation Page 1 Using ELF Introduction ELF is a library of commands and functions designed to enhance AutoCAD and AutoLISP. The ELF library contains 16 utility and file management commands, and over 190 functions for AutoLISP, all contained in a single EXP file. ELF gives the AutoLISP programmer a professional programming language rivaling many commercial compiled language libraries. The range of functions include those for text screen video and window control; popup menus and data entry with a build in help system; sound; keyboard; string manipulation; math; sorting and searching; list handling; file and directory handling; entity creation; and several utility functions. Non-programmers will also appreciate the mini-applications (ELFapps), including the ELF notepad; and the several utility commands. In addition, ELF contains ELFDOS, which implements many DOS commands within AutoCAD for file management, a file and symbol browser, and integrated help. ELF is designed to operate with AutoCAD 386 (release 10-386 and above) on IBM PC and compatible computers under the MS/PCDOS operating system. ELF Features * 193 new functions for AutoLISP programmers: + Video (11 functions) - fast direct video writes to the text screen - printf for C programmers - color attribute control - screen save, fill, and restore + Cursor (4) - cursor positioning - cursor size shape + Text screen windowing (23) - multiple overlapping windows with shaded borders and drop shadows - menus and line editor with integrated user defined help system - file dialog + Keyboard (8) - getkey, getch, getche, and kbhit functions - keyboard status - stuff keyboard buffer with keystrokes + Directory (23) Elf Documentation Page 2 - create / remove / change directories - read / verify / log to all disk drives - read disk directory and disk statistics - copy, move, erase, and rename files. - file path manipulation + File (23) - fast one step ASCII file read and write - binary file I/O + List Handling (8) - insert, delete, and replace items in a list - sort and search a string, integer, or real list - view a string list using the internal browser + String Handling (25) - full C library string scanning and manipulation - a full featured line editor for flexable data entry + Character Classification (13) + Math (23) - expanded trig, logical, and bit manipulation + Entity Creation (9) - fast basic entity creation in one statement using entmake + Selection Set Manipulation (8) - selection set filter - graphic dragger interface - entity transformation - logical union/intersection/difference + Utility / Misc (13) - sound routines - dump a list or entity for debugging - run other DOS programs under program control - clock and timer routines * an ASCII file browser (like the shareware program LIST) * ELFDOS - "DOS-like" file management commands from within AutoCAD, no more shelling out to copy a file or perform other DOS functions. * Three useful "ELFapps" that utilize the ELF library including: + NotePad - a windowed / full screen ASCII file editor written in AutoLISP using ELF + Etables - an AutoCAD "stock" application modified to utilize the ELF menus and symbol browser to display all tables within a drawing. + Demo - a program the demonstrates many of the functions of the ELF library Elf Documentation Page 3 Installation Copy the ELF files from the distribution diskette (or extract them from the archive file) to any subdirectory on the AutoCAD library path. You may place the ELF files in their own subdirectory (eg C:\ELF) and add that directory to your AutoCAD Library Path. To insure that AutoCAD can the find files, add the ELF directory to your ACAD environment variable in your AUTOEXEC.BAT or ACAD386.BAT file: Example: SET ACAD=C:\ACAD386\SUPPORT;C:\ELF ACAD.ADS If you have an ACAD.ADS file, then add ELF to that file with an ASCII editor, or create a file named ACAD.ADS to a directory on the library path. Example contents release 12 ACAD.ADS file: ACADAPP ELF If ELF does not load with your ACAD.ADS file then you must load it manually: eg: (XLOAD"ELF") Once loaded, ELF will display the following message, and ELF commands and functions will be available for use: ELF vX.XX - , Registered to: Your Name Copyright 1992,93 Mountain Software. - Enter "ELF" for help: You may add the following code to any AutoLISP program which uses ELF to automatically xload ELF.EXP: (if(not(member(findfile "ELF.EXP") (ADS))) (if(not(xload"ELF" nil)) (progn (princ "\nERROR: Unable to xload ELF.EXP") (princ\nThis program requires ELF to operate!\007"))) ) or you can simply add (load"ELF") to your program to load ELF.EXP and define color and key symbols. Elf Documentation Page 4 ACAD.LSP ELF functions can not be executed until ELF initializes. AutoCAD does not initialize ADS programs until after ACAD.LSP loads. You can include ELF functions in any function that you wish to (defun) in ACAD.LSP, but they can not execute during the load. Therefore, if you wish to execute an ELF function at entry to the drawing editor, you can place that function into the function (S::STARTUP) which will execute automatically after AutoCAD initialized ELF. ELF.INI This file provides a means to control the name prefix of elf functions and initial setting of the ELF system variable "error_mode". You can also set AutoLISP symbols (release 12 or higher) from ELF.INI. The layout of ELF.INI (an ASCII file similar to "Microsoft Windows" INI files) is as follows: [ELF] begin ELF variable/symbol definition Symbols are defined one line per symbol as = where can be a string(the default), integer, or real value. Integer values must be prepended with a #(pound sign) and real values with a %(percent sign). = =% =# Example: [ELF] function_prefix=elf_ error_mode=%0 color=%7 The "function_prefix" variable string is prepended to ELF functions during ELF's "defun" process. For example, if function_prefix=elf_ then the function "printf" will be defined as "elf_printf". The "error_mode" variable controls ELF's error message display. error_mode=%1 display error messages error_mode=%0 don't display error messages Elf Documentation Page 5 Sample Programs The following files contain "ELFapps" that demonstrate many of the ELF functions. You may run these programs to test ELF's features and copy portions of the code for use in your own programs. Filename Description DEMO.LSP A demonstration of many of ELF's functions NOTEPAD.LSP An ASCII file editor written in AutoLISP and ELF. ETABLES.LSP A program which demonstrates how a "stock" AutoLISP program (here TABLES.LSP, a sample program included with other AutoCAD sample files) can be easily modified using functions from ELF and greatly improved from it's original form. SELSET.LSP demonstrates the ADS dragger functions, and the selection set transformation/manipulation functions ELF.LSP defines symbols for screen attributes, border types, keycode values, and xloads ELF.EXP if not already loaded. Elf Documentation Page 6 ELFDOS Commands ELF contains many file manipulation commands equivalent to the same commands in DOS. Many of the command names are the same as the DOS command except that the letter "D" is added as the first letter of the command to differentiate from similarly named AutoCAD command (eg DCOPY for COPY). Why not just shell to DOS? The ELF replacements for DOS commands are faster and more convenient. It takes time to shell to DOS and return after the command has completed. ELF also adds ASCII file and AutoLISP symbol viewers, and a filefind command. ---------------------------------------- Function: cd ELF Commands Synopsis: change directories Aliases: chdir, dcd Arguments: directory name Notes: works just like the DOS chdir command except a space or Enter is required between CD and the directory name Example: CD \ACAD ---------------------------------------- Function: cls ELF Commands Synopsis: clear (erase) the text screen Aliases: Arguments: Notes: Example: ---------------------------------------- Function: c: ELF Commands Synopsis: logs to C: drive Aliases: Arguments: Elf Documentation Page 7 Notes: Similar to DOS, ELF creates a command for each valid disk drive, therefore, if drives A:,B:,C:, and D: are valid drives, then any of those drives can be logged by entering its drive letter and a colon. Elf will not log to a drive that is not ready (eg floppy drive door open) Example: ---------------------------------------- Function: dcopy ELF Commands Synopsis: copy DOS file(s) Aliases: Arguments: from filespec to copy from (can be a wildcard) to filename or directory to copy to Notes: dcopy performs a "double buffered" (eg fast) file copy and prints from and to filenames as they are copied Example: dcopy c:\acad\*.doc d:\temp ---------------------------------------- Function: derase ELF Commands Synopsis: erase / delete DOS file(s) Aliases: ddel Arguments: filespec filespec to erase (can be a wildcard) Notes: prints filenames as they are deleted Example: derase c:\acad\*.bak ---------------------------------------- Function: dir ELF Commands Synopsis: prints a file directory list Aliases: ddir Arguments: filespec optional wildcard filespec (eg *.DWG) /W optional switch, prints wide (five filenames per line) Notes: Example: ddir *.doc ---------------------------------------- Function: drename ELF Commands Synopsis: rename / move file(s) Aliases: dmove Arguments: from filespec to move from (can be a wildcard) to filename or directory to move to Elf Documentation Page 8 Notes: destination must be the same device Example: dmove c:\acad\*.doc c:\temp ---------------------------------------- Function: elf ELF Commands Synopsis: displays a list of all ELF commands and functions Aliases: Arguments: Notes: uses the ELF browser to display help for all ELF commands and functions (see look). Example: ---------------------------------------- Function: ff ELF Commands Synopsis: find file(s) on the AutoCAD library path and DOS path Aliases: Arguments: Notes: searches for file(s) in the following sequence: 1 - The current directory, the real current directory, which may not be on the AutoCAD library path if you have changed directories after starting AutoCAD. 2 - the AutoCAD library path using AutoCAD's (findfile) function. 3 - the DOS path Example: ff *.sty ---------------------------------------- Function: look ELF Commands Synopsis: display ASCII file(s) to the screen using the ELF browser Aliases: Arguments: filespec file(s) to display Elf Documentation Page 9 Notes: look loads each file matching the filespec into a memory buffer and displays each using the internal full screen browser. The cursor keys can be used to view the file contents. The file can also be printed. If no filename is specified, look will call (wgetfile) where the user can select a file. Key assignments in the browser are as follows: Key Function F1 Help F2 text search (case insensitive) Esc Quit all files Q/X/E Quit / Exit file Alt-P print the entire contents of the buffer to PRN Home Top of file End Bottom of file Up Up one line Dn Down one line PgUp Up one page PgDn and other keys Down one page Example: look c:\acad\*.doc ---------------------------------------- Function: mkdir ELF Commands Synopsis: create a directory Aliases: md, dmd Arguments: directory name Notes: Example: MD C:\ACAD\TEMPDIR ---------------------------------------- Function: password ELF Commands Synopsis: register ELF with your password (obtain from Mountain Software) Aliases: Arguments: Notes: Once the elf password is entered, the delay messages will not appear. Passwords are provided to those who purchase ELF. Example: ---------------------------------------- Function: rmdir ELF Commands Synopsis: remove (delete) a directory Aliases: rd, drd Arguments: Elf Documentation Page 10 Notes: the directory must be empty Example: RD C:\ACAD\TEMPDIR ---------------------------------------- Function: sd ELF Commands Synopsis: set default disk drive Aliases: dsd Arguments: Notes: ELF also defines all valid drives as commands (eg A:, B:, C:, D:, etc). Example: ---------------------------------------- Function: symbol ELF Commands Synopsis: displays the value of an AutoLISP symbol Aliases: Arguments: sym symbol name Notes: (release 12 only) Symbol name can not be an AutoLISP expression. Symbols of type Subr or Exsubr can not be displayed. See the command "look" for a description of the ELF browser. Example: (setq symlist (qsort(atoms-family 1))) symbol symlist ---------------------------------------- Function: ver ELF Commands Synopsis: prints ELF, DOS and AutoCAD version numbers Aliases: Arguments: Notes: Example: ---------------------------------------- Function: what ELF Commands Synopsis: a compact "LIST" command to display entity values Aliases: Arguments: ss a selection set Notes: "what" prompts for a selection set, the user can specify a selection set using any of AutoCAD's selection methods Example: ---------------------------------------- Elf Documentation Page 11 AutoLISP Functions Optional Parameters The ELF library utilizes optional parameters for many of its functions. Optional parameters assume a default value when no specific value is specified in the function call. For example, the ELF function (beep) with no parameters will sound the PC speaker at a frequency of 440 hertz for 0.5 seconds by default. Or, you can specify the frequency alone (beep 800) or the frequency and time, (beep 800 1.0). You can not, however, specify the second parameter without specifying the first. Variable Parameters Some functions also accept a variable number of parameters. For example, the function (printf format ...) requires a format parameter, but additional parameters are required only if the format contains variable specifier. (printf "\nHello World") requires only the format parameter but (printf "Name: %10.10s, Age: %2d" name age) requires two additional parameters to supply the required values. Data Types The following pneumonics are used to denote data types in ELF functions. Pneumonic Data Type Description ------------------------------------------------------------- integer signed short Integer real double precision float string character string integer a character ascii value list AutoLISP list string list list of strings string directory path string single character string drive letter string directory string file name string file extension integer integer disk number (A=1) integer screen column (X) position integer screen row (Y) position integer screen color attribute point a list of two or three reals point " real radius units real angle in radians string an AutoCAD layer symbol an AutoLISP symbol (atom or list) ELF Functions page 12 sel set AutoCAD selection set list A 4 X 4 transformation matrix as a list of 4 lists each containing 4 real values. Return Values ELF functions can return any of the primary data types (eg int, real, string, and nil) and lists. AutoCAD 386 does not support a long integer data type, therefore some ELF functions that would return a long will return a real value. The function (rand) returns real values from a long integer result. Many functions return lists of values. The values of the list can be retrieved using (nth) as well as (car), (cdr), and up to four levels of concatenations of (car) and (cadr) as follows: (nth 0 lst) (car list) ;first element (nth 1 lst) (cadr list) ;second element (nth 2 lst) (caddr list) ;third element (nth 3 lst) (cadddr list) ;fourth element (nth 4 lst) (caddddr list) ;fifth element (nth 5 lst) ;fifth element, etc Many functions that are converted C functions will return nil instead of 0 to indicate a False result. This allows testing for falsity in one step. For example: (if(isascii ch)(doit)) is much simpler than: (if(/= 0 (isascii ch))(doit)) Video Functions The ELF video system is a collection of fast and flexible functions that write directly to the text screen video screen buffer. The function printf, from of the C function library, is included in two forms. The first, (printf) uses the AutoCAD internal printf function. Text printed with this function will "stick" if the user presses to flipscreen to the graphics screen and back to the text screen. AutoCAD uses it's own text screen buffer to save the screen on a single monitor setup. The function (scr_printf), as well as many of the other screen write functions, writes directly to the video buffer, and is not saved to AutoCAD's internal buffer. It is much faster, but will disappear when the user flips screen to the graphics screen and ELF Functions page 13 then returns to the text screen. (scr_printf) also prints using a color attribute. The color attribute is set with the (set_color) function or, in release 12 the symbol "color" can be set to the selected color attribute. The internal color variable is also used by the other screen write functions if no color attribute is specified in the optional attribute function parameter. The file COLORS.LSP contains symbolic names for the color attributes and can be loaded within any AutoLISP program to define the color symbols. ---------------------------------------- Function: box Video Synopsis: draws a box (rectangle) on the text screen using graphic ascii characters. Prototype: (box col row ecol erow attr btype) Arguments: col upper left corner column position row upper left corner row position ecol lower right corner column position erow lower right corner row position attr optional color attribute [default color symbol] btype optional border type [default single line] Returns: none Notes: does not erase the area inside the box Example: (box 10 2 70 18 23 1) ---------------------------------------- Function: cls Video Synopsis: clear text screen to optional color attribute Prototype: (cls attr) Arguments: attr optional color attribute Returns: none Notes: Example: (cls 23) ;;; clear screen using light grey on blue attribute ---------------------------------------- Function: get_video Video Synopsis: get current text screen video parameters Prototype: (get_video) Arguments: none ELF Functions page 14 Returns: cols width of text screen (usually 80) rows height of text screen (usually 25) mode video mode page video page Notes: Example: (setq vid (get_video) cols (car vid) rows (cadr vid)) ---------------------------------------- Function: printf Video Synopsis: formatted "C" type print to text screen or graphics command prompt area Prototype: (printf format ...) Arguments: format conversion specification string Returns: ... a , or arguments for each format specifier in the format parameter Notes: see a "C" language text or compiler library documentation Example: (printf "%-10s%10.2f %d" strvar floatvar intvar) ---------------------------------------- Function: prts Video Synopsis: fast write to text screen at col, row position with optional attribute Prototype: (prts col row string attr) Arguments: col screen column position row screen row position string text string attr optional color attribute Returns: none Notes: uses direct video buffer write for speed Example: (prts 40 10 "Hello World" 23) ---------------------------------------- Function: puts Video Synopsis: fast write to text screen at cursor position with optional attribute Prototype: (puts string attr) ELF Functions page 15 Arguments: string text string attr optional color attribute Returns: none Notes: uses direct video buffer write for speed Example: (puts "Hello World" 23) ---------------------------------------- Function: restore_screen Video Synopsis: restores a previously captured text screen Prototype: (restore_screen) Arguments: none Returns: 1 if successful, nil otherwise Notes: the cursor position and size are not restored (use get_cursor/set_cursor) Example: see save_screen ---------------------------------------- Function: save_screen Video Synopsis: captures the contents of the text screen to a memory buffer Prototype: (save_screen) Arguments: none Returns: 1 if successful, nil otherwise Notes: only one buffer is allocated, subsequent use will overwrite any previous contents of the buffer Example: (save_screen) ;;; take a picture of the screen ;;; do something that messes up the screen (restore_screen) ;;; put it back the way that it was ---------------------------------------- Function: scr_fill Video Synopsis: fill a rectangle of the text screen with a character and color attribute Prototype: (scr_fill col row cols rows ch attr) Arguments: col upper left column position row upper left row position cols lower right column position rows lower right row position ch character as an integer attr color attribute Returns: none ELF Functions page 16 Notes: Example: (setq vid (get_video) vcols (car vid) vrows (cadr vid)) (scr_fill 0 0 vcols vrows (ascii "°") 23) ;;; fill entire screen with patterned lightgrey on blue ---------------------------------------- Function: scr_printf Video Synopsis: formatted "C" type print to text screen using direct video buffer write Prototype: (scr_printf format ...) Arguments: format conversion specification string Returns: ... any number of , or arguments Notes: see printf Example: see printf ---------------------------------------- Function: set_color Video Synopsis: sets the internal "color" variable for use by subsequent uses of routines which can use the default color (r11) Prototype: (set_color attr) Arguments: attr color attribute Returns: for release 12 the AutoLISP symbol COLOR is used to set the default color Notes: (set_color 23) Example: ---------------------------------------- Cursor Functions The cursor functions provide a means to control the location and appearance of the screen cursor. Several of the video screen write functions print at the cursor location, (gotoxy) positions the cursor and (getxy) returns the current cursor location. (get_cursor) returns the cursor shape and (set_cursor) sets the cursor shape (start and ending scan lines). (set_cursor 32 0) will also hide the cursor. ---------------------------------------- ELF Functions page 17 Function: get_cursor Cursor Synopsis: get cursor size / shape Prototype: (get_cursor) Arguments: Returns: start start scan line end end scan line Notes: Example: (setq save_cur (get_cursor)) ;;; save cursor shape ---------------------------------------- Function: getxy Cursor Synopsis: get cursor screen coordinates Prototype: (getxy) Arguments: Returns: col screen column position row screen row position Notes: Example: (setq pos (getxy) col (car pos) row (cadr pos)) ---------------------------------------- Function: gotoxy Cursor Synopsis: position the screen cursor Prototype: (gotoxy col row) Arguments: col screen column (x) position row screen row (y) position Returns: Notes: Example: (gotoxy 0 0) ;;; home cursor ---------------------------------------- Function: set_cursor Cursor Synopsis: set cursor size; start to end scan lines Prototype: (set_cursor start end) Arguments: start start scan line end end scan line Returns: ELF Functions page 18 Notes: full cursor size is different depending on video mode, the CGA cursor is 8 scan lines high, the monochrome ,EGA, and VGA cursors are 14 scan lines high. Specifying 32 as the start scan line will hide the cursor. Example: (set_cursor 0 13) ;;; full block cursor (set_cursor 12 13) ;;; normal cursor (set_cursor 32 0) ;;; hide cursor ---------------------------------------- Window Functions The ELF text screen window system rivals many commercial compiled language function libraries. It provides the programmer with the tools to produce a professional "look and feel" to AutoLISP programs. When a window is opened, the screen text under the window and its border and shadow are saved. When the window is closed the screen is restored to its previous state. There is no practical limit to the number of windows open at on time. Only the topmost window can be written to using the window writing routines (eg wputs, wprts, etc). If you wish to write to a window other than the topmost window, you can do so, but you must use the screen writing routines, calculate cursor position, and otherwise maintain the window yourself. When no color attribute is specified in a window write function, the window attribute will be used by default, not the symbol "color" as used by screen writing functions. ---------------------------------------- Function: set_menu_help Window Synopsis: sets the user help string list for wmenu Prototype: (set_menu_help ) Arguments: a string list to be displayed when the F1 key is pressed while in (wmenu). The first item in the list will be the help window title. Returns: ELF Functions page 19 Notes: In release 12 or higher the symbol MENU_HELP can be used to set the help string. In release 12 (set_menu_help) will also set this symbol. The symbol MENU_HELP can be local to a particular function or global in scope. The user can display the default help screen by pressing F1 the second time. Example: (set_menu_help '("[ My Help Screen ]" "" "This is my help message")) ---------------------------------------- Function: wclose Window Synopsis: closes the top window restoring the screen under the window Prototype: (wclose) Arguments: none Returns: number of remaining open windows if successful or nil Notes: Example: ---------------------------------------- Function: wcloseall Window Synopsis: closes all windows Prototype: (wcloseall) Arguments: none Returns: Notes: use at the end of programs to close any remaining open windows Example: ---------------------------------------- Function: wclreol Window Synopsis: erase from window cursor to end of line Prototype: (wclreol) Arguments: Returns: none Notes: Example: ---------------------------------------- Function: wcls Window Synopsis: clear window to optional color attribute Prototype: (wcls attr) ELF Functions page 20 Arguments: attr optional color attribute Returns: none Notes: Example: (wcls 23) ;;; clear window using light grey on blue attribute ---------------------------------------- Function: werase_line Window Synopsis: erase a line of text from a window Prototype: (werase_line line) Arguments: line window row to erase Returns: none Notes: Example: (werase_line 2) ;;; erase line 2 ---------------------------------------- Function: wgetstr Window Synopsis: open a window centered on the text screen, prints a prompt on the top border and gets string input. Prototype: (wgetstr prompt default length wattr battr btype) Arguments: prompt prompt string default optional default string / string to edit len optional string length (default = 78) wattr optional window attribute (default = color symbol) battr optional border attribute (optional = wattr) btype optional border type (default = double) Returns: the edited string or nil if the string is empty Notes: see strget and wpopup Example: (wgetstr "Enter text" "Hello World" 60 23 23 33) ---------------------------------------- Function: wgetdrive Window Synopsis: select a disk drive from a menu, all valid drives are listed with their respective drive type (eg removable/floppy, fixed, network, and redirected devices) Prototype: (wgetdrive col row wattr battr hattr btype) ELF Functions page 21 Arguments: col optional upper left column position (default = centered) row optional upper left row position (default = centered) wattr optional window attribute (default = color variable) battr optional border attribute hattr optional highlight (cursor) bar attribute btype optional border type Returns: the disk drive as an integer (A:=1, B:=2, etc) Notes: Example: (setq drive (wgetdrive 10 5)) ---------------------------------------- Function: wgetfile Window Synopsis: select a file from a menu of DOS files from the current directory. The user can change directories and access all available disk drives. Prototype: (wgetfile filespec fileattr col row wattr battr hattr btype) Arguments: filespec wildcard filespec (eq *.DAT) fileattr file attribute mask (see findfirst) col optional upper left column position (default = -1 centered) row optional upper left row position (default = -1 centered) wattr optional window attribute (default = color variable) battr optional border attribute hattr optional highlight (cursor) bar attribute btype optional border type Returns: the full qualified pathname of the selected file or nil if is pressed. Notes: The drive select menu is activated by pressing . Example: (setq filename (wgetfile "*.TXT" 33 -1 -1 23 23 70 17) ---------------------------------------- ELF Functions page 22 Function: wgetxy Window Synopsis: get window screen position Prototype: (wgetxy) Arguments: none Returns: col window column position row window row position Notes: Example: (setq wcur (getxy) wcol (car wcur) ;;; cursor column wrow (cadr wcur) ;;; cursor row ) ---------------------------------------- Function: wgotoxy Window Synopsis: move window cursor Prototype: (wgotoxy col row) Arguments: col window column position row window row position Returns: none Notes: Example: (wgotoxy 0 0) ;;; home cursor in window ---------------------------------------- Function: winfo Window Synopsis: gets the top window size and position Prototype: (winfo) Arguments: none Returns: col upper left column position row upper left row position cols lower right column position rows lower right row position Notes: Example: (setq w (winfo) wcol (car w) wrow (cadr w) wcols (caddr w) wrows (cadddr w)) ---------------------------------------- ELF Functions page 23 Function: wmenu Window Synopsis: opens a centered window and displays a menu. The user can then select one of the displayed items. Prototype: (wmenu slist wattr battr hattr btype shadow title) Arguments: slist list of strings to display in the menu col optional upper left column position (default = centered) row optional upper left row position (default = centered) wattr optional window color attribute (default = "color" symbol) battr optional border attribute (default = wattr) hattr optional highlight bar attribute (default = reversed wattr) btype optional border type (default = double line) title optional window title Returns: 0 based item number selected keycode of key pressed to exit menu ELF Functions page 24 Notes: If the list of items is longer that can be displayed in one window then the user can page through the list with the cursor keys. Keys are as follows: Key Meaning move cursor up move cursor down move up one page move down one page exit exit exit Display help screen. If the symbol MENU_HELP is defined, its contents will be displayed. The function (set_menu_help) can be used to set MENU_HELP in release 10 or 11. The user can press F1 the second time to display the default help text. move to last item move to first item any alphanumeric key will move the cursor to the next item starting in that character Example: (setq item (wmenu '("Yes" "No") 23 23 1 1 "?")) yn (car item) key (cadr item) ) (if(/= key EscKey) (doit) (exit)) ---------------------------------------- Function: wmsg Window Synopsis: opens a centered window, displays a message and optionally waits for a keystroke and closes the window Prototype: (wmsg str wait attr battr btype) Arguments: str the message string wait optional, 1 = wait for a keystroke then close window (default) else leave window open wattr optional window color attribute (default = color symbol) wattr optional border color attribute (default = wattr) btype optional border type (default = double line with drop shadow) Returns: if wait=1 then keycode entered to close window is returned ELF Functions page 25 Notes: Example: (setq key (wmsg "Continue ?[Y/N]" 1 23 23 1)) ---------------------------------------- Function: wopen Window Synopsis: open a window on the text screen with specified location, size, border, and colors; saving the area under the window Prototype: (wopen col row cols rows wattr battr btype) Arguments: col upper left column position (-1 = centered) row upper left row position (-1 = centered) cols number of columns (including border) rows number of rows (including border) wattr optional window attribute (default = color variable) battr optional border attribute btype optional border type: Type Meaning 0 no border 1 single line 2 double line 3 double vertical 4 double horizontal 5 solid btype + 8 = hilight upper left sides of border for raised effect btype + 16 = hilight lower right sides of border btype + 32 = add drop shadow to right and lower sides of window Returns: the number of windows currently open Notes: flips screen to the text screen Example: (wopen 20 5 40 10 23 23 2) ---------------------------------------- Function: wpopup Window Synopsis: open a window centered on the text screen Prototype: (wpopup cols rows wattr battr) ELF Functions page 26 Arguments: cols number of column wide (including border) rows number of rows high (including border) wattr optional window attribute (default = color symbol) battr optional border attribute (optional = wattr) btype optional border type (default = double) Returns: the number of windows currently open Notes: Example: (wpopup 40 10 23 23) ---------------------------------------- Function: wprintf Window Synopsis: printf to window at window cursor position Prototype: (wprintf format ...) Arguments: see printf Returns: Notes: see printf Example: ---------------------------------------- Function: wprts Window Synopsis: write to window at col, row position with optional attribute Prototype: (wprts col row string attr) Arguments: col window column position row window row position string text string attr optional color attribute Returns: none Notes: Example: (wprts 0 3 "Hello World" 23) ---------------------------------------- Function: wputcen Window Synopsis: write a centered string to window at window cursor row position Prototype: (wputcen str) Arguments: str the string to print Returns: ELF Functions page 27 Notes: cursor column position is ignored and the string is centered within the window Example: ---------------------------------------- Function: wputs Window Synopsis: write to window at window cursor position with optional attribute Prototype: (puts string attr) Arguments: string text string attr optional color attribute Returns: none Notes: Example: (wputs "Hello World" 23) ---------------------------------------- Function: wscroll Window Synopsis: scroll window text Prototype: (wscroll dir start end lines) Arguments: dir direction; 0 = up (default), 1 = down start start row to scroll (default = 0) end end row (default = last window row) line optional number of lines to scroll (default = 1) Returns: none Notes: Example: (wscroll) ;;; scroll entire window up 1 line (wscroll 1 0 2 1) ;;; scroll first 3 window rows up 1 line ---------------------------------------- Function: wshadow Window Synopsis: adds a drop shadow to the top (last opened) window Prototype: (wshadow attr) Arguments: attr color attribute (default lightgrey on black) Returns: ELF Functions page 28 Notes: Example: (wshadow 23) ---------------------------------------- Function: wtitle Window Synopsis: prints on the border of a window in one of 6 positions Prototype: (wtitle []) Arguments: str title message pos optional position to place string Value Meaning 0 top left (default) 1 top center 2 top right 3 bottom left 4 bottom center 5 bottom right Returns: Notes: If no windows are open wtitle has no effect. Titles will be trimmed to fit available space on the border. Example: (wtitle "My Window" 1) ---------------------------------------- Keyboard Functions The ELF keyboard functions add both C library functions to read a character from the keyboard and functions to read the keyboard directly. The function (getkey) returns a unique value for each key on the PC keyboard. The file ELF.LSP contains symbols for many (but not all) of the PC function and control keys. You can determine the value of any key by entering (getkey) at the Command: prompt and then pressing the desired key. The function (key_stuff) provides a means to control other programs when no other means exists to execute a command or feed data to another command or program. The function is limited to 15 characters unless you have installed a TSR keyboard handler or driver which expands the size of the PC keyboard buffer. ---------------------------------------- Function: getch Key Synopsis: get a character from the keyboard Prototype: (getch) Arguments: Returns: key character as an integer ELF Functions page 29 Notes: Example: (setq char (chr(getch))) ;;; character as a string ---------------------------------------- Function: getche Key Synopsis: get a character from the keyboard with echo Prototype: (getche) Arguments: Returns: key character as an integer Notes: see getch Example: ---------------------------------------- Function: getkey Key Synopsis: get a keystroke from the keyboard Prototype: (getkey) Arguments: Returns: keycode The lower byte of keycode contains the key character and the upper byte contains the keyboard scancode. Notes: The value returned by getkey is unique for (nearly) every key on the PC keyboard. The file KEYS.LSP contains a list of keycodes of cursor movement and function keys. The keycode of any key can be determined by executing (getkey) interactively. Example: (setq c (getkey) ;;; the keycode char (chr(lobyte c)) ;;; key character as a string scode (hibyte c) ;;; keyboard scan code ) ---------------------------------------- Function: kbhit Key Synopsis: checks the keyboard buffer for a waiting keystroke Prototype: (kbhit) Arguments: Returns: a non-zero value if a key is waiting Notes: Example: (while (not(kbhit))) ---------------------------------------- ELF Functions page 30 Function: key_clear Key Synopsis: clears the keyboard buffer of any pending keystrokes Prototype: (key_clear) Arguments: Returns: Notes: Example: (key_clear) ;;; clear the keyboard (setq key (getkey)) ;;; get a keystroke ---------------------------------------- Function: key_ready Key Synopsis: returns immediately with a waiting key Prototype: (key_ready) Arguments: Returns: key or nil Notes: key_ready checks the keyboard buffer and immediately returns the next keycode (leaving it in the buffer) or nil if no key is waiting Example: (while (not(key_ready))) ---------------------------------------- Function: key_stat Key Synopsis: gets the state of keyboard shift and other special keys Prototype: (key_stat) Arguments: Returns: a bit coded field as follows: Bit Mask Meaning 0 1 Right shift key pressed 1 2 Left shift key presses 2 4 Ctrl key pressed 3 8 Alt key pressed 4 16 ScrollLock On 5 32 NumLock On 6 64 Capslock On 7 128 Insert On Notes: Example: ---------------------------------------- Function: key_stuff Key Synopsis: "pushes" keys into the keyboard buffer Prototype: (key_stuff str) Arguments: str up to 15 characters Returns: ELF Functions page 31 Notes: stuffs the keyboard buffer to control "ill behaved" programs. The DOS keyboard buffer can hold a maximum of 15 keys, additional keys are ignored. Example: (key_stuff ".QUIT\nY\n") ---------------------------------------- Directory Functions Elf contains a full suite of functions to read and manipulate the DOS file directory system. In addition to C library functions, ELF provides macro functions to return a list of valid disk drives, directories, and files. ---------------------------------------- Function: access Directory Synopsis: determines if a file exists and can be accessed by mode Prototype: (access path mode) Arguments: path mode: Value Test For 0 existence only 1 read permission 2 write permission 3 read and write permission Returns: 1 if true, nil otherwise Notes: Example: (access "C:\ACAD\FOO.DAT" 2) ;;;checks for the existence and write permission ---------------------------------------- Function: chdir Directory Synopsis: change disk directory Prototype: (chdir path) Arguments: path DOS path Returns: current directory after successful execution or nil otherwise. Notes: If a drive different from the current drive is specified, the directory on the specified drive will be changed. Does not log to a different drive. Example: (chdir "\acad\dwgs") ---------------------------------------- ELF Functions page 32 Function: chpath Directory Synopsis: change current disk drive and directory Prototype: (chpath path) Arguments: path DOS path including drive letter Returns: current directory after successful execution or nil otherwise. Notes: Example: (chpath "d:\dwgs") ---------------------------------------- Function: disk_ready Directory Synopsis: verifies that a removable (floppy) drive is ready and readable Prototype: (disk_ready drive) Arguments: drive drive to check (1=A:, 2=B:, etc) Returns: 1 if true or nil otherwise Notes: Example: (disk_ready 1) ;;; verify that drive A: is ready ---------------------------------------- Function: disk_type Directory Synopsis: Prototype: (disk_type drive) Arguments: drive drive to check (1=A:, 2=B:, etc) Returns: 0 removable (floppy) disk 1 fixed (hard) disk 2 network drive 3 redirected device nil invalid drive Notes: Example: ---------------------------------------- Function: disk_valid Directory Synopsis: verifies that a disk drive is a valid device (but not necessarily ready if a removable/floppy drive) Prototype: (disk_valid drive) Arguments: drive drive to check (1=A:, 2=B:, etc) Returns: 1 if true or nil otherwise ELF Functions page 33 Notes: Example: (disk_valid 6) ;;; verify that drive F: is valid ---------------------------------------- Function: erasefile Directory Synopsis: erase file(s) Prototype: (erasefile filename) Arguments: filename - file to erase Returns: 1 if successful, nil otherwise Notes: Example: (erasefile "thisfile.dat") ---------------------------------------- Function: file_exists Directory Synopsis: determines if a file exists Prototype: (file_exists path) Arguments: path Returns: 1 if true, nil otherwise Notes: Example: (file_exists "C:\ACAD\FOO.DAT") ---------------------------------------- Function: findfirst Directory Synopsis: finds the first instance of a file who's name and directory attributes match the arguments. Prototype: (findfirst filespec attribute) Arguments: filespec optional - a filespec which can include wildcard characters in the file specification (default *.*) attribute optional - a value between 0 and 255. (default 33) The following values can be ORed or added to produce the needed attribute. Value Attribute 1 Archive file 4 Hidden file 8 Normal file 16 Read only file 32 System file 64 Subdirectory 128 Volume ID ELF Functions page 34 Returns: an AutoLISP list if successful or nil otherwise. filename includes file extension filesize size of the file in bytes. date the file date time the file time attribute the files' attribute Example: ("FILENAME.EXT" "134562" "3/31/92" "11:21a" 9) Notes: Findfirst allows you to use the * and ? wildcard characters to search the file system directory structure. If the file is found then the function returns information about the file in an AutoLISP list. If the attribute parameter is 255 then all files and directories will match the attribute. The combination of attribute = 255 and wildcard = "*.*" will match all files, all directories, and the volume id if it exists from the current subdirectory. Files with no attributes will always be returned. Therefore in order to retrieve only directories then files with an attribute value of 0 must be filtered out. Example: (findfirst "*.DWG" 1+8+16) ---------------------------------------- Function: findnext Directory Synopsis: finds the next occurrence of the file specification and attribute after a findfirst call Prototype: (findnext) Arguments: none Returns: AutoLISP list for the file. (see findfirst) Notes: Example: (setq fn (findfirst 33 "*.DAT")) (while (boundp 'fn)) (printf "\n%s" (car fn))) (setq fn (findnext) ) ---------------------------------------- Function: fullpath Directory Synopsis: expands a partial path into a full DOS path string Prototype: (fullpath path) Arguments: path a relative or partial path string (eg "c:filename.ext" Returns: the full path string (eg "C:\ACAD\FILENAME.EXT") ELF Functions page 35 Notes: the file does not have to exist Example: (fullpath "D:FILE.DAT") ;;; might return "D:\DIR1\FILE.DAT ---------------------------------------- Function: getdir Directory Synopsis: returns a string with the current drive:\path Prototype: (getdir) Arguments: none Returns: current directory path Notes: Example: (setq curdir (getdir)) ---------------------------------------- Function: getdiskfree Directory Synopsis: returns size statistics in the specified drive number as a list Prototype: (getdiskfree 3) Arguments: drive number (Current=0, A=1, B=2, C=3, etc) Returns: ( total bytes free bytes sector size sectors per cluster) Notes: Example: (setq dstat (getdiskfree 0) sector (cadddr dstat) cluster (* sector (caddr dstat)) drive_bytes (* cluster (car dstat)) free_bytes (* cluster (cadr dstat)) ) ---------------------------------------- Function: getdisk Directory Synopsis: returns the current drive number (A=1, B=2, C=3, etc) Prototype: (getdisk) Arguments: none Returns: current drive Notes: Example: (setq DriveStr (sprintf "%c:" (+(getdisk)(1-(ascii "A")))) ---------------------------------------- Function: load_dirs Directory Synopsis: returns a list of strings containing file directories from the current directory Prototype: (load_dirs) Arguments: none ELF Functions page 36 Returns: A list of directories if successful or nil otherwise Notes: uses DOS findfirst and findnext Example: (setq dirs (load_dirs)) ---------------------------------------- Function: load_drives Directory Synopsis: returns a list of strings containing all valid disk drives Prototype: (load_drives) Arguments: none Returns: A list of drives if successful or nil otherwise Notes: Example: (setq drives (load_drives)) ---------------------------------------- Function: load_files Directory Synopsis: returns a list of strings containing files matching a filespec and directory attribute Prototype: (load_files filespec attribute) Arguments: filespec optional path and file specification, default: "*.*" Returns: attribute optional bit coded file attributes (see findfirst), default: 33 A list of files if successful or nil otherwise Notes: Example: (setq files (qsort(load_files "D:\DWGS\*.DWG"))) ---------------------------------------- Function: makepath Directory Synopsis: Combines the four components into a full DOS path string Prototype: (makepath drive dir name ext) Arguments: see (splitpath) Returns: full path string Notes: Example: (makepath "D:" "\ACAD\SUPPORT\" "ACAD" ".LSP") ---------------------------------------- Function: mkdir Directory Synopsis: creates a new directory ELF Functions page 37 Prototype: (mkdir dirname) directory directory to create Arguments: directory name if successful or nil otherwise Returns: Notes: (mkdir "\newdir") Example: ---------------------------------------- Function: rmdir Directory Synopsis: removes (deletes) a directory Prototype: (rmdir dirname) Arguments: directory directory to remove Returns: current directory if successful or nil otherwise Notes: Example: (rmdir "\olddir") ---------------------------------------- Function: setdisk Directory Synopsis: logs to the specified disk drive Prototype: (setdisk drive) Arguments: drive drive number (A=1, B=2, C=3, etc) Returns: current drive if successful or nil Notes: Example: (setdisk 3) ;;; make drive C: current ---------------------------------------- Function: splitpath Directory Synopsis: splits a DOS path string into its four components Prototype: (splitpath path) Arguments: path full DOS path to a file Returns: a containing four strings: drive the drive character followed by a ':' (eg "C:") dir the directory (eg "\ACAD\SUPPORT" name the name of the file (eg "ACAD") ext a period followed by the file extension (eg ".LSP") ELF Functions page 38 Notes: Example: (setq plist (splitpath "D:\ACAD\SUPPORT\ACAD.LSP") drive (car plist) ;;; "D:" dir (cadr plist) ;;; "\ACAD\SUPPORT\" name (caddr plist) ;;; "ACAD" ext (cadddr plist) ;;; ".LSP" ) ---------------------------------------- Function: unlink Directory Synopsis: erase file(s) Prototype: (unlink filename) Arguments: filename - file to erase Returns: 1 if successful, nil otherwise Notes: unlink and erasefile are identical Example: (unlink "thisfile.dat") ---------------------------------------- File Functions ELF contains file handling functions to speed file handling. AutoLISP provides functions to read and write to text files a character and a line at a time. ELF adds functions to read and write the entire file in one step. The function (read_file) will return the contents of an entire file and can be used to quickly load the contents of the file into an AutoLISP symbol. (write_file) inverses the process and will write the entire contents of an AutoLISP string list to a file. These functions are much faster than looping through a list and reading/writing a line at a time with AutoLISP. ---------------------------------------- Function: copyfile File Synopsis: copies file(s) Prototype: (copyfile source destination) Arguments: source path destination path Returns: number of files copied if successful, nil otherwise Notes: The destination can be a either a file or directory. Both input and output streams are buffered to improve copy speed. Example: (copyfile "C:\ACAD\*.DAT" "D:") ---------------------------------------- ELF Functions page 39 Function: look File Synopsis: displays an ASCII file to screen using the ELF file viewer Prototype: (look filespec) Arguments: filename or wildcard filespec to view Returns: 1 if successful, nil otherwise Notes: Example: (look "C:\ACAD\*.DOC" ---------------------------------------- Function: movefile File Synopsis: moves / renames file(s) Prototype: (movefile source destination) Arguments: source path destination path Returns: number of files moved if successful, nil otherwise Notes: destination must be on the same drive Example: (movefile "C:\ACAD\*.DAT" "C:\DATDIR") ---------------------------------------- Function: read_file File Synopsis: reads an ASCII file and returns a string list from file records. Each line in the text file is parsed into a string and appended to the returned list. Prototype: (read_file filespec mode) Arguments: filespec file specification of the file to read mode type of list to create (see return value) Returns: A list whose contents are dependant on mode Value Meaning 0 or nil A list of strings 1 A list of dotted pairs containing a 0 based sequential value and a string Notes: The dotted pair list can be accessed randomly using the (assoc) function. Example: (read_file "FOO.BAR" 1) ---------------------------------------- Function: write_file File Synopsis: opens an ASCII file and writes a string list to the file and then closes the file. Each string is placed in the text file as a line of text. Prototype: (write_file filespec type) ELF Functions page 40 Arguments: filespec file specification of the file to write type how the file will be opened, "a" appends to the end of the file, otherwise a new file will be created and any other character is ignored. A list of strings Returns: the number of lines written Notes: Example: (write_file "FOO.BAR" "a" "This is data") ;;; appends a line to file FOO.BAR ---------------------------------------- Binary File The binary file functions provide a means to read and write binary files. These functions are used seperate from other "standard" AutoLISP file I/O functions. A file opened by the AutoLISP function "open" can not be read or written by the binary functions and vice-versa. Byte(char), short int, long int (passed and returned as a real), real (double precision float) and string data types can be read and written. In addition frewind and fseek allow random access reads and writes within the file. ---------------------------------------- Function: fclose Binary File Synopsis: closes a binary file Prototype: (fclose ) Arguments: handle ELF file handle of an open binary file Returns: The file handle if successful or nil otherwise Notes: fclose can not close files opened with the AutoLISP function "open" Example: (if(not(fclose file_handle))(princ "\nERROR closing file")) ---------------------------------------- Function: feof Binary File Synopsis: returns nonnil if the end of file has been reached Prototype: (feof Arguments: handle ELF file handle of an open binary file Returns: nonil value if true, nil otherwise ELF Functions page 41 Notes: Example: (if(feof file_handle) (princ "\nend of file encountered")) ---------------------------------------- Function: ferror Binary File Synopsis: returns nonnil if OS file error indicator has been set Prototype: (ferror ) Arguments: handle ELF file handle of an open binary file Returns: nonil value if true, nil otherwise Notes: Example: (if(ferror file_handle) (princ "\nfile error")) ---------------------------------------- Function: fgetc Binary File Synopsis: reads a character (byte) value from a binary file Prototype: (fgetc ) Arguments: handle ELF file handle of an open binary file Returns: character integer value read or nil on error Notes: Example: (setq s (chr(fgetc file_handle))) ---------------------------------------- Function: fgets Binary File Synopsis: reads a string of up to len characters from a binary file Prototype: (fgets ) Arguments: handle ELF file handle of an open binary file len maximum number of characters to read Returns: string read or nil on error Notes: fgets reads characters until it encounters a newline or characters are read Example: (setq name (fgets file_handle)) ---------------------------------------- Function: fgetsc Binary File Synopsis: reads a signed character value from a binary file Prototype: (fgetsc ) ELF Functions page 42 Arguments: handle ELF file handle of an open binary file Returns: signed char (as an integer) value read or nil on error Notes: Example: (setq sc (fgetsc file_handle)) ---------------------------------------- Function: fgetint Binary File Synopsis: reads a short integer (2 byte word) value from a binary file Prototype: (fgetint ) Arguments: handle ELF file handle of an open binary file Returns: integer value read or nil on error Notes: Example: (setq x (fgetint file_handle)) ---------------------------------------- Function: fgetlong Binary File Synopsis: reads a long integer (4 byte double word) value from a binary file Prototype: (fgetlong ) Arguments: handle ELF file handle of an open binary file Returns: long integer value read (converted to a real) or nil on error Notes: AutoLISP does not support a long integer datatype so long values must be returned to AutoLISP as a real. Example: (setq x (fgetlong file_handle)) ---------------------------------------- Function: fgetreal Binary File Synopsis: reads a real (8 byte double precision floating point) value from a binary file Prototype: (fgetreal ) Arguments: handle ELF file handle of an open binary file Returns: real value read or nil on error Notes: Example: (setq x (fgetreal file_handle)) ---------------------------------------- ELF Functions page 43 Function: fopen Binary File Synopsis: opens a binary file Prototype: (fopen ) Arguments: handle ELF file handle Returns: The file handle if successful or nil otherwise Notes: The ELF file handle is an integer value that is an index to an array of OS file handles maintained internally by ELF. AutoLISP and ELF file handles can not be interchanged, if a file is opened by ELF it can be accessed using ELF binary file functions only. The file must be closed (using fclose) and reopened using the AutoLISP function "open" to use the AutoLISP library functions to access the file. Example: (if(not(fclose file_handle))(princ "\nERROR closing file")) ---------------------------------------- Function: fputc Binary File Synopsis: writes a character (byte) value to a binary file Prototype: (fputc ) Arguments: handle ELF file handle of an open binary file char character (as an integer value) to write Returns: character integer value written or nil on error Notes: writes the least significat byte of the integer value Example: (if(not(fputc file_handle (ascii "A"))) (princ "\nError writing character")) ---------------------------------------- Function: fputs Binary File Synopsis: writes a string to a binary file Prototype: (fputs ) Arguments: handle ELF file handle of an open binary file char string to write Returns: string written or nil on error Notes: only the string is written, a terminating NUL is not written. Example: (if(not(fputs file_handle "Hello")) (princ "\nError writing string")) ---------------------------------------- ELF Functions page 44 Function: fputint Binary File Synopsis: writes an integer (2 byte word) value to a binary file Prototype: (fputint ) Arguments: handle ELF file handle of an open binary file int an integer value to write Returns: integer value written or nil on error Notes: Example: (if(not(fputint file_handle 123)) (princ "\nError writing integer")) ---------------------------------------- Function: fputlong Binary File Synopsis: writes a long integer (4 byte double word) value to a binary file Prototype: (fputlong ) Arguments: handle ELF file handle of an open binary file long a long integer value as a real to write Returns: long integer value written or nil on error Notes: long values (greater than 32767 or less than -32768) must be passed as a real Example: (if(not(fputlong file_handle (float 123456789))) (princ "\nError writing long")) ---------------------------------------- Function: fputreal Binary File Synopsis: writes a real (8 byte double precision floating point) value to a binary file Prototype: (fputreal ) Arguments: handle ELF file handle of an open binary file real value to write Returns: real value written or nil on error Notes: Example: (if(not(fputreal file_handle 1.2345)) (princ "\nError writing real")) ---------------------------------------- Function: frewind Binary File Synopsis: moves the file pointer to the beginning of the file Prototype: (frewind ) ELF Functions page 45 Arguments: handle ELF file handle of an open binary file Returns: The file handle if successful or nil otherwise Notes: Example: (frewind file_handle)) ---------------------------------------- Function: fseek Binary File Synopsis: moves the file pointer Prototype: (fseek ) Arguments: handle ELF file handle of an open binary file origin from whence file pointer is moved: 0 - beginning of file 1 - current position 2 - end of file offset number of bytes to move Returns: An nonnil value if successful or nil otherwise Notes: Example: (foffset file_handle 0 0.0) ; same as frewind (foffset file_handle 1 10.0) ; advance pointer 10 bytes (foffset file_handle 2 -10.0) ; 10 bytes before wnd of file ---------------------------------------- Function: ftell Binary File Synopsis: returns the current position of a binary file pointer Prototype: (ftell ) Arguments: handle ELF file handle of an open binary file Returns: The position of the file pointer from the beginning of the file if successful or nil otherwise Notes: Example: (setq fpos (ftell file_handle)) ; get file pointer position ---------------------------------------- Math Functions ELF expands the AutoLISP math library with additional math, trig, and logical functions. ---------------------------------------- ELF Functions page 46 Function: | Math Synopsis: returns the result of a bitwise OR of the arguments Prototype: (| ...) Arguments: ... any number of integer values Returns: the result of the bitwise OR Notes: Example: (setq color (| lgrey blue_bg)) ---------------------------------------- Function: || Math Synopsis: returns the result of a logical OR of the arguments Prototype: (|| ...) Arguments: ... any number of integer values Returns: the result of the logical OR Notes: Example: ---------------------------------------- Function: & Math Synopsis: returns the result of a bitwise AND of the arguments Prototype: (& ...) Arguments: ... any number of integer values Returns: the result of the bitwise AND Notes: Example: ---------------------------------------- Function: && Math Synopsis: returns the result of a logical AND of the arguments Prototype: (&& ...) Arguments: ... any number of integer values Returns: the result of the logical AND Notes: Example: ---------------------------------------- Function: acos Math Synopsis: returns the inverse cosine of the argument Prototype: (acos rad) Arguments: rad angle in radians ELF Functions page 47 Returns: Notes: Example: ---------------------------------------- Function: asin Math Synopsis: returns the inverse sine of the argument Prototype: (asin rad) Arguments: rad angle in radians Returns: Notes: Example: ---------------------------------------- Function: ceil Math Synopsis: returns the smallest integer greater or equal to the argument Prototype: (ceil rval) Arguments: rval Returns: Notes: Example: (ceil 7.5) ;;; returns 8.0 (ceil -7.5) ;;; returns -7.0 ---------------------------------------- Function: cosh Math Synopsis: returns the hyperbolic cosine of the argument Prototype: (cosh rad) Arguments: rad angle in radians Returns: Notes: Example: ---------------------------------------- Function: dtr Math Synopsis: converts an angle in degrees to radians Prototype: (dtr ang) Arguments: ang angle in degrees Returns: the angle in radians Notes: Example: (setq rad (dtr deg)) ---------------------------------------- ELF Functions page 48 Function: floor Math Synopsis: returns the largest integer not greater than the argument Prototype: (floor rval) Arguments: rval Returns: Notes: Example: (floor 7.5) ;;; returns 7.0 (floor -7.5) ;;; returns -8.0 ---------------------------------------- Function: hibyte Math Synopsis: returns the upper (most significant) byte of an integer Prototype: (hibyte val) Arguments: val an integer value Returns: an integer value containing the MSB Notes: Example: (setq keycode (getkey) ;;; get a keypress char (lobyte keycode) ;;;the character value scancode (hibyte keycode) ;;; the keyboard scancode ) ---------------------------------------- Function: int2sc Math Synopsis: converts a signed integer into a signed char Prototype: (int2sc val) Arguments: val an integer value Returns: an integer value Notes: Example: ---------------------------------------- Function: lobyte Math Synopsis: returns the lower (least significant) byte of an integer Prototype: (lobyte val) Arguments: val an integer value Returns: an integer value containing the LSB Notes: Example: see hibyte ---------------------------------------- ELF Functions page 49 Function: log10 Math Synopsis: returns the logarithm to the base 10 of the argument Prototype: (log10 x) Arguments: x Returns: or nil of x <= 0.0 Notes: Example: ---------------------------------------- Function: rand Math Synopsis: generates a pseudo random number Prototype: (rand) Arguments: Returns: a random value (actually a long integer) Notes: the sequence has a period of 2^32 Example: (setq x (fix(rem(rand 10)))) ---------------------------------------- Function: round Math Synopsis: rounds a real value Prototype: (round val places) Arguments: val the value to round places the number of places to the right of the decimal Returns: the rounded value Notes: Example: (setq pct (round val 2)) ---------------------------------------- Function: rtd Math Synopsis: converts an angle in radians to degrees Prototype: (rtd ang) Arguments: ang angle in radians Returns: the angle in degrees Notes: Example: (setq deg (rtd rad)) ---------------------------------------- Function: sinh Math Synopsis: returns the hyperbolic sine of the argument Prototype: (sinh rad) Arguments: rad angle in radians Returns: ELF Functions page 50 Notes: Example: ---------------------------------------- Function: srand Math Synopsis: seeds the random number generator Prototype: (srand i) Arguments: i optional seed value (default = 1) Returns: Notes: Example: (srand pi) ---------------------------------------- Function: swapb Math Synopsis: reverses bytes in a (short) integer Prototype: (swapb i) Arguments: i integer value Returns: integer Notes: Example: ---------------------------------------- Function: tan Math Synopsis: returns the trigonometric tangent of the argument Prototype: (tan rad) Arguments: rad angle in radians Returns: Notes: Example: ---------------------------------------- Function: tanh Math Synopsis: returns the hyperbolic tangent of the argument Prototype: (tanh rad) Arguments: rad angle in radians Returns: Notes: Example: ---------------------------------------- ELF Functions page 51 Function: xtoi Math Synopsis: converts a hex string to an integer Prototype: (xtoi s) Arguments: s a hex string (eg "0x1CFF") Returns: integer value of hex string Notes: Example: ---------------------------------------- List Handling Functions The list data structure is a central part of LISP. ELF adds functions to manipulate single dimension AutoLISP arrays. You can sort, insert, delete, replace, and find elements in a list. ---------------------------------------- Function: bsearch List Synopsis: located a value in a sorted string, integer or real value list Prototype: (bsearch vlist key) Arguments: vlist list of string, integer, or real values key string, integer, or real value to locate Returns: 0 based index if found or nil if not found Notes: the list must be sorted and of type string, integer, or real Example: (setq sl (qsort '("CC" "BB" "AA")) ;;; returns ("AA" "BB" "CC") (bsearch sl "AA") ;;; returns 0 ---------------------------------------- Function: delete List Synopsis: deletes a list or atom from another list Prototype: (delete list pos) Arguments: list list a list pso 0 based position to insert Returns: new list Notes: Example: (setq new_list(delete old_list 3)) ;;; deletes 4th element ---------------------------------------- ELF Functions page 52 Function: insert List Synopsis: inserts a list or atom into another list Prototype: (insert list pos item) Arguments: list a list pos 0 based position to insert or val the list or value to insert Returns: new list Notes: Example: (setq new_list (insert old_list 3 '("XX" "YY" 123))) ---------------------------------------- Function: lfind List Synopsis: located a value in an unsorted string, integer or real value list Prototype: (lfind vlist key) Arguments: vlist list of string, integer, or real values key string, integer, or real value to find Returns: 0 based index if found or nil if not found Notes: the list must be of type string, integer, or real Example: (setq sl '("CC" "BB" "AA")) (lfind sl "AA") ;;; returns 2 ---------------------------------------- Function: lsearch List Synopsis: located a value in a string, integer or real value list Prototype: (lsearch vlist key) Arguments: vlist list of string, integer, or real values key string, integer, or real value to locate Returns: vlist if found or vlist with key appended if not found Notes: the list must be of type string, integer, or real Example: (setq sl '("CC" "BB" "AA")) (lsearch sl "XX") ;;; returns ("CC "BB" "AA" "XX") ---------------------------------------- ELF Functions page 53 Function: qsort List Synopsis: sorts a string, integer or real value list; or a list of lists Prototype: (qsort lst field) Arguments: lst list to sort fld optional sort key field position for sorting lists of lists, 1 = first field, 2 second, etc Returns: sorted list Notes: Example: (qsort '("CC" "BB "AA")) ;;; returns ("AA" "BB" "CC") (qsort '(3 2 1) ;;; returns (1 2 3) (qsort (list (1 "XX")(2 "AA")) 2) returns ((2 "AA")(1 "XX")) ---------------------------------------- Function: replace List Synopsis: replace a list or atom in a list with another Prototype: (replace list pos item) Arguments: list a list pos 0 based position to insert or val the new list or value to substitute Returns: new list Notes: Example: (replace old_list 3 "XX") ---------------------------------------- Function: symbol List Synopsis: Displays the contents of a symbol to the screen using the ELF file/symbol viewer. Prototype: (symbol sym) Arguments: sym an AutoLISP symbol / list / function Returns: Notes: release 12 only Example: (symbol (qsort(atoms-family 1))) ;;; displays a list of all symbols ---------------------------------------- String Handling Functions ELF Functions page 54 The ELF string library contains functions to scan and modify text strings. In addition, the function (strget) adds a flexible line editor with an integrated help system. ---------------------------------------- Function: field String Synopsis: returns a substring of str1 from token delimiters in str2 and position. Prototype: (field str1 str2 pos) Arguments: str1 the string to search str2 the string containing delimiters Returns: pos the 1 based position in the string the nth pos substring of str1 delimited by chars in str2 or nil Notes: Example: (field "AA;BB;CC;DD;EE" ";" 2) ;;; returns "BB" ---------------------------------------- Function: set_edit_help String Synopsis: sets the user help string list for the function (strget) Prototype: (set_edit_help ) Arguments: a string list to be displayed when the F1 key is pressed while in (strget). The first item in the list will be the help window title. Returns: Notes: In release 12 or higher the symbol EDIT_HELP can be used to set the help string. In release 12 (set_edit_help) will also set this symbol. The symbol EDIT_HELP can be local to a particular function or global in scope. The user can display the default help screen by pressing F1 the second time. Example: (set_edit_help '("[ My Help Screen ]" "" "This is my help message")) ---------------------------------------- Function: sprintf String Synopsis: same as printf except that nothing is printed, the string is returned Prototype: (sprintf format ...) Arguments: see printf Returns: formatted string ELF Functions page 55 Notes: printf to string Example: (write-line (sprintf "\n%-10s%10.3g%10d" name salary age) fp) ---------------------------------------- Function: strchr String Synopsis: finds the first occurrence of ch in str and returns a substring starting at that character Prototype: (strchr str ch) Arguments: str the string to search ch the character to search for Returns: the substring starting in ch Notes: Example: (strchr "AABBCC" (ascii "B")) ;;; returns "BBCC" ---------------------------------------- Function: strcmp String Synopsis: compares two strings for equality (case sensitive) Prototype: (strcmp str1 str2) Arguments: str1 the string compare str2 the string compare Returns: Value Meaning -1 str1 < str2 0 str1 = str2 1 str1 > str2 Notes: Example: (strcmp "Hello World" "HELLO WORLD") returns 1 ---------------------------------------- Function: strcspn String Synopsis: determine the length of the prefix of str1 made entirely of chars not in str2 Prototype: (strcspn str1 str2) Arguments: str1 the main string str2 the string of chars to test Returns: the length of the segment of str1 that begins in the beginning of the string and is made up entirely of characters that do not occur in str2 Notes: Example: (strcspn "AABBCCDDEE" "AB") ;;; returns 0 (strcspn "AABBCCDDEE" "D") ;;; returns 6 ---------------------------------------- ELF Functions page 56 Function: strdate String Synopsis: returns the current date from the internal clock as a formatted string Prototype: (strdate) Arguments: none Returns: date string as MM-DD-YY Notes: Example: (printf "\nToday is %s" (strdate)) ---------------------------------------- Function: strdela String Synopsis: delete all occurrences of chars in str2 from str1 Prototype: (strdela str1 str2) Arguments: str1 string containing chars to be deleted str2 string containing chars to delete Returns: str1 with chars from str2 deleted Notes: Example: (setq str (strdela "This\t is a test;;::///" "\t;:/")) ---------------------------------------- Function: strget String Synopsis: edit a string on the text screen with cursor positioning and editing, background mask, color attribute control, and on line help. Prototype: (strget str len curpos mask attr ...) Arguments: str optional string to edit (default - "") curpos optional starting cursor position within string (default - 0) len optional edit field length (default 80) mask optional background mask character (default - " ") attr optional color attribute (default - "color: symbol) ... optional keycodes which will cause strget to exit (in addition to , , , , and ELF Functions page 57 Returns: the edited string keycode of key causing function to exit cursor position within string at exit Notes: strget prints the string and mask at the cursor position then waits for user input. The cursor is placed at within the string. Insert/overwrite mode is saved between calls to strget. If a string longer than is edited the string will "ticker tape", the maximum string length is 255 characters. Response to keystrokes is as follows: Key Action move cursor left move cursor right exit exit exit exit Display help screen, if the symbol EDIT_HELP is defined, then the contants of that symbol is displayed. In versions prior to release 12, the function (set_edit_help) can be used to set the user defined help. If the user presses F1 the second time, then the default help screen is displayed. word right word left delete from cursor to end of line move to end move to start toggle insert / overwrite mode Example: (setq name (strget name 25 0 (ascii "_") 23 15360);;; will cause strget to exit strget also ---------------------------------------- Function: stricmp String Synopsis: compares two strings for equality (case insensitive) Prototype: (stricmp str1 str2) Arguments: str1 the string compare str2 the string compare Returns: Value Meaning -1 str1 < str2 0 str1 = str2 1 str1 > str2 Notes: Example: (stricmp "Hello World" "HELLO WORLD") returns 0 ---------------------------------------- ELF Functions page 58 Function: strncpy String Synopsis: copies the first n characters of a string Prototype: (strncpy str n) Arguments: str the string to copy n the number of characters to copy Returns: the copied string Notes: Example: (strncpy "Hello World" 8) ;;; returns "Hello Wo" ---------------------------------------- Function: strnset String Synopsis: fills a string Prototype: (strnset char len) Arguments: char character to use to fill string len number of characters Returns: the filled string Notes: Example: (strnset (ascii " ") 40) ;;; returns a string of 40 spaces ---------------------------------------- Function: strpbrk String Synopsis: returns a substring of the first occurrence of any character of str2 in str1 Prototype: (strstr str1 str2) Arguments: str1 the string to search str2 the substring Returns: the substring starting in any char in str2 Notes: Example: (strpbrk "AABBCCDDEE" "CCBB") ;;; returns "BBCCDDEE" ---------------------------------------- Function: strrchr String Synopsis: finds the last occurrence of ch in str and returns a substring starting at that character Prototype: (strrchr str ch) Arguments: str the string to search ch the character to search for Returns: the substring starting in ch Notes: Example: (strrchr "AABBCC" (ascii "B")) ;;; returns "BCC" ---------------------------------------- ELF Functions page 59 Function: strrev String Synopsis: returns the string argument with the character order reversed Prototype: (strrev str) Arguments: str string to be reverses Returns: the reverses string Notes: Example: (setq revs (strrev "ABCDE"));;; returns "EDCBA" ---------------------------------------- Function: strspn String Synopsis: determine the length of the prefix of str1 made entirely of chars in str2 Prototype: (strspn str1 str2) Arguments: str1 the main string str2 the string of chars to test Returns: the length of the segment of str1 that begins in the beginning of the string and is made up entirely of characters that occur in str2 Notes: Example: (strspn "AABBCCDDEE" "AB") ;;; returns 4 ---------------------------------------- Function: strstr String Synopsis: returns a substring of the first occurrence of str2 in str1 Prototype: (strstr str1 str2) Arguments: str1 the string to search str2 the substring Returns: the substring starting in str2 Notes: Example: (strstr "AABBCCDDEE" "CC") ;;; returns "CCDDEE" ---------------------------------------- Function: strswap String Synopsis: swaps all occurrences of char1 with char2 in str Prototype: (strswap str char1 char2) Arguments: str string to search char1 character to search for Returns: char2 character to substitute for char1 ELF Functions page 60 Notes: the string with swapped chars Example: ---------------------------------------- Function: strtime String Synopsis: returns the current time from the internal clock as a formatted string Prototype: (strtime) Arguments: none Returns: time string as HH:MM:SS Notes: Example: (printf "\nThe current time is %s" (strtime)) ---------------------------------------- Function: strtok String Synopsis: returns the first substring of str1 from token delimiters in str2. subsequent calls after the first with no arguments will return the second and any further substrings Prototype: (strtok str1 str2) Arguments: str1 the string to search str2 the string containing tokens delimiters Returns: the substring of str1 up but not including any chars in str2 Notes: Example: (setq s2 (strtok "AA;BB;CC;DD;EE" ";")) ;;; returns "AA" and saves "BB;CC;DD;EE" internally (while (boundp 's2) (print s2) (setq s2 (strtok)) ;; then returns "BB", etc ) ---------------------------------------- Function: strtrim String Synopsis: trim white space (all char values < '!') from the beginning (left side) and end (right side); and compresses white space within a string to a single space between words Prototype: (strtrim str) Arguments: str the string to be trimmed Returns: trimmed string if success or nil if error ELF Functions page 61 Notes: Example: (strtrim "\t\t Hello \t world\t ") returns: "Hello World" ---------------------------------------- Function: strtriml String Synopsis: trim white space from the beginning (left side) of a string Prototype: (strtriml str) Arguments: str the string to be trimmed Returns: trimmed string if success or nil if error Notes: Example: (strtriml "\t\t Hello world") returns: "Hello World" ---------------------------------------- Function: strtrimr String Synopsis: trim white space from the end (right side) of a string Prototype: (strtrimr str) Arguments: str the string to be trimmed Returns: trimmed string if success or nil if error Notes: Example: (strtrimr "Hello world\t ") returns: "Hello World" ---------------------------------------- Function: tolower String Synopsis: Prototype: (tolower char) Arguments: char Returns: character converted to lower case Notes: Example: (chr(tolower(ascii "A"))) ;;; returns: "a" ---------------------------------------- Function: toupper String Synopsis: Prototype: (toupper char) Arguments: char Returns: character converted to upper case Notes: Example: (chr(toupper(ascii "a"))) ;;; returns: "A" ---------------------------------------- ELF Functions page 62 Character Classification Functions The character classification functions are equivalent to those from the "C" function library except that they return nil instead of 0 to indicate a FALSE condition. This allows the AutoLISP programmer to test the expression directly with an (if) function. eg. (If(IsUpper ch) (do something)) ---------------------------------------- Function: isalnum Character Synopsis: returns a non-zero value if argument is a letter or digit Prototype: (isalnum char) Arguments: char Returns: non-zero if true, nil otherwise Notes: Example: ---------------------------------------- Function: isascii Character Synopsis: returns a non-zero value if argument is an ASCII character Prototype: (isascii char) Arguments: char Returns: non-zero if true, nil otherwise Notes: Example: ---------------------------------------- Function: iscntl Character Synopsis: returns a non-zero value if argument is a control character Prototype: (iscntl char) Arguments: char Returns: non-zero if true, nil otherwise Notes: Example: ---------------------------------------- Function: isdigit Character Synopsis: returns a non-zero value if argument is a numeric digit Prototype: (isdigit char) Arguments: char ELF Functions page 63 Returns: non-zero if true, nil otherwise Notes: Example: ---------------------------------------- Function: isgraph Character Synopsis: returns a non-zero value if argument is a visible printable character Prototype: (isgraph char) Arguments: char Returns: non-zero if true, nil otherwise Notes: Example: ---------------------------------------- Function: islower Character Synopsis: returns a non-zero value if argument is a lower case letter Prototype: (islower char) Arguments: char Returns: non-zero if true, nil otherwise Notes: Example: ---------------------------------------- Function: isodigit Character Synopsis: returns a non-zero value if argument is an octal digit (0-7) Prototype: (isodigit char) Arguments: char Returns: non-zero if true, nil otherwise Notes: Example: ---------------------------------------- Function: isprint Character Synopsis: returns a non-zero value if argument is a printable character Prototype: (isprint char) Arguments: char Returns: non-zero if true, nil otherwise Notes: Example: ---------------------------------------- ELF Functions page 64 Function: ispunct Character Synopsis: returns a non-zero value if argument is a punctuation character Prototype: (ispunct char) Arguments: char Returns: non-zero if true, nil otherwise Notes: Example: ---------------------------------------- Function: isspace Character Synopsis: returns a non-zero value if argument is a white-space character (space, tab, newline, etc) Prototype: (isspace char) Arguments: char Returns: non-zero if true, nil otherwise Notes: Example: ---------------------------------------- Function: isupper Character Synopsis: returns a non-zero value if argument is an upper case letter Prototype: (isupper char) Arguments: char Returns: non-zero if true, nil otherwise Notes: Example: ---------------------------------------- Function: isxdigit Character Synopsis: returns a non-zero value if argument is a hexadecimal digit (0-F) Prototype: (isxdigit char) Arguments: char Returns: non-zero if true, nil otherwise Notes: Example: ---------------------------------------- Entity Creation The ELF entity creation functions provide a means to make an entity with a single function call using the ADS/AutoLISP entmake ELF Functions page 65 facility. These functions are at least twice as fast as using (command) and easier to use than (entmake). ---------------------------------------- Function: arc Entity Synopsis: create an arc entity Prototype: (arc cen rad sang eang layer) Arguments: cen the 2D or 3D center point of the arc in the current UCS. (0 is assumed if cen is a 2D point) rad the radius of the arc sang the starting angle in radians eang the ending angle in radians layer optional layer name on which to create the arc Returns: 1 if successful or nil otherwise Notes: Example: (arc '(2.0 3.0) 1.0 (dtr 90.0) (dtr 270.0) "MYLAYER") ---------------------------------------- Function: circle Entity Synopsis: create a circle entity Prototype: (circle cen rad layer) Arguments: cen the 2D or 3D center point of the arc in the current UCS. (0 is assumed if cen is a 2D point) rad the radius of the circle layer optional layer name on which to create the circle Returns: 1 if successful or nil otherwise Notes: Example: (circle '(2.0 3.0) 1.0 "MYLAYER") ---------------------------------------- Function: grid Entity Synopsis: create a grid of line entities Prototype: (grid pnt cols rows colwidth rowheight layer) ELF Functions page 66 Arguments: pnt the 2D or 3D center point of the lower left corner in the current UCS. (0 is assumed if pnt is a 2D point) cols the number of grid columns rows the number of grid rows colwidth the spacing of columns rowheight the spacing of rows layer optional layer name on which to create the grid Returns: 1 if successful or nil otherwise Notes: Example: (grid '(2.0 3.0) 10 10 0.5 0.5 "MYLAYER") ---------------------------------------- Function: line Entity Synopsis: create a line entity Prototype: (line from to layer) Arguments: from the starting point of the line. to the ending point of the line. layer optional layer name on which to create the circle Returns: 1 if successful or nil otherwise Notes: Example: (line '(0.0 0.0) '(1.0 1.0) "MYLAYER") ---------------------------------------- Function: point Entity Synopsis: create a point entity Prototype: (point pt layer) Arguments: pt the coordinates of the point layer optional layer name on which to create the circle Returns: 1 if successful or nil otherwise Notes: Example: (point '(5.0 8.0) "MYLAYER") ---------------------------------------- ELF Functions page 67 Function: pline Entity Synopsis: create a polyline entity Prototype: (pline vlist layer width flags) Arguments: vlist a list of 2d or 3d point coordinates layer optional layer name on which to create the circle width optional line width - default 0 flags bit coded group 70 codes (see AutoCAD DXF file docs) Returns: 1 if successful or nil otherwise Notes: Example: (pline (list(0.0 0.0)(1.0 0.0)(1.0 1.0)) 0.0 1) ; draws a closed polyline ---------------------------------------- Function: rect Entity Synopsis: create a polygon rectangle entity Prototype: (rect pt width height layer) Arguments: pt the origin point width width of the rectangle (x axis) height height of the rectangle (y axis) layer optional layer name on which to create the entity Returns: 1 if successful or nil otherwise Notes: Example: (rect '(0.0 0.0) 1.0 2.0 "MYLAYER") ---------------------------------------- Function: solid Entity Synopsis: create a solid entity Prototype: (solid pt1 pt2 pt3 pt4 layer) Arguments: pt1 the first point pt2 the second point pt3 the third point pt4 optional - the fourth point (default - third point value) layer optional layer name on which to create the entity Returns: 1 if successful or nil otherwise ELF Functions page 68 Notes: Example: (solid '(0.0 0.0) '(0.0 1.0) '(1.0 1.0) '(1.0 0.0) "MYLAYER") ---------------------------------------- Function: text Entity Synopsis: create a text entity Prototype: (text pt str height layer rot obl flg hal val apt) Arguments: pt the text insertion point str the text string height height of the text layer optional layer name on which to create the entity rot optional rotation angle in radians obl optional oblique angle in radians flg optional text generation flag (2=backward, 4=upside down) hal optional horizontal alignment (0=left, 1=center, 2=right, 3=aligned, 4=middle, 5=fit) val optional vertical alignment (0=baseline, 1=bottom, 2=middle, 3=top) apt optional alignment point (default = insertion point) Returns: 1 if successful or nil otherwise Notes: Example: (text '(0.0 0.0) "Hello World" 0.5 "MYLAYER" 0.0 0.0 0 1 0) ---------------------------------------- ELF Functions page 69 Function: Selection Set These functions provide 1) a simple selection set filter; 2) access to the AutoCAD dragger; 3) Entity transformation of an entire selection set; 4) selection set combination. ---------------------------------------- Function: ss_filter Selection Set Synopsis: filters a selection set removing all entities except those in a list of entity types Prototype: (ss_filter ss slist) Arguments: ss a selection set slist a list of entity types Returns: the modified selection set Notes: the selection set is modified in place Example: (ss_filter ss '("LINE" "CIRCLE")) ; removes all entities except lines and circles ---------------------------------------- Function: ss_move Selection Set Synopsis: uses the AutoCAD dragger to move a selection set Prototype: (ss_move ss pt) Arguments: ss selection set to move pt base point Returns: the point that the user selected to end ss_move Notes: ss_move does not actually move the entities, but displays a xor vector image of the original entities and rubber band that moves with the graphics cursor. The returned point can then be used by the programmer to perform custom entity transformations using "ss_xform" or any of AutoCAD's entity creation/modification commands(see sample lisp code in the file SELSET.LSP). Example: (setq newpt(ss_move ss (getpoint))) ; get point to move to ---------------------------------------- Function: ss_rotate Selection Set Synopsis: uses the AutoCAD dragger to rotate a selection set Prototype: (ss_rotate ss pt) Arguments: ss selection set to rotate pt base point Returns: the point that the user selected to end ss_rotate ELF Functions page 70 Notes: see ss_move Example: see ss_move ---------------------------------------- Function: ss_scale Selection Set Synopsis: uses the AutoCAD dragger to scale a selection set Prototype: (ss_scale ss pt) Arguments: ss selection set to scale pt base point Returns: the point that the user selected to end ss_scale Notes: see ss_move Example: see ss_move ---------------------------------------- Function: ss_union Section Set Synopsis: merges all entities in two selection sets into a new third selection set Prototype: (ss_union ss1 ss2) Arguments: ss1 first selection set ss2 second selection set Returns: a new selection set with all entities from ss1 and ss2 Notes: Example: (setq ss_all (ss_union ss1 ss2)) ;merge ss1 and ss2 ---------------------------------------- Function: ss_inters Section Set Synopsis: merges all entities common to two selection sets into a new third selection set Prototype: (ss_inters ss1 ss2) Arguments: ss1 first selection set ss1 second selection set Returns: a new selection set containing entities common to both ss1 and ss2 Notes: Example: (setq ss_common (ss_inters ss1 ss2)) ---------------------------------------- Function: ss_diff Section Set Synopsis: creates a new selection from two selection sets by copying the first and removing entities found in the second from the new selection set. Prototype: (ss_diff ss1 ss2) ELF Functions page 71 Arguments: ss1 first selection set ss1 second selection set Returns: a new selection set as ss1 - ss2 Notes: Example: (setq ss3 (ss_diff ss1 ss2)) ;remove entities in ss2 from ss1 ---------------------------------------- Function: ss_xform Section Set Synopsis: transform entities in a selection set using a transformation matrix Prototype: (ss_xform ss mat) Arguments: ss the selection set to transform mat the transformation matrix to use Returns: 1 if successful, nil otherwise Notes: the transformation matrix is a 4 X 4 list of real values that determine how the entities will be transformed. See "Transformation Matrices" in the AutoCAD "ADS Programmers Reference Maunal" for a full explanation, the dragger examples showing how the functions and amtricies are used. Example: (ss_xform ss mat)) ; ---------------------------------------- Function: Utility / Miscellaneous Functions Utility functions include those to control the PC speaker, read the PC system clock, for program debugging, and to execute DOS programs under program control. ---------------------------------------- Function: adsdump Utility Synopsis: prints the data type and value of an AutoLISP symbol Prototype: (adsdump sym) Arguments: sym an AutoLISP symbol Returns: Notes: Example: (setq x (load_dirs)) (adsdump x) ---------------------------------------- ELF Functions page 72 Function: beep Utility Synopsis: sound a beep on the PC speaker for optional frequency and duration Prototype: (beep freq duration) Arguments: freq frequency in hertz duration length/duration of the beep in decimal seconds Returns: Notes: Example: (beep 440 1.0) ;;; beep middle A for one second ---------------------------------------- Function: clock Utility Synopsis: reads the current internal clock Prototype: (clock) Arguments: none Returns: the current internal clock register reading in seconds (0.01 second precision) Notes: Example: (setq end (+(clock) 2.5)) ;;; delay for 2.5 seconds (while (> end (clock))) ---------------------------------------- Function: exit Utility Synopsis: cancels execution and returns to the Command: prompt Prototype: (exit) Arguments: Returns: Notes: duplicates the (exit) function available in release 12 for pre-release 12 versions Example: ---------------------------------------- Function: getver Utility Synopsis: returns the ELF, AutoCAD, and DOS version numbers Prototype: (getver) Arguments: Returns: ELF version number AutoCAD version number Notes: DOS version number Example: ---------------------------------------- ELF Functions page 73 Function: last_error Utility Synopsis: returns the last internal error message Prototype: (last_error) Arguments: Returns: the error message Notes: with release 12 the symbol *LAST_ERROR* also contains this message Example: (printf "\nThe last ELF error was %s" (last_error)) ---------------------------------------- Function: initialize Utility Synopsis: resets ELF and loads ELF.INI symbols Prototype: (initialize) Arguments: Returns: Notes: the first ELF function call will also call (initialize). Necessary only if you wish to load the symbols from ELF.INI for use prior to calling any ELF function. Example: ---------------------------------------- Function: nosound Utility Synopsis: turns off the PC speaker after a sound function Prototype: (nosound) Arguments: Returns: Notes: Example: see sound ---------------------------------------- Function: pause_key Utility Synopsis: prints "press any key to continue..." and waits for a keystroke Prototype: (pause_key) Arguments: Returns: Notes: Example: ---------------------------------------- Function: sound Utility Synopsis: turns on the PC speaker at a specified tone frequency Prototype: (sound freq) ELF Functions page 74 Arguments: freq frequency in hertz Returns: Notes: see beep Example: (defun play(freq time) (sound freq) ;;; turn on note (wait time) ;;; wait time seconds (nosound) ;;; turn it off ) (play 440 0.5);;; sounds middle A for 1/2 second ---------------------------------------- Function: system Utility Synopsis: executes a DOS command Prototype: (system cmd) Arguments: cmd DOS command or program Returns: DOS errorlevel if successful or -1 on error Notes: You MUST run "cfig386 acad -maxreal FFFFh" to configure the PharLap DOS extender to allow realmode programs to run (select a value large enough to run the desired programs). This function is preferable to SH or SHELL, or executing some programs from an ACAD.PGP entry, when the return value must be known. It's also a little faster. Example: (keystuff "/FRmyfile\n") (if(>= (system "123") 0) (princ "Lotus 123 executed successfully")) ---------------------------------------- Function: wait Utility Synopsis: suspend execution for a specified time duration Prototype: (wait ti) Arguments: ti time in decimal seconds Returns: Notes: Example: (wait 2.5) ;;; delays for 2.5 seconds ---------------------------------------- Symbols (release 12 or later only) Symbol Description *last_error* the last error message string color default color attribute edit_help string list with user defined help for the (strget) function error_mode controls ELF error message display; 1=display errors,0=no message ELF Functions page 75 menu_help string list with user defined help for the (wmenu) function ELF Functions page 76 Copyright The ELF program code and documentation are copyrighted material, registered with the US Copyright office and protected under US and International copyright laws. All rights are reserved. Trademark Mountain Software and ELF are trademarks of Mountain Software. MS-DOS is a registered trademark of Microsoft Corporation. PC-DOS is a registered trademark of IBM Corporation. AutoCAD and AutoLISP are registered trademarks of AutoDesk. Index *last_error* . . . . . 73, 74 dragger . . . . . 2, 5, 69-71 & . . . . . . . . . . . . . 46 drd . . . . . . . . . . . . 9 && . . . . . . . . . . . . 46 drename . . . . . . . . . . 7 | . . . . . . . . . . . 1, 46 dsd . . . . . . . . . . . . 10 || . . . . . . . . . . . . 46 dtr . . . . . . . . . . 47, 65 acad 3, 4, 6-10, 31, 33, 34, edit_help . . . . . 54, 57, 74 36-39, 74 elf 1-12, 18, 28, 31, 38-45, acadapp . . . . . . . . . . 3 51, 53, 54, 64, 72-7 access . . 21, 31, 40, 43, 69 4, 76 acos . . . . . . . . . . . 46 elf.ini . . . . . . . . 4, 73 ADS . . . . . . . 3-5, 64, 71 elfapps . . . . . . . 1, 2, 5 adsdump . . . . . . . . . . 71 elfdos . . . . . . . 1, 2, 6 arc . . . . . . . . . . . . 65 entity . . . 1, 2, 10, 64-69 asin . . . . . . . . . . . 47 erasefile . . . . . . . 33, 38 attr 11, 13-16, 19, 20, 24, 2 error_mode . . . . . . 4, 74 6, 27, 56 esc . . . . . . 9, 21, 24, 56 attribute 1, 11, 13-16, 18-21 exit . 9, 23, 24, 56, 57, 72 , 23-27, 33, 34, 36, exp . . . . . . . . . 1, 3, 5 56, 74 exsubr . . . . . . . . . . 10 autocad 1-6, 8, 10-12, 67, 69 f1 9, 12, 18, 19, 24, 54, 57 -72, 76 fclose . . . . . . . . 40, 43 autodesk . . . . . . . 1, 76 ff . . . . . . . . . . . . 8 autolisp 1-6, 10, 11, 13, 16, fgetc . . . . . . . . . . . 41 18, 34, 38, 40, 42, fgetint . . . . . . . . . . 42 43, 45, 51, 53, 62, fgetlong . . . . . . . . . 42 64, 71, 76 fgetreal . . . . . . . . . 42 beep . . . . . . . 11, 72, 74 fgets . . . . . . . . . . . 41 binary . . . . . . . 2, 40-45 field . . . . . 30, 53, 54, 56 boundp . . . . . . . . 34, 60 file_exists . . . . . . . . 33 box . . . . . . . . . . . . 13 findfile . . . . . . . . 3, 8 bsearch . . . . . . . . . . 51 findfirst . . . 21, 33, 34, 36 capslock . . . . . . . . . 30 findnext . . . . . . . 34, 36 cd . . . . . . . . . . . . 6 flipscreen . . . . . . . . 12 ceil . . . . . . . . . . . 47 floor . . . . . . . . . . . 48 chdir . . . . . . . . . 6, 31 floppy . . . . . . 7, 20, 32 chpath . . . . . . . . . . 32 fopen . . . . . . . . . . . 43 circle . . . . . . 65-67, 69 fputc . . . . . . . . . . . 43 clock . . . 2, 56, 60, 71, 72 fputint . . . . . . . . . . 44 cls . . . . . . . . . . 6, 13 fputlong . . . . . . . . . 44 color 1, 3, 4, 11, 13-16, 18- fputreal . . . . . . . . . 44 21, 23, 24, 25-27, 4 fputs . . . . . . . . . . . 43 6, 56, 74 frewind . . . . . . 40, 44, 45 commands . . . 1-3, 6-10, 69 fseek . . . . . . . . . 40, 45 copyfile . . . . . . . . . 38 fullpath . . . . . . . 34, 35 cosh . . . . . . . . . . . 47 get_cursor . . . . . . 15-17 dcd . . . . . . . . . . . . 6 get_video . . . . . 13, 14, 16 dcopy . . . . . . . . . . 6, 7 getch . . . . . . . 1, 28, 29 ddel . . . . . . . . . . . 7 getche . . . . . . . . 1, 29 ddir . . . . . . . . . . . 7 getdir . . . . . . . . . . 35 delete . 2, 7, 9, 51, 56, 57 getdisk . . . . . . . . . . 35 derase . . . . . . . . . . 7 getdiskfree . . . . . . . . 35 dir . . . . . 7, 11, 27, 36-38 getkey . . . . . 1, 28-30, 48 dmd . . . . . . . . . . . . 9 getxy . . . . . . . 16, 17, 22 dmove . . . . . . . . . . 7, 8 gotoxy . . . . . . . . 16, 17 grid . . . . . . . . . 65, 66 point . . . 11, 42, 44, 65-70 hibyte . . . . . . . . 29, 48 popup . . . . . . . . . . . 1 insert . . . 2, 30, 51-53, 57 printf 1, 4, 11-14, 16, 26, 3 isalnum . . . . . . . . . . 62 4, 54, 55, 56, 60, 7 isascii . . . . . . . . 12, 62 3 iscntl . . . . . . . . . . 62 prts . . . . . . . . . . . 14 isdigit . . . . . . . . . . 62 puts . . . . . . . 14, 15, 27 isgraph . . . . . . . . . . 63 qsort . . . . . 10, 36, 51, 53 islower . . . . . . . . . . 63 radians 11, 46, 47, 49, 50, 6 isodigit . . . . . . . . . 63 5, 68 isprint . . . . . . . . . . 63 rand . . . . . . . . . 12, 49 ispunct . . . . . . . . . . 64 rd . . . . . . . . . . 9, 10 isspace . . . . . . . . . . 64 read_file . . . . . . . 38, 39 isupper . . . . . . . . 62, 64 replace . . . . . . 2, 51, 53 isxdigit . . . . . . . . . 64 rmdir . . . . . . . . . 9, 37 kbhit . . . . . . . . . 1, 29 round . . . . . . . . . . . 49 key_clear . . . . . . . . . 30 rtd . . . . . . . . . . . . 49 key_ready . . . . . . . . . 30 save_screen . . . . . . . . 15 key_stat . . . . . . . . . 30 scancode . . . . . . . 29, 48 key_stuff . . . . . 28, 30, 31 scr_fill . . . . . . . 15, 16 keycode 5, 23, 24, 29, 30, 48 scr_printf . . . . 12, 13, 16 , 57 sd . . . . . . . . . . . . 10 keycodes . . . . . . . 29, 56 set_cursor . . . . . . 15-18 keystuff . . . . . . . . . 74 setdisk . . . . . . . . . . 37 last_error . . . . . . 73, 74 setq 10, 14, 16, 17, 21, 22, len . . . . . . 20, 41, 56-58 24, 25, 29, 30, 34-3 lfind . . . . . . . . . . . 52 6, 38, 41, 42, 45, 4 line 1, 2, 4, 7, 9, 17-20, 23 6-49, 51, 52, 56, 57 -25, 27, 38-40, 54-5 , 59, 60, 69-72 7, 65, 66, 67, 69 shareware . . . . . . . . 1, 2 list 1, 2, 7, 8, 10-12, 14, 1 sinh . . . . . . . . . . . 49 7, 18, 22, 23, 24, 2 solid . . . . . . . 25, 67, 68 9, 31, 34-40, 51, 52 sound . . . . 1, 2, 11, 72-74 , 53, 54, 57, 67, 69 splitpath . . . . . . . 36-38 , 71, 72, 74, 75 sprintf . . . . . . 35, 54, 55 load_dirs . . . . . 35, 36, 71 srand . . . . . . . . . . . 50 load_files . . . . . . . . 36 ss_diff . . . . . . . . 70, 71 lobyte . . . . . . . . 29, 48 ss_filter . . . . . . . . . 69 log10 . . . . . . . . . . . 49 ss_inters . . . . . . . . . 70 look . . . . . . 8-10, 18, 39 ss_move . . . . . . . . 69, 70 lsearch . . . . . . . . . . 52 ss_rotate . . . . . . . . . 69 lsp 4, 5, 13, 28, 29, 36-38, ss_scale . . . . . . . . . 70 69 ss_union . . . . . . . . . 70 makepath . . . . . . . . . 36 strchr . . . . . . . . . . 55 md . . . . . . . . . . . . 9 strcmp . . . . . . . . . . 55 menu_help . . . 18, 19, 24, 75 strcspn . . . . . . . . . . 55 mkdir . . . . . . . 9, 36, 37 strdate . . . . . . . . . . 56 movefile . . . . . . . . . 39 strdela . . . . . . . . . . 56 nosound . . . . . . . . 73, 74 strget . . 20, 54, 56, 57, 74 numlock . . . . . . . . . . 30 stricmp . . . . . . . . . . 57 password . . . . . . . . . 9 string 1, 2, 4, 11, 12, 14-16 pause . . . . . . . . . . . 73 , 18-21, 23, 24, 26- pgdn . . . . . . . . . 9, 24 41, 43, 51, 52, 53-6 pgp . . . . . . . . . . . . 74 1, 65-68, 73-75 pgup . . . . . . . . . 9, 24 strncpy . . . . . . . . . . 58 pharlap . . . . . . . . . . 74 strnset . . . . . . . . . . 58 strpbrk . . . . . . . . . . 58 strrchr . . . . . . . . . . 58 strrev . . . . . . . . . . 59 strspn . . . . . . . . . . 59 strstr . . . . . . . . 58, 59 strswap . . . . . . . . . . 59 strtime . . . . . . . . . . 60 strtok . . . . . . . . . . 60 strtrim . . . . . . . . 60, 61 strtriml . . . . . . . . . 61 strtrimr . . . . . . . . . 61 subr . . . . . . . . . . . 10 substring . . . 54, 55, 58-60 substrings . . . . . . . . 60 symbol 1, 2, 4, 6, 10, 11, 13 , 16, 18, 19, 20, 23 , 24, 26, 38, 53, 54 , 56, 57, 71, 73, 74 system 1, 4, 12, 18, 31, 33, 34, 54, 71, 74 tan . . . . . . . . . . . . 50 tanh . . . . . . . . . . . 50 text 1, 6, 9, 12-16, 18, 20, 24-27, 38, 39, 54, 5 6, 68 tolower . . . . . . . . . . 61 toupper . . . . . . . . . . 61 unlink . . . . . . . . . . 38 utility . . . . . 1, 2, 71-74 ver . . . . . . . . . . . . 10 wait . . . . . . . . . 24, 74 wclose . . . . . . . . . . 19 wcloseall . . . . . . . . . 19 wclreol . . . . . . . . . . 19 wcls . . . . . . . . . 19, 20 werase_line . . . . . . . . 20 wgetdrive . . . . . . . 20, 21 wgetfile . . . . . . . 9, 21 wgetstr . . . . . . . . . . 20 wgetxy . . . . . . . . . . 22 wgotoxy . . . . . . . . . . 22 what . . . . . . . . . . . 10 winfo . . . . . . . . . . . 22 wmenu . . . . . 18, 23, 24, 75 wmsg . . . . . . . . . 24, 25 wopen . . . . . . . . . . . 25 wpopup . . . . . . 20, 25, 26 wprintf . . . . . . . . . . 26 wprts . . . . . . . . . 18, 26 wputcen . . . . . . . . . . 26 wputs . . . . . . . . . 18, 27 write_file . . . . . . 38-40 wscroll . . . . . . . . . . 27 wshadow . . . . . . . . 27, 28 wtitle . . . . . . . . . . 28 xload . . . . . . . . . . . 3