| 1 |
/* |
| 2 |
* primtab.h |
| 3 |
* |
| 4 |
* This file is part of the Oxford Oberon-2 compiler |
| 5 |
* Copyright (c) 2006--2016 J. M. Spivey |
| 6 |
* All rights reserved |
| 7 |
* |
| 8 |
* Redistribution and use in source and binary forms, with or without |
| 9 |
* modification, are permitted provided that the following conditions are met: |
| 10 |
* |
| 11 |
* 1. Redistributions of source code must retain the above copyright notice, |
| 12 |
* this list of conditions and the following disclaimer. |
| 13 |
* 2. Redistributions in binary form must reproduce the above copyright notice, |
| 14 |
* this list of conditions and the following disclaimer in the documentation |
| 15 |
* and/or other materials provided with the distribution. |
| 16 |
* 3. The name of the author may not be used to endorse or promote products |
| 17 |
* derived from this software without specific prior written permission. |
| 18 |
* |
| 19 |
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
| 20 |
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
| 21 |
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
| 22 |
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 23 |
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
| 24 |
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; |
| 25 |
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, |
| 26 |
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR |
| 27 |
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF |
| 28 |
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 |
*/ |
| 30 |
|
| 31 |
#include "obx.h" |
| 32 |
|
| 33 |
/* Types for arguments */ |
| 34 |
typedef int type_C, type_S, type_I; |
| 35 |
typedef longint type_L; |
| 36 |
typedef float type_F; |
| 37 |
typedef double type_D; |
| 38 |
typedef void *type_P, *type_Q, *type_X; |
| 39 |
typedef void type_V; |
| 40 |
|
| 41 |
/* How to fetch each kind of argument */ |
| 42 |
#define arg_C(j) align_byte(bp[HEAD+j].i) |
| 43 |
#define arg_I(j) bp[HEAD+j].i |
| 44 |
#define arg_S(j) align_short(bp[HEAD+j].i) |
| 45 |
#define arg_F(j) bp[HEAD+j].f |
| 46 |
#define arg_P(j) pointer(bp[HEAD+j]) |
| 47 |
#define arg_L(j) get_long(&bp[HEAD+j]) |
| 48 |
#define arg_D(j) get_double(&bp[HEAD+j]) |
| 49 |
#define arg_X(j) pointer(bp[HEAD+j]) |
| 50 |
#define arg_Q(j) ((void *) (ptrtype) get_long(&bp[HEAD+j])) |
| 51 |
|
| 52 |
/* How to return each kind of result */ |
| 53 |
#define res_I(v) (*--sp).i = v |
| 54 |
#define res_S(v) (*--sp).i = v |
| 55 |
#define res_C(v) (*--sp).i = v |
| 56 |
#define res_F(v) (*--sp).f = v |
| 57 |
#define res_L(v) sp -= 2, put_long(sp, v) |
| 58 |
#define res_D(v) sp -= 2, put_double(sp, v) |
| 59 |
#define res_Q(v) sp -= 2, put_long(sp, (ptrtype) v) |
| 60 |
#define res_V(v) v |