home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / mitsch75.zip / scheme-7_5_17-src.zip / scheme-7.5.17 / src / microcode / prim.h < prev    next >
C/C++ Source or Header  |  2001-03-08  |  2KB  |  76 lines

  1. /* -*-C-*-
  2.  
  3. $Id: prim.h,v 9.46 2001/03/08 18:00:26 cph Exp $
  4.  
  5. Copyright (c) 1987-2001 Massachusetts Institute of Technology
  6.  
  7. This program is free software; you can redistribute it and/or modify
  8. it under the terms of the GNU General Public License as published by
  9. the Free Software Foundation; either version 2 of the License, or (at
  10. your option) any later version.
  11.  
  12. This program is distributed in the hope that it will be useful, but
  13. WITHOUT ANY WARRANTY; without even the implied warranty of
  14. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  15. General Public License for more details.
  16.  
  17. You should have received a copy of the GNU General Public License
  18. along with this program; if not, write to the Free Software
  19. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  20. */
  21.  
  22. /* Primitive declarations.
  23.    Note that the following cannot be changed without changing
  24.    findprim.c.
  25.  */
  26.  
  27. #ifndef SCM_PRIM_H
  28. #define SCM_PRIM_H
  29.  
  30. typedef SCHEME_OBJECT EXFUN ((*primitive_procedure_t), (void));
  31.  
  32. extern primitive_procedure_t * Primitive_Procedure_Table;
  33. extern int * Primitive_Arity_Table;
  34. extern int * Primitive_Count_Table;
  35. extern CONST char ** Primitive_Name_Table;
  36. extern CONST char ** Primitive_Documentation_Table;
  37. extern long MAX_PRIMITIVE;
  38.  
  39. extern SCHEME_OBJECT EXFUN
  40.   (declare_primitive,
  41.    (CONST char *, primitive_procedure_t, int, int, CONST char *));
  42.  
  43. extern SCHEME_OBJECT EXFUN
  44.   (install_primitive,
  45.    (CONST char *, primitive_procedure_t, int, int, CONST char *));
  46.  
  47. extern SCHEME_OBJECT EXFUN (Prim_unimplemented, (void));
  48.  
  49. #define PRIMITIVE_NUMBER(primitive) (OBJECT_DATUM (primitive))
  50.  
  51. #define MAKE_PRIMITIVE_OBJECT(index) (MAKE_OBJECT (TC_PRIMITIVE, (index)))
  52.  
  53. #define IMPLEMENTED_PRIMITIVE_P(prim)                    \
  54.   ((Primitive_Procedure_Table[(PRIMITIVE_NUMBER (prim))])        \
  55.    != Prim_unimplemented)
  56.  
  57. #define NUMBER_OF_PRIMITIVES()    (MAX_PRIMITIVE)
  58.  
  59. #define PRIMITIVE_ARITY(prim)                        \
  60.   (Primitive_Arity_Table [PRIMITIVE_NUMBER (prim)])
  61.  
  62. #define PRIMITIVE_DOCUMENTATION(prim)                    \
  63.   (Primitive_Documentation_Table[(PRIMITIVE_NUMBER (prim))])
  64.  
  65. #define PRIMITIVE_NAME(prim)                        \
  66.   (Primitive_Name_Table[(PRIMITIVE_NUMBER (prim))])
  67.  
  68. #define PRIMITIVE_N_PARAMETERS(prim) (PRIMITIVE_ARITY (prim))
  69.  
  70. #define PRIMITIVE_N_ARGUMENTS(prim)                    \
  71.   (((PRIMITIVE_ARITY (prim)) == LEXPR_PRIMITIVE_ARITY)            \
  72.    ? ((long) (Regs[REGBLOCK_LEXPR_ACTUALS]))                \
  73.    : (PRIMITIVE_ARITY (prim)))
  74.  
  75. #endif /* SCM_PRIM_H */
  76.