Mercurial > hg-old > index.cgi
view lwlib/lw_expr.h @ 334:f2173d18c73f
Checkpoint
author | lost |
---|---|
date | Thu, 04 Mar 2010 02:24:38 +0000 |
parents | |
children | 9f58e3bca6e3 |
line wrap: on
line source
/* lwexpr.h Copyright © 2010 William Astle This file is part of LWTOOLS. LWTOOLS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef ___lw_expr_h_seen___ #define ___lw_expr_h_seen___ enum { lw_expr_type_oper, // operator term lw_expr_type_int, // integer lw_expr_type_var, // a "variable" (string for the name) lw_expr_type_special // a "special" reference (user defined) }; enum { lw_expr_oper_plus = 1, // addition lw_expr_oper_minus, // subtraction lw_expr_oper_times, // multiplication lw_expr_oper_divide, // division lw_expr_oper_mod, // modulus lw_expr_oper_intdiv, // integer division lw_expr_oper_bwand, // bitwise and lw_expr_oper_bwor, // bitwise or lw_expr_oper_bwxor, // bitwise xor lw_expr_oper_and, // boolean and lw_expr_oper_or, // boolean or lw_expr_oper_neg, // unary negation, 2's complement lw_expr_oper_com // unary 1's complement }; #ifdef ___lw_expr_c_seen___ typedef struct lw_expr_priv * lw_expr_t; struct lw_expr_opers { lw_expr_t p; struct lw_expr_opers *next; }; struct lw_expr_priv { int type; // type of term int value; // integer value void *value2; // misc pointer value int refcount; // reference count struct lw_expr_opers *operands; // ptr to list of operands (for operators) }; #else /* def ___lw_expr_c_seen___ */ typedef void * lw_expr_t; extern lw_expr_t lwexpr_create(void); extern void lwexpr_destroy(lw_expr_t E); extern lw_expr_t lw_expr_deref(lw_expr_t r); extern lw_expr_t lw_expr_copy(lw_expr_t E); extern void lw_expr_add_operand(lw_expr_t E, lw_expr_t O); extern lw_expr_t lw_expr_deepcopy(lw_expr_t E); extern lw_expr_t lw_expr_build(int exprtype, ...); extern void lw_expr_print(lw_expr_t E); extern int lw_expr_compare(lw_expr_t E1, lw_expr_t E2); #endif /* def ___lw_expr_c_seen___ */ #endif /* ___lw_expr_h_seen___ */