Usenet comp.sys.dec (1990-2013)
 help / color / mirror / Atom feed
* Q: VMS mailboxes and XtAppAddInput... (Short one)
@ 1992-09-17 12:16 Mike Stennett
  1992-09-17 13:52 ` Dave Marra
  0 siblings, 1 reply; 3+ messages in thread
From: Mike Stennett @ 1992-09-17 12:16 UTC (permalink / raw)



I'm posting this for a co-worker who doesn't have access. 

He wants to know how to select input on a VMS mailbox using 
XtAppAddInput?

I'm not a VMS person but I will also try to explain his general problem.
Currently he is polling the mailbox to see if it has input.  He would
like to have the mail box event driven using XtAppAddInput.

My co-worker and I would appreciate anyone who could bring some
insight to this problem.

PS - Please E-mail answers directly to me. If anyone would like to know 
what answers I have received, contact me through E-mail and I will
send you what I received. 

--
Signed: Mike Stennett           Domain: mike@sdd.comsat.com
Phone: +1-301-428-4083          Fax: +1-301-428-7747
USPS: COMSAT Labs, 22300 COMSAT Drive, Clarksburg, MD 20871


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Q: VMS mailboxes and XtAppAddInput... (Short one)
  1992-09-17 12:16 Q: VMS mailboxes and XtAppAddInput... (Short one) Mike Stennett
@ 1992-09-17 13:52 ` Dave Marra
  1992-09-21 19:01   ` Jym Dyer
  0 siblings, 1 reply; 3+ messages in thread
From: Dave Marra @ 1992-09-17 13:52 UTC (permalink / raw)




To get XtAddInput to work on the VMS side do the following:

read through the qio stuff on the vms books...  

then do this:

add this to the file that will use pipe and xtaddinput...

#ifdef VMS

#  include <stdlib.h>
#  include <unixio.h>
#  include <iodef.h>
#  include <descrip.h>

extern sys$clref();

  static short     IOSB[4];
  static           int event;
  char             szIOBuffer[4096]; /* this is the current size of the io
                                        buffer allocated in the caller*/
  static           int channel;
  unsigned long   _status;
#endif

note, the caller should (on VMS), if using a pipe, specify the size of the pipe, 
see the documentation...

in the routine that performs the xtaddinput, add:

#ifdef VMS
  struct   dsc$descriptor_s MBox;
  char     szMBox[256];
#endif

then...

#ifdef VMS
  event = 3;
  getname( event, szMBox );

/*  printf( "Using MailBox %s\n", szMBox );*/

  MBox.dsc$w_length  = strlen( szMBox );
  MBox.dsc$b_dtype   = DSC$K_DTYPE_T;
  MBox.dsc$b_class   = DSC$K_CLASS_S;
  MBox.dsc$a_pointer = szMBox;

  _status = sys$assign( &MBox, &channel, 0, &MBox, 0 );
  if( _status != 1 ) ReportError( _status );

  /*Allocate an event flag.  Use flags only from cluster 0 */

  _status = sys$clref(event);
  if( _status != 1 ) ReportError( _status );

  /* register asynchronous completion routine */

  XtAddInput( event, IOSB, _MsgCallback, &Msg );

  _status = sys$qio( event, channel, IO$_READVBLK, &IOSB, 0, 0,
          &szIOBuffer, sizeof( szIOBuffer ), 0, 0, 0, 0);

  if( _status != 1 ) ReportError( _status );

#else

  XtAddInput(3, XtInputReadMask, _MsgCallback, &Msg);

#endif

next, in _MsgCallback (see XtAddInput above)

#ifdef VMS
  if( IOSB[1] == 0 )
    {
      *pfEof = TRUE;
      fSuccess = TRUE;
      goto end;
    }

  szIOBuffer[IOSB[1]] = 0;

/* out message has 2 bytes of size, then the message, the total size is
** duplicated in IOSB[1]..  be sure to COPY that message
*/

  pMsg->usCurSize = IOSB[1] - 2;
  memcpy( pMsg->pch, &szIOBuffer[2], pMsg->usCurSize );

  fSuccess = TRUE;

  _status = sys$qio( event, channel, IO$_READVBLK, &IOSB, 0, 0,
                     &szIOBuffer, sizeof( szIOBuffer ), 0, 0, 0, 0);

  if( _status != 1 ) ReportError( _status );

  goto end;
#endif



--
+-----------------------------------------------------------------------------+
+ Dave Marra                            X           TMF Engineering           +
+ Software Validation Suites            X          37  Carlene Drive          +
+ X Window System / Motif / VMS         X        Nashua, NH 03062-1480        +
+-----------------------------------------------------------------------------+
+     Currently working at Digital Equipment Corporation, Littleton, MA       +
+-----------------------------------------------------------------------------+


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Q: VMS mailboxes and XtAppAddInput... (Short one)
  1992-09-17 13:52 ` Dave Marra
@ 1992-09-21 19:01   ` Jym Dyer
  0 siblings, 0 replies; 3+ messages in thread
From: Jym Dyer @ 1992-09-21 19:01 UTC (permalink / raw)


> #ifdef VMS
>   event = 3;

=o= This part is pretty important.  Your EFN has to be in the
local event flag cluster.  It can't be one of the ones gotten
with lib$get_ef().

=o= This can be a hassle, especially if you're dealing with some
third-party software (or if you yourself are making third-party
software), because the EFN you choose might be chosen by
somebody else.  Two ways around this:

  o Make a header file defining macros for EFNs for a project --
    or for all projects, if they must work together.

  o Write your own library routine that returns a unique EFN
    from the local cluster.

    <_Jym_>


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~1992-09-21 19:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1992-09-17 12:16 Q: VMS mailboxes and XtAppAddInput... (Short one) Mike Stennett
1992-09-17 13:52 ` Dave Marra
1992-09-21 19:01   ` Jym Dyer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox