* Create & QIO to DECterms
@ 1993-06-22 16:41 Vincent Li
1993-06-22 19:14 ` Fred Kleinsorge
0 siblings, 1 reply; 3+ messages in thread
From: Vincent Li @ 1993-06-22 16:41 UTC (permalink / raw)
Greetings folks,
Question: how does one do QIO to a DECterm created from an application?
Background:
I've followed the examples in the VMS DECwindows application programming
guide, appendix A on the use of DECwTermPort to create a DECterm. Fine, no
problem. Now, my application which makes the call to DECwTermPort wants to
do QIO (read/write) to this newly created terminal, but I can't seem to
assign a channel to the device. I get Access Violation status from the
assign. Is there a way to get around it?
I am not sure if I can do a $creprc as in the example to get around the
problem. I would like to have the application which create the DECterm to
process the input/output and have control of the terminal device. (eg. user
issue command from the application to kill the terminal, which leads to
another question: how does one destroy a terminal device thus created? (FTAn:)
Is there a better way?
Here's the code fragment I used to create & assign the channel:
------------------------------------------------------------
short device_length;
char device_name[50];
$uword user_input_chan;
$uword user_output_chan;
$DESCRIPTOR(terminal, "");
char buffer[256];
struct {
$uword cond_value;
$uword count;
int dev_info;
} iosb;
int status, stsflg;
tnmxuip_set_cursor(display, XtWindow(toplevel_w), TNMXUI_CSR_BUSY);
/* send message to the controller */
status = DECwTermPort(0, 0, 0, device_name, &device_length);
if (status != SS$_NORMAL) {
printf("DECterm creation failed, status is %x\n", status);
goto done;
}
terminal.dsc$w_length = device_length;
terminal.dsc$a_pointer = device_name;
status = sys$assign(terminal, &user_input_chan, 0, 0);
if (status != SS$_NORMAL) {
printf("Could not assign input channel, status is %x\n", status);
if (status == SS$_ACCVIO)
printf("Access violation\n");
is %x\n", status);
goto done;
}
status = sys$assign(terminal, &user_output_chan, 0, 0);
if (status != SS$_NORMAL) {
printf("Could not assign output channel, status is %x\n", status);
goto done;
}
sprintf(buffer, "This is a test output\n");
status = sys$qiow(3, user_output_chan, IO$_WRITEVBLK, &iosb,
0, 0, buffer, 23);
done: tnmxuip_set_cursor(display, XtWindow(toplevel_w), TNMXUI_CSR_DEFAULT);
return;
}
Thanks!
-- Vince
---------------------------------------
vli@mprgate.mpr.ca |-) It works well under pressure: Another thing
|-] you can say about your pillow. -- Mr Boffo
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: Create & QIO to DECterms
1993-06-22 16:41 Create & QIO to DECterms Vincent Li
@ 1993-06-22 19:14 ` Fred Kleinsorge
1993-06-23 12:19 ` Ron Fox
0 siblings, 1 reply; 3+ messages in thread
From: Fred Kleinsorge @ 1993-06-22 19:14 UTC (permalink / raw)
The system service is giving you a error from the probe of the
arguments. I'd check either the line:
terminal.dsc$a_pointer = device_name;
and make it:
terminal.dsc$a_pointer = &device_name[];
or the line:
status = sys$assign(terminal, &user_input_chan, 0, 0);
and make it:
status = sys$assign(&terminal, &user_input_chan, 0, 0);
I always get into trouble on how C decides what to do when passing
structures.
--
+--------------------------------------+
Fred Kleinsorge | All opinions expressed are mine, and |
kleinsorge@star.enet.dec.com | may not reflect those of my employer |
+--------------------------------------+
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Create & QIO to DECterms
1993-06-22 19:14 ` Fred Kleinsorge
@ 1993-06-23 12:19 ` Ron Fox
0 siblings, 0 replies; 3+ messages in thread
From: Ron Fox @ 1993-06-23 12:19 UTC (permalink / raw)
--
In article <1993Jun22.191457.28022@e2big.mko.dec.com>, kleinsorge@star.enet.dec.com (Fred Kleinsorge) writes:
|>Newsgroups: comp.sys.vms,comp.os.vms
|>Path: msuinfo!agate!ames!decwrl!pa.dec.com!e2big.mko.dec.com!star.enet.dec.com!kleinsorge
|>From: kleinsorge@star.enet.dec.com (Fred Kleinsorge)
|>Subject: Re: Create & QIO to DECterms
|>Message-ID: <1993Jun22.191457.28022@e2big.mko.dec.com>
|>Keywords: DECterm
|>Lines: 27
|>Sender: usenet@e2big.mko.dec.com (Mr. USENET)
|>Reply-To: kleinsorge@star.enet.dec.com (Fred Kleinsorge)
|>Organization: Digital Equipment Corporation
|>X-Newsreader: mxrn 6.18-4
|>References: <1993Jun22.164105.23968@mprgate.mpr.ca>
|>Date: Tue, 22 Jun 93 15:14:57 EDT
|>Xref: msuinfo comp.sys.vms:153 comp.os.vms:74069
|>
|>
|>The system service is giving you a error from the probe of the
|>arguments. I'd check either the line:
|>
|> terminal.dsc$a_pointer = device_name;
|>
|>and make it:
|>
|> terminal.dsc$a_pointer = &device_name[];
|>
|>or the line:
|>
|> status = sys$assign(terminal, &user_input_chan, 0, 0);
|>
|>and make it:
|>
|> status = sys$assign(&terminal, &user_input_chan, 0, 0);
|>
|>I always get into trouble on how C decides what to do when passing
|>structures.
|>
|>
|>--
|> +--------------------------------------+
|>Fred Kleinsorge | All opinions expressed are mine, and |
|>kleinsorge@star.enet.dec.com | may not reflect those of my employer |
|> +--------------------------------------+
|>
The problem was the latter one I think. In VMS C, structures are passed
by copy in the argument list. sys$assign, needs a pointer to the descriptor
so you need &terminal in the SYS$ASSIGN. The fudging of the descriptor
is O.K. since array names without subscripts can be treated as pointers to
their contents. By the way, more standard and portable than what you showed
is:
terminal.dsc$a_pointer = &device_name[0];
Which should also work.
RF.
Ron Fox | FOX@MSUNSCL.BITNET | Where the name
NSCL | FOX@RUDOLF.NSCL.MSU.EDU | goes on before
Michigan State University | MSUHEP::RUDOLF::FOX | the quality
East Lansing, MI 48824-1321 | | goes in.
USA
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~1993-06-23 12:19 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1993-06-22 16:41 Create & QIO to DECterms Vincent Li
1993-06-22 19:14 ` Fred Kleinsorge
1993-06-23 12:19 ` Ron Fox
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox