Main Page   Modules   Alphabetical List   Data Structures   File List   Data Fields   Globals  

mygrm.h

00001  /*
00002   * plint/parse/mygrm.h : the `#define TOKEN's and my grammar macros
00003   * 
00004   * Time-stamp: <2002-09-02 22:22:23 gseba>
00005   * 
00006   * Copyright (C) Sebastian Glita, email: gseba@users.sourceforge.net
00007   * 
00008   * This file is part of plint.
00009   * 
00010   * plint is free software; you can  redistribute it and/or modify it under the
00011   * terms of the  GNU General Public License as published  by the Free Software
00012   * Foundation; either version 2, or (at your option) any later version.
00013   *
00014   * plint  is distributed  in the  hope  that it  will be  useful, but  WITHOUT
00015   * ANY  WARRANTY; without  even  the implied  warranty  of MERCHANTABILITY  or
00016   * FITNESS FOR A  PARTICULAR PURPOSE.  See the GNU  General Public License for
00017   * more details.
00018   * 
00019   * You should  have received a  copy of the  GNU General Public  License along
00020   * with  plint; see  the file  COPYING.  If  not, write  to the  Free Software
00021   * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA USA.
00022   *
00023   */
00024 
00025 #ifndef PLINT_PARSE_MYGRM_H
00026 #define PLINT_PARSE_MYGRM_H
00027 
00028 #ifndef YYBISON
00029 #include "data/type.h"
00030 #include "plugin/types.h"
00031 #include "grammar.h"
00032 #endif
00033 
00034 /* if `running' stage */
00035 #define IF_RUN if (plint->run)
00036 /* if `parsing' stage */
00037 #define IF_PRS if (!plint->run)
00038 /* if valid result from previous rules (not aborted) */
00039 #define IF_VAL if (PLINT_CTRL_NONE)
00040 /* for symetry */
00041 #define IF_NUL
00042 
00043 
00044 
00045 #define PLINT_xxx_PUSH(__typ__)                         \
00046   ({                                                    \
00047     PLINT_STACK_PUSH(__typ__, plint->reg.__typ__);      \
00048     plint_clean_##__typ__();                            \
00049   })
00050 
00051 #define PLINT_xxx_POP(__typ__)                          \
00052   ({                                                    \
00053     plint->reg.__typ__ = PLINT_STACK_TOP(__typ__);      \
00054     PLINT_STACK_POP(__typ__);                           \
00055   })
00056 
00057 #define PLINT_xxx_ABRT(__typ__) PLINT_xxx_POP(__typ__), plint_free_##__typ__()
00058 
00059 
00060 #define PLINT_var_PUSH PLINT_xxx_PUSH(var)
00061 #define PLINT_var_POP PLINT_xxx_POP(var)
00062 #define PLINT_var_ABRT PLINT_xxx_ABRT(var)
00063 
00064 #define PLINT_ref_PUSH PLINT_xxx_PUSH(ref)
00065 #define PLINT_ref_POP PLINT_xxx_POP(ref)
00066 #define PLINT_ref_ABRT PLINT_ref_POP
00067 
00068 #define PLINT_mem_PUSH { plint_mem_dup(plint->reg.mem); PLINT_STACK_PUSH(mem, plint->reg.mem); }
00069 #define PLINT_mem_POP { PLINT_xxx_POP(mem); plint_mem_fre(plint->reg.mem); }
00070 #define PLINT_mem_ABRT PLINT_mem_POP
00071 
00072 #define PLINT_tab_PUSH PLINT_xxx_PUSH(tab)
00073 #define PLINT_tab_POP PLINT_xxx_POP(tab)
00074 #define PLINT_tab_ABRT PLINT_xxx_ABRT(tab)
00075 
00076 #define PLINT_hsh_PUSH PLINT_xxx_PUSH(hsh)
00077 #define PLINT_hsh_POP PLINT_xxx_POP(hsh)
00078 #define PLINT_hsh_ABRT PLINT_xxx_ABRT(hsh)
00079 
00080 #define PLINT_str_PUSH PLINT_xxx_PUSH(str)
00081 #define PLINT_str_POP PLINT_xxx_POP(str)
00082 #define PLINT_str_ABRT PLINT_xxx_ABRT(str)
00083 
00084 #define PLINT_idx_PUSH PLINT_STACK_PUSH(idx, plint_index_new())
00085 #define PLINT_idx_ADD(__idx__...) plint_index_add(PLINT_STACK_TOP(idx), ({ plint_idx_t _tmp = __idx__; _tmp; }))
00086 #define PLINT_idx_TIP plint_index_tip(PLINT_STACK_TOP(idx))
00087 #define PLINT_idx_REM { plint_idx_t _tmp = plint_index_rem(PLINT_STACK_TOP(idx)); plint_val_fre(&_tmp.val, _tmp.typ); }
00088 #define PLINT_idx_SIZE plint_index_count(PLINT_STACK_TOP(idx))
00089 #define PLINT_idx_EMPTY plint_index_empty(PLINT_STACK_TOP(idx))
00090 #define PLINT_idx_POP plint_index_free(PLINT_STACK_TOP(idx)), PLINT_STACK_POP(idx)
00091 #define PLINT_idx_ABRT PLINT_idx_POP
00092 
00093 #endif

Generated on Thu Jan 9 19:02:38 2003 for plint by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002