home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / vol_100 / 176_01 / xlftab.c < prev    next >
Text File  |  1985-12-21  |  8KB  |  261 lines

  1. /* xlftab.c - xlisp function table */
  2. /*    Copyright (c) 1985, by David Michael Betz
  3.     All Rights Reserved
  4.     Permission is granted for unrestricted non-commercial use    */
  5.  
  6. #include "xlisp.h"
  7.  
  8. /* external functions */
  9. extern NODE
  10.     *xeval(),*xapply(),*xfuncall(),*xquote(),*xfunction(),*xbquote(),
  11.     *xlambda(),*xset(),*xsetq(),*xsetf(),*xdefun(),*xdefmacro(),
  12.     *xgensym(),*xmakesymbol(),*xintern(),
  13.     *xsymname(),*xsymvalue(),*xsymplist(),*xget(),*xputprop(),*xremprop(),
  14.     *xhash(),*xmkarray(),*xaref(),
  15.     *xcar(),*xcdr(),
  16.     *xcaar(),*xcadr(),*xcdar(),*xcddr(),
  17.     *xcaaar(),*xcaadr(),*xcadar(),*xcaddr(),
  18.     *xcdaar(),*xcdadr(),*xcddar(),*xcdddr(),
  19.     *xcaaaar(),*xcaaadr(),*xcaadar(),*xcaaddr(),
  20.     *xcadaar(),*xcadadr(),*xcaddar(),*xcadddr(),
  21.     *xcdaaar(),*xcdaadr(),*xcdadar(),*xcdaddr(),
  22.     *xcddaar(),*xcddadr(),*xcdddar(),*xcddddr(),
  23.     *xcons(),*xlist(),*xappend(),*xreverse(),*xlast(),*xnth(),*xnthcdr(),
  24.     *xmember(),*xassoc(),*xsubst(),*xsublis(),*xremove(),*xlength(),
  25.     *xmapc(),*xmapcar(),*xmapl(),*xmaplist(),
  26.     *xrplca(),*xrplcd(),*xnconc(),*xdelete(),
  27.     *xatom(),*xsymbolp(),*xnumberp(),*xboundp(),*xnull(),*xlistp(),*xconsp(),
  28.     *xeq(),*xeql(),*xequal(),
  29.     *xcond(),*xcase(),*xand(),*xor(),*xlet(),*xletstar(),*xif(),
  30.     *xprog(),*xprogstar(),*xprog1(),*xprog2(),*xprogn(),*xgo(),*xreturn(),
  31.     *xcatch(),*xthrow(),
  32.     *xerror(),*xcerror(),*xbreak(),*xcleanup(),*xcontinue(),*xerrset(),
  33.     *xbaktrace(),*xevalhook(),
  34.     *xdo(),*xdostar(),*xdolist(),*xdotimes(),
  35.     *xminusp(),*xzerop(),*xplusp(),*xevenp(),*xoddp(),
  36.     *xfix(),*xfloat(),
  37.     *xadd(),*xsub(),*xmul(),*xdiv(),*xrem(),*xmin(),*xmax(),*xabs(),
  38.     *xadd1(),*xsub1(),*xbitand(),*xbitior(),*xbitxor(),*xbitnot(),
  39.     *xsin(),*xcos(),*xtan(),*xexpt(),*xexp(),*xsqrt(),*xrand(),
  40.     *xlss(),*xleq(),*xequ(),*xneq(),*xgeq(),*xgtr(),
  41.     *xstrcat(),*xsubstr(),*xstring(),*xchar(),
  42.     *xread(),*xprint(),*xprin1(),*xprinc(),*xterpri(),
  43.     *xflatsize(),*xflatc(),
  44.     *xopeni(),*xopeno(),*xclose(),*xrdchar(),*xpkchar(),*xwrchar(),*xreadline(),
  45.     *xload(),*xgc(),*xexpand(),*xalloc(),*xmem(),*xtype(),*xexit();
  46.  
  47.  
  48. /* the function table */
  49. struct fdef ftab[] = {
  50.  
  51.     /* evaluator functions */
  52. {    "EVAL",        SUBR,    xeval        },
  53. {    "APPLY",    SUBR,    xapply        },
  54. {    "FUNCALL",    SUBR,    xfuncall    },
  55. {    "QUOTE",    FSUBR,    xquote        },
  56. {    "FUNCTION",    FSUBR,    xfunction    },
  57. {    "BACKQUOTE",    FSUBR,    xbquote        },
  58. {    "LAMBDA",    FSUBR,    xlambda        },
  59.  
  60.     /* symbol functions */
  61. {    "SET",        SUBR,    xset        },
  62. {    "SETQ",        FSUBR,    xsetq        },
  63. {    "SETF",        FSUBR,    xsetf        },
  64. {    "DEFUN",    FSUBR,    xdefun        },
  65. {    "DEFMACRO",    FSUBR,    xdefmacro    },
  66. {    "GENSYM",    SUBR,    xgensym        },
  67. {    "MAKE-SYMBOL",    SUBR,    xmakesymbol    },
  68. {    "INTERN",    SUBR,    xintern        },
  69. {    "SYMBOL-NAME",    SUBR,    xsymname    },
  70. {    "SYMBOL-VALUE",    SUBR,    xsymvalue    },
  71. {    "SYMBOL-PLIST",    SUBR,    xsymplist    },
  72. {    "GET",        SUBR,    xget        },
  73. {    "PUTPROP",    SUBR,    xputprop    },
  74. {    "REMPROP",    SUBR,    xremprop    },
  75. {    "HASH",        SUBR,    xhash        },
  76.  
  77.     /* array functions */
  78. {    "MAKE-ARRAY",    SUBR,    xmkarray    },
  79. {    "AREF",        SUBR,    xaref        },
  80.  
  81.     /* list functions */
  82. {    "CAR",        SUBR,    xcar        },
  83. {    "CDR",        SUBR,    xcdr        },
  84.  
  85. {    "CAAR",        SUBR,    xcaar        },
  86. {    "CADR",        SUBR,    xcadr        },
  87. {    "CDAR",        SUBR,    xcdar        },
  88. {    "CDDR",        SUBR,    xcddr        },
  89.  
  90. {    "CAAAR",    SUBR,    xcaaar        },
  91. {    "CAADR",    SUBR,    xcaadr        },
  92. {    "CADAR",    SUBR,    xcadar        },
  93. {    "CADDR",    SUBR,    xcaddr        },
  94. {    "CDAAR",    SUBR,    xcdaar        },
  95. {    "CDADR",    SUBR,    xcdadr        },
  96. {    "CDDAR",    SUBR,    xcddar        },
  97. {    "CDDDR",    SUBR,    xcdddr        },
  98.  
  99. {    "CAAAAR",    SUBR,    xcaaaar        },
  100. {    "CAAADR",    SUBR,    xcaaadr        },
  101. {    "CAADAR",    SUBR,    xcaadar        },
  102. {    "CAADDR",    SUBR,    xcaaddr        },
  103. {    "CADAAR",    SUBR,    xcadaar        },
  104. {    "CADADR",    SUBR,    xcadadr        },
  105. {    "CADDAR",    SUBR,    xcaddar        },
  106. {    "CADDDR",    SUBR,    xcadddr        },
  107. {    "CDAAAR",    SUBR,    xcdaaar        },
  108. {    "CDAADR",    SUBR,    xcdaadr        },
  109. {    "CDADAR",    SUBR,    xcdadar        },
  110. {    "CDADDR",    SUBR,    xcdaddr        },
  111. {    "CDDAAR",    SUBR,    xcddaar        },
  112. {    "CDDADR",    SUBR,    xcddadr        },
  113. {    "CDDDAR",    SUBR,    xcdddar        },
  114. {    "CDDDDR",    SUBR,    xcddddr        },
  115.  
  116. {    "CONS",        SUBR,    xcons        },
  117. {    "LIST",        SUBR,    xlist        },
  118. {    "APPEND",    SUBR,    xappend        },
  119. {    "REVERSE",    SUBR,    xreverse    },
  120. {    "LAST",        SUBR,    xlast        },
  121. {    "NTH",        SUBR,    xnth        },
  122. {    "NTHCDR",    SUBR,    xnthcdr        },
  123. {    "MEMBER",    SUBR,    xmember        },
  124. {    "ASSOC",    SUBR,    xassoc        },
  125. {    "SUBST",    SUBR,    xsubst        },
  126. {    "SUBLIS",    SUBR,    xsublis        },
  127. {    "REMOVE",    SUBR,    xremove        },
  128. {    "LENGTH",    SUBR,    xlength        },
  129. {    "MAPC",        SUBR,    xmapc        },
  130. {    "MAPCAR",    SUBR,    xmapcar        },
  131. {    "MAPL",        SUBR,    xmapl        },
  132. {    "MAPLIST",    SUBR,    xmaplist    },
  133.  
  134.     /* destructive list functions */
  135. {    "RPLACA",    SUBR,    xrplca        },
  136. {    "RPLACD",    SUBR,    xrplcd        },
  137. {    "NCONC",    SUBR,    xnconc        },
  138. {    "DELETE",    SUBR,    xdelete        },
  139.  
  140.     /* predicate functions */
  141. {    "ATOM",        SUBR,    xatom        },
  142. {    "SYMBOLP",    SUBR,    xsymbolp    },
  143. {    "NUMBERP",    SUBR,    xnumberp    },
  144. {    "BOUNDP",    SUBR,    xboundp        },
  145. {    "NULL",        SUBR,    xnull        },
  146. {    "NOT",        SUBR,    xnull        },
  147. {    "LISTP",    SUBR,    xlistp        },
  148. {    "CONSP",    SUBR,    xconsp        },
  149. {    "MINUSP",    SUBR,    xminusp        },
  150. {    "ZEROP",    SUBR,    xzerop        },
  151. {    "PLUSP",    SUBR,    xplusp        },
  152. {    "EVENP",    SUBR,    xevenp        },
  153. {    "ODDP",        SUBR,    xoddp        },
  154. {    "EQ",        SUBR,    xeq        },
  155. {    "EQL",        SUBR,    xeql        },
  156. {    "EQUAL",    SUBR,    xequal        },
  157.  
  158.     /* control functions */
  159. {    "COND",        FSUBR,    xcond        },
  160. {    "CASE",        FSUBR,    xcase        },
  161. {    "AND",        FSUBR,    xand        },
  162. {    "OR",        FSUBR,    xor        },
  163. {    "LET",        FSUBR,    xlet        },
  164. {    "LET*",        FSUBR,    xletstar    },
  165. {    "IF",        FSUBR,    xif        },
  166. {    "PROG",        FSUBR,    xprog        },
  167. {    "PROG*",    FSUBR,    xprogstar    },
  168. {    "PROG1",    FSUBR,    xprog1        },
  169. {    "PROG2",    FSUBR,    xprog2        },
  170. {    "PROGN",    FSUBR,    xprogn        },
  171. {    "GO",        FSUBR,    xgo        },
  172. {    "RETURN",    SUBR,    xreturn        },
  173. {    "DO",        FSUBR,    xdo        },
  174. {    "DO*",        FSUBR,    xdostar        },
  175. {    "DOLIST",    FSUBR,    xdolist        },
  176. {    "DOTIMES",    FSUBR,    xdotimes    },
  177. {    "CATCH",    FSUBR,    xcatch        },
  178. {    "THROW",    SUBR,    xthrow        },
  179.  
  180.     /* debugging and error handling functions */
  181. {    "ERROR",    SUBR,    xerror        },
  182. {    "CERROR",    SUBR,    xcerror        },
  183. {    "BREAK",    SUBR,    xbreak        },
  184. {    "CLEAN-UP",    SUBR,    xcleanup    },
  185. {    "CONTINUE",    SUBR,    xcontinue    },
  186. {    "ERRSET",    FSUBR,    xerrset        },
  187. {    "BAKTRACE",    SUBR,    xbaktrace    },
  188. {    "EVALHOOK",    SUBR,    xevalhook    },
  189.  
  190.     /* arithmetic functions */
  191. {    "TRUNCATE",    SUBR,    xfix        },
  192. {    "FLOAT",    SUBR,    xfloat        },
  193. {    "+",        SUBR,    xadd        },
  194. {    "-",        SUBR,    xsub        },
  195. {    "*",        SUBR,    xmul        },
  196. {    "/",        SUBR,    xdiv        },
  197. {    "1+",        SUBR,    xadd1        },
  198. {    "1-",        SUBR,    xsub1        },
  199. {    "REM",        SUBR,    xrem        },
  200. {    "MIN",        SUBR,    xmin        },
  201. {    "MAX",        SUBR,    xmax        },
  202. {    "ABS",        SUBR,    xabs        },
  203. {    "SIN",        SUBR,    xsin        },
  204. {    "COS",        SUBR,    xcos        },
  205. {    "TAN",        SUBR,    xtan        },
  206. {    "EXPT",        SUBR,    xexpt        },
  207. {    "EXP",        SUBR,    xexp        },
  208. {    "SQRT",        SUBR,    xsqrt        },
  209. {    "RANDOM",    SUBR,    xrand        },
  210.  
  211.     /* bitwise logical functions */
  212. {    "BIT-AND",    SUBR,    xbitand        },
  213. {    "BIT-IOR",    SUBR,    xbitior        },
  214. {    "BIT-XOR",    SUBR,    xbitxor        },
  215. {    "BIT-NOT",    SUBR,    xbitnot        },
  216.  
  217.     /* numeric comparison functions */
  218. {    "<",        SUBR,    xlss        },
  219. {    "<=",        SUBR,    xleq        },
  220. {    "=",        SUBR,    xequ        },
  221. {    "/=",        SUBR,    xneq        },
  222. {    ">=",        SUBR,    xgeq        },
  223. {    ">",        SUBR,    xgtr        },
  224.  
  225.     /* string functions */
  226. {    "STRCAT",    SUBR,    xstrcat        },
  227. {    "SUBSTR",    SUBR,    xsubstr        },
  228. {    "STRING",    SUBR,    xstring        },
  229. {    "CHAR",        SUBR,    xchar        },
  230.  
  231.     /* I/O functions */
  232. {    "READ",        SUBR,    xread        },
  233. {    "PRINT",    SUBR,    xprint        },
  234. {    "PRIN1",    SUBR,    xprin1        },
  235. {    "PRINC",    SUBR,    xprinc        },
  236. {    "TERPRI",    SUBR,    xterpri        },
  237. {    "FLATSIZE",    SUBR,    xflatsize    },
  238. {    "FLATC",    SUBR,    xflatc        },
  239.  
  240.     /* file I/O functions */
  241. {    "OPENI",    SUBR,    xopeni        },
  242. {    "OPENO",    SUBR,    xopeno        },
  243. {    "CLOSE",    SUBR,    xclose        },
  244. {    "READ-CHAR",    SUBR,    xrdchar        },
  245. {    "PEEK-CHAR",    SUBR,    xpkchar        },
  246. {    "WRITE-CHAR",    SUBR,    xwrchar        },
  247. {    "READ-LINE",    SUBR,    xreadline    },
  248.  
  249.     /* system functions */
  250. {    "LOAD",        SUBR,    xload        },
  251. {    "GC",        SUBR,    xgc        },
  252. {    "EXPAND",    SUBR,    xexpand        },
  253. {    "ALLOC",    SUBR,    xalloc        },
  254. {    "MEM",        SUBR,    xmem        },
  255. {    "TYPE-OF",    SUBR,    xtype        },
  256. {    "EXIT",        SUBR,    xexit        },
  257.  
  258. {    0                    }
  259. };
  260.  
  261.