Skip to the navigation links
Last modified: December 2009

URL: http://cxc-newtest.cfa.harvard.edu/ciao4.2/paramio_api.html
AHELP for CIAO 4.2

pgets

Context: paramio

Synopsis

Read/write individual parameter values from S-Lang.

Syntax

Integer_Type pgetb( paramfile, param )
Short_Type pgets( paramfile, param )
Integer_Type pgeti( paramfile, param )
Float_Type pgetf( paramfile, param )
Double_Type pgetd( paramfile, param )
String_Type pgetstr( paramfile, param )

pputb( paramfile, param, Integer_Type intval )
pputs( paramfile, param, Short_Type shortval )
pputi( paramfile, param, Integer_Type intval )
pputf( paramfile, param, Float_Type floatval )
pputd( paramfile, param, Double_Type doubleval )
pputstr( paramfile, param, String_Type stringval )

Description

These functions provide read and write access to individual parameter values for a tool. Unlike the generic pget() and pset() routines provided by paramio, these functions typecast the variable into the given type.

As with all the paramio routines, the PF_Errno variable is set to 0 on success, or on error it is set to one of the error codes listed in the paramio documentation.

The paramio module is not available by default; to use it in a S-Lang program, it must be loaded using the S-Lang require() function:

  require("paramio");

Example 1

slsh> require("paramio");
slsh> err = pgetd( "dmextract", "sys_err" );
slsh> print(err);
0
slsh> print(typeof(err));
Double_Type

pgetd() is used to return the value of the sys_err parameter of dmextract as a double.

Note that the require("paramio") line only needs to be issued once per Slsh/Sherpa session.

Example 2

slsh> vali = pgeti( "dmextract", "verbose" );
slsh> vals = pgets( "dmextract", "verbose" );
slsh> vald = pgetd( "dmextract", "verbose" );
slsh> valstr = pgetstr( "dmextract", "verbose" );
slsh> vmessage( "i=%d s=%d d=%f str=%s", vali, vals, vald, valstr );
i=0 s=0 d=0.000000 str=0
slsh> typeof(vali);
Integer_Type
slsh> typeof(vals);
Short_Type
slsh> typeof(vald);
Double_Type
slsh> typeof(valstr);
String_Type

Here we get the value of the "verbose" parameter as an integer, short, double, and string.

Bugs

See the bugs page for the paramio module on the CIAO website for an up-to-date listing of known bugs.

See Also

concept
parameter
modules
paramio
paramio
paccess, paramclose, paramopen, pget, plist_names, pquery, pset, punlearn
tools
dmhistory, dmkeypar, dmmakepar, dmreadpar, paccess, pdump, pget, pline, plist, pquery, pset, punlearn

Last modified: December 2009