home *** CD-ROM | disk | FTP | other *** search
-
-
- TABLE OF CONTENTS
-
- --background--
- rexx_dos.library/AddPart
- rexx_dos.library/Delay
- rexx_dos.library/DeleteVar
- rexx_dos.library/ExAll
- rexx_dos.library/Examine
- rexx_dos.library/GetVar
- rexx_dos.library/Info
- rexx_dos.library/MatchPattern
- rexx_dos.library/ReadArgs
- rexx_dos.library/ReadBlock
- rexx_dos.library/SetVar
- rexx_dos.library/SplitPath
- rexx_dos.library/WriteBlock
-
-
- --background-- --background--
-
- $(C): (1996, Rocco Coluccelli, Bologna)
- $VER: rexx_dos.library 37.0 (30.01.97)
-
- rexx_dos.library
-
- This sub-library of the rexxMOOS.library let ARexx programmers
- use some function from the system dos.library
-
- AddPart()
- Delay()
- DeleteVar()
- ExAll()
- Examine()
- GetVar()
- Info()
- MatchPattern()
- ReadArgs()
- ReadBlock()
- SetVar()
- SplitPath()
- WriteBlock()
-
- NOTES
-
- Is part of the MOOS package.
-
- TODO
-
- Support for memory pools.
-
- BUGS
-
- rexx_dos.library/AddPart rexx_dos.library/AddPart
-
- NAME
-
- AddPart -- Appends a file/dir to the end of a path.
-
- SYNOPSIS
-
- path = AddPart(dirname,filename)
-
- FUNCTION
-
- This function adds a file, directory, or subpath name to a
- directory path name taking into account any required separator
- characters. If filename is a fully-qualified path it will totally
- replace the current value of dirname.
-
- INPUTS
-
- dirname - the path to add a file/directory name to.
-
- filename - the filename or directory name to add.
-
- RESULT
-
- The path resulting from dirname and filename.
-
- EXAMPLE
-
- SAY AddPart("RAM:foo","bar")
-
- NOTES
-
- BUGS
-
- SEE ALSO
-
- dos.library/AddPart(), rexx_dos.library/SplitPath()
-
- rexx_dos.library/Delay rexx_dos.library/Delay
-
- NAME
-
- Delay -- Delay a process for a specified time.
-
- SYNOPSIS
-
- Delay(ticks)
-
- FUNCTION
-
- The argument 'ticks' specifies how many ticks (50 per second)
- to wait before returning control.
-
- INPUTS
-
- ticks - Any positive integer number. A negative value will be
- converted to zero.
-
- EXAMPLE
-
- CALL Delay(100) /* wait for 2 seconds */
-
- NOTES
-
- SEE ALSO
-
- rexxsupport.library/Delay(), dos.library/Delay()
-
- rexx_dos.library/DeleteVar rexx_dos.library/DeleteVar
-
- NAME
-
- DeleteVar -- Delete a local or global variable.
-
- SYNOPSIS
-
- success = DeleteVar(name,options)
-
- FUNCTION
-
- The function try to delete the given environment variable.
-
- INPUTS
-
- name - The variable name.
-
- options - "Loc=Local/S"
-
- "Local" - Delete a local variable for the current process.
- (default is to delete a Global variable)
-
- RESULT
-
- success - boolean value (1 mean all done, ok).
-
- EXAMPLE
-
- CALL DeleteVar("language")
-
- NOTES
-
- Since ARexx spawns a new process of each script, even if
- started from Shell, option "Local" may not work as supposed.
-
- SEE ALSO
-
- dos.library/DeleteVar(), rexx_dos.library/SetVar()
-
- rexx_dos.library/ExAll rexx_dos.library/ExAll
-
- NAME
-
- ExAll -- Examine an entire directory.
-
- SYNOPSIS
-
- success = ExAll(pattern,options)
-
- FUNCTION
-
- The function examine an entire directory doing a pattern match
- on all file names before writing them into the output stem.
-
- INPUTS
-
- pattern - A valid AmigaDOS pattern string. It can include a
- specification of the path where is to execute the
- function. See also MatchPattern() to find more
- information about an AmigaDOS pattern structure.
-
- options - "OutStem/A,Type/K/N,Fields/K/N,Prot/S"
-
- "OutStem" - The output stem must be specified. It will
- receive all datas readed from the function
- for every matched file. The stem variable
- consists of the following fields:
-
- <stem.>count
- The number of files processed.
-
- <stem.>n.Name
- The file name, without the path.
-
- <stem.>n.Type
- "FILE" or "DIRECTORY".
-
- <stem.>n.Size
- The file size, in bytes.
-
- <stem.>n.Prot
- The protection bits. See Examine()
- for more details about them.
-
- <stem.>n.WDay
- The day of the week that the file was
- last changed.
-
- <stem.>n.Date
- The date of the last change.
-
- <stem.>n.Time
- The time of the last change.
-
- <stem.>N.Note
- File comment.
-
- "Type" - Not always is necessary to read all the above
- information from a set of files. To select which
- attributes are to read we can use this keyword
- followed by a number:
-
- 1 - To output only the field "Name"
- 2 - Output also "Type"
- 3 - Output also "Size"
- 4 - Output also "Prot"
- 5 - Output also "Date", "WDay", "Time"
- 6 - Output also "Note"
-
- "Fields" - Instead of using the "type" we can specify
- which field we need as output... NOT_YET
-
- "Prot" - By default the protection bits normally used
- from any AmigaDOS filesystem are returned in
- the form "srwed". Using this option they will
- be returned as the original long value.
-
- RESULT
-
- success - boolean value (1 mean all done, ok).
-
- EXAMPLE
-
- IF ExAll("Devs:#?.device","ex.") THEN
- DO n = 0 FOR ex.count
- SAY "Name" ex.n.Name
- END
-
- NOTES
-
- SEE ALSO
-
- rexx_dos.library/Examine(), dos.library/ExAll()
-
- rexx_dos.library/Examine rexx_dos.library/Examine
-
- NAME
-
- Examine -- Examine the FileInfoBlock for a file/dir.
-
- SYNOPSIS
-
- success = Examine(path,options)
-
- FUNCTION
-
- The function examines the given file/directory and returns all
- information stored into its FileInfoBlock structure.
-
- INPUTS
-
- path - Any existing file or directory.
-
- options - "OutStem/A,Prot/S"
-
- "OutStem" - The output stem must be specified. It will
- receive all datas readed from the given path.
- The stem variable has the following fields:
-
- <stem.>FileName
-
- <stem.>DiskKey
-
- <stem.>DirEntryType
- "FILE" or "DIRECTORY".
-
- <stem.>EntryType
-
- <stem.>Protection
- The protection bits. Using the option
- switch "Prot/S" the function returns
- the original integer value of the
- protections bits.
-
- <stem.>Size
-
- <stem.>NumBlocks
-
- <stem.>Comment
-
- <stem.>WeekDay
-
- <stem.>Date
-
- <stem.>Time
-
- <stem.>OwnerUID
-
- <stem.>OwnerGID
-
- Read the include file <dos/dos.h> to find
- more information about these fields.
-
- "Prot" - By default the protection bits normally used
- from any AmigaDOS filesystem are returned in
- the form "srwed". Using this option they will
- be returned as the original long value.
-
- RESULT
-
- success - boolean value (1 mean all done, ok).
-
- EXAMPLE
-
- IF Examine("c:List","ex.") THEN DO
- SAY "DiskKey " ex.DiskKey
- SAY "DirEntryType" ex.DirEntryType
- SAY "FileName " ex.FileName
- SAY "Protection " ex.Protection
- SAY "EntryType " ex.EntryType
- SAY "Size " ex.Size
- SAY "NumBlocks " ex.NumBlocks
- SAY "Comment " ex.Comment
- SAY "WeekDay " ex.WeekDay
- SAY "Date " ex.Date
- SAY "Time " ex.Time
- SAY "OwnerUID " ex.OwnerUID
- SAY "OwnerGID " ex.OwnerGID
- END
-
- NOTES
-
- SEE ALSO
-
- rexx_dos.library/ExAll(), dos.library/Examine()
-
- rexx_dos.library/GetVar rexx_dos.library/GetVar
-
- NAME
-
- GetVar -- Returns the value of a local or global variable.
-
- SYNOPSIS
-
- ret = GetVar(name,options)
-
- FUNCTION
-
- Gets the value of a local or environment variable. It may
- checks only if the specified variable exists. The function
- may also delete the variable after reading its value or after
- verifing its existance.
-
- INPUTS
-
- name - The variable name.
-
- options - "Loc=Local/S,Del=Delete/S,Exists/S"
-
- "Local" - By default, the function tries to get a global
- variable. Using this switch we can force the
- function to search into the local variable list.
-
- "Delete" - The variable will be deleted after readed.
-
- "Exists" - Check if the variable exists. The function
- doesn't return its content.
-
- RESULT
-
- The function returns the variable content. Specifing the switch
- "Exists/S" the function returns a boolean value (1 mean "exists").
-
- EXAMPLE
-
- SAY "language =" GetVar("language")
-
- NOTES
-
- Since ARexx spawns a new process of each script, even if
- started from Shell, option "Local" may not work as supposed.
- Read the autodocs for the dos.library and the support of the
- environment variables.
-
- SEE ALSO
-
- rexx_dos.library/SetVar(), dos.library/GetVar()
-
- rexx_dos.library/Info rexx_dos.library/Info
-
- NAME
-
- Info -- Returns information about any disk in use.
-
- SYNOPSIS
-
- success = Info(path,options)
-
- FUNCTION
-
- It can be used to find information about any disk in use.
-
- INPUTS
-
- path - The function returns information about a disk. This
- argument may be a volume name (DF0:, HD0:, etc), but
- we can give also the path of any file and the function
- will find the right disk by itself.
-
- options - "OutStem/A"
-
- "OutStem" - The output stem must be specified. It will
- receive all datas readed from the indicated
- disk. These fields are returned:
-
- <stem.>VolumeName
- Volume name of the disk
-
- <stem.>DateStamp
- Volume creation date
-
- <stem.>NumSoftErrors
- Number of soft errors on disk
-
- <stem.>UnitNumber
- Which unit disk is mounted on
-
- <stem.>DiskState
- WRITE_PROTECTED, VALIDATING or VALIDATED
-
- <stem.>NumBlocks
- Number of blocks on disk.
-
- <stem.>NumBlocksUsed
- Number of blocks in use
-
- <stem.>BytesPerBlock
- Number of bytes per block
-
- <stem.>DiskType
- Disk type:
-
- "NONE" - No disk_present
- "BAD0" - Unreadable disk
- "DOS0" - DOS disk
- "DOS1" - FFS disk
- "DOS2" - Inter DOS disk
- "DOS3" - Inter FFS disk
- "DOS4" - Fastdir DOS disk
- "DOS5" - Fastdir FFS disk
- "NDOS" - Not really DOS
- "KICK" - Kickstart disk
- "MSD0" - MsDos disk
-
- <stem.>InUse
- Boolean, zero if not in use.
-
- Read the include file <dos/dos.h> to find
- more information about these fields.
-
- RESULT
-
- success - boolean value (1 mean all done, ok).
-
- EXAMPLE
-
- IF Info("SYS:","ex.") THEN DO
- SAY "VolumeName " ex.VolumeName
- SAY "DateStamp " ex.DateStamp
- SAY "NumSoftErrors " ex.NumSoftErrors
- SAY "UnitNumber " ex.UnitNumber
- SAY "DiskState " ex.DiskState
- SAY "NumBlocks " ex.NumBlocks
- SAY "NumBlocksUsed " ex.NumBlocksUsed
- SAY "BytesPerBlock " ex.BytesPerBlock
- SAY "DiskType " ex.DiskType
- SAY "InUse " ex.InUse
- END
-
- NOTES
-
- SEE ALSO
-
- rexx_dos.library/ExAll(), dos.library/Info()
-
- rexx_dos.library/MatchPattern rexx_dos.library/MatchPattern
-
- NAME
-
- MatchPattern -- Pattern matching on a string.
-
- SYNOPSIS
-
- success = MatchPattern(pattern,string,options)
-
- FUNCTION
-
- The function checks for a pattern match with a string.
-
- INPUTS
-
- pattern - The patterns are fairly extensive, and approximate some
- of the ability of Unix/grep "regular expression"
- patterns. Here are the available tokens:
-
- ? Matches a single character.
- # Matches the following expression 0 or
- more times.
- (ab|cd) Matches any one of the items seperated by '|'.
- ~ Negates the following expression. It matches
- all strings that do not match the expression
- (aka ~(foo) matches all strings that are not
- exactly "foo").
- [abc] Character class: matches any of the characters
- in the class.
- [~bc] Character class: matches any of the characters
- not in the class.
- a-z Character range (only within character classes).
- % Matches 0 characters always.
- (useful in "(foo|bar|%)")
-
- "Expression" in the above table means either a single
- character (ex: "#?"), or an alternation (ex:
- "#(ab|cd|ef)"), or a character class (ex: "#[a-zA-Z]").
-
- string - String to match against given pattern.
-
- options - "Case/S"
-
- "Case" - Do a pattern matching case-sensitive.
- (default is case-insensitive)
-
- RESULT
-
- success - boolean value (1 mean all done, ok).
-
- EXAMPLE
-
- SAY MatchPattern("Con#?","L:Kingcon-handler")
- SAY MatchPattern("#?Con#?","L:Kingcon-handler")
-
- NOTES
-
- BUGS
-
- The MatchPattern() function doesn't work with string that
- contain any null ('00'x) character. See the dos.library
- documentation for more details.
-
- SEE ALSO
-
- dos.library/MatchPattern(), rexx_stem.library/StemSearch()
-
- rexx_dos.library/ReadArgs rexx_dos.library/ReadArgs
-
- NAME
-
- ReadArgs -- Parse a string based on a template.
-
- SYNOPSIS
-
- success = ReadArgs(string,template,options)
-
- FUNCTION
-
- This function let's take advantage of the well known ReadArgs()
- contained into the system dos.library. Read its autodocs to
- find more details about templates.
-
- INPUTS
-
- string - The argument string to be parsed.
-
- template - The template.
-
- options - "OutStem"
-
- "OutStem" - The output stem must be specified. It will
- receive all datas readed from the function
- for every matched file:
-
- <stem.>NOT_YET
-
- RESULT
-
- success - boolean value (1 mean all done, ok).
-
- EXAMPLE
-
- NOTES
-
- For those options, into the template string, prepended by
- an abbreviation (eg: "QUICK=Q/S"), making the output stem
- or writing the relative variable will be used only the first
- entry found, no matter which is the shortest.
-
- BUGS
-
- SEE ALSO
-
- dos.library/ReadArgs()
-
- rexx_dos.library/ReadBlock rexx_dos.library/ReadBlock
-
- NAME
-
- ReadBlock -- Returns the content of a given file.
-
- SYNOPSIS
-
- string = ReadBlock(file,options)
-
- FUNCTION
-
- The function reads the given file and returns its content.
- If the specified file is longer than 64k the result will be
- truncated to the maximum length of an ARexx variable.
-
- INPUTS
-
- file - The input file path.
-
- options - "Del=Delete/S"
-
- "Delete" - Delete the file after read.
-
- RESULT
-
- success - boolean value (1 mean all done, ok).
-
- EXAMPLE
-
- SAY "language =" ReadBlock("ENV:language")
-
- NOTES
-
- SEE ALSO
-
- rexx_stem.library/StemRead()
-
- rexx_dos.library/SetVar rexx_dos.library/SetVar
-
- NAME
-
- SetVar -- Sets the value of a local or global variable.
-
- SYNOPSIS
-
- success = SetVar(name,value,options)
-
- FUNCTION
-
- Sets the "value" of the local or global environment variable
- specified by "name".
-
- INPUTS
-
- name - The variable name.
-
- value - The value to assign to the variable. It might be
- a simple text string, but it also can be a binary
- block of data.
-
- options - "Loc=Local/S"
-
- "Local" - Sets a local variable to the current process.
- (default is to set a Global variable)
-
- RESULT
-
- success - boolean value (1 mean all done, ok).
-
- EXAMPLE
-
- CALL SetVar("language","italiano")
-
- value = "Ciao a tutti" || '00'x || "..."
- CALL SetVar("bin",value)
-
- NOTES
-
- Since ARexx spawns a new process of each script, even if
- started from Shell, option "Local" may not work as supposed.
-
- SEE ALSO
-
- dos.library/SetVar(), rexx_dos.library/GetVar()
-
- rexx_dos.library/SplitPath rexx_dos.library/SplitPath
-
- NAME
-
- SplitPath -- Split given path ==> dir/ file
-
- SYNOPSIS
-
- ret = SplitPath(path,options)
-
- FUNCTION
-
- It may be used as a replacement of FilePart() and PathPart().
- Take the given path and splits it into a file and directory part.
-
- INPUTS
-
- path - A valid path string.
-
- options - "OutStem,Path/S"
-
- "OutStem" - An output stem, if specified, will receive
- file and directory part of the given path:
-
- <stem.>DirPart
-
- <stem.>FilePart
-
- "Path" - The function returns the dir part
- of the given path.
- (default returns the file part)
-
- RESULT
-
- The function returns either the file part or the directory
- part of a given path. In case of errors an empty string
- will be returned.
-
- EXAMPLE
-
- dir = "DF0:foo/bar/moos-startup"
- SAY SplitPath(dir,"path.") /* ==> "DF0:foo/bar/" */
- SAY path.DirPart /* ==> "DF0:foo/bar/" */
- SAY path.FilePart /* ==> "moos-startup" */
-
- NOTES
-
- SEE ALSO
-
- rexx_dos.library/AddPart(), dos.library/FilePart()
-
- rexx_dos.library/WriteBlock rexx_dos.library/WriteBlock
-
- NAME
-
- WriteBlock -- Write a string into a file.
-
- SYNOPSIS
-
- success = WriteBlock(file,string,options)
-
- FUNCTION
-
- This function write a given string, or a specified variable
- content, into a file.
-
- INPUTS
-
- file - The output file path.
-
- string - The block to be write.
-
- options - "Append/S"
-
- "Append" - The function doesn't overwrite the output file
- if it exists and appends the given string to it.
-
- RESULT
-
- success - boolean value (1 mean all done, ok).
-
- EXAMPLE
-
- IF WriteBlock("ENV:date",DATE()) THEN
- SAY "Create an environment variable..."
- ELSE SAY "An error was occurred."
-
- NOTES
-
- BUGS
-
- SEE ALSO
-
- rexx_stem.library/StemWrite()
-
-
-