Commit c3dc1953 authored by Richard Buckley's avatar Richard Buckley
Browse files

Added h files from SupportLib.

parent 573576ea
/* 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 callback_H
#define callback_H
/* Changed by J R C 16th Aug 1994 to return |os_error *|.
*/
#ifndef os_H
#include "os.h"
#endif
#ifndef trace_H
#include "trace.h"
#endif
/* The type of a callback function.
*/
typedef os_error *callback_fn (void *, void *, bool *);
/* The type of a callback list.
*/
typedef struct callback_l *callback_l;
/* Function to create a new, empty callback list.
*/
extern os_error *callback_new (callback_l *);
/* Function to delete a callback list.
*/
extern os_error *callback_delete (callback_l);
/* Function to make all the callbacks registered in a given list for
* the given key values.
*
* callback_l the callback list to be scanned
* void * a handle to be passed to the functions called
* int the number of key values to be matched
* ... the keys themselves
*
* Every function registered in the callback list with the given key
* values will be called, and passed the given handle, until
* one is claimed.
*/
extern os_error *callback (callback_l, void *, bool *, int, ...);
/* Function to register a new callback function.
*
* callback_l the callback list to be extended
* callback_fn * the function to call
* void * a handle to be passed to the function when it is called
* int the number of key values provided
* ... a list of integer key values
*
* The function and handle will be registered in the callback list.
*/
extern os_error *callback_register (callback_l, callback_fn *, void *,
int, ...);
/* Function to deregister a callback function. The callback list is
* scanned for a single match to the (function, handle) pair at the given
* key values, and it is deleted.
*/
extern os_error *callback_deregister (callback_l, void *, int, ...);
#if TRACE
extern void callback_trace (callback_l);
#else
#define callback_trace(l) SKIP
#endif
#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.
*/
/*tracef.h*/
#ifndef trace_H
#define trace_H
#ifndef TRACE
#define TRACE 0
#endif
#ifndef os_H
#include "os.h"
#endif
#if TRACE
#define tracef(args) trace_f (__FILE__, __LINE__, args)
#define tracevdu(s, n) trace_vdu (s, n)
#define tracewait(t) trace_wait (__FILE__, __LINE__, t)
extern os_error *trace_initialise (char *var);
extern os_error *trace_terminate (void);
extern void trace_f (char *file, int line, char *, ...);
extern void trace_vdu (char *, int);
extern void trace_wait (char *file, int line, int t);
#else
#define tracef(args) SKIP
#define tracevdu(args) SKIP
#define tracewait(args) SKIP
#define trace_initialise(var) SKIP
#define trace_terminate() SKIP
#define trace_f(args) SKIP
#define trace_vdu(s, n) SKIP
#define trace_wait(t) SKIP
#endif
#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 m_H
#define m_H
/*m.h - redirection for memory allocation functions*/
/*From CLib*/
#include <stdlib.h>
/*From Support*/
#ifndef realloc_H
#include "realloc.h"
#endif
#ifndef trace_H
#include "trace.h"
#endif
/*To use this module, you must call m_ALLOC, m_FREE, m_REALLOC in place
of malloc, free, realloc at ALL PLACES in the programme. Then it is
possible to change your allocation discipline by changing the values of
these macros.*/
#if TRACE
extern void *m_alloc (char *file, int line, int);
extern void m_free (char *file, int line, void *ptr, int size);
extern void *m_realloc (char *file, int line, void *ptr, int old_size,
int size);
extern void m_summary (char *file, int line);
extern void *m_validate_address (char *file, int line, void *ptr);
#define m_ALLOC(size) \
m_alloc (__FILE__, __LINE__, size)
#define m_FREE(ptr, size) \
m_free (__FILE__, __LINE__, ptr, size)
#define m_REALLOC(ptr, old_size, size) \
m_realloc (__FILE__, __LINE__, ptr, old_size, size)
#define m_SUMMARY() \
m_summary (__FILE__, __LINE__)
#define m_VALIDATE_ADDRESS(ptr) \
m_validate_address (__FILE__, __LINE__, ptr)
#else
#define m_ALLOC(size) malloc (size)
#define m_FREE(ptr, size) free (ptr)
#define m_REALLOC(ptr, old_size, size) REALLOC (ptr, size)
#define m_SUMMARY() SKIP
#define m_VALIDATE_ADDRESS(ptr) ((void *) (ptr))
#endif
#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 muldiv_H
#define muldiv_H
/*muldiv.h*/
extern int muldiv (int, int, int);
#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 int riscos_strcmp (char *s0, char *s1);
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
/* 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 trfm_H
#define trfm_H
/*trfm.h - header file for transformations*/
#ifndef os_H
#include "os.h"
#endif
extern void trfm_mul (os_trfm *, os_trfm *, os_trfm *);
extern void trfm_point (os_coord *, os_trfm *, os_coord *);
extern void trfm_dir (os_coord *, os_trfm *, os_coord *);
extern void trfm_inv (os_trfm *, os_trfm *);
extern int trfm_det (os_trfm *);
extern void trfm_box (os_box *, os_trfm *, os_box *);
#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