File: type.h

package info (click to toggle)
elk 3.0-6
  • links: PTS
  • area: main
  • in suites: potato, slink
  • size: 4,068 kB
  • ctags: 3,123
  • sloc: ansic: 20,686; lisp: 5,232; makefile: 419; awk: 91; sh: 21
file content (27 lines) | stat: -rw-r--r-- 659 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
/* Miscellaneous macros for type-checking Scheme objects.
 */

#define Check_Type(x,t) {\
    if (TYPE(x) != t) Wrong_Type (x, t);\
}

#define Check_List(x) {\
    if (TYPE(x) != T_Pair && !Nullp (x)) Wrong_Type_Combination (x, "list");\
}

#define Check_Number(x) {\
    register t = TYPE(x);\
    if (!Numeric (t)) Wrong_Type_Combination (x, "number");\
}

/* This should be renamed; it checks whether x is an *exact* integer.
 */
#define Check_Integer(x) {\
    register t = TYPE(x);\
    if (t != T_Fixnum && t != T_Bignum) Wrong_Type (x, T_Fixnum);\
}

#define Check_Mutable(x) {\
    if (ISCONST(x))\
	Primitive_Error ("attempt to modify constant");\
}