Back to home page

Enduro/X

 
 

    


0001 BBOOLPRCB(3)
0002 ============
0003 :doctype: manpage
0004 
0005 
0006 NAME
0007 ----
0008 Bboolprcb - Print the compiler boolean expression AST to callback function
0009 
0010 
0011 SYNOPSIS
0012 --------
0013 
0014 #include <ubf.h>
0015 
0016 void Bboolprcb (char * 'tree', 
0017         int (*'p_writef')(char *'buffer', long 'datalen', void *'dataptr1'), 
0018         void *'dataptr1');
0019 
0020 Link with '-lubf -lnstd -lm -lpthread'
0021 
0022 DESCRIPTION
0023 -----------
0024 Print the compiled UBF buffer boolean expression evaluation Abstract Syntax Tree
0025  (AST) at 'tree' hander to 'p_writef' callback function. 
0026 The sample output for AST is following:
0027 
0028 --------------------------------------------------------------------------------
0029 
0030 
0031 int writef(char *buffer, long datalen, void *dataptr1)
0032 {
0033     /* in total this will get buffer fragments like
0034      * ((2*(4+5)) || ((5 && ('abc' %% '..b')) && (((2/2)*4) == 5))
0035      * note there could be newlines (\n) between calls
0036      */
0037     return 0;
0038 }
0039 
0040 ...
0041 tree=Bboolco ("2 * ( 4 + 5 ) || 5 && 'abc' %% '..b' && 2/2*4==5")
0042 ...
0043 Bboolprcb(tree, writef, NULL);
0044 
0045 --------------------------------------------------------------------------------
0046 
0047 The callback function will called several times as portions of the AST are
0048 traversed with each call line is terminated with EOS (0x00 byte) symbol. 
0049 The compiled tree to function is presented by 'tree' argument, the callback
0050 is set by 'p_writef' function. Function accepts optional 'dataptr1' argument
0051 which is user pointer forwarded to 'p_writef' callback. The 'dataptr1' can be NULL.
0052 
0053 The 'p_writef' by it self receives 'buffer' which contains ASCII chars of the
0054 AST representation, 'datalen' includes the data buffer received (note EOS are
0055 note included in intermediate calls). The 'dataptr1' is user pointer passed to
0056 *Bboolprcb()*. In case of success the callback shall return 0, and in cases
0057 of failure a non zero value. When error occurs, the function terminates the
0058 printing.
0059 
0060 The last call to printing includes newline and then 0x00 follows.
0061 
0062 
0063 RETURN VALUE
0064 ------------
0065 Function is void and does not return any value.
0066 
0067 ERRORS
0068 ------
0069 Function is void and does not return any error.
0070 
0071 EXAMPLE
0072 -------
0073 See *ubftest/test_expr.c* for sample code.
0074 
0075 BUGS
0076 ----
0077 Report bugs to support@mavimax.com
0078 
0079 SEE ALSO
0080 --------
0081 *Bboolpr(3)* *Bboolev(3)* *Bfloatev(3)* *Btreefree(3)*
0082 
0083 COPYING
0084 -------
0085 (C) Mavimax, Ltd
0086