HP3000-L Archives

March 2007, Week 5

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:
john pitman <[log in to unmask]>
Reply To:
john pitman <[log in to unmask]>
Date:
Fri, 30 Mar 2007 08:06:40 +1000
Content-Type:
text/plain
Parts/Attachments:
text/plain (132 lines)
Keven,
I have also noticed that the timed Enter in B/V died some time ago. I still
come across old code now and again that relied on a value being returned
here, and now they hang, looping on the read. We don't care how long it
took, just that they hit Enter (block mode) or not. Now the Enter only
completes when they hit Enter, so the time is not relevant to us. Previously
the Enter completed at end of time specified if Enter was not pressed, and
returned 0 or negative , whereupon we looped back to the read.

Why do you want the time value?

jp

-----Original Message-----
From: HP-3000 Systems Discussion [mailto:[log in to unmask]] On Behalf
Of Keven Miller (rtt)
Sent: Friday, 30 March 2007 5:26 AM
To: [log in to unmask]
Subject: [HP3000-L] MPE Timed reads FCONTROL (22)

I've noticed in a BASIC program that the ENTER command,
as described in the Basic manual page 2-47 to 2-48,
fails to return the actual time that the user took
to complete the read.

 >list
    10 DIM S$[30]
    20 PRINT "Prompt#";
    30 ENTER 5,R,S$
    40 PRINT LIN(1);"R=";R;" [";S$;"]"
 >run
Prompt#123
R= 0     [123]

 >run
Prompt#
R=-256   []

 >

I'm on MPE 6.0, and it also does the same on 5.5.

Is this a feature that was lost some time ago?
Or just a problem never reported?

Below is a C program where I attempt to read the user
input time (which I had never done before).

Could someone who has done this before,
tell me why its not working or
point out where it can be corrected?

Thanks,
Keven Miller

/* MPE Compile: CCOPTS "-Aa -C +e +w1" */
#  pragma list off
#include <stdio.h>
#include "mpe.h"

#define  proc

#pragma intrinsic CCODE
#pragma intrinsic FOPEN
#pragma intrinsic FCLOSE
#pragma intrinsic FREAD
#pragma intrinsic FCHECK
#pragma intrinsic FSETMODE
#pragma intrinsic FCONTROL
/*------------------------------------------------------------*/

proc float myinput ( int timeout, char *buf )
{
    int   len, cc, fn;
    short to, it;
    float act;
    char  mybuf [260];

    fn = FOPEN ( "in", 02254, 0 );

    fflush (stdout);
    fflush (stderr);

    to = timeout;

    FCONTROL ( fn, 21, &it );        /* Enable input timer */
    FCONTROL ( fn, 4, &to );         /* Set timeout     */

    len = FREAD ( fn, mybuf, -256 );
    mybuf [len] = 0;
    cc = CCODE ();

    FCONTROL ( fn, 22, &it );        /* Read input timer */
fprintf(stderr,"TI=%d\n", it );
    FCONTROL ( fn, 20, &to );        /* Disable input timer */
    to = 0;
    FCONTROL ( fn, 4, &to );         /* Clear timeout  */

    FCLOSE ( fn, 0, 0 );
    fn = 0;                          /* Just in case Stan was looking*/

    if ( cc == CCE )
    {
       strcpy ( buf, mybuf );
       act = it / 100.0;
    } else
       act = -1.0;
    return   act;
}
/*------------------------------------------------------------*/

proc int main ()
{
    int   x;
    float r;
    char  s [255];

    for ( x = 0; x < 5; ++x )
    {
       printf ( "%d)prompt 5>", x+1 );
       r = myinput ( 5, s );
       printf ( "Answer in %f [%s]\n", r, s );
    }
}
/*------------------------------------------------------------*/

* To join/leave the list, search archives, change list settings, *
* etc., please visit http://raven.utc.edu/archives/hp3000-l.html *

* To join/leave the list, search archives, change list settings, *
* etc., please visit http://raven.utc.edu/archives/hp3000-l.html *

ATOM RSS1 RSS2