# ====================================================================== # # IREAD # # iread allows one to "intelligently" read files from various # directories without typing out the full path. For example, # to read the file `mapply` from /u/cl/maple, one normally would # have to say # # read( `/u/cl/maple/mapply` ); # # Much shorter is the command # # iread( mapply ); # # To install iread, type # # read( `/u/cl/maple/iread` ); # # Examples: # # iread(); Gives you the contents of libname # This is a list of useful paths. # Suggested setting: # # libname := `/u/cl/maple`,`libname`; # # # iread( foo ); reads foo from /u/cl/maple # # iread( foo, 1 ); reads foo from the path specified by # libname[1], e.g., `u/cl/maple`. Of # course any valid list index, e.g., 2 # also works. # # iread( foo, P ); reads foo from the path stored in the # variable P. (Any variable will do). # # iread( foo, `u/ma/gauss/maple-stuff`); # # reads foo from Gauss's "maple-stuff" # directory. # # # --- Jim Carlson, October 27, 1992. Updated 30 March 1993 for V.2. # # =================================================================== iread := proc( ) local p; if nargs = 0 then p := 0; if libname = `/usr/local/share/mapleV2/lib` then print(`libname has no extra directories. Try`); print(`libname := ``/u/cl/maple``,``libname``;`); else print(libname); fi; elif nargs = 1 then p := cat(`/u/cl/maple/`, args[1] ); elif nargs = 2 then if whattype(args[2]) = integer then if libname = 'libname' then print(`libname has no extra directories. Try`); print(`libname := ``/u/cl/maple``,``libname``;`); p := 0 else p := cat(libname[args[2]], `/`, args[1] ); fi; elif whattype(args[2]) = string then p := cat(args[2], `/`, args[1]); fi; fi; if p = 0 then ; else read p; print(cat( `read: `,p)) ; fi; end: `help/text/iread` :=TEXT( `FUNCTION: iread - Read in maple source files from standard`, ` maple directories listed in variable "libname".`, ``, `CALLING SEQUENCE:`, `iread(); Prints the contents of libname`, ` This is a list of useful paths.`, ` Suggested setting:`, ` libname := ``/u/cl/maple``,``libname``;`, ``, `iread( foo ); Reads foo from /u/cl/maple`, ``, `iread( foo, 1 ); Reads foo from the path specified by`, ` libname[1], e.g., ``u/cl/maple``. Of`, ` course any valid list index, e.g., 2`, ` also works.`, ``, `iread( foo, P ); Reads foo from the path stored in the`, ` string variable P. (Any variable will do).`, ``, `iread( foo, ``u/cl/c-phb/maple-stuff``);`, ``, ` Reads foo from H.B.Phillip's maple-stuff`, ` directory.`, ``, `PARAMETERS:`, ` foo Name of a maple source file. May also be`, ` a library file with .m extension, e.g.,`, ` a file name like ``foo.m`` is acceptable.`, ``, `SYNOPSIS:`, ``, `Function iread allows one to "intelligently" read files from various`, `directories without typing out the full path.`, ``, `For example, to read the file ``mapply`` from /u/cl/maple, the normal`, `method is read(``/u/cl/maple/mapply`` ); Much shorter is the command`, `iread( mapply );`, ``, `AUTHOR: Jim Carlson, October 27, 1992. Updated 30 March 1993 for V.2.`, ` `, `SEE ALSO:`, ` read, readlib, with`, ` `):