------------------------->  GNU Sather - sourcefile  <-------------------------
-- Copyright (C) 1995 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>  <--------------

-- c.sa:   ANSI C interface classes
-- author: Boris Vaysman
------------------------------------------------------------------------------
immutable class C_CHAR is
   -- ANSI C ``char''  (built in type)
   include COMPARABLE;
   
   create(x:CHAR):C_CHAR is
      builtin C_CHAR_CREATE_CHAR;
   end;

   char:CHAR is
      -- A Sather CHAR version of self
      builtin C_CHAR_CHAR;
   end;
   
   str:STR is
      return char.str;
   end;
   
   zero:SAME is builtin C_CHAR_ZERO; end;
   plus(i:SAME):SAME is builtin C_CHAR_PLUS; end;
   minus(i:SAME):SAME is builtin C_CHAR_MINUS; end;      
   times(i:SAME):SAME is builtin C_CHAR_TIMES; end;         
   div(i:SAME):SAME is builtin C_CHAR_DIV; end;  
   is_eq(i:SAME):BOOL is builtin C_CHAR_IS_EQ; end;
   is_lt(i:SAME):BOOL is builtin C_CHAR_IS_LT; end;
   
end;

immutable class C_UNSIGNED_CHAR is
   -- ANSI C ``unsigned char''  (built in type)
   include COMPARABLE;
   
   create(x:CHAR):C_UNSIGNED_CHAR is
      builtin C_UNSIGNED_CHAR_CREATE_CHAR;
   end;

   char:CHAR is
      -- A Sather CHAR version of self
      builtin C_UNSIGNED_CHAR_CHAR;
   end;
   
   str:STR is
      return char.str;
   end;
   
   zero:SAME is builtin C_UNSIGNED_CHAR_ZERO; end;
   plus(i:SAME):SAME is builtin C_UNSIGNED_CHAR_PLUS; end;
   minus(i:SAME):SAME is builtin C_UNSIGNED_CHAR_MINUS; end;      
   times(i:SAME):SAME is builtin C_UNSIGNED_CHAR_TIMES; end;         
   div(i:SAME):SAME is builtin C_UNSIGNED_CHAR_DIV; end;  
   is_eq(i:SAME):BOOL is builtin C_UNSIGNED_CHAR_IS_EQ; end;
   is_lt(i:SAME):BOOL is builtin C_UNSIGNED_CHAR_IS_LT; end;
   
end;

immutable class C_SIGNED_CHAR is
   -- ANSI C ``signed char''  (built in type)
   include COMPARABLE;
   
   create(x:CHAR):C_SIGNED_CHAR is
      builtin C_SIGNED_CHAR_CREATE_CHAR;
   end;

   char:CHAR is
      -- A Sather CHAR version of self
      builtin C_SIGNED_CHAR_CHAR;
   end;
   
   str:STR is
      return char.str;
   end;
   
   zero:SAME is builtin C_SIGNED_CHAR_ZERO; end;
   plus(i:SAME):SAME is builtin C_SIGNED_CHAR_PLUS; end;
   minus(i:SAME):SAME is builtin C_SIGNED_CHAR_MINUS; end;      
   times(i:SAME):SAME is builtin C_SIGNED_CHAR_TIMES; end;         
   div(i:SAME):SAME is builtin C_SIGNED_CHAR_DIV; end;  
   is_eq(i:SAME):BOOL is builtin C_SIGNED_CHAR_IS_EQ; end;
   is_lt(i:SAME):BOOL is builtin C_SIGNED_CHAR_IS_LT; end;
   
end;


immutable class C_SHORT is
   -- ANSI C ``short''  (built in type)
   include COMPARABLE;
   
   create(x:INT):C_SHORT is
      builtin C_SHORT_CREATE_INT;
   end;

   int:INT is
      -- A Sather integer version of self
      builtin C_SHORT_INT;
   end;
   
   str:STR is
      return int.str;
   end;
   
   zero:SAME is builtin C_SHORT_ZERO; end;
   plus(i:SAME):SAME is builtin C_SHORT_PLUS; end;
   minus(i:SAME):SAME is builtin C_SHORT_MINUS; end;      
   times(i:SAME):SAME is builtin C_SHORT_TIMES; end;         
   div(i:SAME):SAME is builtin C_SHORT_DIV; end;  
   is_eq(i:SAME):BOOL is builtin C_SHORT_IS_EQ; end;
   is_lt(i:SAME):BOOL is builtin C_SHORT_IS_LT; end;
   
   nil:SAME is
      -- let Sather handle this (we are confused by the philosophical
      -- impilations of nil vs void vs unitialized vs zero
      return #(INT::nil);
   end;
   
   is_nil:BOOL is
      return int.is_nil;
   end;
end;

immutable class C_INT is
   -- ANSI C ``int''  (built in type)
   include COMPARABLE;
   
   create(x:INT):C_INT is
      builtin C_INT_CREATE_INT;
   end;

   int:INT is
      -- A Sather integer version of self
      builtin C_INT_INT;
   end;
   
   str:STR is
      return int.str;
   end;
   
   zero:SAME is builtin C_INT_ZERO; end;
   plus(i:SAME):SAME is builtin C_INT_PLUS; end;
   minus(i:SAME):SAME is builtin C_INT_MINUS; end;      
   times(i:SAME):SAME is builtin C_INT_TIMES; end;         
   div(i:SAME):SAME is builtin C_INT_DIV; end;  
   is_eq(i:SAME):BOOL is builtin C_INT_IS_EQ; end;
   is_lt(i:SAME):BOOL is builtin C_INT_IS_LT; end;
   
   nil:SAME is
      -- let Sather handle this (we are confused by the philosophical
      -- impilations of nil vs void vs unitialized vs zero
      return #(INT::nil);
   end;
   
   is_nil:BOOL is
      return int.is_nil;
   end;
end;

immutable class C_LONG is
   -- ANSI C ``long''  (built in type)
   include COMPARABLE;
   
   create(x:INT):C_LONG is
      builtin C_LONG_CREATE_INT;
   end;

   int:INT is
      -- A Sather integer version of self
      builtin C_LONG_INT;
   end;
   
   str:STR is
      return int.str;
   end;
   
   zero:SAME is builtin C_LONG_ZERO; end;
   plus(i:SAME):SAME is builtin C_LONG_PLUS; end;
   minus(i:SAME):SAME is builtin C_LONG_MINUS; end;      
   times(i:SAME):SAME is builtin C_LONG_TIMES; end;         
   div(i:SAME):SAME is builtin C_LONG_DIV; end;  
   is_eq(i:SAME):BOOL is builtin C_LONG_IS_EQ; end;
   is_lt(i:SAME):BOOL is builtin C_LONG_IS_LT; end;
   
   nil:SAME is
      -- let Sather handle this (we are confused by the philosophical
      -- impilations of nil vs void vs unitialized vs zero
      return #(INT::nil);
   end;
   
   is_nil:BOOL is
      return int.is_nil;
   end;
end;

immutable class C_UNSIGNED_SHORT is
   -- ANSI C ``unsigned short''  (built in type)
   include COMPARABLE;
   
   create(x:INT):C_UNSIGNED_SHORT is
      builtin C_UNSIGNED_SHORT_CREATE_INT;
   end;

   int:INT is
      -- A Sather integer version of self
      builtin C_UNSIGNED_SHORT_INT;
   end;
   
   str:STR is
      return int.str;
   end;
   
   zero:SAME is builtin C_UNSIGNED_SHORT_ZERO; end;
   plus(i:SAME):SAME is builtin C_UNSIGNED_SHORT_PLUS; end;
   minus(i:SAME):SAME is builtin C_UNSIGNED_SHORT_MINUS; end;      
   times(i:SAME):SAME is builtin C_UNSIGNED_SHORT_TIMES; end;         
   div(i:SAME):SAME is builtin C_UNSIGNED_SHORT_DIV; end;  
   is_eq(i:SAME):BOOL is builtin C_UNSIGNED_SHORT_IS_EQ; end;
   is_lt(i:SAME):BOOL is builtin C_UNSIGNED_SHORT_IS_LT; end;
   
   nil:SAME is
      -- let Sather handle this (we are confused by the philosophical
      -- impilations of nil vs void vs unitialized vs zero
      return #(INT::nil);
   end;
   
   is_nil:BOOL is
      return int.is_nil;
   end;
end;


immutable class C_UNSIGNED_INT is
   -- ANSI C ``unsigned int''  (built in type)
   include COMPARABLE;
   
   create(x:INT):C_UNSIGNED_INT is
      builtin C_UNSIGNED_INT_CREATE_INT;
   end;

   int:INT is
      -- A Sather integer version of self
      builtin C_UNSIGNED_INT_INT;
   end;
   
   str:STR is
      return int.str;
   end;
   
   zero:SAME is builtin C_UNSIGNED_INT_ZERO; end;
   plus(i:SAME):SAME is builtin C_UNSIGNED_INT_PLUS; end;
   minus(i:SAME):SAME is builtin C_UNSIGNED_INT_MINUS; end;      
   times(i:SAME):SAME is builtin C_UNSIGNED_INT_TIMES; end;         
   div(i:SAME):SAME is builtin C_UNSIGNED_INT_DIV; end;  
   is_eq(i:SAME):BOOL is builtin C_UNSIGNED_INT_IS_EQ; end;
   is_lt(i:SAME):BOOL is builtin C_UNSIGNED_INT_IS_LT; end;
   
   nil:SAME is
      -- let Sather handle this (we are confused by the philosophical
      -- impilations of nil vs void vs unitialized vs zero
      return #(INT::nil);
   end;
   
   is_nil:BOOL is
      return int.is_nil;
   end;
end;

immutable class C_UNSIGNED_LONG is
   -- ANSI C ``unsigned long''  (built in type)
   include COMPARABLE;
   
   create(x:INT):C_UNSIGNED_LONG is
      builtin C_UNSIGNED_LONG_CREATE_INT;
   end;

   int:INT is
      -- A Sather integer version of self
      builtin C_UNSIGNED_LONG_INT;
   end;
   
   str:STR is
      return int.str;
   end;
   
   zero:SAME is builtin C_UNSIGNED_LONG_ZERO; end;
   plus(i:SAME):SAME is builtin C_UNSIGNED_LONG_PLUS; end;
   minus(i:SAME):SAME is builtin C_UNSIGNED_LONG_MINUS; end;      
   times(i:SAME):SAME is builtin C_UNSIGNED_LONG_TIMES; end;         
   div(i:SAME):SAME is builtin C_UNSIGNED_LONG_DIV; end;  
   is_eq(i:SAME):BOOL is builtin C_UNSIGNED_LONG_IS_EQ; end;
   is_lt(i:SAME):BOOL is builtin C_UNSIGNED_LONG_IS_LT; end;
   
   nil:SAME is
      -- let Sather handle this (we are confused by the philosophical
      -- impilations of nil vs void vs unitialized vs zero
      return #(INT::nil);
   end;
   
   is_nil:BOOL is
      return int.is_nil;
   end;
end;

immutable class C_FLOAT is
   -- ANSI C ``float'' type (built in type)
   include COMPARABLE;
   
   create(x:FLT):C_FLOAT is
      builtin C_FLOAT_CREATE_FLT;
   end;

   flt:FLT is
      -- A Sather FLT version of self
      builtin C_FLOAT_FLT;
   end;
   
   str:STR is
      return flt.str;
   end;
   zero:SAME is builtin C_FLOAT_ZERO; end;
   plus(i:SAME):SAME is builtin C_FLOAT_PLUS; end;
   minus(i:SAME):SAME is builtin C_FLOAT_MINUS; end;      
   times(i:SAME):SAME is builtin C_FLOAT_TIMES; end;         
   div(i:SAME):SAME is builtin C_FLOAT_DIV; end;  
   is_eq(i:SAME):BOOL is builtin C_FLOAT_IS_EQ; end;
   is_lt(i:SAME):BOOL is builtin C_FLOAT_IS_LT; end;
   
   nil:SAME is
      -- let Sather handle this (we are confused by the philosophical
      -- impilations of nil vs void vs unitialized vs zero
      return #(FLT::nil);
   end;   
   
   is_nil:BOOL is
      return flt.is_nil;
   end;
end;

immutable class C_DOUBLE is
   -- ANSI C ``double'' type (built in type)
   include COMPARABLE;
   
   create(x:FLTD):C_DOUBLE is
      builtin C_DOUBLE_CREATE_FLTD;
   end;

   fltd:FLTD is
      -- A Sather FLT version of self
      builtin C_DOUBLE_FLTD;
   end;
   
   str:STR is
      return fltd.str;
   end;
   zero:SAME is builtin C_DOUBLE_ZERO; end;
   plus(i:SAME):SAME is builtin C_DOUBLE_PLUS; end;
   minus(i:SAME):SAME is builtin C_DOUBLE_MINUS; end;      
   times(i:SAME):SAME is builtin C_DOUBLE_TIMES; end;         
   div(i:SAME):SAME is builtin C_DOUBLE_DIV; end;  
   is_eq(i:SAME):BOOL is builtin C_DOUBLE_IS_EQ; end;
   is_lt(i:SAME):BOOL is builtin C_DOUBLE_IS_LT; end;
   
   nil:SAME is
      -- let Sather handle this (we are confused by the philosophical
      -- impilations of nil vs void vs unitialized vs zero
      return #(FLTD::nil);
   end;   
   
   is_nil:BOOL is
      return fltd.is_nil;
   end;
end;

immutable class C_LONG_DOUBLE is
   -- ANSI C ``long double'' type (built in type)
   include COMPARABLE;
   
   create(x:FLT):C_LONG_DOUBLE is
      builtin C_LONG_DOUBLE_CREATE_FLT;
   end;

   fltd:FLTD is
      -- A Sather FLT version of self
      builtin C_LONG_DOUBLE_FLT;
   end;
   
   str:STR is
      return fltd.str;
   end;
   zero:SAME is builtin C_LONG_DOUBLE_ZERO; end;
   plus(i:SAME):SAME is builtin C_LONG_DOUBLE_PLUS; end;
   minus(i:SAME):SAME is builtin C_LONG_DOUBLE_MINUS; end;      
   times(i:SAME):SAME is builtin C_LONG_DOUBLE_TIMES; end;         
   div(i:SAME):SAME is builtin C_LONG_DOUBLE_DIV; end;  
   is_eq(i:SAME):BOOL is builtin C_LONG_DOUBLE_IS_EQ; end;
   is_lt(i:SAME):BOOL is builtin C_LONG_DOUBLE_IS_LT; end;
   
   nil:SAME is
      -- let Sather handle this (we are confused by the philosophical
      -- impilations of nil vs void vs unitialized vs zero
      return #(FLTD::nil);
   end;   
   
   is_nil:BOOL is
      return fltd.is_nil;
   end;
end;







