head	1.8;
access;
symbols
	Version_2_1:1.6
	C_Demo_1:1.3;
locks; strict;
comment	@ * @;


1.8
date	92.02.05.03.42.40;	author mer;	state Exp;
branches;
next	1.7;

1.7
date	91.04.28.09.14.16;	author cimarron;	state Exp;
branches;
next	1.6;

1.6
date	91.02.28.20.55.50;	author mao;	state Exp;
branches;
next	1.5;

1.5
date	90.09.25.16.48.47;	author kemnitz;	state Exp;
branches;
next	1.4;

1.4
date	89.09.21.18.59.37;	author hirohama;	state Exp;
branches;
next	1.3;

1.3
date	89.09.05.17.25.41;	author mao;	state C_Demo_1;
branches;
next	1.2;

1.2
date	89.02.02.16.10.12;	author aoki;	state Stab;
branches;
next	1.1;

1.1
date	89.01.17.05.58.28;	author cimarron;	state Exp;
branches;
next	;


desc
@@


1.8
log
@make boolean input function slightly more forgiving
@
text
@/*
 * bool.c --
 * 	Functions for the built-in type "bool".
 */

#include "tmp/c.h"
#include "utils/log.h"

RcsId("$Header: /users/mer/postgres/src/utils/adt/RCS/bool.c,v 1.7 1991/04/28 09:14:16 cimarron Exp mer $");

#include "utils/palloc.h"

	    /* ========== USER I/O ROUTINES ========== */


/*
 *	boolin		- converts "t" or "f" to 1 or 0
 */
int32
boolin(b)
	char	*b;
{
	if (b == NULL)
		elog(WARN, "Bad input string for type bool");
	return((int32) (*b == 't') || (*b == 'T'));
}

/*
 *	boolout		- converts 1 or 0 to "t" or "f"
 */
char *
boolout(b)
	long	b;
{
	char	*result = (char *) palloc(2);

	*result = (b) ? 't' : 'f';
	result[1] = '\0';
	return(result);
}


	     /* ========== PUBLIC ROUTINES ========== */

	 /* (see int.c for comparison/operation routines) */


	     /* ========== PRIVATE ROUTINES ========== */

@


1.7
log
@Converted IsValid code into macros and added an improved NodeIsType scheme
@
text
@d7 1
d9 1
a9 1
RcsId("$Header: RCS/bool.c,v 1.6 91/02/28 20:55:50 mao Exp Locker: cimarron $");
d24 2
a25 2
		return((int32) NULL);
	return((int32) (*b == 't'));
@


1.6
log
@typecast calls to palloc
@
text
@d8 1
a8 1
RcsId("$Header: RCS/bool.c,v 1.5 90/09/25 16:48:47 kemnitz Exp Locker: mao $");
a48 10

/*
 *	boolIsValid
 */
bool
boolIsValid(b)
	bool	b;
{
	return((bool) (b == false || b == true));
}
@


1.5
log
@Updating from revision 1.4 to revision 1.5
@
text
@d8 1
a8 1
RcsId("$Header: RCS/bool.c,v 1.5 90/08/15 08:16:26 cimarron Exp $");
d34 1
a34 1
	char	*result = palloc(2);
@


1.4
log
@palloc defined in "palloc.h" not "postgres.h"
@
text
@d6 1
a6 1
#include "c.h"
d8 1
a8 1
RcsId("$Header: RCS/bool.c,v 1.3 89/09/05 17:25:41 mao C_Demo_1 Locker: hirohama $");
d10 1
a10 1
#include "palloc.h"
@


1.3
log
@Working version of C-only demo
@
text
@a6 1
#include "postgres.h"
d8 1
a8 1
RcsId("$Header: /usr6/postgres/mao/postgres/src/utils/adt/RCS/bool.c,v 1.2 89/02/02 16:10:12 aoki Stab $");
d10 1
@


1.2
log
@MERGE WITH OLD TREE
@
text
@d9 1
a9 1
RcsId("$Header: bool.c,v 1.1 88/06/26 23:10:20 aoki Locked $");
@


1.1
log
@Initial revision
@
text
@a0 1

a1 26
 * 
 * POSTGRES Data Base Management System
 * 
 * Copyright (c) 1988 Regents of the University of California
 * 
 * Permission to use, copy, modify, and distribute this software and its
 * documentation for educational, research, and non-profit purposes and
 * without fee is hereby granted, provided that the above copyright
 * notice appear in all copies and that both that copyright notice and
 * this permission notice appear in supporting documentation, and that
 * the name of the University of California not be used in advertising
 * or publicity pertaining to distribution of the software without
 * specific, written prior permission.  Permission to incorporate this
 * software into commercial products can be obtained from the Campus
 * Software Office, 295 Evans Hall, University of California, Berkeley,
 * Ca., 94720 provided only that the the requestor give the University
 * of California a free licence to any derived software for educational
 * and research purposes.  The University of California makes no
 * representations about the suitability of this software for any
 * purpose.  It is provided "as is" without express or implied warranty.
 * 
 */



/*
d9 1
a9 1
RcsId("$Header: bool.c,v 1.1 88/11/11 16:35:40 postgres Exp $");
@
