00001 /* 00002 * plint/prog/action.c : actions are an implicit way of calling run-time methods 00003 * 00004 * Time-stamp: <2002-12-21 14:42:38 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 #include "share/common.h" 00026 00027 #include "type.h" 00028 #include "action.h" 00029 00045 void plint_com_free(plint_com_t * com) 00046 { 00047 switch (com->type) 00048 { 00049 case PLINT_ACT_NONE: 00050 case PLINT_ACT_INIT: 00051 case PLINT_ACT_ABRT: 00052 break; 00053 00054 case PLINT_ACT_SEEK: 00055 case PLINT_ACT_CALL: 00056 case PLINT_ACT_DONE: 00057 plint_var_fre(com->data); 00058 break; 00059 } 00060 com->type = PLINT_ACT_NONE; 00061 } 00062 00068 void plint_act_free(plint_act_t * act) 00069 { 00070 plint_com_free(&act->in); 00071 plint_com_free(&act->out); 00072 00073 switch (act->_type) 00074 { 00075 case PLINT_ACT_NONE: 00076 break; 00077 00078 default: 00079 plint_mem_fre(act->oper.mems); 00080 00081 switch (act->oper.type) 00082 { 00083 case PLINT_OPER_neu: 00084 00085 case PLINT_OPER_assgn: 00086 case PLINT_OPER_meth: 00087 case PLINT_OPER_call: 00088 case PLINT_OPER_read: 00089 00090 case PLINT_OPER_cast: 00091 00092 case PLINT_OPER_num: case PLINT_OPER_pnt: case PLINT_OPER_str: case PLINT_OPER_bol: case PLINT_OPER_tab: case PLINT_OPER_hsh: 00093 00094 case PLINT_OPER_aadd OR PLINT_OPER_asub OR PLINT_OPER_adiv OR PLINT_OPER_amul OR PLINT_OPER_arem OR PLINT_OPER_apow OR PLINT_OPER_aand OR PLINT_OPER_aor OR PLINT_OPER_anot: 00095 00096 case PLINT_OPER_badd OR PLINT_OPER_bsub OR PLINT_OPER_bdiv OR PLINT_OPER_bmul OR PLINT_OPER_brem OR PLINT_OPER_bpow OR PLINT_OPER_band OR PLINT_OPER_bor OR PLINT_OPER_bnot: 00097 00098 case PLINT_OPER_cequ OR PLINT_OPER_cneq OR PLINT_OPER_clt OR PLINT_OPER_cgt OR PLINT_OPER_clte OR PLINT_OPER_cgte: 00099 00100 case PLINT_OPER_range: 00101 case PLINT_OPER_merge: 00102 plint_var_fre(act->oper.parm); 00103 break; 00104 00105 case PLINT_OPER_len: 00106 case PLINT_OPER_ucni OR PLINT_OPER_uced: 00107 00108 case PLINT_OPER_uadd OR PLINT_OPER_usub OR PLINT_OPER_umul OR PLINT_OPER_udiv OR PLINT_OPER_urem OR PLINT_OPER_upow OR PLINT_OPER_uand OR PLINT_OPER_uor OR PLINT_OPER_unot: 00109 case PLINT_OPER_uinc OR PLINT_OPER_udec: 00110 00111 case PLINT_OPER_echo OR PLINT_OPER_sync: 00112 break; 00113 00114 default: 00115 assert(0); 00116 break; 00117 00118 } 00119 00120 } 00121 } 00122