home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Media Share 9
/
MEDIASHARE_09.ISO
/
bbs
/
ansig100.zip
/
PBPRINT.BAS
< prev
next >
Wrap
BASIC Source File
|
1993-11-05
|
6KB
|
152 lines
DECLARE FUNCTION PBFilter$ (B$)
DECLARE SUB PBPrint (B$)
DEFINT A-Z
CONST true = -1, false = 0
' AnsiGraph Toolkit....
' ┌┬──┐ ┌┬──┐ ┌┐ ┐ ┐ ┌┬──┐ ┌┬──┐ ┌┬─┐ ┌┬──┐ ┌┬──┐ ┌┬──┐ ┬┬──┐
' ├┼──┘ ├┤ │ ├┤ │ │ ├┼─ ├┼─┬┘ ├┼─┴┐ ├┤ │ ├┼──┤ ├┼─┬┘ ├┤ │
' └┘ └┴──┘ └┴─┴─┘ └┴──┘ └┘ └ └┴──┘ └┴──┘ └┘ ┘ └┘ └ ┴┴──┘
'
' █▀▀▄ █▀▀▄ █▀▀█ █▄ █ ▄▀▀▀ ▀█▀ Version
' █▀▀ █▀▀▄ ▀▀▀ █▀▀█ █ ▀▄█ ▀▀▄ █ 1.4
' ▀ ▀▀▀ ▀ ▀ ▀ ▀ ▀▀▀ ▀▀▀
'
' ██████▄ ██████▄ ▐██▌ ▄█████▄ ███████
' ██▄▄▄██ ██ ██ ██ ██ ██ ▐█▌
' ██▀▀▀▀ ██████ ██ ██ ██ ▐█▌
' ██ ██ ▀██ ▐██▌ ██ ██ ▐█▌
'
'
' █▀▄ ╓──┐ ╥─┐ ╥──┐ ╥──┐ ╓─╥─┐ ▄▀▀ ╥──┐ ─╥─ ╥──┐ ╥──┐
' █▀▄ ║ │ ╟─┴┐ ╟─ ╟─┬┘ ║ ▀▄ ╟──┘ ║ ╟─ ╟─┬┘
' ▀ ▀ ╙──┘ ╨──┘ ╨──┘ ╨ ┴ ╨ ▀▀ ╨ ─╨─ ╨──┘ ╨ ┴
'
'────────────────────────────────────────────────────────────────────────────────
' ───┐ ─╖ ▀
' ╓──┘ ║ █▀█ █▀▄ █▀█ █▀█ █▀▄ █▀█ █▀█▀█ █▀█▀█ █ █▀█ █▀█
' ╙─── ─╨─ █▀▀ ▀ ▀▀▀ ▀▀█ ▀ ▀▀ ▀ ▀ ▀ ▀ ▀ ▀ ▀ ▀ ▀ ▀ ▀▀█
' ──────────────────────────────▀▀─────────────────────────────▀▀────────────────
'
' Robert L. Spier Internet: robert.spier@hardgood.com
' One Lookout Circle Rime: Robert Spier -> APPLEWIZ or -> ACC
' Larchmont, NY 10538 Intelec: Robert Spier in Netchat, Programming.
'
' See AnsiG.txt for more info. Registration $20.
'
' Created at a whim because the PcBoard @X.. codes were too bulky and ineficent
' this little subroutine accepts standard Powerboard Color Commands, and
' then prints the string, IN COLOR!
' In informal testing this is almost two times as fast as the PCB-ANSI @X..
' is and is easier as well.
'
' If you wish to extract the normal string from a PB String use PBFilter.
' It is a simple function, and it extracts the normal string!
'
' NOTE: As written PBPrint does NOT add a CRLF to the end of each line.
' Remember PRINT txt$;? Either add it yourself, with a txt$+CHR$(13)
' or go into PBPrint and toss the semi-colon on the LAST print statement
' in the sub. If you change other print statements you may ruin the code.
'
' (c) 1993 Robert Spier
'Demo #1:
'CLS
'a$ = "&1&1 $2$2 &3&3 $4$4 &5&5 $6$6 &7&7 $8$8 &9&9 $10$10 &11&11 $12$12 &13&13&14&14&15&15"
'PbPrint a$
'Demo #2:
'OPEN "\PCBFILE" FOR INPUT AS 1
'DO
'LINE INPUT #1, a$
'pbprint a$
'pbprint CHR$(13) 'This line is important when you are reading files. Could
'be replaced with just PRINT or change the line above to:
'pbprint a$+chr$(13)
'LOOP UNTIL EOF(1)
'CLOSE
FUNCTION PBFilter$ (FilterStr$)
B$ = FilterStr$
DO
'Figure out whether we are talking about Foreground or BackGround
NextInF = INSTR(B$, "&")
NextInB = INSTR(B$, "$")
IF NextInF < NextInB OR NextInB = 0 THEN
SearchChar$ = "&"
NextIn = NextInF
ELSE
NextIn = NextInB
SearchChar$ = "$"
END IF
IF NextIn THEN
a$ = a$ + LEFT$(B$, NextIn - 1)
B$ = RIGHT$(B$, LEN(B$) - NextIn)
NextIn = INSTR(B$, SearchChar$)
B$ = RIGHT$(B$, LEN(B$) - NextIn)
NextInF = INSTR(B$, "&")
NextInB = INSTR(B$, "$")
IF NextInF < NextInB OR NextInB = 0 THEN
another = NextInF
ELSE
another = NextInB
END IF
IF another THEN
a$ = a$ + LEFT$(B$, another - 1)
B$ = RIGHT$(B$, LEN(B$) - another + 1)
END IF
ELSE
EXIT DO
END IF
LOOP
PBFilter$ = a$ + B$
END FUNCTION
SUB PBPrint (B$)
IF LEFT$(B$, 6) = "PBANSI" THEN B$ = RIGHT$(B$, LEN(B$) - 6) 'Just in case!
DO
'Figure out whether we are talking about Foreground or BackGround
NextInF = INSTR(B$, "&")
NextInB = INSTR(B$, "$")
IF NextInF < NextInB AND NextInF <> 0 OR NextInB = 0 THEN
SearchChar$ = "&"
FG = true
NextIn = NextInF
ELSE
NextIn = NextInB
SearchChar$ = "$"
FG = false
END IF
IF NextIn THEN
PRINT LEFT$(B$, NextIn - 1);
B$ = RIGHT$(B$, LEN(B$) - NextIn)
NextIn = INSTR(B$, SearchChar$)
Form$ = MID$(B$, 1, NextIn - 1)
t = VAL(Form$)
IF FG = true THEN COLOR t ELSE COLOR , t
B$ = RIGHT$(B$, LEN(B$) - NextIn)
NextInF = INSTR(B$, "&")
NextInB = INSTR(B$, "$")
IF NextInF < NextInB OR NextInB = 0 THEN
another = NextInF
ELSE
another = NextInB
END IF
IF another THEN
PRINT LEFT$(B$, another - 1);
B$ = RIGHT$(B$, LEN(B$) - another + 1)
END IF
ELSE
EXIT DO
END IF
LOOP
PRINT B$;
END SUB