/*
* Copyright (c) 2003, The Tendra Project <http://www.ten15.org/>
* 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 NAT_OPS_H_INCLUDED
#define NAT_OPS_H_INCLUDED
/* Operations for union NAT */
#define TAG_nat(P) (CHECK_NULL (P)->ag_tag)
/* Operations for field small of union NAT */
#define nat_small_tag 0u
#define IS_nat_small(P) (CHECK_NULL (P)->ag_tag == 0)
#define nat_small_value(P) (CHECK_TAG ((P), 0) + 1)
#define MAKE_nat_small(value_, c_class_nat)\
{\
c_class *x468_ = GEN_c_class ( 2, TYPEID_nat );\
x468_->ag_tag = 0;\
COPY_unsigned (x468_ + 1, (value_));\
(c_class_nat) = x468_;\
}
#define DECONS_nat_small(value_, c_class_nat)\
{\
c_class *x469_ = CHECK_TAG ((c_class_nat), 0);\
(value_) = DEREF_unsigned (x469_ + 1);\
}
#define DESTROY_nat_small(destroyer_, value_, c_class_nat)\
{\
c_class *x470_ = CHECK_TAG ((c_class_nat), 0);\
(value_) = DEREF_unsigned (x470_ + 1);\
(destroyer_) (x470_, 2u);\
}
/* Operations for field large of union NAT */
#define nat_large_tag 1u
#define IS_nat_large(P) (CHECK_NULL (P)->ag_tag == 1)
#define nat_large_values(P) (CHECK_TAG ((P), 1) + 1)
#define MAKE_nat_large(values_, c_class_nat)\
{\
c_class *x471_ = GEN_c_class ( 2, TYPEID_nat );\
x471_->ag_tag = 1;\
COPY_list (x471_ + 1, (values_));\
(c_class_nat) = x471_;\
}
#define DECONS_nat_large(values_, c_class_nat)\
{\
c_class *x472_ = CHECK_TAG ((c_class_nat), 1);\
(values_) = DEREF_list (x472_ + 1);\
}
#define DESTROY_nat_large(destroyer_, values_, c_class_nat)\
{\
c_class *x473_ = CHECK_TAG ((c_class_nat), 1);\
(values_) = DEREF_list (x473_ + 1);\
(destroyer_) (x473_, 2u);\
}
/* Operations for field calc of union NAT */
#define nat_calc_tag 2u
#define IS_nat_calc(P) (CHECK_NULL (P)->ag_tag == 2)
#define nat_calc_value(P) (CHECK_TAG ((P), 2) + 1)
#define nat_calc_tok(P) (CHECK_TAG ((P), 2) + 2)
#define MAKE_nat_calc(value_, c_class_nat)\
{\
c_class *x474_ = GEN_c_class ( 3, TYPEID_nat );\
x474_->ag_tag = 2;\
COPY_exp (x474_ + 1, (value_));\
COPY_ulong (x474_ + 2, LINK_NONE);\
(c_class_nat) = x474_;\
}
#define DECONS_nat_calc(value_, tok_, c_class_nat)\
{\
c_class *x475_ = CHECK_TAG ((c_class_nat), 2);\
(value_) = DEREF_exp (x475_ + 1);\
(tok_) = DEREF_ulong (x475_ + 2);\
}
#define DESTROY_nat_calc(destroyer_, value_, tok_, c_class_nat)\
{\
c_class *x476_ = CHECK_TAG ((c_class_nat), 2);\
(value_) = DEREF_exp (x476_ + 1);\
(tok_) = DEREF_ulong (x476_ + 2);\
(destroyer_) (x476_, 3u);\
}
/* Operations for field neg of union NAT */
#define nat_neg_tag 3u
#define IS_nat_neg(P) (CHECK_NULL (P)->ag_tag == 3)
#define nat_neg_arg(P) (CHECK_TAG ((P), 3) + 1)
#define MAKE_nat_neg(arg_, c_class_nat)\
{\
c_class *x477_ = GEN_c_class ( 2, TYPEID_nat );\
x477_->ag_tag = 3;\
COPY_nat (x477_ + 1, (arg_));\
(c_class_nat) = x477_;\
}
#define DECONS_nat_neg(arg_, c_class_nat)\
{\
c_class *x478_ = CHECK_TAG ((c_class_nat), 3);\
(arg_) = DEREF_nat (x478_ + 1);\
}
#define DESTROY_nat_neg(destroyer_, arg_, c_class_nat)\
{\
c_class *x479_ = CHECK_TAG ((c_class_nat), 3);\
(arg_) = DEREF_nat (x479_ + 1);\
(destroyer_) (x479_, 2u);\
}
/* Operations for field token of union NAT */
#define nat_token_tag 4u
#define IS_nat_token(P) (CHECK_NULL (P)->ag_tag == 4)
#define nat_token_tok(P) (CHECK_TAG ((P), 4) + 1)
#define nat_token_args(P) (CHECK_TAG ((P), 4) + 2)
#define MAKE_nat_token(tok_, args_, c_class_nat)\
{\
c_class *x480_ = GEN_c_class ( 3, TYPEID_nat );\
x480_->ag_tag = 4;\
COPY_id (x480_ + 1, (tok_));\
COPY_list (x480_ + 2, (args_));\
(c_class_nat) = x480_;\
}
#define DECONS_nat_token(tok_, args_, c_class_nat)\
{\
c_class *x481_ = CHECK_TAG ((c_class_nat), 4);\
(tok_) = DEREF_id (x481_ + 1);\
(args_) = DEREF_list (x481_ + 2);\
}
#define DESTROY_nat_token(destroyer_, tok_, args_, c_class_nat)\
{\
c_class *x482_ = CHECK_TAG ((c_class_nat), 4);\
(tok_) = DEREF_id (x482_ + 1);\
(args_) = DEREF_list (x482_ + 2);\
(destroyer_) (x482_, 3u);\
}
#endif
syntax highlighted by Code2HTML, v. 0.9.1