#include "bool.h"

int bool_sort= 0;

udatum
true ()
{
  static udatum kkk= 0;

  if (kkk == 0) {
    kkk= ud_alloc ();
    kkk->ino= 1;        /* user coding */
    (void) ud_const (bool_sort,kkk);
  }
  return kkk;
}

udatum
false ()
{
  static udatum kkk= 0;

  if (kkk == 0) {
    kkk= ud_alloc ();
    kkk->ino= 0;        /* user coding */
    (void) ud_const (bool_sort,kkk);
  }
  return kkk;
}
udatum
not (t1)
    udatum t1;
{
  udatum r;

  if (t1->ino == 0)
    r= true ();
  else
    r= false ();
  ud_free( bool_sort, t1);
  return r;
}
int
eqbool (t1, t2)
    udatum t1, t2;
{
  return (t1->ino == t2->ino);
}
char*
dbool (t1)
     udatum t1;
{
  if (t1->ino == 0)
    return "false";
  else
    return "true";
}
