----------------->  GNU Sather - compiler configuration file  <----------------
-- Copyright (C) 199x by International Computer Science Institute            --
-- 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 INT_CONFIG
#define INT_CONFIG

#ifdef PP
#undef PP
#endif

#ifdef APP
#undef APP
#endif

#ifdef FPP
#undef FPP
#endif

#ifdef VSTD
#undef VSTD
#endif

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

INT_PLUS:	APP,VSTD,exec "$$=INTPLUS($0,$1);" "$$";
INT_MINUS:	APP,VSTD,exec "$$=INTMINUS($0,$1);" "$$";
INT_NEGATE:	APP,VSTD,exec "$$=INTMINUS(0,$0);" "$$";
INT_TIMES:	APP,VSTD,exec "$$=INTTIMES($0,$1);" "$$";
INT_DIV:	FPP,VSTD,exec "$$=INTDIV($0,$1);" "$$";
INT_MOD:	FPP,VSTD,exec "$$=INTMOD($0,$1);" "$$";
INT_IS_EQ:	PP,VSTD,exec "$$=($0)==($1);" "$$";
INT_IS_LT:	PP,VSTD,exec "$$=($0)<($1);" "$$";
INT_BOOL:	PP,VSTD,exec "$$=(BOOL)$0;" "$$";
INT_FLT:	PP,VSTD,exec "$$=(FLT)$0;" "$$";
INT_FLTD:	PP,VSTD,exec "$$=(FLTD)$0;" "$$";
INT_FLTX:	PP,VSTD,exec "$$=(FLT)$0;" "$$";
INT_FLTDX:	PP,VSTD,exec "$$=(FLT)$0;" "$$";
INT_CHAR:	PP,VSTD,exec "$$=(CHAR)$0;" "$$";
INT_C_UNSIGNED_INT:	PP,VSTD,exec "$$=(unsigned int)$0;" "$$";
INT_INT:	PP,exec "$0";
INT_ABS:	PP,VSTD,exec "$$=($0<0)?-$0:$0;" "$$";
INT_SQUARE:	APP,VSTD,exec "$$=INTTIMES($0,$0);" "$$";
INT_MAX:	PP,VSTD,exec "$$=($0>$1)?$0:$1;" "$$";
INT_MIN:	PP,VSTD,exec "$$=($0<$1)?$0:$1;" "$$";
INT_IS_EVEN:	PP,VSTD,exec "$$=($0&1)==0;" "$$";
INT_IS_ODD:	PP,VSTD,exec "$$=($0&1)!=0;" "$$";
INT_IS_BETWEEN:	PP,VSTD,exec "$$=($1<=$0&&$0<=$2)||($2<=$0&&$0<=$1);" "$$";
INT_UPLUS:	APP,VSTD,exec "$$=INTUPLUS($0,$1);" "$$";
INT_UMINUS:	APP,VSTD,exec "$$=INTUMINUS($0,$1);" "$$";
INT_UTIMES:	APP,VSTD,exec "$$=INTUTIMES($0,$1);" "$$";
INT_UDIV:	FPP,VSTD,exec "$$=INTUDIV($0,$1);" "$$";
INT_UMOD:	FPP,VSTD,exec "$$=INTUMOD($0,$1);" "$$";
INT_MPLUS:	PP,VSTD,exec "$$=((unsigned)$0+(unsigned)$1);" "$$";
INT_MMINUS:	PP,VSTD,exec "$$=((unsigned)$0-(unsigned)$1);" "$$";
INT_MNEGATE:	PP,VSTD,exec "$$=(-(unsigned)$0);" "$$";
INT_MTIMES:	PP,VSTD,exec "$$=((unsigned)$0*(unsigned)$1);" "$$";
INT_MDIV:	FPP,VSTD,exec "$$=((unsigned)$0/(unsigned)$1);" "$$";
INT_MMOD:	FPP,VSTD,exec "$$=((unsigned)$0%%(unsigned)$1);" "$$";
INT_BNOT:	PP,VSTD,exec "$$=~$0;" "$$";
INT_BAND:	PP,VSTD,exec "$$=$0&$1;" "$$";
INT_BOR:	PP,VSTD,exec "$$=$0|$1;" "$$";
INT_BXOR:	PP,VSTD,exec "$$=$0\\^$1;" "$$";
INT_LSHIFT:	PP,VSTD,exec "$$=((unsigned)$0)<<((unsigned)$1);" "$$";
INT_RSHIFT:	PP,VSTD,exec "$$=INTRSHIFT($0,$1);" "$$";
INT_URSHIFT:	PP,VSTD,exec "$$=((unsigned)$0)>>((unsigned)$1);" "$$";
INT_CREATE_STR:	FPP,VSTD,exec "$$=atoi(((STR)$1)->arr_part);" "$$";
INT_AGET:	PP,VSTD,exec "$$=((CHAR)(($0&(1<<$1))!=0));" "$$";
INT_ASET:	PP,VSTD,exec "$$=((($0)&(~(1<<($1))))|(($2)<<($1)));" "$$";
INT_MAXINT:	PP,var "INT $$=SINT_MAX;",exec "$$";
INT_MININT:	PP,var "INT $$=SINT_MIN;",exec "$$";
INT_TIMESB:	PP,
		break "$0";
INT_TIMESB_INT:	PP,
		break "$0",
		temp "@r a$$;",
		iter "a$$=$#;" "a$$";
INT_FORB:	PP,
		var "INT $$,$$m;",
		init "$$=$0-1;$$m=$1;",
		iter "if(($$m--)<=0) @@;$$++;" "$$";
INT_UPB:	PP,
		var "INT $$;",
		init "$$=$0-1;",
		iter "$$++;" "$$";
INT_UPTOB:	PP,
		var "INT $$,$$m;",
		init "$$=$0-1;$$m=$1;",
		iter "if($$++>=$$m) @@;" "$$";
INT_DOWNTOB:	PP,
		var "INT $$,$$m;",
		init "$$=$0+1;$$m=$1;",
		iter "if($$--<=$$m) @@;" "$$";
	
#endif 
