From 6c50b05d701d7aa49c00b75f00e2fc185a77b71c Mon Sep 17 00:00:00 2001 From: Chris Hanson Date: Wed, 23 Dec 1987 03:44:55 +0000 Subject: [PATCH] Implement more argument macros. Implement two new macros, `ARG_LOC' and `LEXPR_N_ARGUMENTS', to facilitate writing lexpr primitives. --- v7/src/microcode/prims.h | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/v7/src/microcode/prims.h b/v7/src/microcode/prims.h index b3f7b94e3..67c6d086b 100644 --- a/v7/src/microcode/prims.h +++ b/v7/src/microcode/prims.h @@ -30,7 +30,7 @@ Technology nor of any adaptation thereof in any advertising, promotional, or sales literature without prior written consent from MIT in each case. */ -/* $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/prims.h,v 9.31 1987/12/04 22:18:44 jinx Exp $ */ +/* $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/prims.h,v 9.32 1987/12/23 03:44:55 cph Rel $ */ /* This file contains some macros for defining primitives, for argument type or value checking, and for accessing @@ -188,7 +188,10 @@ do \ error_wrong_type_arg (argument); \ } while (0) -#define ARG_REF(argument) (Stack_Ref (argument - 1)) +#define ARG_LOC(argument) (STACK_LOC (argument - 1)) +#define ARG_REF(argument) (STACK_REF (argument - 1)) + +#define LEXPR_N_ARGUMENTS() (Regs [REGBLOCK_LEXPR_ACTUALS]) extern long arg_nonnegative_integer (); extern long arg_index_integer (); @@ -251,3 +254,23 @@ do { if ((GC_Type (Arg3)) != GCTC) error_wrong_type_arg (3); } while (0) : ((char *) (error_wrong_type_arg (arg)))) #define BOOLEAN_ARG(arg) ((ARG_REF (arg)) != NIL) + +#define CELL_ARG(arg) \ + ((CELL_P (ARG_REF (arg))) \ + ? (ARG_REF (arg)) \ + : ((Pointer) (error_wrong_type_arg (arg)))) + +#define PAIR_ARG(arg) \ + ((PAIR_P (ARG_REF (arg))) \ + ? (ARG_REF (arg)) \ + : ((Pointer) (error_wrong_type_arg (arg)))) + +#define WEAK_PAIR_ARG(arg) \ + ((WEAK_PAIR_P (ARG_REF (arg))) \ + ? (ARG_REF (arg)) \ + : ((Pointer) (error_wrong_type_arg (arg)))) + +#define VECTOR_ARG(arg) \ + ((VECTOR_P (ARG_REF (arg))) \ + ? (ARG_REF (arg)) \ + : ((Pointer) (error_wrong_type_arg (arg)))) -- 2.25.1