
TCL-Programs Reference Manual
Contents
Filesystem Commands
These are filesystem commands
The files in the file-system are the help-files. They can be
addressed by the name of the help-file, regardless of the security
of the help-entry.
| User contributed notes: General remarks |
mavetju@chello.nl
Nov 7th 2000, 10:33
|
A small program to test all the options:
set descriptor 0
proc open {} {
variable descriptor
! say opening
set descriptor [data open smote]
! say $descriptor
}
proc close {} {
variable descriptor
! say closing $descriptor
data close $descriptor
set descriptor 0
}
proc read {} {
variable descriptor
! say reading $descriptor
! say [data read $descriptor]
}
proc info {} {
variable descriptor
! say descriptor: $descriptor [data tell $descriptor] [data eof $descriptor]
}
proc forward {} {
variable descriptor
! say forward
data seek $descriptor 0 end
info
}
proc rewind {} {
variable descriptor
! say rewind
data seek $descriptor 0 set
info
}
addtrigger aa speech {open} {trig words open}
addtrigger ab speech {read} {trig words read}
addtrigger ac speech {info} {trig words info}
addtrigger ad speech {rewind} {trig words rewind}
addtrigger ae speech {forward} {trig words forward}
addtrigger af speech {close} {trig words close}
Use "stat files" to see the status of the files.
|
|
|
File Systems Command Reference
data close <descriptor>
Closes a help-file entry.
Example: data close $desc
data eof <descriptor>
Returns true if the end of the help-file entry has been reached.
Example: if {[data eof $desc]} { data seek $desc 0 set }
data open <help-entry>
Open an help-file entry, initializing the file-descriptor.
Returns the number of the descriptor, or zero if it fails.
Example: set desc [data open smite]
data read <descriptor>
Reads one line out of the help-file entry. Returns ""
if there is nothing more to read.
Example: set line [data read $desc]
data seek <descriptor> <offset> <whence>
Seeks into a file. Whence can be:
set | The offset is relative to the begin of the help-entry. |
cur | The offset is relative to the current offset in the help-entry. |
end | The offset is relative to the end of the help-entry. |
Example: data seek $desc 0 set
data tell <descriptor>
Returns the current offset in the help-file entry.
Example: set offset [data tell $desc]
|