home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 4 / DATAFILE_PDCD4.iso / languages / tcl / !Tcl / doc / RISCOS < prev    next >
Encoding:
Text File  |  1996-01-17  |  4.6 KB  |  115 lines

  1. RISCOS extensions to Tcl
  2.  
  3. These provide 12 commands
  4.         open
  5.         close
  6.         flush
  7.         eof
  8.         puts
  9.         gets
  10.         glob
  11.         exit
  12.         source
  13.         file
  14.         system
  15.         getenv
  16.  
  17. and 2 variables
  18.         rand              ... gives a pseudorandom unsigned integer less
  19.                               than 2^32 
  20.         clock             ... gives the time in centiseconds since the 
  21.                               program was started
  22.  
  23. open <filename> ?<mode>?  ... opens <filename> returns a fileId if ok
  24.                               gives an error otherwise
  25.                               mode can be any standard c mode
  26.                               r  .. open for read
  27.                               w  .. open or create for write,
  28.                                     discard any contents
  29.                               a  .. open or create for write
  30.                                     append to any contents
  31.                               r+ .. open for update
  32.                               w+ .. open or create for update
  33.                                     discard any contents
  34.                               a+ .. open or create for update
  35.                                     append to any contents
  36.  
  37.                                     update= read or write
  38.                                     you must flush between read and write or vv.
  39.  
  40.                                     follow the above by b for binary files
  41.  
  42.                                     default is rb.
  43.  
  44. In the below <fileId> must be a result returned by open
  45. or one of
  46.              stdin          ... input from keyboard
  47.              stdout         ... output to screen
  48.              stderr         ... output to screen
  49.  
  50. these three can be redirected from the command line
  51.  
  52. close <fileId>              ... close file. No error if not open.
  53.  
  54. flush <fileId>              ... sends any buffered output to file
  55.  
  56. eof   <fileId>              ... returns 1 for end of file 0 otherwise
  57.                                 error if <fileId> closed or not opened
  58.  
  59. puts  ?-nonewline? ?<fileId>? <string>
  60.  
  61.                             ... outputs <string> followed by a newline unless
  62.                                 the -nonewline flag is given
  63.                                 <fileId> defaults to stdout
  64.  
  65. gets <fileId> ?<variable>?
  66.                             ... gets a string terminated by a newline
  67.                                 from <fileId>. The newline is not included
  68.                                 in the string.
  69.                                 If <variable> is not given the string is
  70.                                 returned, if it is the string is placed
  71.                                 in <variable> and its length is returned.
  72.  
  73. glob <filename> ?filetype?
  74.                             
  75.                             ... returns a list of all files matching a
  76.                                 filename with possible wildcards in its leaf.
  77.                                 if <filetype> is given it only gives
  78.                                 files of that type
  79.                                 <filettype> can be a decimal integer,
  80.                                 a type name, or the special names
  81.                                 "directory" and "application"
  82.  
  83.                                 no error is given if the returned list is empty
  84.  
  85. exit ?<return code>?        ... exits the program returning the integer code 
  86.                                 given or zero.
  87.  
  88. source <filename>           ... executes <filename> as a Tcl script.
  89.                                 returns the value of the last command.
  90.  
  91. system <string>             ... passes <string> to the RISCOS CLI.
  92.                                 Returns 0=>success -2=>could not run,
  93.                                 other=>return code from program. 
  94.  
  95. getenv <name>               ... returns the value of system variable <name>,
  96.                                 or an empty string if it does not exist
  97.  
  98. file size <filename>        ... returns the length of <filename>
  99. file type <filename>        ... returns the type of <filename>
  100. file exists <filename>      ... returns the 1 if <filename> exists or 0
  101. file access <filename>      ... returns access details of <filename> as a
  102.                                 subset of rwxlRWXL -lower case for user access
  103. file full <filename>        ... returns the canonicalized version of <filename>
  104.  
  105. NOTE
  106.      The POSIX random access functions  seek, tell and read are not
  107. yet provided.
  108.      The POSIX env array is not provided. It can be simulated in Tcl using 
  109. the system and getenv functions. See the library.env script.
  110.      The POSIX commands cd and pwd, and many of the POSIX file options are
  111. not provided. See the library.posix script.
  112.  
  113.  
  114.  
  115.