GESCAPE(3NCARG) | NCAR GRAPHICS | GESCAPE(3NCARG) |
gescape - Provide "Escape" mechanism for non-standard GKS features
gescape (Escape) - provides a standard way of implementing nonstandard GKS features. NCAR GKS has only two user-accessible escape functions defined: one for changing the name of a metafile and another for pausing in an X window.
#include <ncarg/gks.h>
void gescape(Gint func_id, const Gescape_in_data *in_data, Gstore *store_data,Gescape_out_data **out_data);
The sizes of the data records must always be at least "1" in value.
gescape can be used to dynamically change the name of an output metafile and to do so one should use the calls gopen_gks and gopen_ws instead of c_opngks. If you are using c_opngks, see the man page for setusv(3NCARG) for changing the name of the metafile.
To change the name of the output metafile inside your program, you should make a call similar to the following:
The call to gescape to change the metafile name must always occur just before the call to gopen_ws that opens a CGM workstation. Setting the environment variable NCARG_GKS_OUTPUT overrides any attempt to change the name of an output metafile via a gescape call.
int str_len = 12;
Gescape_in_data in_data;
gopen_gks("stdout",0);
in_data.escape_r1.data = (Gdata *)malloc(str_len*sizeof(char));
strcpy(in_data.escape_r1.data, "new.cgm.name" );
in_data.escape_r1.size = str_len;
gescape(-1391,&in_data,NULL,NULL);
See the "User's Guide for NCAR GKS-0A Graphics" for a more complete example of changing metafile names from within a code.
Here is an example of a piece of code that will create an X window, draw a line, and then pause waiting for a mouse click or a key click.
Gescape_in_data in_data;
int str_len = 5;
gopen_gks("stdout",0);
gopen_ws(3,NULL,8);
gactivate_ws(3);
c_line(0.,0.,1.,1.);
c_sflush();
in_data.escape_r1.data = (Gdata *)malloc(str_len*sizeof(char));
strcpy(in_data.escape_r1.data, " 3" );
in_data.escape_r1.size = str_len;
gescape(-1396,&in_data,NULL,NULL);
gdeactivate_ws(3);
gclose_ws(3);
gclose_gks();
The functions c_frame and c_ngpict are in general much easier to use and more flexible than the direct ESCAPE call for pausing in an X window. It is suggested that those functions be used.
To use the GKS C-binding routines, load the ncarg_gks and ncarg_c libraries.
Online: setusv(3NCARG), frame(3NCARG), ngpict(3NCARG), gks(3NCARG), ncarg_gks_cbind(3NCARG)
Hardcopy: User's Guide for NCAR GKS-0A Graphics; NCAR Graphics Fundamentals, UNIX Version
Copyright (C) 1987-2009
University Corporation for Atmospheric Research
The use of this Software is governed by a License Agreement.
March 1993 | UNIX |