home *** CD-ROM | disk | FTP | other *** search
- RISCOS extensions to Tcl
-
- These provide 13 commands
- open
- close
- flush
- eof
- puts
- gets
- glob
- exit
- source
- file
- system
- getenv
- date
-
- and 2 variables
- rand ... gives a pseudorandom unsigned integer less
- than 2^32
- clock ... gives the time in centiseconds since the
- program was started
-
- open <filename> ?<mode>? ... opens <filename> returns a fileId if ok
- gives an error otherwise
- mode can be any standard c mode
- r .. open for read
- w .. open or create for write,
- discard any contents
- a .. open or create for write
- append to any contents
- r+ .. open for update
- w+ .. open or create for update
- discard any contents
- a+ .. open or create for update
- append to any contents
-
- update= read or write
- you must flush between read and write or vv.
-
- follow the above by b for binary files
-
- default is rb.
-
- In the below <fileId> must be a result returned by open
- or one of
- stdin ... input from keyboard
- stdout ... output to screen
- stderr ... output to screen
-
- these three can be redirected from the command line
-
- close <fileId> ... close file. No error if not open.
-
- date ?<format>? ... returns date and time information as a string
- format uses the same %-substitutions as
- Sys$DateFormat.
- It defaults to %24:%mi:%se %dy-%m3-%ce%yr
-
- flush <fileId> ... sends any buffered output to file
-
- eof <fileId> ... returns 1 for end of file 0 otherwise
- error if <fileId> closed or not opened
-
- puts ?-nonewline? ?<fileId>? <string>
-
- ... outputs <string> followed by a newline unless
- the -nonewline flag is given
- <fileId> defaults to stdout
-
- gets <fileId> ?<variable>?
- ... gets a string terminated by a newline
- from <fileId>. The newline is not included
- in the string.
- If <variable> is not given the string is
- returned, if it is the string is placed
- in <variable> and its length is returned.
-
- glob <filename> ?filetype?
-
- ... returns a list of all files matching a
- filename with possible wildcards in its leaf.
- if <filetype> is given it only gives
- files of that type
- <filettype> can be a decimal integer,
- a type name, or the special names
- "directory" and "application"
-
- no error is given if the returned list is empty
-
- exit ?<return code>? ... exits the program returning the integer code
- given or zero.
-
- source <filename> ... executes <filename> as a Tcl script.
- returns the value of the last command.
-
- system <string> ... passes <string> to the RISCOS CLI.
- Returns 0=>success -2=>could not run,
- other=>return code from program.
-
- getenv <name> ... returns the value of system variable <name>,
- or an empty string if it does not exist
-
- file size <filename> ... returns the length of <filename>
- file type <filename> ... returns the type of <filename>
- file exists <filename> ... returns the 1 if <filename> exists or 0
- file access <filename> ... returns access details of <filename> as a
- subset of rwxlRWXL -lower case for user access
- file full <filename> ... returns the canonicalized version of <filename>
-
- NOTE
- The POSIX random access functions seek, tell and read are not
- yet provided.
- The POSIX env array is not provided. It can be simulated in Tcl using
- the system and getenv functions. See the library.env script.
- The POSIX commands cd and pwd, and many of the POSIX file options are
- not provided. See the library.posix script.
-
-
-
-