GESC(3NCARG)

πŸ“¦ version 6.6.2, in epel 9, fedora 43, fedora 44

πŸ’– GESC πŸ’– (aka the Escape function, from the NCAR Graphics manual, section 3NCARG)

okay bestie, sit down, we're doing Fortran GKS today and honestly? it's giving ✨extended capabilities✨.

🌸 NAME 🌸

GESC (short for Escape) β€” it's the standard way to implement nonstandard GKS features. Basically, the stuff the spec forgot to include.

And here's the tea: NCAR GKS only has two user-accessible escape functions defined. Just two. That's it. One is for changing the name of a metafile and the other is for pausing in an X window. Two icons, no more. πŸ’…


πŸŽ€ SYNOPSIS πŸŽ€

CALL GESC (FCTID, LIDR, IDR, MXODR, LODR, ODR)

πŸ¦‹ C-BINDING SYNOPSIS πŸ¦‹

#include <ncarg/gks.h>

void gescape(Gint func_id, const Gescape_in_data *in_data, Gstore
*store_data,Gescape_out_data **out_data);

✨ DESCRIPTION ✨

okay so here's the whole cast, and every single one of them matters, no skipping:

  • FCTID (Integer, Input) β€” the function identifier, aka "which activity are we requesting bestie". The legal values for FCTID are -1391 for changing a metafile name, and -1396 for effecting a pause in an X window. Those are the only two, don't try to freestyle.
  • LIDR (Integer, Input) β€” the dimension of the IDR input data record array (for IDR, scroll down a lil bit, it's right there πŸ‘‡).
  • IDR (Character * 80 Array, Input) β€” the input data record, the actual payload. For calls to GESC with FCTID equal to -1391, this record should contain the desired metafile name, left justified and blank filled. For calls to GESC with FCTID equal to -1396, it should contain the workstation identifier encoded as a five character number. Yes, five. Encode it right. πŸ™ˆ
  • MXODR (Integer, Input) β€” the maximum length of the ODR output data record array (for ODR, see the next bullet, we got you).
  • LODR (Integer, Output) β€” the dimension of the ODR output data record array.
  • ODR (MXODR) (Character * 80 Array, Output) β€” the output data record. That's the thing coming back at you.

πŸ”₯ USAGE πŸ”₯

Simple rule, no cap: LIDR, MXODR, and LODR must always be at least "1" in value.

That's the whole section. Short king. πŸ‘‘


🌈 EXAMPLES 🌈

okay this is the part where it gets fun. GESC can be used to dynamically change the name of an output metafile, and to do that you should use the calls GOPKS and GOPWK instead of OPN GKS. If you are using OPN GKS, then go see the man page for SETUSV for changing the name of the metafile instead. Different route, same destination, iykyk.

To change the name of the output metafile from inside your program, you make a call similar to this:

CHARACTER*80 MFNAME

CALL GOPKS (6,IDUM)
MFNAME = 'new.cgm.name'
CALL GESC(-1391,1,MFNAME,1,1,CDUM)
🚨 IMPORTANT BESTIE 🚨 the call to GESC to change the metafile name must always occur just before the call to GOPWK that opens a CGM workstation. Timing is everything. Also: setting the environment variable NCARG_GKS_OUTPUT overrides any attempt to change the name of an output metafile via a GESC call. So if your name change is doing nothing, check your env vars, that's the culprit fr fr.

See the "User's Guide for NCAR GKS-0A Graphics" for a more complete example of changing metafile names from within a code.


And now for the pause glow-up. Here's an example of a code that will create an X window, draw a line, and then pause waiting for a mouse click or a key click:

CHARACTER*80 IREC,ODUM
CALL GOPKS(6,0)
CALL GOPWK(3,0,8)
CALL GACWK(3)
CALL LINE(0.,0.,1.,1.)
CALL SFLUSH
IREC = '    3'
CALL GESC(-1396,1,IREC,1,1,ODUM)
CALL GDAWK(3)
CALL GCLWK(3)
CALL GCLKS
STOP
END

But ngl? The functions FRAME and NGPICT are in general much easier to use and more flexible than the direct ESCAPE call for pausing in an X window. So it is suggested that you use those functions. Take the easy path, you deserve it. 🫢


πŸ’œ ACCESS πŸ’œ

To use GKS routines, load the NCAR GKS-0A library ncarg_gks. Load it. Then you can slay.


πŸ“ SEE ALSO πŸ“

  • Online: SETUSV, FRAME, NGPICT, gescape
  • 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.

and that's the whole page bestie, we ate and left no crumbs πŸ’…βœ¨ this was the UNIX version, dated March 1993 β€” yeah she's vintage but she still serves, mwah πŸ˜­πŸ’–

πŸ“¦ where this page comes from