Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Clipper Tools One Guide - <b>com_event()</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
COM_EVENT()

Syntax:     COM_EVENT(<port>,<expN>)

Arguments:  <port> denotes the interface (1 or 2) for which the event will
            be tested.
            <expN> may be a numerical value between 1 and 5.

Returns:    A numeric value.
            This function will return the code of an incoming character,
            the condition of the MSR, the condition of the LSR or the number
            of errors occurred to date, as a function of the value that has
            been indicated fir the argument <expN>.

Usage:      It will as a rule, be necessary to establish the cause of the
            trap, if a symbol is placed in the keyboard buffer by
            COM_KEY() and the procedure specified by SET KEY is
            called.  The numeric argument will then determine the
            information to be used.  The meaning of the values 1 to 5 is
            as follows:

            1  The function returns the ASCII code of an incoming
               character.  The value -1 will be returned in the absence of
               any characters.
            2  The function supplies the condition of the MS register at
               the time of the interrupt.
            3  The function supplies the condition of the LS register at
               the time of the interrupt.
            4  The value of the internal error counter will ge returned,
               The error events in the LSR since the last COM_INIT() will
               be counted.
            5  The number of symbols rejected since the buffer was 100
               percent full will be supplied.

            All status information, with the exception of the error counter,
            will be reset when the interface is opened or when
            COM_KEY() is called.  The conditions of LSR and MSR will
            be considered at each interrupt and linked to the respective
            status byte in the internal environment via an OR connection.
            It is therefore, possible to several bits in one register.
            Only overrun errors, parity errors and frame errors (bit 1 to 3
            in the LSR) will be assessed as errors.

Warning:    The input lines in the conventional PC interface cards are
            normally not terminated.  This can lead to unexplainable
            results when interrogating the MSR.

Library:    CT1.LIB


--------------------------------- Example ------------------------------

Examples:   * Determining the number of errors
            * which occurred.

            error_cnt = COM_EVENT(1,4)

            IF error_cnt > 25
               * more than 25 errors?
               ? "Too many errors - break off program."
               release = (.T.)


            ENDIF



See Also: COM_KEY()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson