handle_value

BAP Online Manuals : Library Reference : Library by Name : handle_value
Previous: gotowindow
Next: hostexec

6.2.71. handle_value

get the value associated with a virtual handle

SYNOPSIS

handle_value(file,FileHandle,"DEMONSTRATION")

SYNTAX

handle_value(VirtualHandle,RealHandle,ErrorString)(i,o,i)

ARGUMENTS

handle(VirtualHandle) (i) virtual handle to be evaluated
void(RealHandle) (i) value associated with the virtual handle

DESCRIPTION

Returns the RealHandle that was associated with the virtual handle by a call to new_handle (). Together with new_handle() and rem_handle (), the user can use this predicate to access his own data via virtual file handles. The idea is that a value obtained at runtime can be associated with a constant virtual handle known at compile time (through new_handle()). The value can then be accessed at any place in the program without the need of passing arguments with every call. The use of database predicates can accomplish the same thing (in fact the handle routines do just that), but as we needed this for our file and window management, we thought we might as well export these predicates. We suggest you use these predicates in a separate 'library' module only, as errors in handle access can violate system integrity.

EXAMPLE

new_file(my_data,"Hello World",user_string,"OPEN 
DATA").
....
handle_value(my_data,X,"GET DATA"),
write(X),nl.
....
rem_handle(my_data,_,"LOSE DATA").

ERRORS

A runtime error occurs if an invalid handle is given.

LAYERS

prolog-process, client-server, object

RELATED PREDICATES

new_handle , rem_handle


BAP Online Manuals : Library Reference : Library by Name : handle_value
Previous: gotowindow
Next: hostexec