PURPOSE

Fboolco, Fboolco32, Fvboolco, Fvboolco32 - compile expression, return evaluation tree

SYNOPSIS

#include <stdio.h>
#include "fml.h"
char *
Fboolco(char *expression)
char *
Fvboolco(char *expression, char *viewname)
#include "fml32.h"
char *
Fboolco32(char *expression)
char *
Fvboolco32(char *expression, char *viewname)

DESCRIPTION

Fboolco() compiles a Boolean expression, pointed to by expression, and returns a pointer to the evaluation tree. The expressions recognized are close to the expressions recognized in C. A description of the grammar can be found in the FML Programmer's Guide.

The evaluation tree produced by Fboolco() is used by the other boolean functions listed under SEE ALSO; this avoids having to re-compile the expression.

Fboolco32 is used with 32-bit FML.

Fvboolco and Fvboolco32 provide the same functionality for views. The viewname parameter indicates the view from which the field offsets are taken.

These functions are not supported on /WS platforms.

RETURN VALUES

This function returns NULL on error and sets Ferror to indicate the error condition.

ERRORS

Under the following conditions, Fboolco() fails and sets Ferror to:

[FMALLOC]
"malloc failed"
Allocation of space dynamically using malloc(3) failed.
 
[FSYNTAX]
"bad syntax in Boolean expression"
A syntax error was found in a Boolean expression by Fboolco() other than an unrecognized field name.
 
[FBADNAME]
"unknown field name"
A field name is specified which cannot be found in the field tables or view files.
 
[FEINVAL]
"invalid argument to function"
One of the arguments to the function invoked was invalid, (for example, expression is NULL).
 
[FBADVIEW]
"cannot find or get view"
viewname was not found in the files specified by VIEWDIR or VIEWFILES.
 
[FVFOPEN]
"cannot find or open view file"
While trying to find viewname, the program failed to find one of the files specified by VIEWDIR or VIEWFILES.
 
[EUNIX]
"operating system error"
While trying to find viewname, the program failed to open one of the files specified by VIEWDIR or VIEWFILES for reading.
 
[FVFSYNTAX]
"bad viewfile"
While trying to find viewname, one of the files specified by VIEWDIR or VIEWFILES was corrupted or not a view file.
 
[FMALLOC]
"malloc failed"
While trying to find viewname, malloc() failed while allocating space to hold the view information.

EXAMPLE

#include "stdio.h"
#include "fml.h"
extern char *Fboolco();
char *tree;
if((tree=Fboolco("FIRSTNAME %% 'J.*n' && SEX = 'M'")) == NULL)
  F_error("pgm_name");

compiles a boolean expression that checks if the FIRSTNAME field is in the buffer, begins with 'J' and ends with 'n' (for example, John, Jean, Jurgen, etc.) and the SEX field equal to 'M'.

The first and second characters of the tree array form the least significant byte and the most significant byte, respectively, of an unsigned 16 bit quantity that gives the length, in bytes, of the entire array. This value is useful for copying or otherwise manipulating the array.

SEE ALSO

Fboolev(3fml),
Fboolpr(3fml),
Fldid(3fml)