Re: MPE Timed reads FCONTROL (22) - Hewlett Packard

This is a discussion on Re: MPE Timed reads FCONTROL (22) - Hewlett Packard ; Denys, You know that English recently became a language where not only two negatives made a positive, but two positives made a negative..... as in " Maybe we should put in a bur report at HP. " Yeah, Right ! ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: Re: MPE Timed reads FCONTROL (22)

  1. Re: MPE Timed reads FCONTROL (22)

    Denys,
    You know that English recently became a language where not only two
    negatives made a positive, but two positives made a negative.....


    as in

    " Maybe we should put in a bur report at HP. " Yeah, Right !

    Assuming you meant a BUG report of course?

    john

    -----Original Message-----
    From: Denys Beauchemin [mailto:denys@houston.rr.com]
    Sent: Friday, 30 March 2007 10:35 AM
    To: 'john pitman'
    Subject: RE: [HP3000-L] MPE Timed reads FCONTROL (22)

    That's exactly right, John. However, I don't know what got disconnected in
    MPE/iX. Maybe we should put in a bur report at HP.



    Denys...

    -----Original Message-----
    From: john pitman [mailto:jpitman@ryco.com.au]
    Sent: Thursday, March 29, 2007 6:44 PM
    To: 'Denys Beauchemin'
    Subject: RE: [HP3000-L] MPE Timed reads FCONTROL (22)

    Ok.....

    Keven is correct - you never get HOW long it took for user to Enter, just 0
    means he did hit it, -256 , he didn't hit it.

    Our old code used to test for <= 0 meaning Enter was NOT pressed, a positive
    number meant Enter WAS pressed, so it looped , until we changed code to only
    test for < 0.
    Something in the bowels of the system changed in iX so that the relevant B/V
    routine changed behaviour.

    john

    -----Original Message-----
    From: Denys Beauchemin [mailto:denys@houston.rr.com]
    Sent: Friday, 30 March 2007 8:44 AM
    To: 'john pitman'; HP3000-L@RAVEN.UTC.EDU
    Subject: RE: [HP3000-L] 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 *


  2. Re: MPE Timed reads FCONTROL (22)

    Well, it's been a long year, and I'm tired. Also, it was a private response
    for your eyes only.

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

    Denys,
    You know that English recently became a language where not only two
    negatives made a positive, but two positives made a negative.....


    as in

    " Maybe we should put in a bur report at HP. " Yeah, Right !

    Assuming you meant a BUG report of course?

    john

    -----Original Message-----
    From: Denys Beauchemin [mailto:denys@houston.rr.com]
    Sent: Friday, 30 March 2007 10:35 AM
    To: 'john pitman'
    Subject: RE: [HP3000-L] MPE Timed reads FCONTROL (22)

    That's exactly right, John. However, I don't know what got disconnected in
    MPE/iX. Maybe we should put in a bur report at HP.



    Denys...

    -----Original Message-----
    From: john pitman [mailto:jpitman@ryco.com.au]
    Sent: Thursday, March 29, 2007 6:44 PM
    To: 'Denys Beauchemin'
    Subject: RE: [HP3000-L] MPE Timed reads FCONTROL (22)

    Ok.....

    Keven is correct - you never get HOW long it took for user to Enter, just 0
    means he did hit it, -256 , he didn't hit it.

    Our old code used to test for <= 0 meaning Enter was NOT pressed, a positive
    number meant Enter WAS pressed, so it looped , until we changed code to only
    test for < 0.
    Something in the bowels of the system changed in iX so that the relevant B/V
    routine changed behaviour.

    john

    -----Original Message-----
    From: Denys Beauchemin [mailto:denys@houston.rr.com]
    Sent: Friday, 30 March 2007 8:44 AM
    To: 'john pitman'; HP3000-L@RAVEN.UTC.EDU
    Subject: RE: [HP3000-L] 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 *

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


+ Reply to Thread