/* * Copyright (c) 2003, The Tendra Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice unmodified, this list of conditions, and the following * disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * * Crown Copyright (c) 1997, 1998 * * This TenDRA(r) Computer Program is subject to Copyright * owned by the United Kingdom Secretary of State for Defence * acting through the Defence Evaluation and Research Agency * (DERA). It is made available to Recipients with a * royalty-free licence for its use, reproduction, transfer * to other parties and amendment for any purpose not excluding * product development provided that any such use et cetera * shall be deemed to be acceptance of the following conditions:- * * (1) Its Recipients shall ensure that this Notice is * reproduced upon any copies or amended versions of it; * * (2) Any amended version of it shall be clearly marked to * show both the nature of and the organisation responsible * for the relevant amendment or amendments; * * (3) Its onward transfer from a recipient to another * party shall be deemed to be that party's acceptance of * these conditions; * * (4) DERA gives no warranty or assurance as to its * quality or suitability for any purpose and DERA accepts * no liability whatsoever in relation to any use to which * it may be put. * * $TenDRA: tendra/src/producers/common/c_class.alg,v 1.18 2005/11/07 18:42:37 stefanf Exp $ */ /* * AUTOMATICALLY GENERATED FROM ALGEBRA c_class (VERSION 1.1) * BY calculus (VERSION 1.3) */ #ifndef TOK_OPS_H_INCLUDED #define TOK_OPS_H_INCLUDED /* Operations for union TOKEN */ #define TAG_tok(P) (CHECK_NULL (P)->ag_tag) /* Operations for field exp of union TOKEN */ #define tok_exp_tag 0u #define IS_tok_exp(P) (CHECK_NULL (P)->ag_tag == 0) #define tok_exp_type(P) (CHECK_TAG ((P), 0) + 1) #define tok_exp_constant(P) (CHECK_TAG ((P), 0) + 2) #define tok_exp_value(P) (CHECK_TAG ((P), 0) + 3) #define MAKE_tok_exp(type_, constant_, value_, c_class_tok)\ {\ c_class *x820_ = GEN_c_class ( 4, TYPEID_tok );\ x820_->ag_tag = 0;\ COPY_type (x820_ + 1, (type_));\ COPY_int (x820_ + 2, (constant_));\ COPY_exp (x820_ + 3, (value_));\ (c_class_tok) = x820_;\ } #define DECONS_tok_exp(type_, constant_, value_, c_class_tok)\ {\ c_class *x821_ = CHECK_TAG ((c_class_tok), 0);\ (type_) = DEREF_type (x821_ + 1);\ (constant_) = DEREF_int (x821_ + 2);\ (value_) = DEREF_exp (x821_ + 3);\ } #define DESTROY_tok_exp(destroyer_, type_, constant_, value_, c_class_tok)\ {\ c_class *x822_ = CHECK_TAG ((c_class_tok), 0);\ (type_) = DEREF_type (x822_ + 1);\ (constant_) = DEREF_int (x822_ + 2);\ (value_) = DEREF_exp (x822_ + 3);\ (destroyer_) (x822_, 4u);\ } /* Operations for field stmt of union TOKEN */ #define tok_stmt_tag 1u #define IS_tok_stmt(P) (CHECK_NULL (P)->ag_tag == 1) #define tok_stmt_value(P) (CHECK_TAG ((P), 1) + 1) #define MAKE_tok_stmt(value_, c_class_tok)\ {\ c_class *x823_ = GEN_c_class ( 2, TYPEID_tok );\ x823_->ag_tag = 1;\ COPY_exp (x823_ + 1, (value_));\ (c_class_tok) = x823_;\ } #define DECONS_tok_stmt(value_, c_class_tok)\ {\ c_class *x824_ = CHECK_TAG ((c_class_tok), 1);\ (value_) = DEREF_exp (x824_ + 1);\ } #define DESTROY_tok_stmt(destroyer_, value_, c_class_tok)\ {\ c_class *x825_ = CHECK_TAG ((c_class_tok), 1);\ (value_) = DEREF_exp (x825_ + 1);\ (destroyer_) (x825_, 2u);\ } /* Operations for field set nat_etc of union TOKEN */ #define tok_nat_etc_tag 4u #define IS_tok_nat_etc(P) ((unsigned) (CHECK_NULL (P)->ag_tag - 2) < 2u) #define tok_nat_etc_value(P) (CHECK_TAG_ETC ((P), 2, 4) + 1) #define MAKE_tok_nat_etc(tag, value_, c_class_tok)\ {\ c_class *x826_ = GEN_c_class ( 2, TYPEID_tok );\ x826_->ag_tag = (tag);\ COPY_nat (x826_ + 1, (value_));\ (c_class_tok) = CHECK_TAG_ETC (x826_, 2, 4);\ } #define MODIFY_tok_nat_etc(tag, c_class_tok)\ {\ c_class *x827_ = CHECK_TAG_ETC ((c_class_tok), 2, 4);\ x827_->ag_tag = (tag);\ (void) CHECK_TAG_ETC (x827_, 2, 4);\ } #define DECONS_tok_nat_etc(value_, c_class_tok)\ {\ c_class *x828_ = CHECK_TAG_ETC ((c_class_tok), 2, 4);\ (value_) = DEREF_nat (x828_ + 1);\ } #define DESTROY_tok_nat_etc(destroyer_, value_, c_class_tok)\ {\ c_class *x829_ = CHECK_TAG_ETC ((c_class_tok), 2, 4);\ (value_) = DEREF_nat (x829_ + 1);\ (destroyer_) (x829_, 2u);\ } /* Operations for field nat of union TOKEN */ #define tok_nat_tag 2u #define IS_tok_nat(P) (CHECK_NULL (P)->ag_tag == 2) #define tok_nat_value(P) (CHECK_TAG ((P), 2) + 1) #define MAKE_tok_nat(value_, c_class_tok)\ {\ c_class *x830_ = GEN_c_class ( 2, TYPEID_tok );\ x830_->ag_tag = 2;\ COPY_nat (x830_ + 1, (value_));\ (c_class_tok) = x830_;\ } #define DECONS_tok_nat(value_, c_class_tok)\ {\ c_class *x831_ = CHECK_TAG ((c_class_tok), 2);\ (value_) = DEREF_nat (x831_ + 1);\ } #define DESTROY_tok_nat(destroyer_, value_, c_class_tok)\ {\ c_class *x832_ = CHECK_TAG ((c_class_tok), 2);\ (value_) = DEREF_nat (x832_ + 1);\ (destroyer_) (x832_, 2u);\ } /* Operations for field snat of union TOKEN */ #define tok_snat_tag 3u #define IS_tok_snat(P) (CHECK_NULL (P)->ag_tag == 3) #define tok_snat_value(P) (CHECK_TAG ((P), 3) + 1) #define MAKE_tok_snat(value_, c_class_tok)\ {\ c_class *x833_ = GEN_c_class ( 2, TYPEID_tok );\ x833_->ag_tag = 3;\ COPY_nat (x833_ + 1, (value_));\ (c_class_tok) = x833_;\ } #define DECONS_tok_snat(value_, c_class_tok)\ {\ c_class *x834_ = CHECK_TAG ((c_class_tok), 3);\ (value_) = DEREF_nat (x834_ + 1);\ } #define DESTROY_tok_snat(destroyer_, value_, c_class_tok)\ {\ c_class *x835_ = CHECK_TAG ((c_class_tok), 3);\ (value_) = DEREF_nat (x835_ + 1);\ (destroyer_) (x835_, 2u);\ } /* Operations for field type of union TOKEN */ #define tok_type_tag 4u #define IS_tok_type(P) (CHECK_NULL (P)->ag_tag == 4) #define tok_type_kind(P) (CHECK_TAG ((P), 4) + 1) #define tok_type_value(P) (CHECK_TAG ((P), 4) + 2) #define tok_type_alt(P) (CHECK_TAG ((P), 4) + 3) #define MAKE_tok_type(kind_, value_, c_class_tok)\ {\ c_class *x836_ = GEN_c_class ( 4, TYPEID_tok );\ x836_->ag_tag = 4;\ COPY_btype (x836_ + 1, (kind_));\ COPY_type (x836_ + 2, (value_));\ COPY_type (x836_ + 3, NULL_type);\ (c_class_tok) = x836_;\ } #define DECONS_tok_type(kind_, value_, alt_, c_class_tok)\ {\ c_class *x837_ = CHECK_TAG ((c_class_tok), 4);\ (kind_) = DEREF_btype (x837_ + 1);\ (value_) = DEREF_type (x837_ + 2);\ (alt_) = DEREF_type (x837_ + 3);\ } #define DESTROY_tok_type(destroyer_, kind_, value_, alt_, c_class_tok)\ {\ c_class *x838_ = CHECK_TAG ((c_class_tok), 4);\ (kind_) = DEREF_btype (x838_ + 1);\ (value_) = DEREF_type (x838_ + 2);\ (alt_) = DEREF_type (x838_ + 3);\ (destroyer_) (x838_, 4u);\ } /* Operations for field func of union TOKEN */ #define tok_func_tag 5u #define IS_tok_func(P) (CHECK_NULL (P)->ag_tag == 5) #define tok_func_type(P) (CHECK_TAG ((P), 5) + 1) #define tok_func_defn(P) (CHECK_TAG ((P), 5) + 2) #define tok_func_proc(P) (CHECK_TAG ((P), 5) + 3) #define MAKE_tok_func(type_, c_class_tok)\ {\ c_class *x839_ = GEN_c_class ( 4, TYPEID_tok );\ x839_->ag_tag = 5;\ COPY_type (x839_ + 1, (type_));\ COPY_id (x839_ + 2, NULL_id);\ COPY_tok (x839_ + 3, NULL_tok);\ (c_class_tok) = x839_;\ } #define DECONS_tok_func(type_, defn_, proc_, c_class_tok)\ {\ c_class *x840_ = CHECK_TAG ((c_class_tok), 5);\ (type_) = DEREF_type (x840_ + 1);\ (defn_) = DEREF_id (x840_ + 2);\ (proc_) = DEREF_tok (x840_ + 3);\ } #define DESTROY_tok_func(destroyer_, type_, defn_, proc_, c_class_tok)\ {\ c_class *x841_ = CHECK_TAG ((c_class_tok), 5);\ (type_) = DEREF_type (x841_ + 1);\ (defn_) = DEREF_id (x841_ + 2);\ (proc_) = DEREF_tok (x841_ + 3);\ (destroyer_) (x841_, 4u);\ } /* Operations for field member of union TOKEN */ #define tok_member_tag 6u #define IS_tok_member(P) (CHECK_NULL (P)->ag_tag == 6) #define tok_member_of(P) (CHECK_TAG ((P), 6) + 1) #define tok_member_type(P) (CHECK_TAG ((P), 6) + 2) #define tok_member_value(P) (CHECK_TAG ((P), 6) + 3) #define MAKE_tok_member(of_, type_, value_, c_class_tok)\ {\ c_class *x842_ = GEN_c_class ( 4, TYPEID_tok );\ x842_->ag_tag = 6;\ COPY_type (x842_ + 1, (of_));\ COPY_type (x842_ + 2, (type_));\ COPY_off (x842_ + 3, (value_));\ (c_class_tok) = x842_;\ } #define DECONS_tok_member(of_, type_, value_, c_class_tok)\ {\ c_class *x843_ = CHECK_TAG ((c_class_tok), 6);\ (of_) = DEREF_type (x843_ + 1);\ (type_) = DEREF_type (x843_ + 2);\ (value_) = DEREF_off (x843_ + 3);\ } #define DESTROY_tok_member(destroyer_, of_, type_, value_, c_class_tok)\ {\ c_class *x844_ = CHECK_TAG ((c_class_tok), 6);\ (of_) = DEREF_type (x844_ + 1);\ (type_) = DEREF_type (x844_ + 2);\ (value_) = DEREF_off (x844_ + 3);\ (destroyer_) (x844_, 4u);\ } /* Operations for field class of union TOKEN */ #define tok_class_tag 7u #define IS_tok_class(P) (CHECK_NULL (P)->ag_tag == 7) #define tok_class_type(P) (CHECK_TAG ((P), 7) + 1) #define tok_class_value(P) (CHECK_TAG ((P), 7) + 2) #define tok_class_alt(P) (CHECK_TAG ((P), 7) + 3) #define MAKE_tok_class(type_, value_, c_class_tok)\ {\ c_class *x845_ = GEN_c_class ( 4, TYPEID_tok );\ x845_->ag_tag = 7;\ COPY_type (x845_ + 1, (type_));\ COPY_id (x845_ + 2, (value_));\ COPY_type (x845_ + 3, NULL_type);\ (c_class_tok) = x845_;\ } #define DECONS_tok_class(type_, value_, alt_, c_class_tok)\ {\ c_class *x846_ = CHECK_TAG ((c_class_tok), 7);\ (type_) = DEREF_type (x846_ + 1);\ (value_) = DEREF_id (x846_ + 2);\ (alt_) = DEREF_type (x846_ + 3);\ } #define DESTROY_tok_class(destroyer_, type_, value_, alt_, c_class_tok)\ {\ c_class *x847_ = CHECK_TAG ((c_class_tok), 7);\ (type_) = DEREF_type (x847_ + 1);\ (value_) = DEREF_id (x847_ + 2);\ (alt_) = DEREF_type (x847_ + 3);\ (destroyer_) (x847_, 4u);\ } /* Operations for field proc of union TOKEN */ #define tok_proc_tag 8u #define IS_tok_proc(P) (CHECK_NULL (P)->ag_tag == 8) #define tok_proc_res(P) (CHECK_TAG ((P), 8) + 1) #define tok_proc_pars(P) (CHECK_TAG ((P), 8) + 2) #define tok_proc_key(P) (CHECK_TAG ((P), 8) + 3) #define tok_proc_apps(P) (CHECK_TAG ((P), 8) + 4) #define tok_proc_bids(P) (CHECK_TAG ((P), 8) + 5) #define tok_proc_pids(P) (CHECK_TAG ((P), 8) + 6) #define MAKE_tok_proc(res_, pars_, key_, c_class_tok)\ {\ c_class *x848_ = GEN_c_class ( 7, TYPEID_tok );\ x848_->ag_tag = 8;\ COPY_tok (x848_ + 1, (res_));\ COPY_nspace (x848_ + 2, (pars_));\ COPY_int (x848_ + 3, (key_));\ COPY_inst (x848_ + 4, NULL_inst);\ COPY_list (x848_ + 5, NULL_list ( IDENTIFIER ));\ COPY_list (x848_ + 6, NULL_list ( IDENTIFIER ));\ (c_class_tok) = x848_;\ } #define DECONS_tok_proc(res_, pars_, key_, apps_, bids_, pids_, c_class_tok)\ {\ c_class *x849_ = CHECK_TAG ((c_class_tok), 8);\ (res_) = DEREF_tok (x849_ + 1);\ (pars_) = DEREF_nspace (x849_ + 2);\ (key_) = DEREF_int (x849_ + 3);\ (apps_) = DEREF_inst (x849_ + 4);\ (bids_) = DEREF_list (x849_ + 5);\ (pids_) = DEREF_list (x849_ + 6);\ } #define DESTROY_tok_proc(destroyer_, res_, pars_, key_, apps_, bids_, pids_, c_class_tok)\ {\ c_class *x850_ = CHECK_TAG ((c_class_tok), 8);\ (res_) = DEREF_tok (x850_ + 1);\ (pars_) = DEREF_nspace (x850_ + 2);\ (key_) = DEREF_int (x850_ + 3);\ (apps_) = DEREF_inst (x850_ + 4);\ (bids_) = DEREF_list (x850_ + 5);\ (pids_) = DEREF_list (x850_ + 6);\ (destroyer_) (x850_, 7u);\ } /* Operations for field templ of union TOKEN */ #define tok_templ_tag 9u #define IS_tok_templ(P) (CHECK_NULL (P)->ag_tag == 9) #define tok_templ_usage(P) (CHECK_TAG ((P), 9) + 1) #define tok_templ_pars(P) (CHECK_TAG ((P), 9) + 2) #define tok_templ_apps(P) (CHECK_TAG ((P), 9) + 3) #define tok_templ_pids(P) (CHECK_TAG ((P), 9) + 4) #define tok_templ_dargs(P) (CHECK_TAG ((P), 9) + 5) #define MAKE_tok_templ(usage_, pars_, c_class_tok)\ {\ c_class *x851_ = GEN_c_class ( 6, TYPEID_tok );\ x851_->ag_tag = 9;\ COPY_dspec (x851_ + 1, (usage_));\ COPY_nspace (x851_ + 2, (pars_));\ COPY_inst (x851_ + 3, NULL_inst);\ COPY_list (x851_ + 4, NULL_list ( IDENTIFIER ));\ COPY_list (x851_ + 5, NULL_list ( TOKEN ));\ (c_class_tok) = x851_;\ } #define DECONS_tok_templ(usage_, pars_, apps_, pids_, dargs_, c_class_tok)\ {\ c_class *x852_ = CHECK_TAG ((c_class_tok), 9);\ (usage_) = DEREF_dspec (x852_ + 1);\ (pars_) = DEREF_nspace (x852_ + 2);\ (apps_) = DEREF_inst (x852_ + 3);\ (pids_) = DEREF_list (x852_ + 4);\ (dargs_) = DEREF_list (x852_ + 5);\ } #define DESTROY_tok_templ(destroyer_, usage_, pars_, apps_, pids_, dargs_, c_class_tok)\ {\ c_class *x853_ = CHECK_TAG ((c_class_tok), 9);\ (usage_) = DEREF_dspec (x853_ + 1);\ (pars_) = DEREF_nspace (x853_ + 2);\ (apps_) = DEREF_inst (x853_ + 3);\ (pids_) = DEREF_list (x853_ + 4);\ (dargs_) = DEREF_list (x853_ + 5);\ (destroyer_) (x853_, 6u);\ } #endif