home *** CD-ROM | disk | FTP | other *** search
- ArmBob v.1.02 Reference GCW 06/06/94
-
- ----------------- LOW LEVEL ---------------
-
- To access the operating system, the swi function is provided.
-
- swi(x,r) nil x is either the SWI integer or the SWI's name
- as a string. r is a vector of at least 8 integers.
- SWI x is called with register values given by the components
- r[0], r[1], ... r[7] and the function returns with the returned
- values of the registers in the components of r.
-
- Note that even though a SWI may pass no values in registers, it is
- necessary for the second argument of swi to be a vector with at least
- 8 components.
-
- Wimp tasks may be started with the function wimp_init.
-
- wimp_init(vn,name,mesg_list) integer vn is 100 times the version
- of RISC OS being used, name is
- the name of the wimp task, and mesg_list is a buffer,
- given as a string or its integer address, containing the
- messages, stored as words and terminated by 0, which the
- task wishes to receive. The function returns the task handle
- as an integer.
-
- Programs running as wimp tasks must use the function wimp_closedown
- before terminating.
-
- wimp_closedown() nil De-register the task with the task manager.
-
- Look at the example of !Harness to see how the library Bob:h.wimp
- is used. If the function event_process is used, a separate call to
- wimp_closedown is not needed. Instead, a 20-element vector of message
- handlers should be defined, that return FALSE if the program is to
- quit, and TRUE otherwise.
-
- To display an error message in a dialogue box use wimp_report.
-
- wimp_report(s) integer Display string s in a dialogue box and
- return 0 if no key or mouse button is
- clicked, 1 if the OK button is selected,
- and 2 if the CANCEL button is selected.
-
- To use a string as a buffer, say for a window or menu definition,
- a new syntactic form has been added.
-
- in <buffer> put { item1 ; item2 ; ..... }
-
- where <buffer> could be either a string or an integer address, and
- the items are either integers or strings.
-
- The following function is useful for putting null-terminated strings
- into buffers and padding out with nulls to the next word boundary:
-
- align_null(s)
- {
- local len;
- s += 0;
- len = sizeof(s);
- switch (len%4)
- {
- case 1:
- s += 0;
- case 2:
- s += 0;
- case 3:
- s += 0;
- break;
- }
- return s;
- }
-
- Sometimes one wishes to put into a buffer not a string but an indirect
- reference to a string. For this the function @ has been provided.
-
- @(s) integer Returns the address of the first (i.e 0-th) character
- in the string s.
-
- As far as swi is concerned, string components of a register-vector
- are automatically converted to their integer addresses.
-
- One may access the contents of an integer address or string using
- the "peek" functions $,£,`.
-
- $(x) string Returns the string delimited by a character with
- an ASCII code less than 32 stored at the address x.
-
- £(x) integer Returns as an integer the contents of the 4-byte
- word at the address x or in the string x.
-
- `(x) integer Returns as an integer the contents of the byte at
- the address x or in the string x.
-
- If s is a string `(s) is the same as s[0] and £(s) is just
-
- s[0] + s[1]<<8 + s[2]<<16 + s[3]<<24
-
- It is worth mentioning that strings' contents automatically start on
- word boundaries.
-
- To "poke" values into a string the functions $$, ££, `` are provided.
-
- $$(x,s) string Place string s at address x, and return s.
-
- ££(x,n) integer Place word n at address x, and return n.
-
- ``(x,c) integer Place byte c at address x, and return c.
-
- Example
- -------
-
- A function to read the command line:
-
- getenv()
- {
- local r;
- r = newvector(8);
- swi("OS_GetEnv",r);
- return($(r[0]));
- }
-
- See also Bob:h.hidden and Bob:h.chain, and the files in Bob:h.wimp.
-
- --------- END ----------