MPE Timed reads FCONTROL (22) - Hewlett Packard

This is a discussion on MPE Timed reads FCONTROL (22) - Hewlett Packard ; 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 ...

+ Reply to Thread
Results 1 to 4 of 4

Thread: MPE Timed reads FCONTROL (22)

  1. 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
    #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 *


  2. Re: MPE Timed reads FCONTROL (22)

    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:HP3000-L@RAVEN.UTC.EDU] On Behalf
    Of Keven Miller (rtt)
    Sent: Friday, 30 March 2007 5:26 AM
    To: HP3000-L@RAVEN.UTC.EDU
    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
    #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 *


  3. Re: MPE Timed reads FCONTROL (22)

    I'm not sure I can agree with you John. I'm on 7.0 and in BASIC, running
    Keven's program yields two outcomes: 0 if you press enter and -256 if you
    do not press enter. The latter event occurs at the end of the time
    specified in the the ENTER statement. In Keven's example, that was 5 and my
    tests show that at 5 seconds, the enter is automatically completed and you
    get a -256 for the time.

    I believe this timeout feature is accomplished through the judicious use of
    FCONTROL 4 on STDIN or STDINX, recording wall time and then checking wall
    time on the way back from the FREAD. If you got a CCL from the FREAD, you
    knew the timer had expired so you returned a -256. At least, that's the way
    I did it in the late 1970s with my screen handling procedures.

    Good times.

    Denys...

    -----Original Message-----
    From: HP-3000 Systems Discussion [mailto:HP3000-L@RAVEN.UTC.EDU] On Behalf
    Of john pitman
    Sent: Thursday, March 29, 2007 5:07 PM
    To: HP3000-L@RAVEN.UTC.EDU
    Subject: Re: [HP3000-L] MPE Timed reads FCONTROL (22)

    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:HP3000-L@RAVEN.UTC.EDU] On Behalf
    Of Keven Miller (rtt)
    Sent: Friday, 30 March 2007 5:26 AM
    To: HP3000-L@RAVEN.UTC.EDU
    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
    #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 *

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


  4. Re: MPE Timed reads FCONTROL (22)

    Mike Hornsby wrote:
    > Keven Miller (rtt) wrote:
    >
    >> 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]

    >
    > The Basic/V ENTER statement does indeed use an FCONTROL 22 call to get
    > the read timer.
    > However, when connected via Telnet/iX or VT, FCONTROL 22 will return a
    > CCE condition code
    > but is essentially a NO OP. If you want to prove this, try your sample
    > program on the system console
    > or a DTC connected terminal.


    Thanks!
    Guess it must have been something lost from the terminal serial driver to
    the terminal network driver.
    Keven

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


+ Reply to Thread