home *** CD-ROM | disk | FTP | other *** search
- ----------------------------------------------------------------------------------------------------
-
- RMH.LIBRARY
- version 1.5
-
- MINI MINI DOC
-
- ----------------------------------------------------------------------------------------------------
-
- WARNING
- THIS SOFTWARE AND INFORMATION ARE PROVIDED "AS IS".
- ALL USE IS AT YOUR OWN RISK, AND NO LIABILITY OR
- RESPONSIBILITY IS ASSUMED.
- NO WARRANTIES ARE MADE.
-
- ----------------------------------------------------------------------------------------------------
-
- INDEX
-
- 1. Introdution
- 2. Installation
- 3. System Requirements
- 4. Author
- 5. Distribution
- 6. Terms
- 7. Bugs
- 8. Functions in alphabetic order
-
- ----------------------------------------------------------------------------------------------------
-
- 1. Introdution
-
- The name of the library stands for RexxMusthave, so the library is a set
- of functions I think ARexx macros should have.
-
- All resources created are automagically freed at the exit of the macro
- if it is not done in the macro.
-
- ----------------------------------------------------------------------------------------------------
-
- 2. Installation
-
- No installation script is given.
-
- To install the library:
- - copy rmh.library.library to LIBS:
- - write in a shell: rx "call addlib('rmh.library',0,-30)"
-
- ----------------------------------------------------------------------------------------------------
-
- 3. System Requirements
-
- The library needs AmigaOS, version >=2.
-
- ----------------------------------------------------------------------------------------------------
-
- 4. Author
-
- The author is:
-
- Alfonso Ranieri
-
- His e-mail address is:
-
- alfier@iol.it
-
- You can find him at:
-
- - #amichat dalnet;
- - #amigaita ircnet;
- - #amyita ircnet.
-
- You can find last version of this library at
-
- http://users.iol.it/alfier/
-
- ----------------------------------------------------------------------------------------------------
-
- 5. Distribution
-
- rmh.library is FreeWare.
-
- You are free to detribute it as long as the original archive is kept intact.
- Commercial use or its inclusion in other software package is prohibited
- without prior consens from the Author.
-
- ----------------------------------------------------------------------------------------------------
-
- 6. Terms
-
- - stem or stemName: a valid ARexx variable name i.e. var, var.0, var.name, var;
-
- - DateStam: a stem set by macro or returned by the function, with
- the fields:
- - DAYS"
- - "MINUTE"
- - "TICK
- set;
-
- - types of arguments: the types used are:
- D any data --
- N numeric /N
- S symbol /S ARexx valid symbol
- V stemName /V ARexx valid symbol as S but with length<20
-
- ----------------------------------------------------------------------------------------------------
-
- 7. Bugs
-
- None knonw.
-
- ----------------------------------------------------------------------------------------------------
-
- 8. Functions in alphabetic order:
-
- --------------------------------
-
- ADDPART
- Usage: complete = ADDPART(path,file)
- <path>,<file>
-
- Adds a path to a file.
-
- Returns the complete path to file.
-
- --------------------------------
-
- ALLOCSIGNAL
- Usage: sigBit = ALLOCSIGNAL()
- ---
-
- Allocates an returns a signal bit.
- The mask to wait for is 2**sigBit.
-
- Returns -1 for failure
-
- --------------------------------
-
- AND
- Usage: res = AND(val1,val2,..)
- <val1/N>,<val2/N>,{val/N}
-
- And till to 15 integer.
-
- --------------------------------
-
- CHECKTIMER
- Usage: res = CHECKTIMER(timerid)
- <timerid/N>
-
- Check if a timer completed.
- If the timer was not started, the function returns 1, as the timer
- completed. See StartTimer().
-
- Returs an arexx boolean.
-
- --------------------------------
-
- COMPAREDATES
- Usage: res = COMPAREDATES(date1,date2)
- <date1/V>,<date2/V>
-
- Compares 2 dates set as DateStamp.
-
- Returns:
- -1 date1>date2
- 0 date1==date2
- 1 date1>date2
-
- --------------------------------
-
- CREATETIMER
- Usage: CREATETIMER()
-
- Creates a timer. See StartTimer().
-
- Returns the id of the timer.
-
- --------------------------------
-
- DELETEVAR
- Usage: DELETEVAR(name,[options])
- <name>,[options]
-
- Deletes the var name.
-
- If present, options is one or more of:
- - "VAR"
- - "ALIAS"
- - "IGNORE"
- - "GLOBAL"
- - "BINARY"
- - "NTNULL"
- - "SAVE"
- i.e. "VAR GLOBAL"
- The default is "VAR GLOBAL"
-
- --------------------------------
-
- EASYREQUEST
- Usage: res = EASYREQUEST(text,title,gadgetText,screenName,flags,idcmp)
- <text>,[title],[gadgetText],[screeName],[NOFALLBACK],[idcmp/N]
-
- Creates and shows and intuition easy requester.
-
- - text is the text of the requester
-
- - title is the title (default "Arexx Macro Request")
-
- - gadgetText is the string for gadgets text; each gadgetText must be
- separeted by the other with a | (i.e "a|b|c" creates 3 gadgets a b c)
-
- - screenName is the name of a pubblic screen where to open the requester
-
- - "FALLBACK", if present as the 5th argument makes the function to not
- open the requester on the default pubblic screen if the screenName
- dosn't exist, but to fail
-
- - idcmp is an integer value of IDCMP flags wich will stop the requesters
-
- The text and gadgetText can't contain % but followed by an another %.
- Gadget are counted from left to right and first is number 1, last 0.
-
- Returns:
-
- -20 the requester was not created
- -30 the window was not created (indicates no screen too)
- -1 idcmp received
- 0 last gadget pressed
- n>=0 gadget number n pressed
-
- --------------------------------
-
- EXPAND
- Usage: num = EXPAND(stem,pattern,[FILE|DIR])
- <stem/V>,<pattern>,[FILE|DIR]
-
- Reads entries which match pattern given.
- The entries are written in the fields .i the given stem and the
- entry type is written in .i.DIRENTRYTYPE , where i = 0...num-1.
-
- Normally every kind of entries are read, but if the 3nd argument is:
- - FILE only files are read
- - DIR only dir are read
-
- Returns the numbers of entries that match pattern.
-
- --------------------------------
-
- FAULT
- Usage: FAULT(code,name)
- <code/N>,<name>
-
- Builds and returns the string:
-
- <name>":" <dos error string of code>
-
- --------------------------------
-
- FILEPART
- Usage: FILEPART(path)
- <path>
-
- Returns the file part of a path.
-
- --------------------------------
-
- FORMATDATE
- Usage: FORMATDATE(date,fmt,locale)
- [date/V],[fmt],[locale]
-
- Returns a formatted date string.
-
- If date is present, it must be a stem set as a DateStamp and the date
- is read from it. If it is not present, the date is the current system
- date.
-
- If fmt is present, it must be a valid locale/FormatDate format string.
- If it is not present, it is the short date format of the locale.
-
- If locale is given, the functions tries to open the locale to format
- the date in that locale way. If it is not present, locale is the
- default locale of the system.
-
- --------------------------------
-
- FREESIGNAL
- Usage: call FREESIGNAL(signal)
- <signal/N>
-
- Free an allocated signal bit.
-
- --------------------------------
-
- FREETIMER
- Usage: call FREETIMER(timerid)
- <timerid/N>
-
- Free a timer allocated by CreateTimer().
- The timer id can't be used anymore, after a call to this function.
-
- --------------------------------
-
- GETFILEDATE
- Usage: res = GETFILEDATE(fileName,date)
- <fileName>,<date/V>
-
- Reads the date of a file and set date as a DateStamp struct.
-
- Returns:
- 0 the file was not found
- 1 success
-
- --------------------------------
-
- GETUNIQUEID
- Usage: res GETUNIQUEID()
-
- Each call to this function returns an unique integer.
-
- --------------------------------
-
- GETVAR
- Usage: GETVAR(name,options)
- <name>,[options]
-
- Gets the value of the var name.
-
- If present, options is one or more of:
- - "VAR"
- - "ALIAS"
- - "IGNORE"
- - "GLOBAL"
- - "BINARY"
- - "NTNULL"
- - "SAVE"
- i.e. "VAR GLOBAL"
- The default is "VAR".
-
- --------------------------------
-
- HELP
- Usage: HELP(funName)
- <funName>
-
- Returns the arguments types mask of the function funName.
-
- --------------------------------
-
- IOERR
- Usage: IOERR()
-
- Returns the current I/O error code.
-
- --------------------------------
-
- MATCHPATTERN
- Usage: res = MATCHPATTERN(pattern,string,[CASE])
- <pattern>,<string>,[CASE]
-
- Verifies if string match pattern.
-
- pattern must be the result of ParsePattern().
- If the 3rd argument CASE is given, the matching is case sensitive.
-
- --------------------------------
-
- OR
- Usage: OR(val1,val2,...)
- <val1/N>,<val2/N>,{val/N}
-
- Or till to 15 integers.
-
- --------------------------------
-
- PARSEDATE
- Usage: PARSEDATE(string,fmt,stem,locale)
- <string>,[fmt],[stem],[locale]
-
- Verify if string is a well formatted date according to fmt.
-
- If fmt is present, it must be a valid locale/ParseDate format string.
- If it is not present, it is the short date format of the locale.
-
- If stem is givin, sets it as a dateStamps.
-
- If locale is given, the functions tries to open the locale to parse
- the date in that locale way. If it is not present, locale is the
- default locale of the system.
-
- Returns an arexx boolean.
-
- --------------------------------
-
- PARSEPATTERN
- Usage: pattern = PARSEPATTERN(pattern,CASE)
- <pattern>,[CASE]
-
- Creates an returns a pattern to be use with MatchPattern().
- If the 2nd argument CASE is given, the parsing is case sensitive.
-
- --------------------------------
-
- PATHPART
- Usage: PATHPART(path)
- <path>
-
- Returns the path part of a path.
-
- --------------------------------
-
- PORTSIGNAL
- Usage: PORTSIGNAL(portName)
- <portName>
-
- Return the signal bit of a in-macro-created port.
-
- --------------------------------
-
- PRINTFAULT
- Usage: PRINTFAULT(code,msg)
- <code/N>,<msg>
-
- Prints to STDERR/STDOUT the same string fault() would return.
-
- --------------------------------
-
- PROGRAMNAME
- Usage: PROGRAMNAME(FULL)
- [FULL]
-
- Returns the "program name" of the macro.
-
- If FULL is given the complete path is returned.
- If FULL is not given just the macro name is returned.
-
- --------------------------------
-
- READARGS
- Usage: res = READARGS(<template>,[help],[stem/V],[args])
- <template>,[help],[stem/V],[args]
-
- Calls dos/ReadArgs().
-
- - template is the template of the arguments
-
- - help is the help string to prompt when a ? is given (default TEMPLATE itself)
-
- - var is the stem nme where to write the arguments (default "PARM")
-
- - args is the arguments line for an online arguments parsing, not from STDIN
-
- If STDERR is opend with (i.e. by open(STDERR,"*","W") ) all intermedie I/O
- is made with it.
-
- The function writes (lets supposed "PARM" is the stem name), counting
- them arguments from left to right:
-
- - i.value the value of the argument
-
- - i.flag arexx boolean indicating if the arguments was give
-
- - i.mult number of MULTI if /M givien for argument i
- i.value.j multi value j of arguments i (j = 0 ... i.mult)
-
- EXAMPLE
-
- /* */
-
- if ~ReadArgs("FILE/M/A,BUFFER=BUFF/N,QUICK/S") then do
- call PrintFault(IoErr(),ProgramName())
- exit
- end
-
- if parm.1.flag then say "BUFFER:" parm.1.value
- if parm.2.flag then say "QUICK"
-
- say "FILE(s):" parm.0.mult
- do i = 0 to parm.0.mult
-
- num = expand("F",parm.0.value.i)
- do j = 0 to num-1
- say f.j
- end
-
- end
-
-
- --------------------------------
-
- READTEXTCLIP
- Usage: res = READTEXTCLIP(var,clip/N)
- <var>,[clip/N]
-
- Reads in var the text content of the clipborad unit clip.
-
- Returns an arexx boolean.
-
- --------------------------------
-
- SETFILEDATE
- Usage: res = SETFILEDATE(fileName,date)
- <fileName>,<date/V>
-
- Sets the date of a file from date, a DateStamp set stem.
-
- Returns an arexx boolean.
-
- --------------------------------
-
- SETIOERR
- Usage: call SETIOERR(code)
- <code/N>
-
- Sets the current I/O error code.
-
- --------------------------------
-
- SETVAR
- Usage: res = SETVAR(name,value,options)
- <name>,<value>,[options]
-
- Sets the var name to the value value.
-
- If present, options is one or more of:
- - "VAR"
- - "ALIAS"
- - "IGNORE"
- - "GLOBAL"
- - "BINARY"
- - "NTNULL"
- - "SAVE"
- i.e. "VAR GLOBAL"
- The default is "VAR GLOBAL"
-
- --------------------------------
-
- SIGNAL
- Usage: call SIGNAL(task,signals)
- <task/N>,<signals/N>
-
- Signals the task with signal.
-
- --------------------------------
-
- STARTTIMER
- Usage: call STARTTIMER(timerid,secs,micros)
- <timerid/N>,[secs/N],[micros/N]
-
- Starts a timer to wait for secs seconds and micros microseconds.
- The timer is started async, so you can go on doing what you want
- after this call. To wait for the timer to complete just make a
- wait to Wait() with its signal bit obteined with timerSignal().
- If the timer was already started, it is stopped and re-started
- with new values.
-
- If the timer is not stopped or not freed, it is stopped and freed
- at the exit of the macro.
-
- Returns always 1.
-
- --------------------------------
-
- STOPTIMER
- Usage: call STOPTIMER(timerid)
- <timerid/N>
-
- Stop a timer.
- Returns always 1, even if the timer was not started.
-
- --------------------------------
-
- TIMERSIGNAL
- Usage: signal = TIMERSIGNAL(timerid)
- <timerid/N>
-
- Returns the signal.
- The mask to wait for is signal.
-
- --------------------------------
-
- WAIT
- Usage: WAIT(signals,secs,micros)
- <signals/N>,[secs/N],[micros/N]
-
- Waits for signals or sec seconds and micros microsends of timeout.
-
- Returns the signals received or 0 is timeout.
-
- --------------------------------
-
- WRITETEXTCLIP
- Usage: WRITETEXTCLIP(text,clip)
- <text>,[clip/N]
-
- Writes a text in the clipboard units clip.
-
- --------------------------------
-