/*------------------------->  Sather - configfile  <-------------------------*/
/* Copyright (C) 2000 by K Hopper, University of Waikato, New Zealand        */
/* This file is part of the GNU Sather library. It is free software; you may */
/* redistribute  and/or modify it under the terms of the GNU Library General */
/* Public  License (LGPL)  as published  by the  Free  Software  Foundation; */
/* either version 2 of the license, or (at your option) any later version.   */
/* This  library  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 Doc/LGPL for more details.       */
/* The license text is also available from:  Free Software Foundation, Inc., */
/* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA                     */
/*------------>  Please email comments to <bug-sather@gnu.org>  <------------*/

#ifndef CARD_CONFIG
#define CARD_CONFIG

#ifdef PP
#undef PP
#endif

#ifdef FPP
#undef FPP
#endif

#ifdef VSTD
#undef VSTD
#endif

#define PP    no_pre,no_post
#define FPP   fragile,PP
#define VSTD  var "@r $$;"

BIN_CARD:             PP,exec "(CARD)$0";
CARD_BIN:	      PP,exec "$0";
CARD_CARD:            PP,exec "$0";
CARD_INT:             PP,VSTD,exec "$$=CARDINT($0);" "$$";
CARD_FLT:             PP,VSTD,exec "$$=CARDFLT($0);" "$$";
CARD_FLTD:            PP,VSTD,exec "$$=CARDFLTD($0);" "$$";
CARD_C_UNSIGNED_INT:  PP,VSTD,exec "$$=(unsigned int)$0;" "$$";
CARD_CREATE_STR:      FPP,VSTD,exec "$$=((unsigned int)$0)>>((unsigned)$1);" "$$";
CARD_IS_EQ:           PP,VSTD,exec "$$=($0)==($1);" "$$";
CARD_IS_LT:           PP,VSTD,exec "$$=($0)<($1);" "$$";
CARD_IS_EVEN:         PP,VSTD,exec "$$=($0&1)==0;" "$$";
CARD_IS_ODD:          PP,VSTD,exec "$$=($0&1)!=0;" "$$";
CARD_IS_BETWEEN:      PP,VSTD,exec "$$=($1<=$0&&$0<=&2)||($2<=$0&&$0<=$1);" "$$";
CARD_MAX:             PP,VSTD,exec "$$=($0>$1)?$0:$1;" "$$";
CARD_MIN:             PP,VSTD,exec "$$=($0<$1)?$0:$1;" "$$";
CARD_PLUS:            PP,VSTD,exec "$$=CARDPLUS($0,$1);" "$$";
CARD_MINUS:           PP,VSTD,exec "$$=CARDMINUS($0,$1);" "$$";
CARD_TIMES:           PP,VSTD,exec "$$=CARDTIMES($0,$1);" "$$";
CARD_DIV:             FPP,VSTD,exec "$$=CARDDIV($0,$1);" "$$";
CARD_MOD:             FPP,VSTD,exec "$$=CARDMOD($0,$1);" "$$";
CARD_SQUARE:          PP,VSTD,exec "$$=CARDTIMES($0,$0);" "$$";

CARD_TIMESB:          PP,
                      break "$0";
CARD_TIMESB_CARD:     PP,
                      break "$0",
                      temp "@r a$$;",
                      iter "a$$=$#;" "a$$";
CARD_FORB:            PP,
                      var "CARD $$,$$m;",
		      temp "@r a$$;",
                      init "$$=$0;$$m=$1;",
                      iter "if(($$m--)==0) @@;a$$=($$++);" "a$$";

CARD_UPB:	      no_pre,no_post ,
		      var "CARD $$;",
		      init "$$=$0;",
		      iter "$$;" "$$++";

CARD_UPTOB:	      no_pre,no_post ,
		      var "CARD $$,$$m;",
		      init "$$=$0;$$m=$1;",
		      iter "if($$>$$m) @@;" "$$++";

CARD_DOWNTOB:	      no_pre,no_post ,
		      var "CARD $$,$$m;",
		      init "$$=$0;$$m=$1;",
		      iter "if(($$)+1<$$m+1) @@;" "$$--";
--		      iter "if($$--<=$$m) @@;" "$$";

#endif