[Info-vax] C Examples of Calling SMG$ Routines?
cao...@pitbulluk.org
caoimhe at pitbulluk.org
Mon Jun 28 11:59:31 EDT 2021
On Sunday, June 27, 2021 at 6:13:06 PM UTC+1, Zane H. Healy wrote:
> In looking at the "OpenVMS RTL Screen Management (SMG$) Manual" on the VSI
> website, they give examples of every language supported, except C/C++. The
> manual itself says it's new as of 2019, but also says it's for HP OpenVMS
> VAX/Alpha 7.3. :-) Looking at my copy of the manual for v6, all they did
> was remove the code for "RPG II".
>
> Does anyone happen to have some basic examples of using the SMG$ Routines in
> C? As it happens, the example does just what I need, since it shows how to
> use SMG$READ_KEYSTROKE.
>
> Thanks,
> Zane
For completeness from your cross-posting, here's a really minimal example:
#include <ssdef.h>
#include <descrip.h>
#include <smgdef.h>
#include <smg$routines.h>
#include <stdio.h>
#include <starlet.h>
#include <string.h>
main(void)
{
unsigned vkbd, stat;
short keycode;
stat = smg$create_virtual_keyboard(&vkbd,0,0,0,0);
stat = smg$read_keystroke(&vkbd,&keycode,0,0,0,0,0);
printf("%d\n",keycode);
stat = smg$delete_virtual_keyboard(&vkbd);
}
SYS$INPUT is assumed when the 2nd parameter of smg$create_virtual_keyboard is null (otherwise you need a string descriptor reference there).
smg$read_keystroke waits for a single keypress (single char or VT-style escape sequence representing PFx, keypad, etc., or a timeout indication) if you've specified a timeout longword reference for the 4th parameter.
The <smg$routines.h> are in the sys$library:sys$startlet_c.tlb as is everything else. It's interesting to note that all of the function prototypes have '__unknown_params' as their parameter so you really do need the documentation. This seems rather lazy of DEC.
I write a BLISS-32 macro library for SMG a while back if anybody is interested. I still prefer it to C.
Sorry.
More information about the Info-vax
mailing list