Object Types

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





Generic Object methods






Function ObjectAlloc

Object ObjectAlloc() ;
Allocates an empty, undefined object.


Returns
_NULL:if no memory was available
else a new undefined Object.


Errors
_ENOMEM:if no memory was available



Function ObjectCopy

Object ObjectCopy(Object obj) ;
Hard-copies an Object.


Args
_obj:Object to copy


Returns
_NULL:if a NULL Object was passed as argument, or no memory was available
else a direct, fully recursive copy of the Object.


Errors
_EINVAL:if a NULL Object was passed as argument
_ENOMEM:if no memory was available



Function ObjectClone

Object ObjectClone(Object obj) ;
Clones an Object.


Args
_obj:Object to clone


Returns
_NULL:if a NULL Object was passed as argument, or no memory was available
else a cloned version of the Object (flat copy).


Errors
_EINVAL:if a NULL Object was passed as argument
_ENOMEM:if no memory was available



Function ObjectDup

Object ObjectDup(Object obj) ;
References an Object.


Args
_obj:Object to reference


Returns
_NULL:if a NULL Object was passed as argument
else the referenced object.


Errors
_EINVAL:if a NULL Object was passed as argument



Function ObjectDrop

Object ObjectDrop(Object obj) ;
Dereferences an Object.


Args
_obj:Object to dereference


Returns
_NULL:if a NULL Object was passed as argument
else the dereferenced object.


Errors
_EINVAL:if a NULL Object was passed as argument



Function ObjectFree

void ObjectFree(Object obj) ;
Frees and Object if it is unreferenced.


Args
_obj:Object to free



Function ObjectType

Type ObjectType(Object obj) ;
Returns the type of an Object.


Args
_obj:Object to query


Returns
_-1:if a NULL Object was passed as argument
else the numeric identifier for the object type.


Errors
_EINVAL:if a NULL Object was passed as argument



Function ObjectTypeName

char * ObjectTypeName(Type typ) ;
Returns a name for a numeric type identifier.


Args
_obj:Object to query


Returns
_"":if an unknown type was given
else a unique string usable as a name for that type.



Function ObjectContent

void * ObjectContent(Object obj) ;
Returns a pointer on the content of an Object.


Args
_obj:Object to query


Returns
_-1:if a NULL Object was passed as argument
else a pointer to the Object's content.


Errors
_EINVAL:if a NULL Object was passed as argument



Function ObjectStat

unsigned long ObjectStat(Object obj) ;
Prints an Object's statistics.


Args
_obj:Object to query


Returns
_-1:if a NULL Object was passed as argument
else 0.



Function ObjectOut

unsigned long ObjectOut(Object obj, char * out, unsigned long max) ;
Prints an Object into a character string.


Args
_obj:Object to print
_out:allocated output string (at least max+1 characters)
_max:max number of characters to print


Returns
_-1:if some error occurred
_ the maximum number of character needed to print completely the object if 'out' is NULL (max is ignored)
else the total number of characters printed


Errors
_EINVAL:if a NULL Object was passed as argument



Function ObjectEqual

unsigned char ObjectEqual(Object obj, Object objw) ;
Tests the equality between Objects.


Args
_obj:Object to test
_objw:reference Object


Returns
_-1:if a NULL Object was passed as argument
_ 0:if the two Objects were distinct
_+1:if the two Objects were equal


Errors
_EINVAL:if a NULL Object was passed as argument



Function ObjectStrg

Strg ObjectStrg(Object obj) ;
Returns the String representation of an Object.


Args
_obj:Object to print


Returns
_NULL:if a NULL Object was passed as argument, or no memory was available
else the Object's String representation.


Errors
_EINVAL:if a NULL was passed as argument
_ENOMEM:if no memory was available

Below this line, the methods specifications are incomplete.
You must read the source to know the exact behaviour of each function.





Void object type






Function VoidNew

Object VoidNew() ;


Returns
_NULL:if no memory was available


Errors
_EINVAL:if a NULL was passed as argument
_ENOMEM:if no memory was available



Function VoidWrap

Object VoidWrap(Void vd) ;


Args
_vd:


Returns
_NULL:if no memory was available


Errors
_EINVAL:if a NULL was passed as argument
_ENOMEM:if no memory was available



Function VoidOut

unsigned long VoidOut(Void vd, char * out, unsigned long max) ;


Args
_vd:
_out:
_max:


Returns
_NULL:if no memory was available


Errors
_EINVAL:if a NULL was passed as argument
_ENOMEM:if no memory was available




Intg object type






Function IntgAlloc

Intg IntgAlloc() ;


Returns
_NULL:if no memory was available


Errors
_EINVAL:if a NULL was passed as argument
_ENOMEM:if no memory was available



Function IntgCopy

Intg IntgCopy(Intg in) ;


Args
_in:


Returns
_NULL:if no memory was available


Errors
_EINVAL:if a NULL was passed as argument
_ENOMEM:if no memory was available



Function IntgClone

Intg IntgClone(Intg in) ;


Args
_in:


Returns
_NULL:if no memory was available


Errors
_EINVAL:if a NULL was passed as argument
_ENOMEM:if no memory was available



Function IntgNew

Object IntgNew(long nb) ;


Args
_nb:


Returns
_NULL:if no memory was available


Errors
_EINVAL:if a NULL was passed as argument
_ENOMEM:if no memory was available



Function IntgWrap

Object IntgWrap(Intg in) ;


Args
_in:


Returns
_NULL:if no memory was available


Errors
_EINVAL:if a NULL was passed as argument
_ENOMEM:if no memory was available



Function IntgOut

unsigned long IntgOut(Intg in, char * out, unsigned long max) ;


Args
_in:
_out:
_max:


Returns
_NULL:if no memory was available


Errors
_EINVAL:if a NULL was passed as argument
_ENOMEM:if no memory was available



Function IntgEqual

unsigned char IntgEqual(Intg in, Intg inw) ;


Args
_in:
_inw:


Returns
_NULL:if no memory was available


Errors
_EINVAL:if a NULL was passed as argument
_ENOMEM:if no memory was available




Fltp object type






Function FltpAlloc

Fltp FltpAlloc() ;


Returns
_NULL:if no memory was available


Errors
_EINVAL:if a NULL was passed as argument
_ENOMEM:if no memory was available



Function FltpCopy

Fltp FltpCopy(Fltp fp) ;


Args
_fp:


Returns
_NULL:if no memory was available


Errors
_EINVAL:if a NULL was passed as argument
_ENOMEM:if no memory was available



Function FltpClone

Fltp FltpClone(Fltp fp) ;


Args
_fp:


Returns
_NULL:if no memory was available


Errors
_EINVAL:if a NULL was passed as argument
_ENOMEM:if no memory was available



Function FltpNew

Object FltpNew(double nb) ;


Args
_nb:


Returns
_NULL:if no memory was available


Errors
_EINVAL:if a NULL was passed as argument
_ENOMEM:if no memory was available



Function FltpWrap

Object FltpWrap(Fltp fp) ;


Args
_fp:


Returns
_NULL:if no memory was available


Errors
_EINVAL:if a NULL was passed as argument
_ENOMEM:if no memory was available



Function FltpOut

unsigned long FltpOut(Fltp fp, char * out, unsigned long max) ;


Args
_fp:
_out:
_max:


Returns
_NULL:if no memory was available


Errors
_EINVAL:if a NULL was passed as argument
_ENOMEM:if no memory was available



Function FltpEqual

unsigned char FltpEqual(Fltp fp, Fltp fpw) ;


Args
_fp:
_fpw:


Returns
_NULL:if no memory was available


Errors
_EINVAL:if a NULL was passed as argument
_ENOMEM:if no memory was available



Function StrgAlloc

Strg StrgAlloc(unsigned long size) ;


Args
_size:


Returns
_NULL:if no memory was available


Errors
_EINVAL:if a NULL was passed as argument
_ENOMEM:if no memory was available



Function StrgCopy

Strg StrgCopy(Strg str) ;


Args
_str:


Returns
_NULL:if no memory was available


Errors
_EINVAL:if a NULL was passed as argument
_ENOMEM:if no memory was available



Function StrgClone

Strg StrgClone(Strg str) ;


Args
_str:


Returns
_NULL:if no memory was available


Errors
_EINVAL:if a NULL was passed as argument
_ENOMEM:if no memory was available



Function StrgFree

void StrgFree(Strg str) ;


Args
_str:


Returns
_NULL:if no memory was available


Errors
_EINVAL:if a NULL was passed as argument
_ENOMEM:if no memory was available



Function StrgNew

Object StrgNew(char * str) ;


Args
_str:


Returns
_NULL:if no memory was available


Errors
_EINVAL:if a NULL was passed as argument
_ENOMEM:if no memory was available



Function StrgWrap

Object StrgWrap(Strg str) ;


Args
_str:


Returns
_NULL:if no memory was available


Errors
_EINVAL:if a NULL was passed as argument
_ENOMEM:if no memory was available



Function StrgLen

unsigned long StrgLen(Strg str) ;


Args
_str:


Returns
_NULL:if no memory was available


Errors
_EINVAL:if a NULL was passed as argument
_ENOMEM:if no memory was available



Function StrgCat

Strg StrgCat(Strg str1, Strg str2) ;


Args
_str1:
_str2:


Returns
_NULL:if no memory was available


Errors
_EINVAL:if a NULL was passed as argument
_ENOMEM:if no memory was available



Function StrgCut

Strg StrgCut(Strg str, unsigned long beg, unsigned long end) ;


Args
_str:
_beg:
_end:


Returns
_NULL:if no memory was available


Errors
_EINVAL:if a NULL was passed as argument
_ENOMEM:if no memory was available



Function StrgOut

unsigned long StrgOut(Strg str, char * out, unsigned long max) ;


Args
_str:
_out:
_max:


Returns
_NULL:if no memory was available


Errors
_EINVAL:if a NULL was passed as argument
_ENOMEM:if no memory was available



Function StrgEqual

unsigned char StrgEqual(Strg str, Strg strw) ;


Args
_str:
_strw:


Returns
_NULL:if no memory was available


Errors
_EINVAL:if a NULL was passed as argument
_ENOMEM:if no memory was available



Function StrgCharString

unsigned long StrgCharString(Strg str, char * out, unsigned long max) ;


Args
_str:
_out:
_max:


Returns
_NULL:if no memory was available


Errors
_EINVAL:if a NULL was passed as argument
_ENOMEM:if no memory was available



Function ListAlloc

List ListAlloc() ;


Returns
_NULL:if no memory was available


Errors
_EINVAL:if a NULL was passed as argument
_ENOMEM:if no memory was available



Function ListAllocBlock

List ListAllocBlock(unsigned long numb) ;


Args
_numb:


Returns
_NULL:if no memory was available


Errors
_EINVAL:if a NULL was passed as argument
_ENOMEM:if no memory was available



Function ListCopy

List ListCopy(List lst) ;


Args
_lst:


Returns
_NULL:if no memory was available


Errors
_EINVAL:if a NULL was passed as argument
_ENOMEM:if no memory was available



Function ListClone

List ListClone(List lst) ;


Args
_lst:


Returns
_NULL:if no memory was available


Errors
_EINVAL:if a NULL was passed as argument
_ENOMEM:if no memory was available



Function ListDup

List ListDup(List lst) ;


Args
_lst:


Returns
_NULL:if no memory was available


Errors
_EINVAL:if a NULL was passed as argument
_ENOMEM:if no memory was available



Function ListDrop

List ListDrop(List lst) ;


Args
_lst:


Returns
_NULL:if no memory was available


Errors
_EINVAL:if a NULL was passed as argument
_ENOMEM:if no memory was available



Function ListFree

void ListFree(List lst) ;


Args
_lst:


Returns
_NULL:if no memory was available


Errors
_EINVAL:if a NULL was passed as argument
_ENOMEM:if no memory was available



Function ListNew

Object ListNew() ;


Returns
_NULL:if no memory was available


Errors
_EINVAL:if a NULL was passed as argument
_ENOMEM:if no memory was available



Function ListWrap

Object ListWrap(List lst) ;


Args
_lst:


Returns
_NULL:if no memory was available


Errors
_EINVAL:if a NULL was passed as argument
_ENOMEM:if no memory was available



Function ListLen

unsigned long ListLen(List lst) ;
Returns the length of a List.


Args
_lst:


Returns
_NULL:if no memory was available


Errors
_EINVAL:if a NULL was passed as argument
_ENOMEM:if no memory was available



Function ListGet

Object ListGet(List lst, unsigned long pos) ;
Gets an object by its position in a List.


Args
_lst:
_pos:


Returns
_NULL:if no memory was available


Errors
_EINVAL:if a NULL was passed as argument
_ENOMEM:if no memory was available



Function ListPut

Object ListPut(List lst, unsigned long pos, Object obj) ;
Puts an object by its position in a List.


Args
_lst:
_pos:
_obj:


Returns
_NULL:if no memory was available


Errors
_EINVAL:if a NULL was passed as argument
_ENOMEM:if no memory was available



Function ListDel

List ListDel(List lst, unsigned long beg, unsigned long end) ;
Deletes the objects in positions [beg,end[ in a List.


Args
_lst:
_beg:
_end:


Returns
_NULL:if no memory was available


Errors
_EINVAL:if a NULL was passed as argument
_ENOMEM:if no memory was available



Function ListIns

List ListIns(List lst, unsigned long pos, List lsi) ;
Inserts the objects of the second List in the first, between the pos-1-th and the pos-th objects.


Args
_lst:
_pos:
_lsi:


Returns
_NULL:if no memory was available


Errors
_EINVAL:if a NULL was passed as argument
_ENOMEM:if no memory was available


Note
To prevent internal structures and memory corruption, lsi is empty after successfull
insertion.



Function ListPush

List ListPush(List lst, Object obj) ;
Adds an object at the end of a List.


Args
_lst:
_obj:


Returns
_NULL:if no memory was available


Errors
_EINVAL:if a NULL was passed as argument
_ENOMEM:if no memory was available



Function ListPop

Object ListPop(List lst) ;
Retrives an object at the end of a List.


Args
_lst:


Returns
_NULL:if no memory was available


Errors
_EINVAL:if a NULL was passed as argument
_ENOMEM:if no memory was available



Function ListUnshift

List ListUnshift(List lst, Object obj) ;
Adds an object at the beginning of a List.


Args
_lst:
_obj:


Returns
_NULL:if no memory was available


Errors
_EINVAL:if a NULL was passed as argument
_ENOMEM:if no memory was available



Function ListShift

Object ListShift(List lst) ;
Retrives an object at the beginning of a List.


Args
_lst:


Returns
_NULL:if no memory was available


Errors
_EINVAL:if a NULL was passed as argument
_ENOMEM:if no memory was available



Function ListOut

unsigned long ListOut(List lst, char * out, unsigned long max) ;


Args
_lst:
_out:
_max:


Returns
_NULL:if no memory was available


Errors
_EINVAL:if a NULL was passed as argument
_ENOMEM:if no memory was available



Function ListEqual

unsigned char ListEqual(List lst, List lstw) ;


Args
_lst:
_lstw:


Returns
_NULL:if no memory was available


Errors
_EINVAL:if a NULL was passed as argument
_ENOMEM:if no memory was available



Function CodeAlloc

Code CodeAlloc() ;


Returns
_NULL:if no memory was available


Errors
_EINVAL:if a NULL was passed as argument
_ENOMEM:if no memory was available



Function CodeCopy

Code CodeCopy(Code cod) ;


Args
_cod:


Returns
_NULL:if no memory was available


Errors
_EINVAL:if a NULL was passed as argument
_ENOMEM:if no memory was available



Function CodeClone

Code CodeClone(Code cod) ;


Args
_cod:


Returns
_NULL:if no memory was available


Errors
_EINVAL:if a NULL was passed as argument
_ENOMEM:if no memory was available



Function CodeDup

Code CodeDup(Code cod) ;


Args
_cod:


Returns
_NULL:if no memory was available


Errors
_EINVAL:if a NULL was passed as argument
_ENOMEM:if no memory was available



Function CodeDrop

Code CodeDrop(Code cod) ;


Args
_cod:


Returns
_NULL:if no memory was available


Errors
_EINVAL:if a NULL was passed as argument
_ENOMEM:if no memory was available



Function CodeFree

void CodeFree(Code cod) ;


Args
_cod:


Returns
_NULL:if no memory was available


Errors
_EINVAL:if a NULL was passed as argument
_ENOMEM:if no memory was available



Function CodeNew

Object CodeNew() ;


Returns
_NULL:if no memory was available


Errors
_EINVAL:if a NULL was passed as argument
_ENOMEM:if no memory was available



Function CodeWrap

Object CodeWrap(Code cod) ;


Args
_cod:


Returns
_NULL:if no memory was available


Errors
_EINVAL:if a NULL was passed as argument
_ENOMEM:if no memory was available



Function CodeArgC

unsigned char CodeArgC(Code cod) ;


Args
_cod:


Returns
_NULL:if no memory was available


Errors
_EINVAL:if a NULL was passed as argument
_ENOMEM:if no memory was available



Function CodeArgT

unsigned short CodeArgT(Code cod, unsigned char argn) ;


Args
_cod:
_argn:


Returns
_NULL:if no memory was available


Errors
_EINVAL:if a NULL was passed as argument
_ENOMEM:if no memory was available



Function CodeRetC

unsigned char CodeRetC(Code cod) ;


Args
_cod:


Returns
_NULL:if no memory was available


Errors
_EINVAL:if a NULL was passed as argument
_ENOMEM:if no memory was available



Function CodeSetArgC

unsigned char CodeSetArgC(Code cod, unsigned char argc) ;


Args
_cod:
_argc:


Returns
_NULL:if no memory was available


Errors
_EINVAL:if a NULL was passed as argument
_ENOMEM:if no memory was available



Function CodeSetArgT

unsigned short CodeSetArgT(Code cod, unsigned char argn, Type argt) ;


Args
_cod:
_argn:
_argt:


Returns
_NULL:if no memory was available


Errors
_EINVAL:if a NULL was passed as argument
_ENOMEM:if no memory was available



Function CodeSetArgT

unsigned char CodeSetArgC(Code cod, unsigned char retc) ;


Args
_cod:
_retc:


Returns
_NULL:if no memory was available


Errors
_EINVAL:if a NULL was passed as argument
_ENOMEM:if no memory was available



Function CodeName

char * CodeName(Code cod) ;


Args
_cod:


Returns
_NULL:if no memory was available


Errors
_EINVAL:if a NULL was passed as argument
_ENOMEM:if no memory was available



Function CodeStrgName

Strg CodeStrgName(Code cod) ;


Args
_cod:


Returns
_NULL:if no memory was available


Errors
_EINVAL:if a NULL was passed as argument
_ENOMEM:if no memory was available



Function CodeGetFunc

void * CodeGetFunc(Code cod) ;


Args
_cod:


Returns
_NULL:if no memory was available


Errors
_EINVAL:if a NULL was passed as argument
_ENOMEM:if no memory was available



Function CodeGetData

Object CodeGetData(Code cod) ;


Args
_cod:


Returns
_NULL:if no memory was available


Errors
_EINVAL:if a NULL was passed as argument
_ENOMEM:if no memory was available



Function CodeSetFunc

void * CodeSetFunc(Code cod, void * func) ;


Args
_cod:
_func:


Returns
_NULL:if no memory was available


Errors
_EINVAL:if a NULL was passed as argument
_ENOMEM:if no memory was available



Function CodeSetData

Object CodeSetData(Code cod, Object data) ;


Args
_cod:
_data:


Returns
_NULL:if no memory was available


Errors
_EINVAL:if a NULL was passed as argument
_ENOMEM:if no memory was available



Function CodeOut

unsigned long CodeOut(Code cod, char * out, unsigned long max) ;


Args
_cod:
_out:
_max:


Returns
_NULL:if no memory was available


Errors
_EINVAL:if a NULL was passed as argument
_ENOMEM:if no memory was available



Function CodeEqual

unsigned char CodeEqual(Code cod, Code codw) ;


Args
_cod:
_codw:


Returns
_NULL:if no memory was available


Errors
_EINVAL:if a NULL was passed as argument
_ENOMEM:if no memory was available



Function BltnAlloc

Bltn BltnAlloc() ;


Returns
_NULL:if no memory was available


Errors
_EINVAL:if a NULL was passed as argument
_ENOMEM:if no memory was available



Function BltnCopy

Bltn BltnCopy(Bltn blt) ;


Args
_blt:


Returns
_NULL:if no memory was available


Errors
_EINVAL:if a NULL was passed as argument
_ENOMEM:if no memory was available



Function BltnClone

Bltn BltnClone(Bltn blt) ;


Args
_blt:


Returns
_NULL:if no memory was available


Errors
_EINVAL:if a NULL was passed as argument
_ENOMEM:if no memory was available



Function BltnFree

void BltnFree(Bltn blt) ;


Args
_blt:


Returns
_NULL:if no memory was available


Errors
_EINVAL:if a NULL was passed as argument
_ENOMEM:if no memory was available



Function BltnNew

Object BltnNew() ;


Returns
_NULL:if no memory was available


Errors
_EINVAL:if a NULL was passed as argument
_ENOMEM:if no memory was available



Function BltnWrap

Object BltnWrap(Bltn blt) ;


Args
_blt:


Returns
_NULL:if no memory was available


Errors
_EINVAL:if a NULL was passed as argument
_ENOMEM:if no memory was available



Function BltnArgC

unsigned char BltnArgC(Bltn blt) ;


Args
_blt:


Returns
_NULL:if no memory was available


Errors
_EINVAL:if a NULL was passed as argument
_ENOMEM:if no memory was available



Function BltnArgT

unsigned short BltnArgT(Bltn blt, unsigned char argn) ;


Args
_blt:
_argn:


Returns
_NULL:if no memory was available


Errors
_EINVAL:if a NULL was passed as argument
_ENOMEM:if no memory was available



Function BltnName

Strg BltnName(Bltn blt) ;


Args
_blt:


Returns
_NULL:if no memory was available


Errors
_EINVAL:if a NULL was passed as argument
_ENOMEM:if no memory was available



Function BltnFunc

void * BltnFunc(Bltn blt) ;


Args
_blt:


Returns
_NULL:if no memory was available


Errors
_EINVAL:if a NULL was passed as argument
_ENOMEM:if no memory was available



Function BltnOut

unsigned long BltnOut(Bltn blt, char * out, unsigned long max) ;


Args
_blt:
_out:
_max:


Returns
_NULL:if no memory was available


Errors
_EINVAL:if a NULL was passed as argument
_ENOMEM:if no memory was available



Function BltnEqual

unsigned char BltnEqual(Bltn blt, Bltn bltw) ;


Args
_blt:
_bltw:


Returns
_NULL:if no memory was available


Errors
_EINVAL:if a NULL was passed as argument
_ENOMEM:if no memory was available