HP3000-L Archives

May 1995, Week 3

HP3000-L@RAVEN.UTC.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Randy Medd <[log in to unmask]>
Reply To:
Randy Medd <[log in to unmask]>
Date:
Fri, 19 May 1995 08:33:06 -0700
Content-Type:
text/plain
Parts/Attachments:
text/plain (81 lines)
>I'm wondering if this will work under MPE/V as well:
>
>:FILE term,NEW;DEV=nnn;ACC=INOUT;
 
Actually, this form of the :FILE equation evolved on the Classic.
 
>I don't remember INOUT being in MPE/V, but I could be wrong.  If this
>will work, is there any way to pipe the input on that port to another
>port or file, or read the input directly from that file equation?
 
The problem with simply reading the port, using something like :FCOPY,
is that the default behaviour includes echo - as data is read, via
FREAD, it's echoed back to the sender.  You could disable echo with a
special term-type file, but that doesn't solve the entire problem -
you'll still get line-feeds echoed for each completed FREAD.
 
A simple program would do the trick.  Mock C-code:
 
#define CCG     (0)
#define CCL     (1)
#define CCE     (2)
    short int
       file_num,
       prev_echo = 0,
       prev_tt = 0,
       prev_cps = 0,
       fc_parm,
       len,
       err_num,
       done = 0;
    unsigned char
       buf[82];
 
    file_num = FOPEN(, 0604, 0504, "ldev ");
    FCONTROL(file_num, 13, &prev_echo); /* disable echo */
    FCONTROL(file_num, 39, &prev_tt);   /* get current term-type */
    fc_parm = 18;                       /* term-type 18 */
    FCONTROL(file_num, 38, &fc_parm);   /* change term-type */
    fc_parm = 0;
    FCONTROL(file_num, 13, &fc_parm);   /* again, disable echo */
/* The above is necessary as the new term-type might have echo ON */
    FSETMODE(file_num, 4);              /* disable lf_after_read */
    FCONTROL(file_num, 40, &prev_cps);  /* get input/output speed */
    fc_parm = 1920;                     /* speed in cps */
    FCONTROL(file_num, 11, &fc_parm);   /* set input/output speed */
    fc_parm = 13;                       /* carriage return */
    FCONTROL(file_num, 41, &fc_parm);   /* unedited-mode */
    for (;;)
       {
       fc_parm = 10;
       FCONTROL(file_num, 4, &fc_parm); /* set 10-second timer */
       len = FREAD(file_num, buf, -80);
       if (ccode() == CCG)
          FS_Err();                     /* unexpected EOF */
       if (ccode() == CCL)
          {
          FCHECK(file_num, &err_num);
          if (err_num != 22)
             FS_Err();                  /* unexpected error */
          continue;
          }
       Process_Data(buf, len);
       if (done)
          break;
       }
    FCONTROL(file_num, 38, &prev_tt);
    if (prev_echo == 0)
       FCONTROL(file_num, 12, &prev_echo); /* re-enable echo */
    FCONTROL(file_num, 11, &prev_cps);
    FCLOSE(file_num, 0, 0);
 
I omitted condition-code checks after the FOPEN/FCONTROL/FSETMODE
calls to save space - good and proper form calls for checking the
results of _each_ of these operations.  You'd be surprised where
errors crop up.  (been there, done that)
 
--
-------------------------------------------------------------
Randy Medd
Telamon, Inc.

ATOM RSS1 RSS2