source: rxutilex/trunk/FUNCTIONS@ 4

Last change on this file since 4 was 4, checked in by Alex Taylor, 13 years ago

RXUTILEX: initial import

File size: 9.8 KB
Line 
1FUNCTIONS IN RXUTILEX.DLL
2
3(See file 'TODO' for functions which are under consideration to be added.)
4
5Sys2DropFuncs - Deregister all functions
6Sys2FormatTime - Format calender time (strftime wrapper)
7Sys2GetClipboardText - Retrieve the current clipboard text
8Sys2GetEpochTime - Get or convert calender time (seconds from epoch)
9Sys2KillProcess - Kill a process by name or PID
10Sys2LoadFuncs - Register all functions
11Sys2LocateDLL - Search for a loaded/loadable DLL
12Sys2PutClipboardText - Copy a text string to the clipboard
13Sys2QueryForegroundProcess - Get the PID of the current foreground process
14Sys2QueryPhysicalMemory - Get the amount of installed RAM
15Sys2QueryProcess - Get information about a process
16Sys2QueryProcessList - Get the list of running processes
17Sys2ReplaceModule - Unlock a DLL (DosReplaceModule wrapper)
18Sys2Version - Get the version of this library
19
20
21If an internal error occurs in any function, the variable SYS2ERR will contain
22an error message of the form "RC: description" where RC is a non-zero error
23code, and description indicates the internal function call that failed. If
24no error occurs, SYS2ERR will be "0".
25
26
27-------------------------------------------------------------------------
28Sys2DropFuncs
29
30Deregisters all Sys2* REXX functions.
31
32REXX ARGUMENTS: None
33REXX RETURN VALUE: ""
34
35
36-------------------------------------------------------------------------
37Sys2FormatTime
38
39Converts a number of seconds from the epoch (1970-01-01 0:00:00 UTC) into
40a formatted date and time string.
41
42REXX ARGUMENTS:
43 1. Number of seconds (a positive integer) to be converted. (REQUIRED)
44 This value cannot be greater than 2,147,483,647.
45 2. Format type, one of:
46 D = return in the form 'yyyy-mm-dd hh:mm:ss (w)' where w
47 represents the weekday (0-6 where 0=Sunday) (DEFAULT)
48 I = return in ISO8601 combined form 'yyyy-mm-ddThh:mm:ss[Z]'
49 L = return in the form 'day month year (weekday) time' where month
50 and weekday are language-dependent abbreviations
51 Note: With D and I, time is returned in 24-hour format; L may vary.
52 3. TZ conversion flag (indicates whether to convert to UTC from local
53 time), one of:
54 U = return UTC or unconverted time
55 L = assume the input is in Coordinated Universal Time, and convert
56 to local time using the current TZ (DEFAULT)
57
58REXX RETURN VALUE: The formatted time string, or "" on error.
59
60
61-------------------------------------------------------------------------
62Sys2GetClipboardText
63
64Retrieves a plain-text string from the clipboard if one is available.
65
66This function requires Presentation Manager to be active, although the
67REXX program itself need not be running in a PM process.
68
69REXX ARGUMENTS:
70 None.
71
72REXX RETURN VALUE: The retrieved clipboard string
73
74
75-------------------------------------------------------------------------
76Sys2GetEpochTime
77
78Converts formatted date and time into a number of seconds (UTC) from the
79epoch (defined as 1970-01-01 0:00:00). The input time is assumed to
80refer to the current timezone as defined in the TZ environment variable.
81
82If no parameters are specified, the current system time is used. If at
83least one parameter is specified, then any missing parameter is assumed
84to be its minimum possible value (1 for day or month, 0 for all others).
85
86The time is formatted according to the C runtime's locale support, as
87configured via the LANG and LC_* environment variables.
88
89REXX ARGUMENTS:
90 1. The year (1970-2037)
91 Years prior to 1970 or later than 2037 cannot be supported due to the
92 limitations in how the C library calculates epoch time. Specifying
93 1969 or earlier will generate a REXX error. Any date later than 2037
94 will return a value of 0 (and SYS2ERR will report an error in 'mktime').
95 NOTE: A 2-digit year can be specified, in which case the number will be
96 added to 1900 if it is 70 or higher, or to 2000 otherwise.
97 e.g. '20' ==> 2020
98 '75' ==> 1975
99 This is subject to the limitation noted above, such that values
100 from 38 to 69 will result in a return value of 0.
101 2. The month (1-12)
102 3. The day (1-31)
103 4. Hours (0-23)
104 5. Minutes (0-59)
105 6. Seconds (0-61)
106
107REXX RETURN VALUE: The number of seconds since the epoch, or 0 on error.
108
109
110-------------------------------------------------------------------------
111Sys2KillProcess
112
113Terminates the (first) running process with the specified executable name
114or process-ID.
115
116REXX ARGUMENTS:
117 1. The process identifier (program name or process ID) (REQUIRED)
118 2. Flag indicicating the identifier type:
119 'P': decimal process ID
120 'H': hexadecimal process ID
121 'N': executable program name (with or without extension) (DEFAULT)
122
123REXX RETURN VALUE: 1 on success or 0 on failure.
124
125
126-------------------------------------------------------------------------
127Sys2LoadFuncs
128
129Registers all Sys2* REXX functions (except this one, obviously).
130
131REXX ARGUMENTS: None
132REXX RETURN VALUE: ""
133
134
135-------------------------------------------------------------------------
136Sys2LocateDLL
137
138Searches for a DLL by name and returns its fully-qualified path.
139
140If a DLL with the given name is currently loaded, that instance of the
141DLL will be returned. Otherwise, standard DLL loading rules (according
142to the current LIBPATH and/or extended LIBPATH configuration) are used to
143search for a DLL whose module name matches the one specified.
144
145REXX ARGUMENTS:
146 1. The name of the DLL to search for. (REQUIRED)
147
148
149REXX RETURN VALUE:
150 The fully-qualified path of the DLL, if found; "" otherwise.
151
152
153-------------------------------------------------------------------------
154
155Sys2PutClipboardText
156
157Writes a string to the clipboard in plain-text format. Specifying either
158no value or an empty string in the first argument will simply clear the
159clipboard of CF_TEXT data.
160
161This function requires Presentation Manager to be active, although the
162REXX program itself need not be running in a PM process.
163
164REXX ARGUMENTS:
165 1. String to be written to the clipboard (DEFAULT: "")
166 2. Flag indicating whether other clipboard formats should be cleared:
167 Y = yes, call WinEmptyClipbrd() before writing text (DEFAULT)
168 N = no, leave (non-CF_TEXT) clipboard data untouched
169
170REXX RETURN VALUE: 1 on success, 0 on failure
171
172
173-------------------------------------------------------------------------
174Sys2QueryForegroundProcess
175
176Queries the PID of the current foreground process.
177
178REXX ARGUMENTS: None
179
180REXX RETURN VALUE:
181 Integer representing the process ID (in decimal), or 0 if an error
182 occurred.
183
184
185-------------------------------------------------------------------------
186Sys2QueryPhysicalMemory
187
188Queries the amount of physical memory (RAM) installed in the system.
189
190REXX ARGUMENTS: None
191
192REXX RETURN VALUE:
193 Integer representing the amount of installed memory, in KiB, or 0 if an
194 error occurred.
195
196
197-------------------------------------------------------------------------
198Sys2QueryProcess
199
200Queries information about the specified process.
201
202REXX ARGUMENTS:
203 1. The process identifier (program name or process ID) (REQUIRED)
204 2. Flag indicicating the identifier type:
205 'P': decimal process ID
206 'H': hexadecimal process ID
207 'N': executable program name (with or without extension) (DEFAULT)
208
209REXX RETURN VALUE:
210 A string of the format
211 pid parent-pid process-type priority cpu-time executable-name
212 "priority" is in hexadecimal notation, all other numbers are decimal.
213 "" is returned if the process was not found or if an internal error
214 occurred.
215
216
217-------------------------------------------------------------------------
218Sys2QueryProcessList
219
220Gets a list of running processes. The results will be returned in a stem
221variable, where stem.0 contains number of items, and each stem item is a
222string of the form:
223 pid parent-pid process-type priority cpu-time executable-name
224"priority" is in hexadecimal notation, all other numbers are decimal.
225
226Notes:
227 - "process-type" will be one of:
228 0 Full screen protect-mode session
229 1 Requires real mode. Dos emulation.
230 2 VIO windowable protect-mode session
231 3 Presentation Manager protect-mode session
232 4 Detached protect-mode process.
233 - If "priority" is 0 then the priority class could not be determined.
234 - If "executable-name" is "--" then the name could not be identified.
235
236REXX ARGUMENTS:
237 1. The name of the stem in which to return the results (REQUIRED)
238
239REXX RETURN VALUE: Number of processes found, or "" in case of error.
240
241
242-------------------------------------------------------------------------
243Sys2ReplaceModule
244
245Unlocks and optionally replaces an in-use (locked) DLL or EXE.
246
247REXX ARGUMENTS:
248 1. The filespec of the module to be replaced. (REQUIRED)
249 2. The filespec of the new module to replace it with. (DEFAULT: none)
250 3. The filespec of the backup file to be created. (DEFAULT: none)
251
252REXX RETURN VALUE:
253 1 on success, or 0 if an error occurred.
254
255
256-------------------------------------------------------------------------
257Sys2Version
258
259Returns the current library version.
260
261REXX ARGUMENTS: None
262REXX RETURN VALUE: Current version in the form "major.minor.refresh"
263
Note: See TracBrowser for help on using the repository browser.