home *** CD-ROM | disk | FTP | other *** search
-
-
- TABLE OF CONTENTS
-
- --background--
- --general--
- rexx_stem.library/StemCopy
- rexx_stem.library/StemInsert
- rexx_stem.library/StemRead
- rexx_stem.library/StemRemove
- rexx_stem.library/StemSearch
- rexx_stem.library/StemSort
- rexx_stem.library/StemWrite
-
-
- --background-- --background--
-
- $(C): (1996, Rocco Coluccelli, Bologna)
- $VER: rexx_stem.library 37.00 (30.01.97)
-
- rexx_stem.library
-
- This sub-library of the rexxMOOS.library let ARexx programmers
- perform very powerfull manipulation over stem and compound symbols.
-
- StemCopy()
- StemInsert()
- StemRead()
- StemRemove()
- StemSearch()
- StemSort()
- StemWrite()
-
- NOTES
-
- Is part of the MOOS package.
-
- TODO
-
- StemToString()
-
- BUGS
-
- --general-- --general--
-
- Stem & Compound symbols.
-
- Let's refresh our memory about stem and compound symbols as used into
- the ARexx language. Those entities are very usefull when we need to
- build a vector or a structure. Here is the general form to specify a
- compound symbol:
-
- stem.level_1.level_2.level_3 ...
-
- All functions of this library that accept one or more stem as inputs
- arguments let you specify them using the following convention:
-
- stem.levels_sx.#.levels_dx The "#" locate where will be placed
- numbers to get each stem's entries.
- "levels_sx" and "levels_dx" are one
- or more, dot separated, levels. This
- mean that we can work at every level
- of a stem.
-
- stem.levels_sx.count The total number of entries at this
- level from 0 to count-1. This entry
- must be present to let functions know
- how many values are in each stem at
- any level.
-
- Refer to the ARexx documentation to find more information about the
- use of stem and compound symbols.
-
- rexx_stem.library/StemCopy rexx_stem.library/StemCopy
-
- NAME
-
- StemCopy -- Copy a stem into another.
-
- SYNOPSIS
-
- success = StemCopy(options)
-
- FUNCTION
-
- StemCopy() take a source stem and copy its entries into a
- destination stem. By default the source stem will be appended
- at the end of the destination.
-
- INPUTS
-
- options - "FromStem/A,ToStem/A,FromPos/K/N,ToPos/K/N,Tot/K/N"
-
- "FromStem/A" - The source stem.
-
- "ToStem/A" - The destination stem, will receive entries
- from the source stem.
-
- "FromPos/K/N" - First entry, in the source stem, to be
- copied. (default is 0)
-
- "ToPos/K/N" - Position where start to copy all entries.
- The existing entries will be overwritten.
- (default is last entry, append source stem
- to destination)
-
- "Tot/K/N" - How many entries, from the source stem,
- need to copy into the destination.
- (default is all entries)
-
- RESULT
-
- success - boolean value (1 mean all done, ok).
-
- EXAMPLE
-
- from. = "From stem...."; from.count = 5; to.count = 12
- DO i = 0 FOR to.count
- to.i.post = "to stem" i
- END
- IF StemCopy('from. to.#.post ToPos 2') THEN
- DO i = 0 FOR to.count
- SAY "TO."i".POST ==" to.i.post
- END
-
- NOTES
-
- BUGS
-
- SEE ALSO
-
- rexx_stem.library/StemInsert()
-
- rexx_stem.library/StemInsert rexx_stem.library/StemInsert
-
- NAME
-
- StemInsert -- Insert a stem into another.
-
- SYNOPSIS
-
- success = StemInsert(from,options)
-
- FUNCTION
-
- StemInsert() take a source stem and insert its entries into a
- destination stem.
-
- INPUTS
-
- from - The source stem.
-
- options - "ToStem/A,FromPos/K/N,ToPos/K/N,Tot/K/N"
-
- "ToStem/A" - The destination stem, will receive entries
- from the source stem.
-
- "FromPos/K/N" - First entry, in the source stem, to be
- inserted. (default is 0)
-
- "ToPos/K/N" - Position where start to insert all entries.
- The existing entries will be shifted down
- before inserting the others from the source.
- (default is after the last entry of the
- destination stem)
-
- "Tot/K/N" - How many entries, from the source stem,
- need to insert into the destination.
- (default is all entries)
-
- RESULT
-
- success - boolean value (1 mean all done, ok).
-
- EXAMPLE
-
- in. = "empty"; in.count = 6
- DO i = 0 FOR in.count; SAY in.i; END
- IF StemInsert('in.','out. FromPos 3 Tot 4') THEN
- DO i = 0 FOR out.count
- SAY out.i
- END
-
- NOTES
-
- BUGS
-
- SEE ALSO
-
- rexx_stem.library/StemRead rexx_stem.library/StemRead
-
- NAME
-
- StemRead -- Read a file putting its lines into a stem.
-
- SYNOPSIS
-
- success = StemRead(filepath,options)
-
- FUNCTION
-
- The function read the given file line by line and put
- them into a specified stem.
-
- INPUTS
-
- filepath - Relative or absolute path. This argument must
- be provided and the file must exists.
-
- options - "OutStem/A,Del=Delete/S"
-
- "OutStem/A" - The stem to put readed lines in.
-
- "Delete/S" - Delete the file after read.
-
- RESULT
-
- success - boolean value (1 mean all done, ok).
-
- EXAMPLE
-
- IF StemRead("S:User-Startup","txt.") THEN
- DO n = 0 FOR txt.count
- SAY txt.n
- END
-
- NOTES
-
- The maximum length for a line must be less than 8192 characters.
-
- SEE ALSO
-
- rexx_stem.library/StemWrite()
-
- rexx_stem.library/StemRemove rexx_stem.library/StemRemove
-
- NAME
-
- StemRemove -- Remove a block of entries.
-
- SYNOPSIS
-
- success = StemRemove(options)
-
- FUNCTION
-
- This function take a stem and remove a block of entries.
- The stem will be repacked updating also the dimension (count).
-
- INPUTS
-
- options - "InStem/A,FromPos/K/N,ToPos/K/N,Tot/K/N"
-
- "InStem/A" - The stem to perform removing on.
-
- "FromPos/K/N" - The first entry to be removed.
- (default is 0)
-
- "ToPos/K/N" - The last entry to be removed. All other
- entries, from ToPos+1 to the last, will
- take place over the deleted ones.
- (default is last entry of the stem)
-
- "Tot/K/N" - Instead of using ToPos you can specify
- how many entries need to remove.
- (default is all entries)
-
- RESULT
-
- success - boolean value (1 mean all done, ok).
-
- EXAMPLE
-
- in. = "empty"; in.2 = "full"; in.4 = "full"; in.count = 10
- DO i = 0 FOR in.count; SAY in.i; END
- IF StemRemove('in. FromPos 3 Tot 5') THEN
- DO i = 0 FOR in.count
- SAY in.i
- END
-
- NOTES
-
- Using this function to remove ALL entries from a stem is
- a non-sense, use the instruction DROP instead.
-
- BUGS
-
- SEE ALSO
-
- rexx_stem.library/StemInsert()
-
- rexx_stem.library/StemSearch rexx_stem.library/StemSearch
-
- NAME
-
- StemSearch -- Search a pattern into the given stem.
-
- SYNOPSIS
-
- success = StemSearch(pattern,options)
-
- FUNCTION
-
- StemSearch() do a pattern matching over entries of a given stem.
- It will fill an output stem with all found entries.
-
- INPUTS
-
- pattern - The pattern to search for (standard AmigaDOS).
-
- options - "InStem/A,OutStem/A,Pos/K/N,Case/S"
-
- "InStem/A" - Stem where perform the pattern matching.
-
- "OutStem/A" - Output stem for all matched entries.
-
- "Pos/K/N" - Start searching from the entry at "Pos"...
- (default is the first entry)
-
- "Case/S" - Do search case sensitive.
- (default NoCase)
-
- RESULT
-
- success - boolean value (1 mean all done, ok).
-
- EXAMPLE
-
- in. = "empty"; in.2 = "String"; in.5 = "string"
- in.count = 10
- IF StemSearch("st#?","in. out.") THEN
- DO n = 0 FOR out.count; SAY out.n; END
-
- NOTES
-
- BUGS
-
- SEE ALSO
-
- dos.library/MatchPattern, dos.library/MatchPatternNoCase
-
- rexx_stem.library/StemSort rexx_stem.library/StemSort
-
- NAME
-
- StemSort -- Sort entries into the given stem.
-
- SYNOPSIS
-
- success = StemSort(options)
-
- FUNCTION
-
- StemSort() perform a sorting of entries found into a stem.
- It can fill an output stem with all sorted entries. The sort
- function is, by default, case insensitive.
-
- INPUTS
-
- options - "InStem/A,OutStem,Descend/S,NoDupes/S,Case/S"
-
- "InStem/A" - Stem to be sorted. All entries will be
- overwritten by the sorted ones.
-
- "OutStem" - Optionally you can give an output stem
- where store all sorted entries leaving
- the InStem untouched.
-
- "Descend/S" - Sort in alphabetical descend order (default
- is "Ascend").
-
- "NoDupes/S" - Remove duplicates entries.
-
- "Case/S" - Force sort to be case sensitive.
-
- RESULT
-
- success - boolean value (1 mean all done, ok).
-
- EXAMPLE
-
- in.count = 20
- DO n = 0 FOR in.count; in.n = ERRORTEXT(n); SAY in.n; END
- IF StemSort("in. out.") THEN
- DO n = 0 FOR out.count
- SAY out.n
- END
-
- NOTES
-
- Use the tqsort() function to sort case sensitive and a built-in
- Tqsort for sorting case insensitive.
-
- SEE ALSO
-
- rexx_stem.library/StemWrite rexx_stem.library/StemWrite
-
- NAME
-
- StemWrite -- Write the given stem into a file.
-
- SYNOPSIS
-
- success = StemWrite(filepath,options)
-
- FUNCTION
-
- The function write entries from a given stem to a file.
-
- INPUTS
-
- filepath - Relative or absolute path. This argument must
- be provided.
-
- options - "InStem/A,Append/S"
-
- "InStem/A" - The source stem to take entries from.
-
- "Append/S" - Don't overwrite the output file if exists.
-
- RESULT
-
- success - boolean value (1 mean all done, ok).
-
- EXAMPLE
-
- txt. = "Prova StemWrite()"; txt.count = 20
- IF StemWrite("T:prova","txt.") THEN
- SAY "All done..."
-
- NOTES
-
- SEE ALSO
-
- rexx_stem.library/StemRead()
-
-
-