home *** CD-ROM | disk | FTP | other *** search
- ' TabTest.Bas - Program to demonstrate tab expansion and
- ' compression using both ifxed-interval tabs
- ' and irregular-interval tabs.
-
- ' $INCLUDE: 'TABMAN.BI'
-
- DECLARE SUB DisplayTabBar ()
- DECLARE SUB ShowTheTabs (aTabStr$)
-
-
- CLS
- PRINT "TabTest - test expansion/compression"
- PRINT
-
- ' Set up a couple of test strings.
-
- FOR aTab% = 1 TO 8
- TestString1$ = TestString1$ + "*" + CHR$(9)
- NEXT aTab%
- TestString1$ = TestString1$ + "*"
-
- TestString2$ = " 1 2 3 4 "
- TestString2$ = TestString2$ + " 5 6 7"
-
-
- ' Run the whole program twice - once for each type of tab.
-
- FOR Style% = 1 TO 2
- InitTabManager (Style%)
-
- IF Style% = 1 THEN
- SetTab 4
- ELSE
- SetTab 51: SetTab 46: SetTab 21: SetTab 9
- SetTab 36: SetTab 31: SetTab 17: SetTab 5
- END IF
-
- DeTab TestString1$, NoTabs$
-
- PRINT "Here is string '";
- ShowTheTabs TestString1$
- PRINT "' detabbed."
-
- DisplayTabBar
- PRINT NoTabs$
-
- PRINT : PRINT "Here is the string to entab:"
- PRINT TestString2$
- DisplayTabBar
-
- EnTab TestString2$, HasTabs$
-
- PRINT "Here is the resulting string:"
- ShowTheTabs HasTabs$
-
- IF Style% = 2 THEN
- PRINT : PRINT
- PRINT "The same entabbed string, but after removing tabstop #21"
- ClrTab 21
-
- EnTab TestString2$, HasTabs$
- DisplayTabBar
- ShowTheTabs HasTabs$
-
- PRINT
- END IF
- NEXT Style%
- END
-
-
- SUB DisplayTabBar
- ' DisplayTabBar - Subprogram to display a bar showing
- ' the current tab settings.
-
- FOR I% = 1 TO 80
- IF IsTab%(I%) THEN
- PRINT "T";
- ELSE
- PRINT "-";
- END IF
- NEXT I%
-
- END SUB
-
-
- SUB ShowTheTabs (aTabStr$)
- ' ShowTheTabs - Subprogram to display an entabbed string
- ' using the C language convention of showing
- ' the tab character as "\t".
-
- FOR I% = 1 TO LEN(aTabStr$)
- IF MID$(aTabStr$, I%, 1) = CHR$(9) THEN
- PRINT "\t";
- ELSE
- PRINT MID$(aTabStr$, I%, 1);
- END IF
- NEXT I%
-
- END SUB
-