home *** CD-ROM | disk | FTP | other *** search
/ ARM Club 3 / TheARMClub_PDCD3.iso / hensa / programming / tcl / tcl_1 / !Tcl_doc_RISCOS < prev    next >
Encoding:
Text File  |  1996-03-27  |  4.9 KB  |  121 lines

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