Previous Next Up Title Contents Index Top Library

3.4.1. C BINDING

A simple function corresponds to each object (widget) which may be called outside the MOTIF context (in any program, C, Fortran, PHIGS).

1. pxgui_menu (wsid)

int wsid : Workstation number

This function is used to access all GPHIGS_GUI functions, taking into account the %pp command in the configuration file.

2. pxgui_posted_str (wsid)

int wsid: Workstation number

This function is used to access the list of structures posted on a workstation, it is then possible to consult or modify this list interactively.

3. pxgui_view_expert (wsid, viewNumber)

int wsid: Workstation number

int viewNumber : View number

This function is used to access fine adjustments of PHIGS viewing.

4. pxgui_view_simple (wsid, viewNumber)

int wsid: Workstation number

int viewNumber : View number

This function is used to access simple adjustments of PHIGS viewing.

5. pxgui_wait ()

This function is used to access GPHIGS-GUI functions, at any time, with no active input and with the %mi yes option.

6. pxgui_debug (w, wsid, font)

Widget w: Shell Widget shell if toolkit is initialized, otherwise NULL

int wsid: Workstation number

char* font: User font ex : "6x13" if NULL "fixed" font will be used

This functions is used to access the browser and CSS debugger.

7. pxgui_colorWs (wsid)

int wsid: Workstation number

This functions is used to access to control color index

8. pxgui_genesis (driver)

int driver: Driver number (8887, 7177, ...)

This function is used to access all GUI functions at any time, interactively and automatically, using the appropriate driver .

Example of the use of a pxgui_xxx function :

	#include <phigs.h>

	main(argc,argv)
	int argc;
	char **argv;
	{
		...

		/* Open  PHIGS */
		popen_phigs(...);
		/* Open workstation 1 */
		popen_ws(1,"/dev/tty",8887);
		/* Construct CSS */
		popen_struct(1);
		pset_view_index(1);
		ppolyline3(&pt);
		pclose_struct();

		ppost_structs(1,1,1.);
		predraw_all_structs(1,PFLAG_ALWAYS);

		pxgui_view_simple(1,1);
		/* Close workstation */
		pclose_ws(1);

		/* Close PHIGS */
		pclose_phigs();

	}

It is therefore possible to adjust the view with pxgui_view_simple, then to generate the C file corresponding to the correct view and to integrate it into the program.

NB : In order to access GPHIGS_GUI functions at any time from a PHIGS program, at least one active input in the application must be available, for example, a request locator or an input device in Event mode, and to scan the PHIGS event file using the pwait_event(...) function, i.e. when using the %mi. command.

A program such as :

	#include <phigs.h>

	main(argc,argv)
	int argc;
	char **argv;
	{
		...
		< variable declaration >
		...

		/* Open PHIGS */
		popen_phigs(...);

		/* Open wokstation number 1 */
		popen_ws(1,"/dev/tty",8887);

		/* Construct CSS */
		popen_struct(1);
		ppolyline3(&pt);
		pclose_struct();

		ppost_structs(1,1,1.);

		predraw_all_structs(1,PFLAG_ALWAYS);

		getchar();
		
		pclose_ws(1;

		/* close PHIGS */
		pclose_phigs();

	}

is correct from a PHIGS point of view, but it could not operate with the

%mi yes

GPHIGS_GUI option.

This program is actually "sequential", it scrolls and does not wait for any PHIGS-type event, it does, however, wait for the C order input / output system.(getchar)

For this program to operate with GPHIGS_GUI, simply replace the keyboard read wait getchar by a PHIGS request locator on workstation number 1, for example, or use the pxgui_wait() function from the toolkit.

This function can only be used with GPHIGS_GUI and the %mi yes option .

A program must therefore either be waiting for at least one PHIGS-type event irrespective of its mode (request , sample or Event) or waiting with pxgui_wait and not getchar (for example) to be able to use GPHIGS_GUI.

For purists, MainLoop Motif is simulated on the PHIGS inputs, if there is no input in the application, there is no MainLoop and the program cannot operate in Motif (since the events are not processed (dispatched) ).


Previous Next Up Title Contents Index Top Library