source: trunk/ccl/lisp-kernel/macros.h @ 6

Last change on this file since 6 was 6, checked in by gb, 16 years ago

Initial revision

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 1.7 KB
Line 
1/*
2   Copyright (C) 1994-2001 Digitool, Inc
3   This file is part of OpenMCL. 
4
5   OpenMCL is licensed under the terms of the Lisp Lesser GNU Public
6   License , known as the LLGPL and distributed with OpenMCL as the
7   file "LICENSE".  The LLGPL consists of a preamble and the LGPL,
8   which is distributed with OpenMCL as the file "LGPL".  Where these
9   conflict, the preamble takes precedence. 
10
11   OpenMCL is referenced in the preamble as the "LIBRARY."
12
13   The LLGPL is also available online at
14   http://opensource.franz.com/preamble.html
15*/
16
17/* Totally different content than 'macros.s' */
18
19
20
21#ifndef __macros__
22#define __macros__
23
24#define lisp_reg_p(reg)  ((reg) >= fn)
25
26#define fulltag_of(o)  ((o) & fulltagmask)
27#define tag_of(o) ((o) & tagmask)
28#define untag(o) ((o) & ~fulltagmask)
29
30#define deref(o,n) (*((LispObj*) ((LispObj *)(untag((LispObj)o)))+(n)))
31#define header_of(o) deref(o,0)
32
33#define header_subtag(h) ((h) & subtagmask)
34#define header_element_count(h) ((h) >> num_subtag_bits)
35#define make_header(subtag,element_count) ((subtag)|((element_count)<<num_subtag_bits))
36
37#define unbox_fixnum(x) ((int)(((int)(x))>>fixnum_shift))
38#define box_fixnum(x) ((x)<<fixnum_shift)
39
40#define car(x) (((cons *)(untag(x)))->car)
41#define cdr(x) (((cons *)(untag(x)))->cdr)
42
43/* "sym" is an untagged pointer to a symbol */
44#define BOUNDP(sym)  ((((lispsymbol *)(sym))->vcell) != undefined)
45
46/* Likewise. */
47#define FBOUNDP(sym) ((((lispsymbol *)(sym))->fcell) != nrs_UDF.vcell)
48
49
50/* lfuns */
51#define lfun_bits(f) (deref(f,header_element_count(header_of(f))))
52#define named_function_p(f) (!(lfun_bits(f)&(1<<(29+fixnum_shift))))
53#define named_function_name(f) (deref(f,-1+header_element_count(header_of(f))))
54
55#endif
Note: See TracBrowser for help on using the repository browser.