Przemek,

Maybee this will help you.
The container API allows access to the internal data structures of Xbase++.
Each variable in Xbase++ is based internally on a data structure called a
Container object . Each container object manages the type and the value of a
variable. Access to a container is only possible through the ContainerHandle
of the object. 
The container API uses functions to create new container objects
(_conNew...()), to read their values (_conGet...()) and to change their
values (_conPut...()). Because the ContainerHandle of a parameter can be
accessed and the return value of a function set using the container API, all
of the operations of the parameter API can also be accomplished with the
container API. Note: Even though the _par...() and _con...() functions can
be used jointly, it is recommended that the container API will be used. 

For each of the functions of the container API, success or failure of the
function is determined by examining the return value. Functions which return
ContainerHandles return the value NULLCONTAINER when an error occurs. All
other functions indicate an error by a return value not equal to NULL. 
Important: 
Instead of testing the type of container and then reading the value, the
value should be read and the return value tested. This is because Xbase++
allows several threads in an application, all of which can access Xbase++
variables. So that programs can work correctly, all operations on variables
are atomic. This keeps two threads from attempting to change the value of a
variable at the same time. In this situation, the changes are executed
sequentially such that the second change sets the value. 

Examination of the variable type with _conType() and reading the value with
_conGet...() are two different operations. Therefore, it is possible that
the variable could be changed by another thread after testing the type but
before reading the value. 
The following chapter gives an alphabetical reference of all container API
functions.

PS. I'll try to ask a co developer who is working with xBase++ to test it
tomorrow and I'll post the results


Best Regards
Mike Evans

/*** mvtest.prg ***/
proc main()
? VERSION(), OS(), DATE(), TIME()
?
? "1", type("P1"), type("P2"), type("P3"), type("P4")
init()
? "5", type("P1"), type("P2"), type("P3"), type("P4")
? "===="
CLEAR MEMORY
? "1", type("P1"), type("P2"), type("P3"), type("P4")
init(1)
? "5", type("P1"), type("P2"), type("P3"), type("P4")
? "===="
return

proc init(x)
memvar p1
private p1:=1
? "2", type("P1"), type("P2"), type("P3"), type("P4")
init2(x)
? "4", type("P1"), type("P2"), type("P3"), type("P4")
return

proc init2(x)
memvar p3
private p3:=1
init3(x)
? p3
return

proc init3(x)
memvar p1, p2, p3, p4
private p3:="[c]"
public p1:="a", p2:="b"
if x!=NIL
   x:=type("P4:='d'")
endif
? "3", type("P1"), type("P2"), type("P3"), type("P4")
return
_______________________________________________
Harbour mailing list
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour

_______________________________________________
Harbour mailing list
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour

Reply via email to