S2Util is a REXX callable library of general functions.
The functions are:
- S2WordSplit: Parse a string and split it into words on blank spaces, but counting quoted strings as single words. Words are put into elements of a REXX array-like stem (STEM.0 has the number of words, and STEM.1-STEM.n have the words).
- S2ParseArgs: Parse an argument string. As well as parsing words and noticing quotes, arguments are preceded by a dash or slash, and consist of everything up to the next word with a dash or slash. The "value" of the argument is anything after a space, colon, or equals sign. Arguments, as well as being listed in the array, are hashed into the same stem as STEM.arg=argvalue (eg for the argument /FOO=BAR, STEM.FOO will have the value BAR). Note that if a nonzero numeric argument is passed (eg /1=2), then the "value" will be set (eg STEM.1=2), but if the argument 0 is passed (eg /0=asd), the "count" will override. STEM.0 will always hold the number of arguments.
- S2Version: New in v2.0, this function (which really should have been there from the start) returns a string with the version number, a blank space, and then author's contact details (name, email address, web site url).
- S2GetHAB: New in v2.0, this function allows a Presentation Manager program to find out the Anchor Block Handle (HAB) when given a Window Handle (HWND; despite the potentially misleading name, all PM objects have HWNDs). A HAB can be used with S2GetResStr and also clipboard functions, ShutdownSystem, and similar, although S2GetResStr is the only one available now.
- S2GetResStr: Get a string from a resource. Pass a HAB, a HMODULE (module handle; 0 to access own EXE), and a numeric ID (as specified in the .RC file), and the string is returned. Maximum length 255 characters - not sure how to overcome this.
- S2MakeClipboardViewer: Pass this function a HWND and it makes that object into a Clipboard Viewer. This means, simply, that OS/2 will notify that object every time the clipboard is changed.
Add new comment