Commit f44675e1 authored by ROOL's avatar ROOL 🤖
Browse files

This commit was manufactured by cvs2git to create branch 'Spinner'.

Sprout from master 1996-11-21 12:49:07 UTC Neil Turton <nturton@gitlab.riscosopen.org> 'Initial revision'
Cherrypick from Spin_xx 1996-11-21 12:50:23 UTC Neil Turton <nturton@gitlab.riscosopen.org> 'Import from SrcFiler':
    Mk,fd7
    Textfile
Delete:
    !!Log
    !!Log423
    !BuildNote
    ViaFile
    c/riscos
    h/riscos
parent 24bf7d3d
cc -ISupport:,OS: -fach -wp -DDRAWFILE -depend !Depend -c -zM -ff -o o.verify c.verify
Norcroft RISC OS ARM C vsn 5.06 (Acorn Computers Ltd) [Feb 16 1995]
cc -ISupport:,OS: -fach -wp -DDRAWFILE -depend !Depend -c -zM -ff -o o.trfm <Support$Dir>.c.trfm
Norcroft RISC OS ARM C vsn 5.06 (Acorn Computers Ltd) [Feb 16 1995]
cc -ISupport:,OS: -fach -wp -DDRAWFILE -depend !Depend -c -zM -ff -o o.textarea c.textarea
Norcroft RISC OS ARM C vsn 5.06 (Acorn Computers Ltd) [Feb 16 1995]
cc -ISupport:,OS: -fach -wp -DDRAWFILE -depend !Depend -c -zM -ff -o o.riscos <Support$Dir>.c.riscos
Norcroft RISC OS ARM C vsn 5.06 (Acorn Computers Ltd) [Feb 16 1995]
cc -ISupport:,OS: -fach -wp -DDRAWFILE -depend !Depend -c -zM -ff -o o.render c.render
Norcroft RISC OS ARM C vsn 5.06 (Acorn Computers Ltd) [Feb 16 1995]
ObjAsm -depend !Depend -stamp -quit <Support$Dir>.asm.muldiv o.muldiv
ARM AOF Macro Assembler 3.06 (Acorn Computers Ltd) [Jan 11 1995]
cc -ISupport:,OS: -fach -wp -DDRAWFILE -depend !Depend -c -zM -ff -o o.main c.main
Norcroft RISC OS ARM C vsn 5.06 (Acorn Computers Ltd) [Feb 16 1995]
"c.main", line 279: Warning: variable 'regs' declared but not used
c.main: 1 warning, 0 errors, 0 serious errors
CMHG cmhg.header o.header
cc -ISupport:,OS: -fach -wp -DDRAWFILE -depend !Depend -c -zM -ff -o o.declare c.declare
Norcroft RISC OS ARM C vsn 5.06 (Acorn Computers Ltd) [Feb 16 1995]
cc -ISupport:,OS: -fach -wp -DDRAWFILE -depend !Depend -c -zM -ff -o o.callback <Support$Dir>.c.callback
Norcroft RISC OS ARM C vsn 5.06 (Acorn Computers Ltd) [Feb 16 1995]
cc -ISupport:,OS: -fach -wp -DDRAWFILE -depend !Depend -c -zM -ff -o o.bbox c.bbox
Norcroft RISC OS ARM C vsn 5.06 (Acorn Computers Ltd) [Feb 16 1995]
Link -o aof.DrawFile -aof o.bbox o.callback o.declare o.header o.main o.muldiv o.render o.riscos o.textarea o.trfm o.verify OSLib:OSLib.o RISC_OSLib:o.romcstubs
DrawFile: rom module built
CMHG cmhg.header o.header
Link -o aof.DrawFile -aof o.bbox o.callback o.declare o.header o.main o.muldiv o.render o.riscos o.textarea o.trfm o.verify OSLib:OSLib.o RISC_OSLib:o.romcstubs
DrawFile: rom module built
cc -ISupport:,OS: -fach -wp -DDRAWFILE -depend !Depend -c -zM -ff -o o.riscos <Support$Dir>.c.riscos
Norcroft RISC OS ARM C vsn 5.06 (Acorn Computers Ltd) [Feb 16 1995]
Link -o aof.DrawFile -aof o.bbox o.callback o.declare o.header o.main o.muldiv o.render o.riscos o.textarea o.trfm o.verify OSLib:OSLib.o RISC_OSLib:o.romcstubs
DrawFile: rom module built
DrawFile was built with version 0.10 of the Support library.
To allow the objects to be rebuilt as released, the two
Support library files riscos.h and riscos.c have been copied
locally from version 0.10.
Apart from building identical objects, DrawFile can be built
with the latest version of Lib.Support.
AMcC (27-Apr-95)
| 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 rm.DrawFile
echo done
This diff is collapsed.
l.drawfile.0x45540x.o.000
l.drawfile.0x45540.o.000
l.drawfile.0x45540x.o.001
l.drawfile.0x45540.o.001
l.drawfile.0x45540x.o.002
l.drawfile.0x45540.o.002
l.drawfile.0x00030x.o.003
l.drawfile.0x00030.o.003
l.drawfile.0x00030x.o.004
l.drawfile.0x00030.o.004
/* 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.
*/
/*riscos.c - useful functions for windowing applications*/
/*From CLib*/
#include <stdarg.h>
#include <stdio.h>
#include <string.h>
/*From OSLib*/
#include "messagetrans.h"
#include "macros.h"
#include "os.h"
#include "territory.h"
#include "wimp.h"
/*From Support*/
#include "m.h"
#include "riscos.h"
#include "trace.h"
#ifndef BOOTCMDS
static char *Decimal_Point = ".";
static int Decimal_Point_Len = 1;
#endif
#ifndef BOOTCMDS
static os_error *Error_Lookup (int errnum, char *token, va_list list)
{ char *p [4];
int i;
os_error error;
tracef ("Error_Lookup (%d, %s)\n" _ errnum _ token);
/*Assume that 4 args are always given.*/
for (i = 0; i < 4; i++) p [i] = va_arg (list, char *);
error.errnum = errnum;
riscos_strcpy (error.errmess, token);
return xmessagetrans_error_lookup (&error, NULL,
NULL, 0, p [0], p [1], p [2], p [3]);
}
#endif
#ifndef BOOTCMDS
/*------------------------------------------------------------------------*/
os_error *riscos_territory (territory_t t)
{ os_error *error = NULL;
/*Fix MED-3471: use "." if there is no territory yet. A correct
application will call this function again if the territory changes.
JRC 12th Dec 1994*/
if (xterritory_read_string_symbols (t, territory_SYMBOL_DECIMAL_POINT,
&Decimal_Point) != NULL)
Decimal_Point = ".";
Decimal_Point_Len = strlen (Decimal_Point);
/*finish:*/
return error;
}
/*------------------------------------------------------------------------*/
os_error *riscos_error_lookup (int errnum, char *token, ...)
{ va_list list;
os_error *error;
tracef ("riscos_error_lookup (%d, %s)\n" _ errnum _ token);
va_start (list, token);
error = Error_Lookup (errnum, token, list);
va_end (list);
return error;
}
#endif
#if TRACE
/*------------------------------------------------------------------------*/
void riscos__assert (char *file, int line, char *msg)
{ os_error error;
int len;
tracef ("riscos__assert\n");
error.errnum = 1;
sprintf (error.errmess, "\"%.*s\", line %d: %n",
sizeof error.errmess - 11 - UNSIGNED_WIDTH - 1, file, line, &len);
riscos_strncpy (&error.errmess [len], msg, os_ERROR_LIMIT - len - 1);
(void) xwimp_report_error (&error, wimp_ERROR_BOX_SHORT_TITLE,
"Assertion failure", NULL);
}
#endif
/*------------------------------------------------------------------------*/
int riscos_strlen (char *s)
/* Calculates the length of a string in the traditional RiSC O S way.
*/
{ int l = 0;
while (s [l] >= ' ')
l++;
return l;
}
#ifndef BOOTCMDS
/*------------------------------------------------------------------------*/
char *riscos_strcpy (char *s1, char *s)
/* Copy a string in the traditional RiSC O S way.
*/
{ int i = 0;
while ((s1 [i] = s [i]) >= ' ')
i++;
s1 [i] = '\0';
return s1;
}
#endif
/*------------------------------------------------------------------------*/
char *riscos_strncpy (char *s1, char *s, int n)
/* Copy a RISC O S string of limited length, like
* sprintf (s1, "%.*s", MIN (n, riscos_strlen (s)), s);
*/
{ int i;
/*Copy up to |n| characters of the string*/
for (i = 0; s [i] >= ' ' && i < n; i++)
s1 [i] = s [i];
/*Append a terminator.*/
s1 [i] = '\0';
return s1;
}
#ifndef BOOTCMDS
/*------------------------------------------------------------------------*/
char *riscos_format_dec (char *s, int i, int width, int prec)
{ tracef ("riscos_format_dec (%d)\n" _ i);
if (sprintf (s, "%*.*d", width, prec, i) < 1)
CLEAR (s);
return s;
}
#ifndef PICKER
/*------------------------------------------------------------------------*/
char *riscos_format_hex (char *s, int i, int width, int prec)
{ tracef ("riscos_format_hex (0x%X)\n" _ i);
if (sprintf (s, "%*.*X", width, prec, i) < 1)
CLEAR (s);
return s;
}
#endif
/*------------------------------------------------------------------------*/
char *riscos_format_char (char *s, char c)
{ tracef ("riscos_format_char ('%c')\n" _ c);
if (sprintf (s, "%c", c) < 1)
CLEAR (s);
return s;
}
/*------------------------------------------------------------------------*/
char *riscos_format_fixed (char *s, int mul, int div, int width, int prec)
/*Like |sprintf (s, "*.*f", width, prec, mul/div)|, but using integers
only. |Div| must be > 0.*/
{ int i, scale;
tracef ("riscos_format_fixed (%d/%d)\n" _ mul _ div);
scale = 1;
for (i = 0; i < prec; i++) scale *= 10;
i = SGN (mul)*((unsigned) ABS (mul)/div);
if (prec > 0)
{ int f = (scale*ABS (mul)/div)%scale;
if (sprintf (s, "%*d%s%*.*d\n", MAX (width - prec - 1, 0), i,
Decimal_Point, prec, prec, f) < 2)
CLEAR (s);
}
else
{ if (sprintf (s, "%*d\n", width, i) < 1)
CLEAR (s);
}
return s;
}
/*------------------------------------------------------------------------*/
int riscos_scan_dec (char *s, int *i_out)
{ int i, width;
tracef ("riscos_scan_dec\n");
if (sscanf (s, "%d%n", &i, &width) < 1)
return 0;
if (i_out != NULL) *i_out = i;
return width;
}
#endif
#ifndef BOOTCMDS
#ifndef PICKER
/*------------------------------------------------------------------------*/
int riscos_scan_hex (char *s, int *i_out)
{ int i, width;
tracef ("riscos_scan_hex\n");
if (sscanf (s, "%x%n", &i, &width) < 1)
return 0;
if (i_out != NULL) *i_out = i;
return width;
}
#endif
#endif
#ifndef BOOTCMDS
/*------------------------------------------------------------------------*/
int riscos_scan_fixed (char *s, int *mul_out, int div)
{ int mul = 0, place, sgn = 1;
char *cc = s;
tracef ("riscos_scan_fixed (s \"%s\", div %d)\n" _ s _ div);
/*Skip leading spaces.*/
cc += strspn (s, " \t\xA0");
/*Fix MED-4986: '\n' is a terminator! J R C 16th Mar 1995*/
if (*cc == '-') sgn = -1, cc++;
for (; ISDIGIT (*cc); cc++)
mul = 10*mul + DIGIT (*cc);
tracef ("SGN %d, INT %d\n" _ sgn _ mul);
mul *= div;
if (strncmp (cc, Decimal_Point, Decimal_Point_Len) == 0)
cc += Decimal_Point_Len;
/*Add in the fractional part too.*/
for (place = 10; ISDIGIT (*cc); cc++, place *= 10)
mul += div*DIGIT (*cc)/place;
tracef ("MUL %d\n" _ mul);
if (mul_out != NULL) *mul_out = sgn*mul;
return cc - s;
}
#endif
/* 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.
*/
#ifndef riscos_H
#define riscos_H
/*From OSLib*/
#ifndef os_H
#include "os.h"
#endif
#ifndef territory_H
#include "territory.h"
#endif
/* Function to change the territory in use for |riscos_{scan/format}_fixed.
*/
extern os_error *riscos_territory (territory_t);
/* Macro to provide an assertion facility using Wimp_ReportError.
*/
#define riscos_assert(c) \
(!(c)? riscos__assert (__FILE__, __LINE__, #c): (void) SKIP)
/* Function to be used by |riscos_assert()| - not for external use.
*/
extern void riscos__assert (char *file, int line, char *msg);
/* Function to return an |os_error *| from an error token in the global
* messages file.
*/
extern os_error *riscos_error_lookup (int errnum, char *token, ...);
/* Trivial functions to do things "the RISC O S way" rather than "the C
* way." This means treating strings as control-char terminated, rather
* than 0-terminated. These can be printed using a format of
* "%.*s" and passing in the length of the string, as calculated by
* |riscos_strlen|, as a argument to the printing function. Note that
* riscos_strncpy() is not like strncpy(): it always terminates its output.
*/
extern int riscos_strlen (char *s);
extern char *riscos_strcpy (char *s1, char *s);
extern char *riscos_strncpy (char *s1, char *s, int n);
/* Useful string processing functions, designed to allow safe in-line use
* by taking a buffer argument, the pointer to which they return.
*/
extern char *riscos_format_dec (char *s, int i, int width, int prec);
/*sprintf (s, "%*.*d", width, prec, i)*/
extern char *riscos_format_hex (char *s, int i, int width, int prec);
/*sprintf (s, "%*.*X", width, prec, i)*/
extern char *riscos_format_char (char *s, char c);
/*sprintf (s, "%c", c)*/
extern char *riscos_format_fixed (char *s, int mul, int div, int width,
int prec); /*sprintf (s, "*.*f", width, prec, mul/div)*/
/* Functions to read back the items above - these return the number of
* characters successfully read, 0 for error.
*/
extern int riscos_scan_dec (char *s, int *i_out);
/*sscanf (s, "%d", i)*/
extern int riscos_scan_hex (char *s, int *i_out);
/*sscanf (s, "%x", i)*/
extern int riscos_scan_fixed (char *s, int *mul_out, int div);
/*sscanf (s, "%lf", mul), mul *= div*/
#endif
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