Usage

Usage — gives a QNX 4-style usage message during run-time.

Syntax

Usage(usemsg?, program?)

		

Arguments

usemsg

An optional message name. The default is __USAGE.

program

An optional program name. The default is the current program.

Returns

A usage message on success, or -1 on failure.

Description

This function prints a QNX 4 use message while a program is running. The default message name is __USAGE, and the default program is the program that is currently running. Generally the defaults are used.

The usage message must be entered in the exact same format as a QNX 4 use message, where each line starts with #. The line immediately before the first QNX 4 use message line (#ifdef...) must be the name of the message, followed by "(double quote). The #endif line at the end of the QNX 4 use message must end with another " (double quote), followed by ; (semicolon). See the example below. For an entry of %C at the beginning of any line, QNX will insert the name of the program.

To use this method, you must load the Usage.lsp library with a call to require_lisp("Usage.lsp").

Example

This example, ex_Usage.g, is included in the product distribution.

#!/usr/cogent/bin/phgamma

/*
The following example puts up a window with an exit button, and prints
a usage message.
*/

PtInit(nil);
require_lisp("Usage.lsp");
require_lisp("PhotonWidgets.lsp");

win = new(PtWindow);
win.SetDim(200,130);
win.fill_color = PgRGB(140,200,250);

but = new(PtButton);
but.SetPos(80,50);
but.text_string = "Exit";
PtAttachCallback(but,Pt_CB_ACTIVATE,#exit_program(3));

__USAGE="
#ifdef __USAGE
#The usage message appears here.
#For example:
#%C
#Push the exit button to exit.
#endif";

Usage();

PtRealizeWidget(win);
PtMainLoop();

See Also

In Photon documentation: use.