CND-DET routines 5/8

 BBS: Inland Empire Archive
Date: 03-25-93 (15:35)             Number: 290
From: DIRK THEURER                 Refer#: NONE
  To: ALL                           Recvd: NO  
Subj: CND-DET routines 5/8           Conf: (2) Quik_Bas
'
' CND-DET routines (part 5)
'
            '
            ' get number of characters in data to follow
            '
            NoOfUs = 0
            Timeout = 0
            DO
              i$ = GetChar$
              IF i$ <> "" THEN
                Timeout = 0
                EXIT DO
              END IF
              Timeout = Timeout + 1
            LOOP WHILE Timeout < 500

            IF Timeout THEN
              '
              ' fatal error - timed out getting number of chars in data
              '
              FOR i = 1 TO 500: NEXT i
              FOSSILFlush
              GetCNDNumber% = 5
              EXIT FUNCTION
            END IF

            DataLength = ASC(i$)
            NoOfGottenChars = 0
            '
            ' Timeout should be zero coming in here
            '
            DO
              i$ = GetChar$
              IF i$ <> "" THEN
                SELECT CASE ASC(i$)
                  CASE 48 TO 57 ' 0 to 9
                    '
                    ' number is fine
                    '
                  CASE 79, 80   ' O (out of area) or P (private)
                    '
                    ' should only occur at end of data - non-fatal error
                    ' otherwise
                    '
                    IF NoOfGottenChars + 1 <> DataLength THEN
                      CND.CNDAttrib = 10
                    END IF
                  CASE ELSE
                    '
                    ' any other characters during data stream indicates
                    ' non-fatal error
                    '
                    CND.CNDAttrib = 10
                END SELECT
                CNDData = CNDData + i$
                NoOfGottenChars = NoOfGottenChars + 1
                Timeout = 0
              ELSE
                Timeout = Timeout + 1
                IF Timeout > 500 THEN
                  '
                  ' fatal error - timed out trying to receive indicated
                  '               number of data characters
                  '
                  FOR i = 1 TO 50: NEXT i
                  FOSSILFlush
                  GetCNDNumber% = 6
                  EXIT FUNCTION
                END IF
              END IF
            LOOP WHILE NoOfGottenChars < DataLength
'
' Continues...
'



---
 * Origin: RAVE * Burnaby, BC (1:153/810)
Outer Court
Echo Basic Postings

Books at Amazon:

Back to BASIC: The History, Corruption, and Future of the Language

Hackers: Heroes of the Computer Revolution (including Tiny BASIC)

Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution

The Advent of the Algorithm: The Idea that Rules the World

Moths in the Machine: The Power and Perils of Programming

Mastering Visual Basic .NET