![]() | Programming Guide | ![]() |
Gets the value of a global string
#include <smglobs.h>char *sm_pinquire(int which);
which- Specifies the global string to get through one of these constants:
P_YES- Returns valid affirmative input for a field whose
keystroke_filterproperty is set toPV_YES_NO. The return is a null-terminated string that contains the lowercase yes value and the uppercase yes value.P_NO- Returns valid negative input for a field whose
keystroke_filterproperty is set toPV_YES_NO. The return is a null-terminated string that contains the lowercase no value and the uppercase no value.P_DECIMAL- Returns a three-character string: the user's decimal point marker, the operating system's decimal point marker, and the null terminator.
P_DICNAME- Returns the repository's file name.
P_FLDPTRS- Returns a pointer to an array of field structures. The implementation of these structures is release-dependent.
P_TERM- Returns the name Panther uses as the terminal identifier, or an empty string if not found.
P_SPMASK- Returns a pointer to a memory-resident, full-size form containing all blanks.
P_USER- Returns a pointer to developer-specified region of memory for the current screen. Each screen maintains its own pointer. This pointer is not set by Panther; it is set and maintained by the application.
SP_NAME- Returns the name of the active screen.
SP_STATLINE- Returns the status line's current text.
SP_STATATTR- Returns attributes of current status line—a pointer to an array of unsigned short integers.
V_- One of the
V_constants defined insmvideo.h, returns video-related information.
- · If the argument corresponds to a global pointer variable, a pointer to the value of that variable.
sm_pinquiregets the current value of a global pointer variable. To modify a global string, use sm_pset.Because the objects pointed to by the pointers returned by
sm_pinquireusually have short duration, use or copy them quickly. This caution does not apply toP_USER, which is maintained by the application. TheP_pointers point to the actual objects in Panther. TheSP_pointers point to copies of the objects. Because an object's characteristics is implementation dependent, it might change in future releases of Panther. Except forP_USER, do not use the pointers returned bysm_pinquireto modify objects directly. Usesm_psetinstead.
/* Get next key from user. Return -1 for 'n', 1 for 'y', and
* 0 if unknown. 'n' and 'y' come from the message file,
* and so can be changed to reflect the local language.
*/
int get_yes_no()
{
unsigned key;
char *yes;
char *no;
key = sm_getkey();
yes = sm_pinquire(P_YES);
no = sm_pinquire(P_NO);
if (key == yes[0] || key == yes[1])
return(1);
if (key == no[0] || key == no[1])
return(-1);
return(0);
}