/*****************************************************************/
/**                                                             **/
/**             (C) Copyright 1992 the Regents of the           **/
/**        University of California.  All Rights Reserved.      **/
/**                                                             **/
/**        This work was produced under the sponsorship of      **/
/**         the U.S. Department of Energy.  The Government      **/
/**                retains certain rights therein.              **/
/**                                                             **/
/**                         Written by                          **/
/**         Distributed Programming Environments Project        **/
/**           Computer Software and Networking Division,        **/
/**                   Livermore Computer Center,                **/
/**            Lawrence Livermore National Laboratory           **/
/**                                                             **/
/*****************************************************************/

static char sccsid_conv_bool[] = "@(#)conv_bool.c	1.11 11/13/92 10:32:14  LLNL ";

/*
	Embedded Language for Remote Operations Services
	ELROS

	AUTHOR:		James A. Guse
			Network Systems Division

	DATE WRITTEN:	11/6/90

	ROUTINE:	__ROr_convert_Boolean_const


PURPOSE:
	This routine converts the string "True" or "False" into 
	a boolean value.

IN:
	valuelength - length in bytes of value variable
	maxlength - length in bytes of value variable
	maxlength2 - length in bytes of value variable
	constant - string of value expression

OUT:
	value - value specified by the constant argument


CALLED ROUTINES:

	
MODIFICATION HISTORY:


*/

#include <elros/exceptions.h>


int __ROr_convert_Boolean_const(value,valuelength,maxlength,maxlength2,constant)

	void *value;
	unsigned long valuelength;
	unsigned long maxlength;
	unsigned long maxlength2;
	char *constant;

{
   unsigned char *byteptr = (unsigned char *)value;
   unsigned char byte;

   re_comp("^True$");

   if (!re_comp)
      return (__ROx_CONST_BOOLEANERROR);

   if (re_exec(constant))
      byte = 0xFF;
   else
   {
      re_comp("^False$");

      if (!re_comp)
         return (__ROx_CONST_BOOLEANERROR);

      if (re_exec(constant))
         byte = 0x00;
      else
         return(__ROx_CONST_BOOLEANERROR);
   }

   memset(byteptr,byte,valuelength);
   return(SUCCESS);
}


