Commit 5e08cc7c authored by Neil Turton's avatar Neil Turton
Browse files

Import from cleaned 360 CD

parents
| Copyright 1996 Acorn Computers Ltd
|
| Licensed under the Apache License, Version 2.0 (the "License");
| you may not use this file except in compliance with the License.
| You may obtain a copy of the License at
|
| http://www.apache.org/licenses/LICENSE-2.0
|
| Unless required by applicable law or agreed to in writing, software
| distributed under the License is distributed on an "AS IS" BASIS,
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
| See the License for the specific language governing permissions and
| limitations under the License.
|
Dir <Obey$Dir>
amu_machine -f MakeDecAOF decode
hdr/** gitlab-language=armasm linguist-language=armasm linguist-detectable=true
s/** gitlab-language=armasm linguist-language=armasm linguist-detectable=true
**/s/** gitlab-language=armasm linguist-language=armasm linguist-detectable=true
c/** gitlab-language=c linguist-language=c linguist-detectable=true
**/c/** gitlab-language=c linguist-language=c linguist-detectable=true
h/** gitlab-language=c linguist-language=c linguist-detectable=true
**/h/** gitlab-language=c linguist-language=c linguist-detectable=true
_swi & _swix
------------
These functions provide a generic method of calling RISC OS SWIs from C. They
are the preferred method of calling SWIs.
Two functions are provided _swi, for calling SWIs without setting the X bit
and _swix which sets the X bit before calling the SWI.
The definitions for these functions are
extern int _swi(int swi_no, unsigned int mask, ...);
extern int _swix(int swi_no, unsigned int mask, ...);
swi_no is the number of the SWI to be called. This should never have the X bit
set.
mask is a word containing an input and output register mask, a return register,
and a block parameter register.
The arrangement of mask is as follows:
Bits 0 - 9: Set if R(N) is passed to the SWI.
Bits 22 - 31: Set if R(31-N) is output from the SWI (ie bit 31
corresponds to R0, bit 22 corresponds to R9).
Bit 21: Set if the PC (including the flags) is to be output.
Bits 16 - 19: Register no. to be returned from a _swi call. This is only
applicable to _swi as _swix always returns either 0 or an error
pointer.
Bit 11: Set if a local block parameter is to be passed to the SWI
Bits 12 - 15: Register number for local block parameter if bit 11 set.
If a register is specified as a return register (bits 16-19) it must not also
be specified as an output register in the output register mask (bits 22-31).
If a register is specified as a local block parameter register it must not also
be specified as an input register in the input register mask (bits 0-9).
If the PC is specified as a return register (ie bits 16-19 = 15) or as an
output registers (bit 21 = 1) the value returned will contain the flags in bits
28 to 31 (28 = V, 29 = C, 30 = Z, 31 = N).
The remainder of the variadic arguments are as follows (in order):
The word value of each input register in order from 0 to 9 as specified by bits
0 to 9 of the mask.
The address of a word to be written for each output register in order from
0 to 9 as specified by bits 31 downto 22 of the mask.
The address of a word to be written with the PC value on exit from the SWI if
bit 21 of the register mask is set.
If bit 11 is set the remainder of the arguments are placed in order in a
parameter block and the address of the parameter block is passed to the SWI in
the register specified by bits 12-15.
The functions are declared in the header swis.h along with some macros for
constructing masks and a complete list of system SWI definitions.
The macros are as follows:
_IN(n) - Specifies that R(n) is used on input
_OUT(n) - Specifies that R(n) is output
_BLOCK(n) - Specifies that R(n) is a block parameter
_RETURN(n) - Specifies that R(n) is returned from _swi.
The values of the macros should be ORed together to produce the value for the
mask.
The following constants are defined
_FLAGS - the register containing the flags (currently 15)
_C - mask for the C bit in _FLAGS
_Z - mask for the Z bit in _FLAGS
_N - mask for the N bit in _FLAGS
Please use these constants as they may change on ARM 600.
Example calls:
_swi(OS_NewLine, 0); /* Must specify 0 register mask */
_swi(OS_Write0, _IN(0), "Hello, World");
task_handle = _swi(Wimp_Initialise, _IN(0)|_IN(1)|_IN(2)|_RETURN(1),
300, *(int *)"TASK", "Test");
e = _swix(Wimp_LoadTemplate, _IN(1)|_IN(2)|_IN(3)|_IN(4)|_IN(5)|_IN(6)|_OUT(2)|_OUT(6),
template_buffer, workspace, workspace_end, -1, "MyWind", next,
&workspace_end, &next);
e = _swix(Wimp_SetExtent, _IN(0)|_BLOCK(1), w, minx, miny, maxx, maxy);
Control Files
=============
Author: William Stoye
History:
0.01
0.02
0.03 - 19-June-89 - remarks about help, and icons.
0.04 - 04-July-89 - ctl_make becomes ctl_init()
0.05 - 11-July-89 - more updates
0.06 - 12-July-89 - more updates
02-Jan-90 - I realise now that there are various shortcomings,
this thing has lain fallow for some time.
Key-bindings must be specific to specific contexts,
as different windows might have different ones.
Interactive help on menu entries (perhaps via Messages
file) should be supported. Should better use of
DecodeArgs be made? None of these issues have yet been
investigated.
0.10 - 31-Jan-90 RMokady - Major changes to syntax !
* actions use OS_ReadArgs.
* Nested action blocks.
- Added interactive help support.
- Changed key bindings.
0.11 - 08-Feb-90 RMokady - Some more changes to syntax.
* added external menus.
* added colourmenu menu.
* added action on non leaf entries.
* added noreopen option for dbox.
* added submenu -1 support.
- added section about built in actions.
- added onclick section.
To do:
------
Escape sequences in quoted strings.
Help actions.
Better key names.
The 'ctl' module is a set of library facilities, written in C, allowing a
program to put a great deal of user event decoding into a resource file.
This file controls the mapping of menu, dialogue box and key events into
textually named actions, which are then executed by the program. It makes
programs easier to construct, and means that the result is customisable (to
some extent) by the user.
This is always called Control, and is a resource file within an application
directory.
File Syntax
-----------
# starts a comment line. Blank lines are ignored.
Each line is split into symbols, separated by spaces.
A symbol is any character sequence in matching quote marks, OR any
alphanumeric char sequence (underscore is also allowed, and the first
character may not be a number).
Escape sequences within quoted symbols are currently not supported.
Examples: hello
delete_file
"Hello there"
Symbol comparison is case-sensitive. Conventionally all keywords within a
Control file are entirely in lower case.
In the ensuring descriptions, items in angle brackets (unless otherwise
stated) are all symbols.
Actions and Action sequences
----------------------------
An action is a symbol.
Anything after the action on the same line is treated as arguments to the
action, arguments can be continued on the next line if the NL is immediately
preceded by \, otherwise a NL character is treated as space.
The symbol is the name of an operation that the application supports,
the actual set of operations available is defined by the application.
An action block is a sequence of one or more actions grouped inside
matching '{' , '}'. Action blocks can appear anywhere a single action can
appear. Action blocks can be nested. The closing '}' should be on a separate
line, otherwise it will be taken to be part of the argument list for the
preceding action.
so an action block should look something like:
... {
action1 args
action2 args
action3 args
} ...
You can have other symbols on the line following the '}' as it is not
an action.
Actions return an integer return code which is then passed on to the next
action executed.
Built in actions.
-----------------
The following built-in actions are always available:
error <error message> -- Produce the specified error message,
in the standard Wimp error message
window.
oscli .... -- The argument is passed to the OS_CLI.
OR * ...
showdbox <dbox name> -- Cancel the current menu and show
this dialogue box as a menu. (I.E. clicks
outside it close it).
quit -- Quit the application (I.E. calls exit(0)).
process -- See hot keys section below.
if <expr> -- Tests the return code returned from the last
action, if it is equal to <expr> the following
action or action block is executed, if not
the action or action block is skipped.
else -- Can only come after an if action, if the if
test failed the action or action block following
this action will be executed, if not it will be
skipped.
<Number> -- A number on its own simply sets the return code
to its value.
For example:
5 an_action
will pass a return code of 5 into an_action.
A control object header
-----------------------
Syntax: ctl <logical control object name>
This starts entries in a named control object.
A menu header
-------------
Syntax: menu <menu name> <menu title> <menu body>
OR menu <menu name> <menu title> colourmenu
OR menu <menu name> external
Used to start the declaration of a menu.
The first form defines a simple menu:
<menu title> is the text used for the menu title, if it is a valid
message token from the Messages file, the message text is used,
otherwise the actual text is used.
<menu body> is the menu body in the syntax used for menu_new, again this is
first matched against message tokens in the Messages file.
Note:
The menu body text should not include the ! and > symbols,
as submenus, and greying of menu entries is handled by the
ctl module (see below).
The second form is like the first form, but the menu body is a colour
selection menu (like the one used by edit to set the text colours).
The third form defines a menu who's title and body are specified by the
application at run time. Range checking on entry and submenu numbers is only
done when the application attaches the wimp menu structure at run time.
A Menu help token /action
--------------------------
Syntax: help token <token>
OR help action <action> (or action block) <-- NOT YET IMPLEMENTED
The first form gives a token for the interactive help messages to be used
with this menu the entry number (starting with 1) will be appended to the
token before it is searched for in the Messages file.
The second form gives the action sequence to be performed when help is
requested, the result code passed to the first (or only) action is the menu
entry number.
A menu open action
------------------
Syntax: onopen <action> (or action block)
This describes the actions to be performed when the menu is opened.
A menu reopen action
--------------------
Syntax: onreopen <action> (or action block)
This describes the actions to be performed when the menu is reopened,
as a result of the user using the ADJUST button.
A menu entry
------------
Syntax: entry <entry number> action (or action block)
This describes the actions to be performed when the user clicks
on the entry.
Entry numbers are checked against the number of entries in the menu,
and errors are generated if you try to specify an out of range entry number.
Entries on the menu which don't have actions defined for them, are greyed
out (unless they have submenus attached to them, see below).
An entry number of -1 means 'default' , if actions are specified for entry
-1 , entries with no actions will not be greyed out, but the actions
specified for entry -1 will be used for them.
The return code passed to the first action is the entry number on which
the user clicked.
A submenu
----------
Syntax: submenu <entry number> menu <submenu name>
OR submenu <entry number> dbox <dbox name>
OR submenu <entry number> warning action (or action block)
OR submenu <entry number> menu <submenu name> action (or action block)
OR submenu <entry number> dbox <dbox name> action (or action block)
The first form indicates a non-leaf menu entry. The submenu name must refer
to a previously defined menu, and matches the menu name given in the menu
header.
The second form indicates a non-leaf menu leading to a dbox. The dbox name
must refer to a previously defined dbox, and matches the dbox name given in
the dbox header.
The third form indicates a non-leaf menu entry which leads to some actions
this is different from entry n action ... because a right arrow will be
displayed in this position on the parent menu.
The fourth form is like the first form but allows you to specify the actions
to be performed if the user clicks on the menu entry leading to the submenu.
The fifth form is like the second form but allows you to specify the actions
to be performed if the user clicks on the menu entry leading to the dbox.
You can not have both
entry n action ...
and submenu n ...
for the same menu.
If you use -1 as the entry number, all entries without specific actions / or
submenus will lead to the submenu / dbox specified.
The end of a menu
-----------------
Syntax: endmenu
This should appear at the end of a menu description. Menu descriptions
cannot be nested.
A dialogue box header
---------------------
Syntax: dbox <dbox name>
Used to start the declaration of a dbox.
A dialogue box template name.
-----------------------------
Syntax template <template name>
The correspondingly named template
(typically in the resource file Templates) will be used to describe the
visual appearance of the dialogue box. The template directive must appear
before any icon actions in the dbox description.
A dialogue box help token /action
---------------------------------
Syntax: help token <token>
OR help action <action> (or action block) <-- NOT YET IMPLEMENTED
The first form gives a token for the interactive help messages to be used
with this dbox the icon number (starting with 0) will be appended to the
token before it is searched for in the Messages file. Unless the pointer is
not over an icon in which case the unmodified token will be used.
The second form gives the action sequence to be performed when help
is requested, the result code passed to the first (or only) action
is the icon number (or -1 if not over an icon).
A dialogue box open action
--------------------------
Syntax: onopen <action sequence>
This describes the actions to be obeyed every time a dialogue box is opened
(and just before it is first displayed).
A dialogue box reopen action
----------------------------
Syntax: onreopen <action sequence>
This describes the actions to be obeyed every time a dialogue box is
reopened (as a result of the user clicking ADJUST on an icon).
Dialogue boxes with noreopen.
-----------------------------
Syntax: noreopen
This prevents the dbox from being reopened by a right click.
If the user right clicks in the dbox the menu tree from which the dbox is
hanging will remain open, but the dbox will be closed.
You can not have both onreopen and noreopen in the same dbox description.
A dialogue box close action
---------------------------
Syntax: onclose <action sequence>
This describes the actions to be obeyed every time a dialogue box is closed.
A dialogue box icon action
--------------------------
Syntax: icon <icon number> <action sequence>
This describes the action to be taken when a hit occurs on the specified
icon.
Icons which don't have an action defined for them will be greyed out, unless
their button type is 'Never'.
An icon number of -1 means 'Default', if actions are specified for icon -1,
icons without actions will not be greyed out, but the actions specified for
icon -1 will be used for them.
The return code passed to the first action is the icon number.
The end of a dbox
-----------------
Syntax: enddbox
This should appear at the end of a dbox description. Dialogue box
descriptions cannot be nested.
Keystrokes
----------
Syntax: onkey keycode <action> (or action block)
OR: onkey [S][C] <keyname> <action> (or action block)
OR: onkey <Default> <action> (or action block)
with the first form the keycode (as returned by the W)mp is given)
with the second form, the key name is given, key names are:
For any normal key the symbol on the key (i.e. a for unshifted a or A for
shift+a). For special keys <keyname> (i.e. <f5> or <Print> with the angle
brackets as part of the name). The key name can be preceded by C to specify
Control+key or by S to specify Shift+key. S and C can be combined, so SC<f1>
is Shift+Control+<f1>.
Example:
onkey Sa action
onkey A action
onkey 65 action
are all equivalent.
Note: To specify Uppercase s or Uppercase c use Ss & Sc as S or C will
result in a syntax error. to specify # use S3 as # will begin a comment.
The key name <Default> is used to mean any other key.
The result code passed to the first action on the list is the key code.
The action process passes the key to the wimp, so
onkey <Default> process
will result in all undefined key presses being passed to the wimp.
The onclick action.
-------------------
Syntax: onclick action (or action block)
This specifies the actions to be executed when the user clicks on an icon in
the window to which the ctl is attached. The main use of this is for ctls
attached to the iconbar.
The return code passed to the first action on executed is the mouse button
state as returned from the wimp in the wimp_EBUT event.
The end of a 'ctl'
------------------
Syntax: endctl
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
#
# Objects for RISCOSLIB:o.risc_oslib
#
DEC_OBJS =\
o_rl_dec.akbd\
o_rl_dec.alarm\
o_rl_dec.baricon\
o_rl_dec.bastxt\
o_rl_dec.bbc\
o_rl_dec.colourmenu\
o_rl_dec.colourtran\
o_rl_dec.coords\
o_rl_dec.ctl\
o_rl_dec.dbox\
o_rl_dec.dboxfile\
o_rl_dec.dboxquery\
o_rl_dec.dboxtcol\
o_rl_dec.dragasprit\
o_rl_dec.drawcheck\
o_rl_dec.drawfdiag\
o_rl_dec.drawfiles\
o_rl_dec.drawfobj\
o_rl_dec.drawmod\
o_rl_dec.drawtextc\
o_rl_dec.event\
o_rl_dec.fileicon\
o_rl_dec.flex\
o_rl_dec.font\
o_rl_dec.heap\
o_rl_dec.help\
o_rl_dec.magnify\
o_rl_dec.menu\
o_rl_dec.msgs\
o_rl_dec.os\
o_rl_dec.pointer\
o_rl_dec.poll\
o_rl_dec.print\
o_rl_dec.res\
o_rl_dec.resspr\
o_rl_dec.saveas\
o_rl_dec.sprite\
o_rl_dec.swi\
o_rl_dec.template\
o_rl_dec.trace\
o_rl_dec.txt\
o_rl_dec.txt1\
o_rl_dec.txt3\
o_rl_dec.txtar\
o_rl_dec.txtedit\
o_rl_dec.txtfile\
o_rl_dec.txtfind\
o_rl_dec.txtmisc\
o_rl_dec.txtopt\
o_rl_dec.txtoptmenu\
o_rl_dec.txtregexp\
o_rl_dec.txtscrap\
o_rl_dec.txtundo\
o_rl_dec.txtwin\
o_rl_dec.visdelay\
o_rl_dec.werr\
o_rl_dec.wimp\
o_rl_dec.wimpt\
o_rl_dec.win\
o_rl_dec.xferrecv\
o_rl_dec.xfersend\
rm_o_d.alloc\
rm_o_d.armsys\
rm_o_d.bsearch_a\
rm_o_d.cl_modbody\
rm_o_d.cl_rmhdr\
rm_o_d.cl_spare\
rm_o_d.ctype\
rm_o_d.error\
rm_o_d.fpprintf\
rm_o_d.k_modbody\
rm_o_d.locale\
rm_o_d.math\
rm_o_d.memcpy\
rm_o_d.printf\
rm_o_d.scanf\
rm_o_d.signal\
rm_o_d.sort\
rm_o_d.stdio\
rm_o_d.stdlib\
rm_o_d.string\
rm_o_d.swiv\
rm_o_d.time\
rm_o_rl_d.akbd\
rm_o_rl_d.alarm\
rm_o_rl_d.baricon\
rm_o_rl_d.bastxt\
rm_o_rl_d.bbc\
rm_o_rl_d.colourmenu\
rm_o_rl_d.colourtran\
rm_o_rl_d.dbox\
rm_o_rl_d.dboxfile\
rm_o_rl_d.dboxquery\
rm_o_rl_d.dboxtcol\
rm_o_rl_d.dragasprit\
rm_o_rl_d.drawmod\
rm_o_rl_d.event\
rm_o_rl_d.fileicon\
rm_o_rl_d.flex\
rm_o_rl_d.font\
rm_o_rl_d.heap\
rm_o_rl_d.help\
rm_o_rl_d.initmodule\
rm_o_rl_d.magnify\
rm_o_rl_d.menu\
rm_o_rl_d.msgs\
rm_o_rl_d.os\
rm_o_rl_d.pointer\
rm_o_rl_d.poll\
rm_o_rl_d.print\
rm_o_rl_d.res\
rm_o_rl_d.resspr\
rm_o_rl_d.rl_modbody\
rm_o_rl_d.rl_spare\
rm_o_rl_d.saveas\
rm_o_rl_d.sprite\
rm_o_rl_d.swi\
rm_o_rl_d.template\
rm_o_rl_d.txt\
rm_o_rl_d.txt1\
rm_o_rl_d.txt3\
rm_o_rl_d.txtar\
rm_o_rl_d.txtedit\
rm_o_rl_d.txtfile\
rm_o_rl_d.txtfind\
rm_o_rl_d.txtmisc\
rm_o_rl_d.txtopt\
rm_o_rl_d.txtoptmenu\
rm_o_rl_d.txtregexp\
rm_o_rl_d.txtscrap\
rm_o_rl_d.txtundo\
rm_o_rl_d.txtwin\
rm_o_rl_d.visdelay\
rm_o_rl_d.werr\
rm_o_rl_d.wimp\
rm_o_rl_d.wimpt\
rm_o_rl_d.win\
rm_o_rl_d.xferrecv\
rm_o_rl_d.xfersend
.SUFFIXES: .o_rl .o_rl_dec .rm_o_rl .rm_o_rl_d .rm_o .rm_o_d
.o_rl.o_rl_dec:; decaof $< -s -t -a -g -d -r -c > $@
.rm_o.rm_o_d:; decaof $< -s -t -a -g -d -r -c > $@
.rm_o_rl.rm_o_rl_d:; decaof $< -s -t -a -g -d -r -c > $@
decode: ${DEC_OBJS}
@echo decoding done
This diff is collapsed.
| Copyright 1996 Acorn Computers Ltd
|
| Licensed under the Apache License, Version 2.0 (the "License");
| you may not use this file except in compliance with the License.
| You may obtain a copy of the License at
|
| http://www.apache.org/licenses/LICENSE-2.0
|
| Unless required by applicable law or agreed to in writing, software
| distributed under the License is distributed on an "AS IS" BASIS,
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
| See the License for the specific language governing permissions and
| limitations under the License.
|
Dir <Obey$Dir>
echo amu_machine clean_all
amu_machine clean_all
echo MkClean: all done
\ No newline at end of file
| Copyright 1996 Acorn Computers Ltd
|
| Licensed under the Apache License, Version 2.0 (the "License");
| you may not use this file except in compliance with the License.
| You may obtain a copy of the License at
|
| http://www.apache.org/licenses/LICENSE-2.0
|
| Unless required by applicable law or agreed to in writing, software
| distributed under the License is distributed on an "AS IS" BASIS,
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
| See the License for the specific language governing permissions and
| limitations under the License.
|
Dir <Obey$Dir>
wimpslot -min 1000k
echo amu_machine export
echo Do you really want to do this!!
echo its ok ... -n is set
amu_machine export -n
| Copyright 1996 Acorn Computers Ltd
|
| Licensed under the Apache License, Version 2.0 (the "License");
| you may not use this file except in compliance with the License.
| You may obtain a copy of the License at
|
| http://www.apache.org/licenses/LICENSE-2.0
|
| Unless required by applicable law or agreed to in writing, software
| distributed under the License is distributed on an "AS IS" BASIS,
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
| See the License for the specific language governing permissions and
| limitations under the License.
|
Dir <Obey$Dir>
amu_machine INSTDIR=<Install$Dir> install_rom
| Copyright 1996 Acorn Computers Ltd
|
| Licensed under the Apache License, Version 2.0 (the "License");
| you may not use this file except in compliance with the License.
| You may obtain a copy of the License at
|
| http://www.apache.org/licenses/LICENSE-2.0
|
| Unless required by applicable law or agreed to in writing, software
| distributed under the License is distributed on an "AS IS" BASIS,
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
| See the License for the specific language governing permissions and
| limitations under the License.
|
Dir <Obey$Dir>
wimpslot -min 1000k
echo amu_machine lib.stubs
|amu_machine lib.stubs
echo amu_machine lib.risc_oslib
|amu_machine lib.risc_oslib
echo amu_machine lib.clib
amu_machine lib.clib
echo MkLibs: all done
| Copyright 1996 Acorn Computers Ltd
|
| Licensed under the Apache License, Version 2.0 (the "License");
| you may not use this file except in compliance with the License.
| You may obtain a copy of the License at
|
| http://www.apache.org/licenses/LICENSE-2.0
|
| Unless required by applicable law or agreed to in writing, software
| distributed under the License is distributed on an "AS IS" BASIS,
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
| See the License for the specific language governing permissions and
| limitations under the License.
|
Dir <Obey$Dir>
wimpslot -min 1000k
echo amu_machine rom
amu_machine rom
*
!.gitignore
/* Copyright 1996 Acorn Computers Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* > C.Arthur */
/* Copyright (C) Acorn Computers Ltd., 1988 */
#include "arthur.h"
#include <stdarg.h>
/*
** Things in the Arthur C library.
**
** See also S.ArthurAsm for the OS bits
*/
int art_osbyte1(int, int);
art_error *art_osbyte(art_reg_set *regs)
{
return art_swix(OS_Byte, regs);
}
int art_osbyte1(int num, int arg)
{
art_reg_set a;
a.r[0] = num;
a.r[1] = arg & 0xff;
a.r[2] = arg >> 8;
arg = (int)art_osbyte(&a);
return (a.r[1] & 0xff) | (a.r[2] << 8);
}
art_error *art_osword(int action, void *data)
{
art_reg_set a;
a.r[0] = action;
a.r[1] = (int)data;
return art_swix(OS_Word, &a);
}
art_error *art_osgbpb(art_osgbpb_block * data)
{
return art_swix(OS_GBPB, (art_reg_set *)data);
}
art_error *art_osfile(art_osfile_block *data)
{
return art_swix(OS_File, (art_reg_set *)data);
}
art_error *art_osargs(art_reg_set *regs)
{
return art_swix(OS_Args, regs);
}
art_error *art_osfind(art_reg_set *regs)
{
return art_swix(OS_Find, regs);
}
int art_adval(int x)
{
return art_osbyte1(128, x);
}
void art_clg()
{ art_vdu(16);
}
void art_cls()
{ art_vdu(12);
}
void art_colour(int c)
{ art_vdu(17);
art_vdu(c);
}
/* note: cursor ends up on circle */
void art_circle(int x,int y,int r)
{ art_move(x,y);
art_plot(0x95,x+r,y);
}
void art_circlefill(int x,int y,int r)
{ art_move(x,y);
art_plot(0x9D,x+r,y);
}
void art_cursor(int c)
{
art_vduq(23,1,c,0,0,0,0,0,0,0);
}
void art_draw(int x,int y)
{ art_vdu(25);art_vdu(5);
art_vduw(x);art_vduw(y);
}
void art_drawby(int x,int y)
{ art_vdu(25);art_vdu(1);
art_vduw(x);art_vduw(y);
}
void art_fill(int x,int y)
{
art_plot(0x85,x,y);
}
void art_gcol(int a,int b)
{ art_vdu(18);art_vdu(a);art_vdu(b);
}
void art_gwindow(int a,int b,int c,int d)
{ art_vdu(24);art_vduw(a);art_vduw(b);art_vduw(c);art_vduw(d);
}
int art_inkey(int n)
{
n=art_osbyte1(129,n);
if ((n & 0xFF00) == 0xFF00) return -1;
return n;
}
void art_mode(int n)
{ art_vdu(22);
art_vdu(n);
}
/*
art_mouseX();
art_mouseY();
art_mouseB();
*/
void art_move(int x,int y)
{ art_vdu(25);art_vdu(4);
art_vduw(x);art_vduw(y);
}
void art_moveby(int x,int y)
{ art_vdu(25);art_vdu(0);
art_vduw(x);art_vduw(y);
}
/* mandel() ? */
void art_origin(int x,int y)
{ art_vdu(29);art_vduw(x);art_vduw(y);
}
void art_palette(int l,int p,int r,int g,int b)
{ art_vdu(19);art_vdu(l);art_vdu(p);art_vdu(r);art_vdu(g);art_vdu(b);
}
void art_plot(int n,int x,int y)
{ art_vdu(25);art_vdu(n);
art_vduw(x);art_vduw(y);
}
int art_point(int x,int y)
{
short block[3];
block[0]=x;
block[1]=y;
block[2]=0; /* to zero high byte */
x = (int)art_osword(9,block);
return block[2];
}
int art_pos()
{ return art_osbyte1(134,0) & 0xFF;
}
void art_rectangle(int x,int y,int l,int h)
{
art_move(x,y);
art_drawby(0,h);
art_drawby(l,0);
art_drawby(0,-h);
art_drawby(-l,0);
}
void art_rectanglefill(int x,int y,int l,int h)
{
art_move(x,y);
art_plot(0x61,l,h);
}
unsigned art_rnd(unsigned n)
{
extern unsigned rand(void);
return rand()%n+1;
}
void art_stringprint(char *s)
{
while (*s) art_vdu(*s++);
}
void art_tab(int x,int y) { art_vdu(31);art_vdu(x);art_vdu(y); }
void art_tint(int type, int mask)
{
art_vdu(23);art_vdu(17);
art_vdu(type & 3);
art_vdu((mask << 6) & 0x0c0);
art_vduw(0);art_vduw(0);art_vduw(0);
}
/*
** array of length of sequence for vdu codes
** it is assumed that the correct number of arguments has been supplied
*/
static char Qlen[32] =
{ 1, /* VDU 0 */
2, /* next character to printer only */
1, /* printer on */
1, /* printer off */
1, /* print at text cursor */
1, /* print at graphics cursor */
1, /* enable VDU driver */
1, /* beep */
1, /* backspace */
1, /* forward space (horizontal tab) */
1, /* line feed */
1, /* up a line */
1, /* clear (text) screen */
1, /* carriage return */
1, /* page mode on */
1, /* page mode off */
1, /* clear graphics window */
2, /* define text colour */
3, /* define graphics colour */
6, /* define logical colour */
1, /* restore default palette */
1, /* disable VDU drivers */
2, /* Select screen mode */
10, /* VDU 23,.. */
9, /* set graphics window */
6, /* PLOT ... */
1, /* restore default windows */
1, /* ESCAPE char - no effect */
5, /* define text window */
5, /* define graphics origin */
1, /* home cursor */
3 /* tab cursor */
/* and all the rest are 1 */
};
/*
** send the appropiate number of characters to art_vdu()
** it is assumed that the correct number of arguments has been supplied
*/
void art_vduq(int c,...)
{ va_list ap;
int n;
art_vdu(c);
if (c>=' ') return;
va_start(ap,c);
n=Qlen[c];
while(--n)
{ art_vdu(va_arg(ap,int));
}
va_end(ap);
}
int art_vpos()
{
return art_osbyte1(134,0) >> 8;
}
/******************************************************************************
Now for the new sound functions
******************************************************************************/
void art_sound(chan, amp, pitch, dur, futime)
int chan, amp, pitch, dur, futime;
{
art_reg_set a;
a.r[2] = (chan &0x0000ffff) | (amp << 16);
a.r[3] = (pitch & 0x0000ffff) | (dur << 16); /* compact bits */
if(futime != -2) {
a.r[0] = futime;
a.r[1] = 0;
a = art_swi(Sound_QSchedule, &a);
}
else
a = art_swi(Sound_Sound, (art_reg_set *)(8 + (int)(&a))); /* fast! */
}
void art_sound_on()
{
art_reg_set a;
a.r[0] = 2;
a = art_swi(Sound_Enable, &a);
}
void art_sound_off()
{
art_reg_set a;
a.r[0] = 1;
a = art_swi(Sound_Enable, &a);
}
void art_voices(int chan)
{
art_reg_set a;
a.r[1] = a.r[2] = a.r[3] = a.r[4] = 0;
a.r[0] = chan;
a = art_swi(Sound_Configure, &a);
}
void art_stereo(int chan, int pos)
{
art_reg_set a;
a.r[0] = chan;
a.r[1] = pos;
a = art_swi(Sound_Stereo, &a);
}
void art_set_beats(int length)
{
art_reg_set a;
a.r[0] = length;
a = art_swi(Sound_QBeats, &a);
}
int art_get_beats()
{
art_reg_set a;
a.r[0] = -1;
a = art_swi(Sound_QBeats, &a);
return a.r[0];
}
int art_get_beat()
{
art_reg_set a;
a.r[0] = 0;
a = art_swi(Sound_QBeats, &a);
return a.r[0];
}
void art_set_tempo(int newtemp)
{
art_reg_set a;
a.r[0] = newtemp;
a = art_swi(Sound_QTempo, &a);
}
int art_get_tempo()
{
art_reg_set a;
a.r[0] = 0;
a = art_swi(Sound_QTempo, &a);
return a.r[0];
}
/******************************************************************************
The WIMP functions - most of them in m/c in arthurasm for compactness
******************************************************************************/
int art_w_initialise(art_error * e)
{
art_reg_set a;
art_error * eo;
eo = art_swix(Wimp_Initialise, &a);
if((e->errnum = (int)eo) != 0)
*e = *eo;
return a.r[0];
}
int art_create_wind(art_wind_block *details, art_error *e)
{
art_reg_set a;
art_error * eo;
a.r[1] = (int)details;
eo = art_swix(Wimp_CreateWindow, &a);
if((e->errnum = (int)eo) != 0)
*e = *eo;
return a.r[0];
}
int art_create_icon(art_icon_block *details, art_error * e)
{
art_reg_set a;
art_error * eo;
a.r[1] = (int)details;
eo = art_swix(Wimp_CreateIcon, &a);
if((e->errnum = (int)eo) != 0)
*e = *eo;
return a.r[0];
}
void art_delete_wind(int handle, art_error *e)
{
art_reg_set a;
art_error * eo;
a.r[1] = (int)&handle;
eo = art_swix(Wimp_DeleteWindow, &a);
if((e->errnum = (int)eo) != 0)
*e = *eo;
}
void art_delete_icon(int wind, int icon, art_error *e)
{
art_reg_set a;
int i[2];
art_error * eo;
i[0] = wind;
i[1] = icon;
a.r[1] = (int)i;
eo = art_swix(Wimp_DeleteIcon, &a);
if((e->errnum = (int)eo) != 0)
*e = *eo;
}
void art_open_wind(art_open_block *details, art_error *e)
{
art_reg_set a;
art_error * eo;
a.r[1] = (int)details;
eo = art_swix(Wimp_OpenWindow, &a);
if((e->errnum = (int)eo) != 0)
*e = *eo;
}
void art_close_wind(int handle, art_error *e)
{
art_reg_set a;
art_error * eo;
a.r[1] = (int)&handle;
eo = art_swix(Wimp_CloseWindow, &a);
if((e->errnum = (int)eo) != 0)
*e = *eo;
}
int art_poll_wimp(int mask, art_univ_block *details, art_error *e)
{
art_reg_set a;
art_error * eo;
a.r[0] = mask;
a.r[1] = (int)details;
eo = art_swix(Wimp_Poll, &a);
if((e->errnum = (int)eo) != 0)
*e = *eo;
return a.r[0];
}
int art_redraw_wind(art_redraw_block *details, art_error *e)
{
art_reg_set a;
art_error * eo;
a.r[1] = (int)details;
eo = art_swix(Wimp_RedrawWindow, &a);
if((e->errnum = (int)eo) != 0)
*e = *eo;
return a.r[0];
}
int art_update_wind(art_redraw_block *details, art_error *e)
{
art_reg_set a;
art_error * eo;
a.r[1] = (int)details;
eo = art_swix(Wimp_UpdateWindow, &a);
if((e->errnum = (int)eo) != 0)
*e = *eo;
return a.r[0];
}
int art_get_rectangle(art_redraw_block *details, art_error *e)
{
art_reg_set a;
art_error * eo;
a.r[1] = (int)details;
eo = art_swix(Wimp_GetRectangle, &a);
if((e->errnum = (int)eo) != 0)
*e = *eo;
return a.r[0];
}
void art_get_wind_state(int handle, art_open_block *out, art_error *e)
{
art_reg_set a;
art_error * eo;
out->wind_handle = handle;
a.r[1] = (int)out;
eo = art_swix(Wimp_GetWindowState, &a);
if((e->errnum = (int)eo) != 0)
*e = *eo;
}
void art_set_icon_state(art_istate_block *details, art_error *e)
{
art_reg_set a;
art_error * eo;
a.r[1] = (int)details;
eo = art_swix(Wimp_SetIconState, &a);
if((e->errnum = (int)eo) != 0)
*e = *eo;
}
void art_get_icon_state(art_istate_block *details, art_error *e)
{
art_reg_set a;
art_error * eo;
a.r[1] = (int)details;
eo = art_swix(Wimp_GetIconState, &a);
if((e->errnum = (int)eo) != 0)
*e = *eo;
}
void art_get_point_info(art_mouse_block *out, art_error *e)
{
art_reg_set a;
art_error * eo;
a.r[1] = (int)out;
eo = art_swix(Wimp_GetPointerInfo, &a);
if((e->errnum = (int)eo) != 0)
*e = *eo;
}
void art_drag_box(art_drag_block *details, art_error *e)
{
art_reg_set a;
art_error * eo;
a.r[1] = (int)details;
eo = art_swix(Wimp_DragBox, &a);
if((e->errnum = (int)eo) != 0)
*e = *eo;
}
void art_force_redraw(art_redraw_block *details, art_error *e)
{
art_error * eo;
eo = art_swix(Wimp_ForceRedraw, (art_reg_set *)details);
if((e->errnum = (int)eo) != 0)
*e = *eo;
}
void art_set_caret_pos(art_caret_block *details, art_error *e)
{
art_error * eo;
eo = art_swix(Wimp_SetCaretPosition, (art_reg_set *)details);
if((e->errnum = (int)eo) != 0)
*e = *eo;
}
void art_get_caret_pos(art_caret_block * out, art_error *e)
{
art_reg_set a;
art_error * eo;
a.r[1] = (int)out;
eo = art_swix(Wimp_GetCaretPosition, &a);
if((e->errnum = (int)eo) != 0)
*e = *eo;
}
void art_create_menu(art_menu_block *details, int x, int y, art_error *e)
{
art_reg_set a;
art_error * eo;
a.r[1] = (int)details;
a.r[2] = x;
a.r[3] = y;
eo = art_swix(Wimp_CreateMenu, &a);
if((e->errnum = (int)eo) != 0)
*e = *eo;
}
void art_decode_menu(art_menu_block *details,
art_univ_block *selections,
art_textbuf *out,
art_error *e)
{
art_reg_set a;
art_error * eo;
a.r[1] = (int)details;
a.r[2] = (int)selections;
a.r[3] = (int)out;
eo = art_swix(Wimp_DecodeMenu, &a);
if((e->errnum = (int)eo) != 0)
*e = *eo;
}
void art_which_icon(art_which_block *details, art_icon_list *out, art_error *e)
{
art_reg_set a;
art_error * eo;
a.r[0] = details->wind_handle;
a.r[2] = details->bit_mask;
a.r[3] = details->bit_set;
a.r[1] = (int)out;
eo = art_swix(Wimp_WhichIcon, &a);
if((e->errnum = (int)eo) != 0)
*e = *eo;
}
void art_set_extent(art_redraw_block *details, art_error *e)
{
art_reg_set a;
art_error * eo;
a.r[0] = details->wind_handle;
a.r[1] = (int)details + 4;
eo = art_swix(Wimp_SetExtent, &a);
if((e->errnum = (int)eo) != 0)
*e = *eo;
}
void art_set_point_shape(art_pshape_block *details, art_error *e)
{
art_error * eo;
eo = art_swix(Wimp_SetPointerShape, (art_reg_set *)details);
if((e->errnum = (int)eo) != 0)
*e = *eo;
}
void art_open_template(char *name, art_error *e)
{
art_reg_set a;
art_error * eo;
a.r[1] = (int)name;
eo = art_swix(Wimp_OpenTemplate, &a);
if((e->errnum = (int)eo) != 0)
*e = *eo;
}
void art_close_template(art_error *e)
{
art_reg_set a;
art_error * eo;
eo = art_swix(Wimp_CloseTemplate, &a);
if((e->errnum = (int)eo) != 0)
*e = *eo;
}
void art_load_template(art_temp_block *details, art_error *e)
{
art_error * eo;
eo = art_swix(Wimp_LoadTemplate, (art_reg_set *)details);
if((e->errnum = (int)eo) != 0)
*e = *eo;
}
/*****************************************************************************/
/* in s.ArthurAsm ...
** art_swi()
** art_swix()
** art_get()
** art_vdu()
** art_vduw()
** art_mouseX()
** art_mouseY()
** art_mouseB()
*/
/* Copyright 1996 Acorn Computers Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* > C.Super */
/* Copyright (C) Acorn Computers Ltd., 1988 */
#include "h.Super"
/*
** Things in the Brazil Supervisor C library.
**
** See also S.SuperAsm for the OS bits
*/
int bra_osbyte(regs)
bra_reg_set * regs;
{
return bra_swie(OS_Byte, regs);
}
int bra_osword(action, data)
void * data;
int action;
{
bra_reg_set a;
a.r[0] = action;
a.r[1] = (int)data;
return bra_swie(OS_Word, &a);
}
int bra_osgbpb(data)
bra_osgbpb_block * data;
{
return bra_swie(OS_GBPB, (bra_reg_set *)data);
}
int bra_osfile(data)
bra_osfile_block * data;
{
return bra_swie(OS_File, (bra_reg_set *)data);
}
int bra_osargs(regs)
bra_reg_set * regs;
{
return bra_swie(OS_Args, regs);
}
int bra_osfind(regs)
bra_reg_set * regs;
{
return bra_swie(OS_Find, regs);
}
/* in s.SuperAsm ...
** bra_swi()
** bra_swie()
*/
This diff is collapsed.
/* Copyright 1996 Acorn Computers Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* armprof.c: Copyright (C) Codemist Ltd., 1988 */
/* Copyright (C) Acorn Computers Ltd., 1988, 1990 */
/* RISCOS-specific profiling support */
/*
* RCS $Revision$
* Checkin $Date$
* Revising $Author$
*/
#include <stdio.h>
/* HIDDEN EXPORTS */
extern void _mapstore(void);
extern void _fmapstore(char *);
void _write_profile(char *);
#ifdef __STDC__
#error armprof.c MUST be compiled in -pcc mode
#endif
extern unsigned Image$$RO$$Base, Image$$RO$$Limit, Image$$RW$$Limit;
static unsigned *RO_Base = &Image$$RO$$Base;
static unsigned *RO_Limit = &Image$$RO$$Limit;
static unsigned *RW_Limit = &Image$$RO$$Limit;
extern void _count(void), _count1(void);
typedef union count_position
/* This defines the format of the word that follows on from a call */
/* to _count1(). The related constant values are related to the way that */
/* file-name decoding tables are packed away. */
{ int i;
struct s
{ unsigned int posn:12,
line:16,
file:4;
} s;
} count_position;
#define file_name_map_start 0xfff12340 /* Magic number */
#define file_name_map_end 0x31415926 /* Magic number */
#define word_roundup(s) ((char *)(((int)s + 3) & (~3)))
static char *find_file_map(int p)
{
int i, w;
char *s;
while (((w = *(int *)p) & 0xfffffff0) != file_name_map_start)
{ if (p >= (int)RO_Limit) return "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0";
p += 4;
}
s = (char *)(p + 4);
for ( i = 0; i<=(w & 0xf); i++)
{ s += 1 + strlen(s);
s = word_roundup(s);
}
if (*(int *)s != file_name_map_end) return find_file_map((int)s);
return (char *)(p + 4);
}
static void _map_store(FILE *map_file)
{
unsigned count1 = (unsigned)_count1; /* address of the fn as an int */
unsigned p, onthisline = 4, w1 = 0, w2 = 0;
unsigned ro_base = (unsigned)RO_Base;
unsigned ro_limit = (unsigned)RO_Limit;
unsigned rw_limit = (unsigned)RW_Limit;
fprintf(map_file,
"\nFunction/statement counts from code base = %.6x to code limit = %.6x\n",
ro_base, ro_limit);
for (p = ro_base; p < ro_limit; p += 4)
{ int w = *(int *)p;
if ((w & 0xff000000) == 0xeb000000) /* Unconditional BL instruction */
{ unsigned dest = (p + 8 + ((w << 8) >> 6));
if (dest != count1 && dest >= ro_base && dest < rw_limit)
{ /* Try for call through (straight) veneer */
int b = *(int *)dest;
if ((b & 0xff000000) == 0xea000000) /* Unconditional B */
dest = (dest + 8 + ((b << 8) >> 6));
}
if (dest == count1)
{ if (onthisline == 4) onthisline = 0, fputs("\n ", map_file);
++onthisline;
fprintf(map_file, " %.6u: %-9u",
(*(unsigned *)(p + 8) << 4) >> 16,
*(unsigned *)(p + 4));
}
}
if ( ((w & 0xff000000) == 0xe9000000) &&
( ((w & 0x00ff0000) == 0x002c0000 && w1 == 0xe1a0b00c) ||
((w & 0x00ff0000) == 0x002d0000 && w1 == 0xe1a0c00d) ) &&
/* STMFD sp!, ..., ; MOV ip, sp @@@@@, either calling sequence */
(w2 & 0xffff0000) == 0xff000000)
{ char *name = (char *)(p - 8 - (w2 & 0xffff));
if (onthisline != 0) fputc('\n', map_file);
onthisline = 4;
fprintf(map_file, "%s", name);
}
w2 = w1;
w1 = w;
}
if (onthisline != 0) fputc('\n', map_file);
}
void _mapstore()
{
_map_store(stderr);
}
void _fmapstore(char *filename)
{
FILE *map_file = map_file = fopen(filename, "w");
if (map_file == NULL)
{ fprintf(stderr, "\nUnable to open %s for execution profile log\n",
filename);
return;
}
_map_store(map_file);
fclose(map_file);
fprintf(stderr, "\nProfile information written to %s\n", filename);
}
void _write_profile(char *filename)
{
/* Create a (binary) file containing execution profile information for */
/* the current program. The format is eccentric, and must be kept in step */
/* with (a) parts of armgen.c that generate code that collects statistics */
/* and (b) code in misc.c that reads in the binary file created here and */
/* displays the counts attached to a source listing of the original code. */
int count1 = (int)_count1;
int p, w1 = 0, w2 = 0, pass, nfiles = 0, namebytes = 0, ncounts = 0;
int global_name_offset[256];
char *global_file_map[256]; /* Limits total number of files allowed */
FILE *map_file = fopen(filename, "wb");
char *file_map;
if (map_file == NULL)
{ fprintf(stderr, "\nUnable to open %s for execution profile log\n",
filename);
return;
}
for (pass = 1; pass <=2; pass++)
{
if (pass == 2)
/* Write file header indicating size of sub-parts */
{ fwrite("\xff*COUNTFILE*", 4, 3, map_file);
fwrite(&namebytes, 4, 1, map_file);
fwrite(&nfiles, 4, 1, map_file);
fwrite(&ncounts, 4, 1, map_file);
for (p = 0; p < nfiles; p++)
{ char *ss = global_file_map[p];
int len = 1 + strlen(ss);
len = ((len + 3) & (~3)) / 4;
fwrite(ss, 4, len, map_file);
}
for (p = 0; p < nfiles; p++)
fwrite(&global_name_offset[p], 4, 1, map_file);
}
file_map = NULL;
for (p = (int)RO_Base; p < (int)RO_Limit; p += 4)
{ int w = *(int *)p;
if ((w & 0xff000000) == 0xeb000000) /* BL instruction */
{ int dest = (p + 8 + ((w << 8) >> 6));
if (dest != count1 &&
dest >= (int)RO_Base && dest < (int)RO_Limit)
{ /* Try for call through (straight) veneer */
int b = *(int *)dest;
if ((b & 0xff000000) == 0xea000000) /* Unconditional B */
dest = (dest + 8 + ((b << 8) >> 6));
}
if (dest == count1)
{ count_position k;
int i;
char *s;
if (file_map == NULL ||
(int)file_map <= p) file_map = find_file_map(p+12);
s = file_map;
k.i = *(int *)(p + 8);
for (i = 0; i<k.s.file; i++)
{ s += 1 + strlen(s);
s = word_roundup(s);
}
if (pass == 1)
{ int i;
for (i = 0;;i++)
{ if (i >= nfiles)
{ global_name_offset[nfiles] = namebytes;
global_file_map[nfiles++] = s;
namebytes += 1 + strlen(s);
namebytes = (namebytes + 3) & (~3);
break;
}
else if (strcmp(s,global_file_map[i]) ==0) break;
}
ncounts++;
}
else
{ int i;
for (i = 0; strcmp(s, global_file_map[i]) !=0; i++);
fwrite((int *)(p + 4), 4, 1, map_file);
i = (k.s.line & 0xffff) | (i << 16);
fwrite(&i, 4, 1, map_file);
}
p += 8;
}
}
w2 = w1;
w1 = w;
}
}
fwrite("\xff*ENDCOUNT*\n", 4, 3, map_file); /* Trailer data */
fclose(map_file);
fprintf(stderr, "\nProfile information written to %s\n", filename);
}
This diff is collapsed.
/* Copyright 1996 Acorn Computers Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* bsearch.c: extraced from sort.c */
/* Copyright (C) Codemist Ltd., 1988 */
#include <stddef.h>
#include <stdlib.h>
#define Compar_(a, b) (compar(a, b))
void *__bsearch(const void *key, const void *base,
size_t nmemb, size_t size,
int (*compar)(const void *, const void *))
{
/* Binary search for given key in a sorted array (starting at base). */
/* Comparisons are performed using the given function, and the array has */
/* nmemb items in it, each of size bytes. */
int midn, c;
void *midp;
for (;;)
{ if (nmemb==0) return NULL; /* not found at all. */
else if (nmemb==1)
/* If there is only one item left in the array it is the only one that */
/* needs to be looked at. */
{ if (Compar_(key, base)==0) return (void *)base;
else return NULL;
}
midn = nmemb>>1; /* index of middle item */
/* I have to cast bast to (char *) here so that the addition will be */
/* performed using natural machine arithmetic. */
midp = (char *)base + midn * size;
c = Compar_(key, midp);
if (c==0) return midp; /* item found (by accident) */
else if (c<0) nmemb = midn; /* key is to left of midpoint */
else /* key is to the right */
{ base = (char *)midp + size; /* exclude the midpoint */
nmemb = nmemb - midn - 1;
}
continue;
}
}
/* end of bsearch.c */
/* Copyright 1996 Acorn Computers Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* ctype.c: ANSI draft (X3J11 May 88) library code, section 4.3 */
/* Copyright (C) Codemist Ltd. */
/* Version 3a */
#include <ctype.h>
#include "kernel.h"
#include "territory.h"
#include "swis.h"
/* HIDDEN EXPORTs */
void _set_ctype(int);
void _ctype_init(void);
/* IL (illegal) is 0, but enhances readability. */
#define IL 0
#define _UX (__U+__X)
#define _LX (__L+__X)
#define _CS (__C+__S) /* control and space (e.g. tab) */
/*
* MUST arrange that an array of ILs gets put into memory just before __ctype.
* 4 copies for both byte sexes and to fill out a 32 bit word. This is
* done elsewhere, in cl_data.
*/
extern unsigned char __ctype[256];
/* Certain library facilities defined by macros can be used even if the
corresponding header file has not been included, if the macro is #undef'ed
or if not followed by a '('. This means that they must exist
as ordinary functions even if they are usually expanded as macros.
Hence the following (note that this relies that <ctype.h> defines
all the RHS's as macros to avoid defining fns as infinite loops):
*/
int (isalnum)(int c) { return isalnum(c); }
int (isalpha)(int c) { return isalpha(c); }
int (iscntrl)(int c) { return iscntrl(c); }
int (isdigit)(int c) { return isdigit(c); }
int (isgraph)(int c) { return isgraph(c); }
int (islower)(int c) { return islower(c); }
int (isprint)(int c) { return isprint(c); }
int (ispunct)(int c) { return ispunct(c); }
int (isspace)(int c) { return isspace(c); }
int (isupper)(int c) { return isupper(c); }
int (isxdigit)(int c) { return isxdigit(c); }
static char *touppertbl, *tolowertbl;
int toupper(int c)
{
return touppertbl ? touppertbl[c] : (islower(c) ? c + ('A' - 'a') : c);
}
int tolower(int c)
{
return tolowertbl ? tolowertbl[c] : (isupper(c) ? c + ('a' - 'A') : c);
}
#if 'A' == 193 /* ebcdic -- this test relies on NorCroft __C */
static unsigned char ctype[256] = {
__C,__C,__C,__C, IL,_CS, IL,__C, IL, IL, IL,_CS,_CS,_CS,__C,__C,
__C,__C,__C,__C, IL, IL,__C, IL,__C,__C, IL, IL,__C,__C,__C,__C,
IL, IL, IL, IL, IL,_CS,__C,__C, IL, IL, IL, IL, IL,__C,__C,__C,
IL, IL,__C, IL, IL, IL, IL,__C, IL, IL, IL, IL,__C,__C, IL, IL,
__B+__S, IL, IL, IL, IL, IL, IL, IL, IL, IL, IL,__P,__P,__P,__P,__P,
__P, IL, IL, IL, IL, IL, IL, IL, IL, IL,__P,__P,__P,__P,__P,__P,
__P,__P, IL, IL, IL, IL, IL, IL, IL, IL, IL,__P,__P,__P,__P,__P,
IL,__P, IL, IL, IL, IL, IL, IL, IL,__P,__P,__P,__P,__P,__P,__P,
IL,_LX,_LX,_LX,_LX,_LX,_LX,__L,__L,__L, IL, IL, IL, IL, IL, IL,
IL,__L,__L,__L,__L,__L,__L,__L,__L,__L, IL, IL, IL, IL, IL, IL,
IL, IL,__L,__L,__L,__L,__L,__L,__L,__L, IL, IL, IL,__P, IL, IL,
IL, IL, IL, IL, IL, IL, IL, IL, IL, IL, IL, IL, IL,__P, IL, IL,
__P,_UX,_UX,_UX,_UX,_UX,_UX,__U,__U,__U, IL, IL, IL, IL, IL, IL,
__P,__U,__U,__U,__U,__U,__U,__U,__U,__U, IL, IL, IL, IL, IL, IL,
__P, IL,__U,__U,__U,__U,__U,__U,__U,__U, IL, IL, IL, IL, IL, IL,
__N,__N,__N,__N,__N,__N,__N,__N,__N,__N, IL, IL, IL, IL, IL, IL
};
#else /* ascii */
static unsigned char ctype[128] = {
__C, /* nul */
__C, /* \001 */
__C, /* \002 */
__C, /* \003 */
__C, /* \004 */
__C, /* \005 */
__C, /* \006 */
__C, /* bell */
__C, /* backspace */
__C+__S, /* tab */
__C+__S, /* newline */
__C+__S, /* vtab */
__C+__S, /* formfeed */
__C+__S, /* return */
__C, /* \016 */
__C, /* \017 */
__C, /* \020 */
__C, /* \021 */
__C, /* \022 */
__C, /* \023 */
__C, /* \024 */
__C, /* \025 */
__C, /* \026 */
__C, /* \027 */
__C, /* \030 */
__C, /* \031 */
__C, /* \032 */
__C, /* \033 */
__C, /* \034 */
__C, /* \035 */
__C, /* \036 */
__C, /* \037 */
__B+__S, /* space */
__P, /* ! */
__P, /* " */
__P, /* # */
__P, /* $ */
__P, /* % */
__P, /* & */
__P, /* ' */
__P, /* ( */
__P, /* ) */
__P, /* * */
__P, /* + */
__P, /* , */
__P, /* - */
__P, /* . */
__P, /* / */
__N, /* 0 */
__N, /* 1 */
__N, /* 2 */
__N, /* 3 */
__N, /* 4 */
__N, /* 5 */
__N, /* 6 */
__N, /* 7 */
__N, /* 8 */
__N, /* 9 */
__P, /* : */
__P, /* ; */
__P, /* < */
__P, /* = */
__P, /* > */
__P, /* ? */
__P, /* @ */
__U+__X, /* A */
__U+__X, /* B */
__U+__X, /* C */
__U+__X, /* D */
__U+__X, /* E */
__U+__X, /* F */
__U, /* G */
__U, /* H */
__U, /* I */
__U, /* J */
__U, /* K */
__U, /* L */
__U, /* M */
__U, /* N */
__U, /* O */
__U, /* P */
__U, /* Q */
__U, /* R */
__U, /* S */
__U, /* T */
__U, /* U */
__U, /* V */
__U, /* W */
__U, /* X */
__U, /* Y */
__U, /* Z */
__P, /* [ */
__P, /* \ */
__P, /* ] */
__P, /* ^ */
__P, /* _ */
__P, /* ` */
__L+__X, /* a */
__L+__X, /* b */
__L+__X, /* c */
__L+__X, /* d */
__L+__X, /* e */
__L+__X, /* f */
__L, /* g */
__L, /* h */
__L, /* i */
__L, /* j */
__L, /* k */
__L, /* l */
__L, /* m */
__L, /* n */
__L, /* o */
__L, /* p */
__L, /* q */
__L, /* r */
__L, /* s */
__L, /* t */
__L, /* u */
__L, /* v */
__L, /* w */
__L, /* x */
__L, /* y */
__L, /* z */
__P, /* { */
__P, /* | */
__P, /* } */
__P, /* ~ */
__C /* \177 */
};
#endif
static unsigned int null_property_table[8] = { 0, 0, 0, 0, 0, 0, 0, 0 };
static unsigned int *getpropertytable(int territory, int PROPERTY_CODE)
{
_kernel_swi_regs r;
r.r[0] = territory;
r.r[1] = PROPERTY_CODE;
if (_kernel_swi(Territory_CharacterPropertyTable, &r, &r))
return null_property_table;
return (unsigned int *)r.r[0];
}
static char *getcvttable(int territory, int swi)
{
_kernel_swi_regs r;
r.r[0] = territory;
if (_kernel_swi(swi, &r, &r))
return 0;
return (char *)r.r[0];
}
void _set_ctype(int territory)
{
unsigned int i, j; /* unsigned is cue to division */
unsigned int *ctltable, *uctable, *lctable, *ptable, *stable;
unsigned int ctlw, ucw, lcw, pw, sw;
if (!territory) {
for (j = 0; j < sizeof(ctype); j++)
__ctype[j] = ctype[j];
#if 'A' != 193
for (j = 128; j < 256; j++)
__ctype[j] = IL;
#endif
touppertbl = 0;
tolowertbl = 0;
} else {
/* Get property tables - these are byte sex dependant */
ctltable = getpropertytable(territory, TERRITORY_PROPERTY_CONTROL);
uctable = getpropertytable(territory, TERRITORY_PROPERTY_UPPERCASE);
lctable = getpropertytable(territory, TERRITORY_PROPERTY_LOWERCASE);
ptable = getpropertytable(territory, TERRITORY_PROPERTY_PUNCTUATION);
stable = getpropertytable(territory, TERRITORY_PROPERTY_SPACE);
j = 0;
/* Check to see this generates sensible assembler */
for (i = 0; i < 256 / 32; i++) {
ctlw = ctltable[i];
ucw = uctable[i];
lcw = lctable[i];
pw = ptable[i];
sw = stable[i];
do {
__ctype[j] = (ctlw & 1) * __C | (ucw & 1) * __U |
(lcw & 1) * __L | (pw & 1) * __P | (sw & 1) * __S;
ctlw >>= 1;
ucw >>= 1;
lcw >>= 1;
pw >>= 1;
sw >>= 1;
} while (++j & 0x1f);
}
/* Unfortunately ANSI actually DEFINE what digits are !
* But I want to use Roman numerals :-)
* Numbers are in a block together even in EBCIDIC
*/
for (j = '0'; j <= '9'; j++)
__ctype[j] |= __N;
/* Similarly they say what xdigit is
* 'A' - 'F' & 'a' - 'f' also occur in a block in EBCIDIC
*/
for (j = 'A'; j <= 'F'; j++) {
__ctype[j] |= __X;
__ctype[j + 'a' - 'A'] |= __X;
}
/* Because of ANSI restriction wrt isgraph and isprint __C is the only */
/* allowable flag from the territory properties */
__ctype[' '] = (__ctype[' '] & __C) | __B | __S;
touppertbl = getcvttable(territory, Territory_UpperCaseTable);
tolowertbl = getcvttable(territory, Territory_LowerCaseTable);
}
}
void _ctype_init()
{
__ctype[-1] = IL; /* for ctype(EOF) */
_set_ctype(0);
}
/* End of ctype.c */
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment