aboutsummaryrefslogtreecommitdiffstats
path: root/mps/code/range.h
diff options
context:
space:
mode:
authorGareth Rees2013-05-20 20:45:52 +0100
committerGareth Rees2013-05-20 20:45:52 +0100
commit082f12d68ec69cbdedb159493fa2f634412f5a39 (patch)
tree572c49ff6fa11bf34f043fae9b2a8d2a70c74b0b /mps/code/range.h
parent2849a0bd33b8aa80910cb31cbdc25b9177fa9b8b (diff)
downloademacs-082f12d68ec69cbdedb159493fa2f634412f5a39.tar.gz
emacs-082f12d68ec69cbdedb159493fa2f634412f5a39.zip
New module range handles common operations on address ranges.
Copied from Perforce Change: 182015 ServerID: perforce.ravenbrook.com
Diffstat (limited to 'mps/code/range.h')
-rw-r--r--mps/code/range.h85
1 files changed, 85 insertions, 0 deletions
diff --git a/mps/code/range.h b/mps/code/range.h
new file mode 100644
index 00000000000..24c1ca39e2d
--- /dev/null
+++ b/mps/code/range.h
@@ -0,0 +1,85 @@
1/* range.h: ADDRESS RANGE INTERFACE
2 *
3 * $Id$
4 * Copyright (c) 2013 Ravenbrook Limited. See end of file for license.
5 *
6 * .purpose: Representation of address ranges.
7 */
8
9#ifndef range_h
10#define range_h
11
12#include "mpmtypes.h"
13
14
15/* Signatures */
16
17#define RangeSig ((Sig)0x5196A493) /* SIGnature RANGE */
18
19
20/* Prototypes */
21
22typedef struct RangeStruct *Range;
23
24#define RangeBase(range) ((range)->base)
25#define RangeLimit(range) ((range)->limit)
26#define RangeSize(range) (AddrOffset(RangeBase(range), RangeLimit(range)))
27
28extern Res RangeInit(Range range, Addr base, Addr limit);
29extern void RangeFinish(Range range);
30extern Res RangeDescribe(Range range, mps_lib_FILE *stream);
31extern Bool RangeCheck(Range range);
32extern Bool RangeOverlap(Range range1, Range range2);
33
34
35/* Types */
36
37typedef struct RangeStruct {
38 Sig sig;
39 Addr base;
40 Addr limit;
41} RangeStruct;
42
43#endif /* range_h */
44
45
46/* C. COPYRIGHT AND LICENSE
47 *
48 * Copyright (C) 2013 Ravenbrook Limited <http://www.ravenbrook.com/>.
49 * All rights reserved. This is an open source license. Contact
50 * Ravenbrook for commercial licensing options.
51 *
52 * Redistribution and use in source and binary forms, with or without
53 * modification, are permitted provided that the following conditions are
54 * met:
55 *
56 * 1. Redistributions of source code must retain the above copyright
57 * notice, this list of conditions and the following disclaimer.
58 *
59 * 2. Redistributions in binary form must reproduce the above copyright
60 * notice, this list of conditions and the following disclaimer in the
61 * documentation and/or other materials provided with the distribution.
62 *
63 * 3. Redistributions in any form must be accompanied by information on how
64 * to obtain complete source code for this software and any accompanying
65 * software that uses this software. The source code must either be
66 * included in the distribution or be available for no more than the cost
67 * of distribution plus a nominal fee, and must be freely redistributable
68 * under reasonable conditions. For an executable file, complete source
69 * code means the source code for all modules it contains. It does not
70 * include source code for modules or files that typically accompany the
71 * major components of the operating system on which the executable file
72 * runs.
73 *
74 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
75 * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
76 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
77 * PURPOSE, OR NON-INFRINGEMENT, ARE DISCLAIMED. IN NO EVENT SHALL THE
78 * COPYRIGHT HOLDERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
79 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
80 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
81 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
82 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
83 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
84 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
85 */