Commit 9d187537 authored by Kevin Bracey's avatar Kevin Bracey
Browse files

* Merged in (via sbrodie's branch) public source release of RISC_OSLib.

* Fixed C library tty so it can output '\b' (backspace).
* Made offsetof() and va_arg() macros work with C++.

Version 5.34. Tagged as 'RISC_OSLib-5_34'
parent 8159da18
......@@ -341,6 +341,8 @@ ROM_OBJS =\
rm_o_rl.fileicon \
rm_o_rl.flex \
rm_o_rl.font \
rm_o_rl.fontlist \
rm_o_rl.fontselect \
rm_o_rl.heap \
rm_o_rl.magnify \
rm_o_rl.menu \
......@@ -387,12 +389,12 @@ RLIB_OBJS =\
o_rl.colourtran o_rl.coords o_rl.ctl o_rl.dbox o_rl.dboxfile o_rl.dboxquery \
o_rl.dboxtcol o_rl.dragasprit o_rl.drawcheck o_rl.drawfdiag o_rl.drawfiles \
o_rl.drawfobj o_rl.drawmod o_rl.drawtextc o_rl.event o_rl.fileicon o_rl.flex \
o_rl.font o_rl.heap o_rl.help o_rl.magnify o_rl.menu o_rl.msgs o_rl.os \
o_rl.pointer o_rl.poll o_rl.print o_rl.res o_rl.resspr o_rl.saveas o_rl.sprite \
o_rl.swi o_rl.template o_rl.trace o_rl.txt o_rl.txt1 o_rl.txt3 o_rl.txtar \
o_rl.txtedit o_rl.txtfile o_rl.txtfind o_rl.txtmisc o_rl.txtopt o_rl.txtoptmenu \
o_rl.txtregexp o_rl.txtscrap o_rl.txtundo o_rl.txtwin o_rl.visdelay \
o_rl.werr o_rl.wimp o_rl.wimpt o_rl.win o_rl.xferrecv o_rl.xfersend
o_rl.font o_rl.fontlist o_rl.fontselect o_rl.heap o_rl.help o_rl.magnify o_rl.menu \
o_rl.msgs o_rl.os o_rl.pointer o_rl.poll o_rl.print o_rl.res o_rl.resspr \
o_rl.saveas o_rl.sprite o_rl.swi o_rl.template o_rl.trace o_rl.txt o_rl.txt1 \
o_rl.txt3 o_rl.txtar o_rl.txtedit o_rl.txtfile o_rl.txtfind o_rl.txtmisc \
o_rl.txtopt o_rl.txtoptmenu o_rl.txtregexp o_rl.txtscrap o_rl.txtundo o_rl.txtwin \
o_rl.visdelay o_rl.werr o_rl.wimp o_rl.wimpt o_rl.win o_rl.xferrecv o_rl.xfersend
#
# Objects for RISCOSLIB:o.riscoslibm
......@@ -403,13 +405,13 @@ RLIB_MOD_OBJS =\
m_o_rl.dboxfile m_o_rl.dboxquery m_o_rl.dboxtcol m_o_rl.dragasprit \
m_o_rl.drawcheck m_o_rl.drawfdiag m_o_rl.drawfiles m_o_rl.drawfobj m_o_rl.drawmod \
m_o_rl.drawtextc m_o_rl.event m_o_rl.fileicon m_o_rl.flex m_o_rl.font \
m_o_rl.heap m_o_rl.help m_o_rl.magnify m_o_rl.menu m_o_rl.msgs m_o_rl.os \
m_o_rl.pointer m_o_rl.poll m_o_rl.print m_o_rl.res m_o_rl.resspr m_o_rl.saveas \
m_o_rl.sprite m_o_rl.swi m_o_rl.template m_o_rl.trace m_o_rl.txt m_o_rl.txt1 \
m_o_rl.txt3 m_o_rl.txtar m_o_rl.txtedit m_o_rl.txtfile m_o_rl.txtfind \
m_o_rl.txtmisc m_o_rl.txtopt m_o_rl.txtoptmenu m_o_rl.txtregexp \
m_o_rl.txtscrap m_o_rl.txtundo m_o_rl.txtwin m_o_rl.visdelay m_o_rl.werr \
m_o_rl.wimp m_o_rl.wimpt m_o_rl.win m_o_rl.xferrecv m_o_rl.xfersend
m_o_rl.fontlist m_o_rl.fontselect m_o_rl.heap m_o_rl.help m_o_rl.magnify \
m_o_rl.menu m_o_rl.msgs m_o_rl.os m_o_rl.pointer m_o_rl.poll m_o_rl.print \
m_o_rl.res m_o_rl.resspr m_o_rl.saveas m_o_rl.sprite m_o_rl.swi m_o_rl.template \
m_o_rl.trace m_o_rl.txt m_o_rl.txt1 m_o_rl.txt3 m_o_rl.txtar m_o_rl.txtedit \
m_o_rl.txtfile m_o_rl.txtfind m_o_rl.txtmisc m_o_rl.txtopt m_o_rl.txtoptmenu \
m_o_rl.txtregexp m_o_rl.txtscrap m_o_rl.txtundo m_o_rl.txtwin m_o_rl.visdelay \
m_o_rl.werr m_o_rl.wimp m_o_rl.wimpt m_o_rl.win m_o_rl.xferrecv m_o_rl.xfersend
#
# Build rules:
......
......@@ -11,14 +11,14 @@
GBLS Module_HelpVersion
GBLS Module_ComponentName
GBLS Module_ComponentPath
Module_MajorVersion SETS "5.33"
Module_Version SETA 533
Module_MajorVersion SETS "5.34"
Module_Version SETA 534
Module_MinorVersion SETS ""
Module_Date SETS "10 May 2001"
Module_ApplicationDate2 SETS "10-May-01"
Module_ApplicationDate4 SETS "10-May-2001"
Module_Date SETS "23 Aug 2001"
Module_ApplicationDate2 SETS "23-Aug-01"
Module_ApplicationDate4 SETS "23-Aug-2001"
Module_ComponentName SETS "RISC_OSLib"
Module_ComponentPath SETS "RiscOS/Sources/Lib/RISC_OSLib"
Module_FullVersion SETS "5.33"
Module_HelpVersion SETS "5.33 (10 May 2001)"
Module_FullVersion SETS "5.34"
Module_HelpVersion SETS "5.34 (23 Aug 2001)"
END
/* (5.33)
/* (5.34)
*
* This file is automatically maintained by srccommit, do not edit manually.
*
*/
#define Module_MajorVersion_CMHG 5.33
#define Module_MajorVersion_CMHG 5.34
#define Module_MinorVersion_CMHG
#define Module_Date_CMHG 10 May 2001
#define Module_Date_CMHG 23 Aug 2001
#define Module_MajorVersion "5.33"
#define Module_Version 533
#define Module_MajorVersion "5.34"
#define Module_Version 534
#define Module_MinorVersion ""
#define Module_Date "10 May 2001"
#define Module_Date "23 Aug 2001"
#define Module_ApplicationDate2 "10-May-01"
#define Module_ApplicationDate4 "10-May-2001"
#define Module_ApplicationDate2 "23-Aug-01"
#define Module_ApplicationDate4 "23-Aug-2001"
#define Module_ComponentName "RISC_OSLib"
#define Module_ComponentPath "RiscOS/Sources/Lib/RISC_OSLib"
#define Module_FullVersion "5.33"
#define Module_HelpVersion "5.33 (10 May 2001)"
#define Module_FullVersion "5.34"
#define Module_HelpVersion "5.34 (23 Aug 2001)"
......@@ -312,7 +312,7 @@ int _ttywrite(const unsigned char *buf, unsigned int len, int flag)
if (ch == '\n') {
if (_kernel_oswrch(LF) < 0) return -1;
ch = CR;
} else if (ch < 32 && ch != 0x07 && !isspace(ch)) {
} else if (ch < 32 && ch != 0x07 && ch != 0x08 && !isspace(ch)) {
if (_kernel_oswrch('|') < 0) return -1;
ch = (ch & 31) | 64;
}
......
......@@ -18,7 +18,7 @@
/* stdarg.h: ANSI 'C' (X3J11 Oct 88) library header, section 4.8 */
/* Copyright (C) Codemist Ltd. */
/* Copyright (C) Acorn Computers Ltd. 1991, 1992 */
/* version 3.00 */
/* version 3.01 */
#ifndef __stdarg_h
#define __stdarg_h
......@@ -44,6 +44,22 @@ typedef char *va_list[1]; /* see <stdio.h> */
* is passed as an argument it gets passed by reference.
*/
#ifdef __cplusplus
template <class T> struct __alignoftest
{ char __member1; T __member2;
};
#define __alignof(type) \
((char *)&(((__alignoftest<type>*) 0)->__member2) - (char *)0)
#define __alignuptotype(ptr,type) \
((char *)((int)(ptr) + (__alignof(type)-1) & ~(__alignof(type)-1)))
#define va_start(ap,parmN) \
((void)(*(ap) = (char *)&(parmN) + sizeof(parmN)))
#define va_arg(ap,type) \
(*(type *)((*(ap)=__alignuptotype(*(ap),type)+sizeof(type))-\
sizeof(type)))
#else
/* Note that ___type is a syntactic item a bit like the type qualifiers */
/* 'static', 'register', 'const' etc except that it has no effect! Its */
/* purpose is to indicate when a type is being introduced and thus */
......@@ -56,13 +72,6 @@ typedef char *va_list[1]; /* see <stdio.h> */
((char *)((int)(ptr) + (__alignof(type)-1) & ~(__alignof(type)-1)))
#ifdef __cplusplus
#define va_start(ap,parmN) \
((void)(*(ap) = (char *)&(parmN) + sizeof(parmN)))
#define va_arg(ap,type) \
(*(___type type *)((*(ap)=__alignuptotype(*(ap),type)+sizeof(___type type))-\
sizeof(___type type)))
#else
#define va_start(ap,parmN) \
(___assert((___typeof(parmN) & 0x481) == 0, \
"Illegal type of 2nd argument to va_start"), \
......
......@@ -18,7 +18,7 @@
/* stddef.h: ANSI 'C' (X3J11 Oct 88) library header, section 4.1.4 */
/* Copyright (C) Codemist Ltd. */
/* Copyright (C) Acorn Computers Ltd. 1991, 1992 */
/* version 2.00 */
/* version 2.01 */
/*
* The following types and macros are defined in several headers referred to in
......@@ -58,8 +58,13 @@ typedef int wchar_t; /* also in <stdlib.h> */
/* null pointer constant. */
#endif
#ifdef __cplusplus
#define offsetof(type, member) \
((size_t)((char *)&(((type *)0)->member) - (char *)0))
#else
#define offsetof(type, member) \
((size_t)((char *)&(((___type type *)0)->member) - (char *)0))
#endif
/*
* expands to an integral constant expression that has type size_t, the
* value of which is the offset in bytes, from the beginning of a structure
......
......@@ -63,7 +63,7 @@ int akbd_pollkey(int *keycode /*out*/)
/* bona fide function key */
*keycode = 256 + x;
} else {
/* he's typing ahead with a control-@: sorry boy, you loose
/* he's typing ahead with a control-@: sorry boy, you lose
the next key. */
*keycode = 0;
};
......
/* Copyright 2001 Pace Micro Technology plc
*
* 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.
*/
/************************************************************************/
/* © Acorn Computers Ltd, 1992. */
/* */
/* This file forms part of an unsupported source release of RISC_OSLib. */
/* */
/* It may be freely used to create executable images for saleable */
/* products but cannot be sold in source form or as an object library */
/* without the prior written consent of Acorn Computers Ltd. */
/* */
/* If this file is re-distributed (even if modified) it should retain */
/* this copyright notice. */
/* */
/************************************************************************/
/*
* Title: fontlist.c
* Purpose: Code to enumerate the fonts available into a tree structure
* History: IDJ: 06-Feb-92: prepared for source release
*
*/
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "werr.h"
#include "wimp.h"
#include "wimpt.h"
#include "win.h"
#include "event.h"
#include "baricon.h"
#include "res.h"
#include "resspr.h"
#include "menu.h"
#include "template.h"
#include "dbox.h"
#include "fontlist.h"
#include "fontselect.h"
#include "msgs.h"
#include "akbd.h"
#include "font.h"
#ifndef UROM
/* -------------------------------------------------- */
/* Globals defined */
/* -------------------------------------------------- */
fontlist_node *font__tree = NULL;
/* -------------------------------------------------- */
/* Functions defined */
/* -------------------------------------------------- */
/* Create a tree of all the available fonts in font__tree, returning NULL if an error occurred.
system is TRUE if the system font is to appear in the tree */
extern fontlist_node *font__list_all_fonts( BOOL system );
/* Free the font tree structure */
extern void font__free_font_tree( fontlist_node *font_tree );
/* Add a new font to the font tree strucutre */
static fontlist_node *font__add_new_font( fontlist_node **font_list_ptr, char *font_name );
/* Find the position of a font entry in the tree (creating it if necessary first) */
static fontlist_node *font__seek_font( fontlist_node **font_list_ptr, char **font_name_ptr, BOOL rest_of_name );
/* Allocate memory for a font entry for the tree */
static fontlist_node *font__allocate_new_font( void );
/* Deallocate memory for a font entry for the tree */
static void font__deallocate_font( fontlist_node *font_tree );
/* -------------------------------------------------- */
/* Function to create a list of the available fonts */
/* -------------------------------------------------- */
/*
Create a tree of all the available fonts in font__tree,
returning NULL if an error occurred.
system is TRUE if the system font is to appear in the tree
*/
/* -------------------------------------------------- */
extern fontlist_node *fontlist_list_all_fonts( BOOL system )
{
int font_count = 0;
char font[40];
if (system)
font__add_new_font( &font__tree, "System" );
while (font_count != -1)
{
if ( wimpt_complain(font_list( font, &font_count ) ) != NULL)
return NULL;
if (font_count != -1)
if ( font__add_new_font( &font__tree, font ) == NULL )
{
werr(0, "No room for font list.\n");
return NULL;
}
}
return font__tree;
}
/* -------------------------------------------------- */
/* Free the font tree structure */
/* -------------------------------------------------- */
extern void fontlist_free_font_tree( fontlist_node *font_tree )
{
font__deallocate_font( font_tree );
}
/* -------------------------------------------------- */
/* Add a new font to the font tree strucutre */
/* -------------------------------------------------- */
static fontlist_node *font__add_new_font( fontlist_node **font_list_ptr, char *font_name )
{
fontlist_node *font_ptr;
/* Find/create font with the first portion of the font name */
font_ptr = font__seek_font( font_list_ptr, &font_name, FALSE );
/* NULL => no room to create the font entry */
if (font_ptr==NULL)
return NULL;
/* Find/create weight of font */
if (*font_name != '\0')
{
font_ptr = font__seek_font( &font_ptr->son, &font_name, FALSE );
if (font_ptr==NULL)
return NULL;
/* Find/create style of font */
if (*font_name != '\0')
{
font_ptr = font__seek_font( &font_ptr->son, &font_name, TRUE );
if (font_ptr==NULL)
return NULL;
}
}
/* Now we have found/created the complete font */
font_ptr -> flag = TRUE;
return font_ptr;
}
static fontlist_node *font__seek_font( fontlist_node **font_list_ptr, char **font_name_ptr, BOOL rest_of_name )
{
int i;
if (*font_list_ptr == NULL)
{
if ((*font_list_ptr = font__allocate_new_font()) == NULL)
return NULL;
(*font_list_ptr) -> flag = FALSE;
(*font_list_ptr) -> son = NULL;
(*font_list_ptr) -> brother = NULL;
strcpy((*font_list_ptr)->name, *font_name_ptr);
if (rest_of_name)
{
*font_name_ptr += strlen( *font_name_ptr );
}
else
{
for ( i=0; (**font_name_ptr != '\0') && (**font_name_ptr != '.'); i++ )
(*font_name_ptr)++;
if (**font_name_ptr != '\0')
{
(*font_list_ptr)->name[i] = '\0';
(*font_name_ptr)++;
}
}
return *font_list_ptr;
}
for (i=0; ((*font_name_ptr)[i] != '\0' && (rest_of_name || (*font_name_ptr)[i] != '.')) ;i++);
if ( ( strncmp( *font_name_ptr, (*font_list_ptr)->name, i) != 0 ) ||
( (*font_list_ptr)->name[i]!='\0' ) )
return font__seek_font( &((*font_list_ptr)->brother), font_name_ptr, rest_of_name );
(*font_name_ptr) += i;
if ( **font_name_ptr == '.' )
(*font_name_ptr)++;
return *font_list_ptr;
}
/* -------------------------------------------------- */
/* Allocate memory for a font entry for the tree */
/* -------------------------------------------------- */
static fontlist_node *font__allocate_new_font( void )
{
return (fontlist_node *) (malloc(sizeof(fontlist_node)));
}
/* -------------------------------------------------- */
/* Deallocate memory for a font entry from the tree */
/* -------------------------------------------------- */
static void font__deallocate_font( fontlist_node *font )
{
if (font!=NULL)
{
font__deallocate_font( font->brother );
font__deallocate_font( font->son );
free( (void *) font);
}
}
#endif /* UROM */
This diff is collapsed.
......@@ -12,4 +12,4 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#define VERSION "4.17 (06 Nov 1990)"
#define VERSION "5.34 (18 Aug 2001)"
/* Copyright 2001 Pace Micro Technology plc
*
* 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.
*/
/****************************************************************************
* This source file was written by Acorn Computers Limited. It is part of *
* the RISCOS library for writing applications in C for RISC OS. It may be *
* used freely in the creation of programs for Archimedes. It should be *
* used with Acorn's C Compiler Release 3 or later. *
* *
***************************************************************************/
/*
* Title: fontlist.h
* Purpose: Routines to enumerate the fonts on the system into a tree structure
*
*/
#ifndef __fontlist_h
#define __fontlist_h
/* -------------------------------------------------- */
/* Structures required */
/* -------------------------------------------------- */
typedef struct fontlist_node
{
char name[40];
struct fontlist_node *son;
struct fontlist_node *brother;
int flag;
} fontlist_node;
/* As an example of a font tree structure, consider
Corpus.Medium, Corpus.Bold, Selwyn,
Trinity.Medium, Trinity.Bold, Trinity.Medium.Italic,
Widget.Medium.Italic.Outline
This will be stored in the following way: (#'s denote flag's which are TRUE)
--+--> Corpus --+--> # Medium
| |
| +--> # Bold
|
+--> # Selwyn
|
+--> Trinity --+--> # Medium -----> # Italic
| |
| +--> # Bold
|
+--> Widget --+--> Medium -----> # Italic.Outline
[ Brothers are connected vertically downwars, sons to their parents
right-to-left ]
*/
/* -------------------------------------------------- */
/* Globals defined */
/* -------------------------------------------------- */
extern fontlist_node *font__tree;
/* --------------------------- fontlist_list_all_fonts -----------------------------
* Description: Read in the font list into a font tree
*
* Parameters: BOOL system -- TRUE if System font should be included in the list
* Returns: a pointer to the start of the font tree
* Other Info:
*/
fontlist_node *fontlist_list_all_fonts( BOOL system );
/* --------------------------- fontlist_free_font_tree -----------------------------
* Description: Free a font tree
*
* Parameters: fontlist_node *font_tree -- the font tree to free
* Returns:
* Other Info:
*/
void fontlist_free_font_tree( fontlist_node *font_tree );
#endif
/* end fontlist.h */
/* Copyright 2001 Pace Micro Technology plc
*
* 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.
*/
/****************************************************************************
* This source file was written by Acorn Computers Limited. It is part of *
* the RISCOS library for writing applications in C for RISC OS. It may be *
* used freely in the creation of programs for Archimedes. It should be *
* used with Acorn's C Compiler Release 3 or later. *
* *
***************************************************************************/
/*
* Title: fontselect.h
* Purpose: Consistent interface to font choosing
*
*/
#ifndef __fontselect_h
#define __fontselect_h
typedef BOOL (*fontselect_fn)(char *font_name, double width, double height, wimp_eventstr *event );
/* --------------------------- fontselect_init -----------------------------
* Description: Read in the font list and prepare data for the font selector window
*
* Parameters:
* Returns: TRUE if initialisation succeeded.
* Other Info:
*/
int fontselect_init( void );
/* --------------------------- fontselect_closedown -----------------------------
* Description: Close the font selector windows if they are open, and free the font selector data structures
*
* Parameters:
* Returns:
* Other Info: This call is provided to return the machine to the state it was in before a call of fontselect_init()
*/
void fontselect_closedown( void );
/* --------------------------- fontselect_closewindows -----------------------------
* Description: Close the font selector windows if they are open
*
* Parameters:
* Returns:
* Other Info: This call will close the font selector windows and unattach the handlers, if they are open.
*/
void fontselect_closewindows( void );
/* --------------------------- fontselect_selector -----------------------------
* Description: Opens up or reopens the font chooser window.
*
* Parameters: char *title -- The title for the window (can be NULL if flags SETTITLE is clear)
* int flags -- The flags for the call (see below)
* char *font_name -- The font name to set the window contents to (only if SETFONT is set)
* double width -- The width in point size of the font
* double height --
* fontselect_fn unknown_icon --
* Returns: The window handle of the font selector main window, if the function
* call was successful. Otherwise it returns 0.
* Other Info: The flags word allows the call to have different effects.
* If fontselect_SETFONT is set then the window contents wil be updated to reflect the font choice passed in
* If fontselect_SETTITLE is set then the title of the window will be set, otherwise title is ignored.
* If fontselect_REOPEN is set then the font selector will only open the window if it is already open. This
* lets the application update the contents of the window only if it is currently open.
* Note that the fontselect_init() must be called before this routine.
*/
int fontselect_selector( char *title, int flags, char *font_name, double width, double height, fontselect_fn unknown_icon_routine );
#define fontselect_REOPEN 0x001
#define fontselect_SETTITLE 0x002
#define fontselect_SETFONT 0x004
/* ---------------------------- fontselect_attach_menu ----------------------------
* Description: Attaches a menu to all four font selector windows
*
* Parameters: menu mn -- menu to attach
* event_menu_proc menu_processor -- menu processor for the menu events
* void *handle -- handle to pass to the menu processor
* Returns: TRUE if the menus were attached, FALSE otherwise
* Other Info: none.
*/
BOOL fontselect_attach_menu( menu mn, event_menu_proc menu_processor, void *handle );
#endif
/* end fontselect.h */
......@@ -22,9 +22,9 @@
; * whether or not a line number has ever been specified
; * whether or not a line number was specified for this line
GBLL ModeMayBeNonUser
ModeMayBeNonUser SETL {FALSE}
GET s.h_Brazil
GET Hdr:ListOpts
GET Hdr:APCS.Common
GET Hdr:Macros
AREA |C$$code|, CODE, READONLY
......
......@@ -38,8 +38,12 @@
GBLL ModeMayBeNonUser
ModeMayBeNonUser SETL {FALSE}
GET s.h_Brazil
GET Hdr:Wimp
GET Hdr:ListOpts
GET Hdr:APCS.Common
GET Hdr:Macros
XWimp_Poll * (1 :SHL: 17) :OR: &400C7
XWimp_PollIdle * (1 :SHL: 17) :OR: &400E1
AREA |C$$code|, CODE, READONLY
......
......@@ -44,17 +44,23 @@ names SETL {TRUE}
GBLL ModeMayBeNonUser
ModeMayBeNonUser SETL {FALSE}
GET s.h_Brazil
GET Hdr:ListOpts
GET Hdr:APCS.Common
GET Hdr:Macros
SWI_OP * &EF000000 ; SWIAL opcode
XOS_MASK * &00020000 ; mask to make a swi a RISC OS V-error SWI
XOS_WriteC * XOS_MASK + 0
XOS_ReadC * XOS_MASK + 4
XOS_Byte * XOS_MASK + 6
XOS_Word * XOS_MASK + 7
XOS_ReadVarVal * XOS_MASK + &23
XOS_CallASWIR12 * XOS_MASK + &71
; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
; Register names
;whether to avoid dynamic code for swi veneers
GBLL StaticSWIVeneer
StaticSWIVeneer SETL StrongARM :LAND: {TRUE}
[ :LNOT:UROM
EXPORT |bbc_get|
......@@ -118,7 +124,6 @@ bbc_vdu SWI XOS_WriteC
; In a1 contains swi number, a2 points to ARM register structure
os_swi
[ StaticSWIVeneer
STMDB sp!, {v1-v6, lr}
MOV r12, r0
CMP r1, #0
......@@ -132,21 +137,6 @@ os_swi
os_swi_noregset
SWI XOS_CallASWIR12
Return "v1-v6"
|
STMDB sp!, {v1-v6, lr}
ORR a1, a1, #SWI_OP ; make into SWI operation
ADR v1, exit_sequence
LDMIA v1, {v2,v3}
MOVS ip, a2
MOVEQ v2, #0
STMDB sp!, {a1, v2,v3} ; copy SWI and exit code onto stack
LDMNEIA a2, {r0-r9} ; load up registers for SWI if wanted
MOV pc, sp ; and jump to the sequence
; SWI whatever ; <- sp
exit_sequence
STMIA ip, {r0-r9}
Return "a2-a4,v1-v6" ; a2-a4 just to pop stack
]
; os_error *os_swix(int swicode, os_regset* /*inout*/);
......@@ -154,7 +144,6 @@ exit_sequence
; In a1 contains swi number, a2 points to ARM register structure
os_swix
[ StaticSWIVeneer
STMDB sp!, {v1-v6, lr}
ORR a1, a1, #XOS_MASK ; make a SWI of V-error type
MOV r12, r0
......@@ -171,27 +160,6 @@ os_swix_noregset
SWI XOS_CallASWIR12
MOVVC a1, #0
Return "v1-v6"
|
STMDB sp!, {v1-v6, lr}
ORR a1, a1, #XOS_MASK ; make a SWI of V-error type
ORR a1, a1, #SWI_OP ; make into SWI operation
ADR v1, xexit_sequence
LDMIA v1, {v2,v3,v4,v5}
MOVS ip, a2
MOVEQ v2, #0
STMDB sp!, {a1, v2,v3,v4,v5} ; copy SWI and exit code onto stack
LDMNEIA ip, {r0-r9} ; load up registers for SWI if wanted
MOV pc, sp ; and jump to the sequence
; SWI Xwhatever ; <- sp
xexit_sequence
STMIA ip, {r0-r9}
MOVVC a1, #0
ADD sp, sp, #4 * 4
Return "a3,v1-v6"
; a3 is junk (LDM)
; Note: CAN NOT move stack past LDM
; before instruction executes
]
os_swix0
os_swix1
......@@ -209,7 +177,6 @@ os_swi3
os_swi4
os_swi5
os_swi6
[ StaticSWIVeneer
STMDB sp!, {v1-v6, lr}
MOV r12, r0
MOV a1, a2
......@@ -220,22 +187,6 @@ os_swi6
SWI XOS_CallASWIR12
MOVVC a1, #0
Return "v1-v6"
|
STMDB sp!, {v1-v6, lr}
ORR a1, a1, #SWI_OP
ADR ip, swi6_exit_sequence
LDMIA ip, {ip, lr}
STMDB sp!, {a1, ip, lr}
MOV a1, a2
MOV a2, a3
MOV a3, a4
ADD ip, sp, #10 * 4
LDMIA ip, {a4, v1, v2}
MOV pc, sp
swi6_exit_sequence
MOVVC a1, #0
Return "a2-a4,v1-v6"
]
swi_ret_inst
MOV pc, ip
......@@ -243,7 +194,6 @@ swi_ret_inst
os_swix1r
ORR a1, a1, #&20000
os_swi1r
[ StaticSWIVeneer
STMDB sp!, {a3, v1-v6, lr}
MOV r12, r0
MOV r0, a2
......@@ -254,25 +204,10 @@ os_swi1r
STRNE a1, [ip]
MOV a1, #0
Return "a2,v1-v6"
|
ORR a1, a1, #&ef000000
LDR a2, swi_ret_inst
STMDB sp!, {a1, a2, a3, v1-v6, lr}
MOV a1, a2
MOV ip, pc
MOV pc, sp
LDR ip, [sp, #8]!
Return "a2,v1-v6",,VS
TEQ ip, #0
STRNE a1, [ip]
MOV a1, #0
Return "a2,v1-v6"
]
os_swix2r
ORR a1, a1, #&20000
os_swi2r
[ StaticSWIVeneer
STMDB sp!, {a4, v1-v6, lr}
MOV r12, r0
MOV a1, a2
......@@ -287,30 +222,10 @@ os_swi2r
STRNE a2, [ip]
MOV a1, #0
Return "a2,v1-v6"
|
MOV ip, a2
ORR a1, a1, #&ef000000
LDR a2, swi_ret_inst
STMDB sp!, {a1, a2, a4, v1-v6, lr}
MOV a1, ip
MOV a2, a3
MOV ip, pc
MOV pc, sp
LDR ip, [sp, #8]!
Return "a2,v1-v6",,VS
TEQ ip, #0
STRNE a1, [ip]
LDR ip, [sp, #8 * 4]
TEQ ip, #0
STRNE a2, [ip]
MOV a1, #0
Return "a2,v1-v6"
]
os_swix3r
ORR a1, a1, #&20000
os_swi3r
[ StaticSWIVeneer
STMDB sp!, {v1-v6, lr}
MOV r12, r0
MOV a1, a2
......@@ -328,33 +243,10 @@ os_swi3r
STRNE a3, [v3]
MOV a1, #0
Return "v1-v6"
|
MOV ip, a2
ORR a1, a1, #&ef000000
LDR a2, swi_ret_inst
STMDB sp!, {a1, a2, v1-v6, lr}
MOV a1, ip
MOV a2, a3
MOV a3, a4
MOV ip, pc
MOV pc, sp
ADD ip, sp, #9 * 4
LDMIA ip, {v1, v2, v3}
Return "a2,a3,v1-v6",,VS
TEQ v1, #0
STRNE a1, [v1]
TEQ v2, #0
STRNE a2, [v2]
TEQ v3, #0
STRNE a3, [v3]
MOV a1, #0
Return "a2,a3,v1-v6"
]
os_swix4r
ORR a1, a1, #&20000
os_swi4r
[ StaticSWIVeneer
STMDB sp!, {v1-v6, lr}
MOV r12, r0
MOV a1, a2
......@@ -375,36 +267,10 @@ os_swi4r
STRNE a4, [v4]
MOV a1, #0
Return "v1-v6"
|
MOV ip, a2
ORR a1, a1, #&ef000000
LDR a2, swi_ret_inst
STMDB sp!, {a1, a2, v1-v6, lr}
MOV a1, ip
MOV a2, a3
MOV a3, a4
LDR a4, [sp, #9 * 4]
MOV ip, pc
MOV pc, sp
ADD ip, sp, #10 * 4
LDMIA ip, {v1-v4}
Return "a2,a3,v1-v6",,VS
TEQ v1, #0
STRNE a1, [v1]
TEQ v2, #0
STRNE a2, [v2]
TEQ v3, #0
STRNE a3, [v3]
TEQ v4, #0
STRNE a4, [v4]
MOV a1, #0
Return "a2,a3v1-v6"
]
os_swix5r
ORR a1, a1, #&20000
os_swi5r
[ StaticSWIVeneer
STMDB sp!, {v1-v6, lr}
MOV r12, r0
MOV a1, a2
......@@ -428,39 +294,10 @@ os_swi5r
STRNE v1, [ip]
MOV a1, #0
Return "v1-v6"
|
MOV ip, a2
ORR a1, a1, #&ef000000
LDR a2, swi_ret_inst
STMDB sp!, {a1, a2, v1-v6, lr}
MOV a1, ip
MOV a2, a3
MOV a3, a4
ADD ip, sp, #9 * 4
LDMIA ip, {a4, v1}
MOV ip, pc
MOV pc, sp
ADD ip, sp, #11 * 4
LDMIA ip, {v3-v6, ip}
Return "a3,a4,v1-v6",,VS
TEQ v3, #0
STRNE a1, [v3]
TEQ v4, #0
STRNE a2, [v4]
TEQ v5, #0
STRNE a3, [v5]
TEQ v6, #0
STRNE a4, [v6]
TEQ ip, #0
STRNE v1, [ip]
MOV a1, #0
Return "a3,a4,v1-v6"
]
os_swix6r
ORR a1, a1, #&20000
os_swi6r
[ StaticSWIVeneer
STMDB sp!, {v1-v6, lr}
MOV r12, r0
MOV a1, a2
......@@ -486,36 +323,6 @@ os_swi6r
STRNE v2, [lr]
MOV a1, #0
Return "v1-v6"
|
MOV ip, a2
ORR a1, a1, #&ef000000
LDR a2, swi_ret_inst
STMDB sp!, {a1, a2, v1-v6, lr}
MOV a1, ip
MOV a2, a3
MOV a3, a4
ADD ip, sp, #9 * 4
LDMIA ip, {a4, v1, v2}
MOV ip, pc
MOV pc, sp
ADD ip, sp, #12 * 4
LDMIA ip, {v3-v6, ip, lr} ; APCS-R assumption here
Return "a3,a4,v1-v6",,VS
TEQ v3, #0
STRNE a1, [v3]
TEQ v4, #0
STRNE a2, [v4]
TEQ v5, #0
STRNE a3, [v5]
TEQ v6, #0
STRNE a4, [v6]
TEQ ip, #0
STRNE v1, [ip]
TEQ lr, #0
STRNE v2, [lr]
MOV a1, #0
Return "a3,a4,v1-v6"
]
os_byte
FunctionEntry
......
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