Usenet comp.sys.dec (1990-2013)
 help / color / mirror / Atom feed
From: marra@samuel.enet.dec.com (Dave Marra)
Subject: Re: Q: VMS mailboxes and XtAppAddInput... (Short one)
Date: Thu, 17 Sep 1992 13:52:21 GMT	[thread overview]
Message-ID: <1992Sep17.135221.18272@nntpd.lkg.dec.com> (raw)
In-Reply-To: mike.716732164@sdd.comsat.com



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       +
+-----------------------------------------------------------------------------+


  reply	other threads:[~1992-09-17 13:52 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1992-09-17 12:16 Q: VMS mailboxes and XtAppAddInput... (Short one) Mike Stennett
1992-09-17 13:52 ` Dave Marra [this message]
1992-09-21 19:01   ` Jym Dyer
read-only archive

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