/* %Z%%M% %I% %E% */

/*
 * Copyright (c) 1991, 1992, 1993, 1995 by Wayne C. Gramlich.
 * All rights reserved.
 *
 * Permission to use, copy, modify, distribute, and sell this software
 * for any purpose is hereby granted without fee provided that the above
 * copyright notice and this permission are retained.  The author makes
 * no representations about the suitability of this software for any purpose.
 * It is provided "as is" without express or implied warranty.
 */

/*
 * This file implements the logical base type operations in ANSI-C.
 */

#ifndef UNIX_STDIO_H
#include "unix_stdio.h"
#endif

int logical__true = 1;

int logical__false = 0;

int logical___initial = 0;

void
logical__external__initialize(void)
{
}

int
logical__and(
	int		logical1,
	int		logical2)
{
	return logical1 && logical2;
}

int
logical__equal(
	int		logical1,
	int		logical2)
{
	int 		int1;
	int 		int2;

	int1 = (logical1 == 0) ? 0 : 1;
	int2 = (logical2 == 0) ? 0 : 1;
	return int1 == int2;
}

int
logical__not(
	int		logical)
{
	return !logical;
}

int
logical__or(
	int		logical1,
	int		logical2)
{
	return logical1 || logical2;
}

unsigned
logical__unsigned_convert(
	int		logical)
{
	return logical;
}

int
logical__xor(
	int		logical1,
	int		logical2)
{
	int 		int1;
	int 		int2;

	int1 = (logical1 == 0) ? 0 : 1;
	int2 = (logical2 == 0) ? 0 : 1;
	return int1 ^ int2;
}
