1 /** 2 3 SFSEXP: Small, Fast S-Expression Library version 1.0 4 Written by Matthew Sottile (matt@lanl.gov) 5 6 Copyright (2003-2006). The Regents of the University of California. This 7 material was produced under U.S. Government contract W-7405-ENG-36 for Los 8 Alamos National Laboratory, which is operated by the University of 9 California for the U.S. Department of Energy. The U.S. Government has rights 10 to use, reproduce, and distribute this software. NEITHER THE GOVERNMENT NOR 11 THE UNIVERSITY MAKES ANY WARRANTY, EXPRESS OR IMPLIED, OR ASSUMES ANY 12 LIABILITY FOR THE USE OF THIS SOFTWARE. If software is modified to produce 13 derivative works, such modified software should be clearly marked, so as not 14 to confuse it with the version available from LANL. 15 16 Additionally, this library is free software; you can redistribute it and/or 17 modify it under the terms of the GNU Lesser General Public License as 18 published by the Free Software Foundation; either version 2.1 of the 19 License, or (at your option) any later version. 20 21 This library is distributed in the hope that it will be useful, but WITHOUT 22 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 23 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License 24 for more details. 25 26 You should have received a copy of the GNU Lesser General Public License 27 along with this library; if not, write to the Free Software Foundation, 28 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, U SA 29 30 LA-CC-04-094 31 32 **/ 33 34 /** 35 * utility functions and other relevant stuff for making slisp work 36 */ 37 #ifndef __SLISP_UTIL_H__ 38 #define __SLISP_UTIL_H__ 39 40 #include "sexp.h" 41 42 /** 43 * tokens for operations 44 */ 45 typedef enum { 46 /* binary logical operations */ 47 SL_EQ, SL_GT, SL_LT, SL_NE, SL_GEQ, SL_LEQ, 48 49 /* unary logical operations */ 50 SL_NOT, 51 52 /* mathematical operations, binary */ 53 SL_PLUS, SL_MINUS, SL_MULT, SL_DIVIDE, SL_EXP, 54 55 /* mathematical operations, unary */ 56 SL_SQRT, 57 58 /* list construction/separation */ 59 SL_CONS, SL_CDR, SL_CAR, 60 61 /* function application over lists */ 62 SL_FOLD, SL_MAP, 63 64 /* list sorting */ 65 SL_SORT, 66 67 /* conditional */ 68 SL_IF, 69 70 /* lambda */ 71 SL_LAMBDA, 72 73 /* UNKNOWN : ERROR */ 74 SL_UNKNOWN 75 } slisp_op_t; 76 77 /* 78 * types for expression elements 79 */ 80 typedef enum { 81 SL_INT, 82 SL_FLOAT, 83 SL_STRING, 84 SL_SEXP, 85 SL_INVALID 86 } slisp_val_t; 87 88 #ifdef __cplusplus 89 extern "C" { 90 #endif 91 92 sexp_t *deep_copy_sexp(sexp_t *sx); 93 slisp_op_t tokenize(sexp_t *sx); 94 slisp_val_t derive_type(sexp_t *sx); 95 96 #ifdef __cplusplus 97 } 98 #endif 99 100 #endif /* __SLISP_UTIL_H__ */ 101