BeSly Software Solutions About yab About us Admin




Name:

peek$ -- retrieve internal string-information

Synopsis:
 
print peek$("foo") 

Description:
The peek$-function has many different and unrelated uses. It is a kind of grabbag for retrieving all kinds of string information, internal to yab; the exact nature of the strings returned be the peek$-function depends on the string passed as an argument.

peek$ always returns a string, however the closely related peek-function exists, which may be used to retrieve numerical information from among the internals of yab. Finally note, that some of the values which are retrieved with peek$ may even be changed, using the poke-function.

The following list shows all possible arguments to peek$:peek$("infolevel")Returns either "debug", "note", "warning", "error" or "fatal", depending on the current infolevel. This value can be specified with an option on the commandline or changed during the execution of the program with the corresponding poke; however, normally only the author of yab would want to change this from its default value "warning".

peek$("error")
Return a string describing the nature of the last error in an open- or seek-statement. See the corresponding peek("error") for a detailed description.

peek$("library")
Return the name of the library, this statement is contained in. See the import-command for a detailed description or for more about libraries.

peek$("os")
This peek returns the name of the operating system, on wich your yab version was compiled. This version of yab can only return "Haiku" as it can only run on Haiku. If there are future variants of Haiku, This should identify the variant.

peek$("env","NAME")
Return the environment variable specified by NAME (which may be any string expression). Which kind of environment variables are available on your system depends, as well as their meaning, on your system; however typing env on the commandline will produce a list. Note, that peek$("env",...) can be written as peek$("environment",...) too.

peek$("refsreceived")
Returns TrackerItem which you used 'open with...' your application on, or the path and name of the file that was double-clicked. The  double-clicked file must have an attribute "BEOS:PREF_APP" set to the yab applications signature and the this application signature must be registered in the FileTypes prefflet.

Save a data file and then use :
ATTRIBUTE SET "Mime:, "BEOS:PREF_APP", "application/x-vnd.yourcool-app", Filename$

Where "application/x-vnd.yourcool-app" is the application signature and Filename$ is the name of the data file. Double-clicking the data file will open the yab application. peek$("refsreceived") will return this data file pathame.

peek$("argument")
Return one of the arguments, that have been passed to yab at invocation time (the next call will return the the second argument, and so on). E.g. if yab has been called like this: yab foo.yab bar baz, then the first call to peek$("argument") will return bar. This is because foo.yab is treated as the name of the program to run, whereas bar and baz are considered arguments to this program, which are passed on the commandline. The second call to peek$("argument") will return baz. Note, that peek$("argument") can be written as peek$("arguments").
Finally you will want to check out the corresponding function peek("argument").

Example:
print "You have supplied these arguments: "
while(peek("argument")) 
	print peek("argument"),peek$("argument") 
wend 

Explanation:

If you save this program in a file foo.yab and execute it via yab t.yab a b c, your will get this output:

3a 
2b 
1c 


Related: peek, poke, open