Parsing module

Instructions manual





OKit: Object Tree, RPL Virtual Machine and compiler shared library

Copyright (C) 2000 Yann LANDRIN-SCHWEITZER


This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.

This library is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser
General Public License for more details.

You should have received a copy of the GNU Lesser General Public License
along with this library; if not, write to the Free Software Foundation,
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA


Author: Yann LANDRIN-SCHWEITZER
Contact: varkhan@free.fr
Homepage: http://varkhan.free.fr/





USES ErrLog.h





OKit_Bltn table query






Function OKit_BltnSort

OKit_Bltn * OKit_BltnSort(OKit_Bltn * table, unsigned long tablesize) ;
Sorts lexically a table of OKit_Bltn definitions.


Args
_table:table of OKit_Bltn definitions
_tablesize:size of OKit_Bltn table


Returns
_NULL:if the table was NULL or empty
else the table, after sorting.



Function OKit_BltnByName

OKit_Bltn OKit_BltnByName(OKit_Bltn * table, unsigned long tablesize, char * str) ;
Retrives a built-in executable by its name.


Args
_table:table of OKit_Bltn definitions
_tablesize:size of OKit_Bltn table
_str:string to lookup in the table


Returns
_NULL:if the built-in was not found
else the built-in whose name is 'str'.


NOTE
The built-in table must be sorted lexically by name entries. If not, results
are unpredictable.




Parsing






Function OKit_ObjectParse

OKit_Object OKit_ObjectParse(OKit_Bltn * table, unsigned long tablesize, char * str, unsigned long * off) ;
Parses the next token in a string.


Args
_table:table of OKit_Bltn definitions
_tablesize:size of OKit_Bltn table
_str:string to parse
_off:offset pointer in the string indicating where to begin (or NULL)


Returns
_NULL:if a syntax error occurred or the end of the string was reached
else the next parsed OKit_Object.


NOTE
The built-in table must be sorted lexically by name entries. If not, results
are unpredictable.



Function OKit_ListParse

OKit_List OKit_ListParse(OKit_Bltn * table, unsigned long tablesize, char * str, unsigned long * off) ;
Parses a string into a OKit_List of OKit_Objects.


Args
_table:table of OKit_Bltn definitions
_tablesize:size of OKit_Bltn table
_str:string to parse
_off:offset pointer in the string indicating where to begin (or NULL)


Returns
_NULL:if a syntax error occurred, or no object was found
else a OKit_List of all recognised OKit_Objects.


Errors
_EINVAL:if a syntax error occurred
_ENOMEM:if no memory was available


NOTE
The built-in table must be sorted lexically by name entries. If not, results
are unpredictable.