home *** CD-ROM | disk | FTP | other *** search
/ Media Share 9 / MEDIASHARE_09.ISO / bbs / ansig100.zip / PCBPRINT.BAS < prev    next >
BASIC Source File  |  1993-11-05  |  5KB  |  137 lines

  1. DECLARE SUB PcbPrint (StringInput$)
  2. DEFINT A-Z
  3. DECLARE FUNCTION PCBFilter$ (TextInput$)
  4. 'AnsiGraph Toolkit....              
  5. '                ┌┬──┐ ┌┬──┐     ┌┬─┐  ┌┬──┐ ┌┬──┐ ┌┬──┐ ┬┬──┐
  6. '                ├┼──┘ ├┤    ─── ├┼─┴┐ ├┤  │ ├┼──┤ ├┼─┬┘ ├┤  │
  7. '                └┘    └┴──┘     └┴──┘ └┴──┘ └┘  ┘ └┘ └  ┴┴──┘
  8. '
  9. '                    █▀▀▄ ▄▀▀▄ █▀▀▄     █▀▀█ █▄  █ ▄▀▀▀ ▀█▀
  10. '                    █▀▀  █  ▄ █▀▀▄ ▀▀▀ █▀▀█ █ ▀▄█  ▀▀▄  █
  11. '                    ▀     ▀▀  ▀▀▀      ▀  ▀ ▀   ▀ ▀▀▀  ▀▀▀
  12. '
  13. '                     ██████▄ ██████▄ ▐██▌ ▄█████▄ ███████
  14. '                     ██▄▄▄██ ██   ██  ██  ██   ██   ▐█▌
  15. '                     ██▀▀▀▀  ██████   ██  ██   ██   ▐█▌    Version
  16. '                     ██      ██  ▀██ ▐██▌ ██   ██   ▐█▌      1.2
  17. '
  18. '     █▀▄ ╓──┐ ╥─┐  ╥──┐ ╥──┐ ╓─╥─┐      ▄▀▀ ╥──┐ ─╥─ ╥──┐ ╥──┐
  19. '     █▀▄ ║  │ ╟─┴┐ ╟─   ╟─┬┘   ║         ▀▄ ╟──┘  ║  ╟─   ╟─┬┘
  20. '     ▀ ▀ ╙──┘ ╨──┘ ╨──┘ ╨ ┴    ╨        ▀▀  ╨    ─╨─ ╨──┘ ╨ ┴
  21. '
  22. '────────────────────────────────────────────────────────────────────────────────
  23. '         ───┐ ─╖                                        ▀
  24. '         ╓──┘  ║   █▀█ █▀▄ █▀█ █▀█ █▀▄ █▀█  █▀█▀█ █▀█▀█ █ █▀█ █▀█
  25. '         ╙─── ─╨─  █▀▀ ▀   ▀▀▀ ▀▀█ ▀   ▀▀ ▀ ▀ ▀ ▀ ▀ ▀ ▀ ▀ ▀ ▀ ▀▀█
  26. ' ──────────────────────────────▀▀─────────────────────────────▀▀────────────────
  27. '
  28. '        Robert L. Spier                Internet: robert.spier@hardgood.com
  29. '        One Lookout Circle             Rime: Robert Spier -> APPLEWIZ or -> ACC
  30. '        Larchmont, NY 10538            Intelec: Robert Spier in Netchat, Programming.
  31. '
  32. '  See AnsiG.txt for more info.  Registration $20.
  33. '
  34. ' PCBPrint will print a string (Starting at the current cursor location)
  35. 'and will use all of the applicable PCBANSI formatting codes.  @X.. It will NOT
  36. 'strip @..@ codes from the text, so please don't include them.  If that is
  37. 'needed,  it will be implemented in a future verison.
  38. ' PCBFilter, filters out all of the @X.. codes from a string and returns, the
  39. ' plain string.
  40. '
  41. 'Demo
  42. '     b$ = "@X24Hello!    @X12Goodbye!@X31Its Time to say hello!@XCR"
  43. '     PcbPrint b$
  44. '     b$ = "Hello!@X02Goodbye!" + CHR$(13)
  45. '     PcbPrint b$
  46. '     COLOR 15, 0
  47. '     PRINT PCBFilter$(b$)
  48.  
  49. FUNCTION PCBFilter$ (TextInput$)
  50. b$ = TextInput$
  51. DO
  52.         NextIn = INSTR(b$, "@X")
  53.         it = 1
  54.                 IF NextIn THEN
  55.                         IF it = 1 AND NextIn <> 1 THEN
  56.                             a$ = LEFT$(b$, NextIn - 1)
  57.                             b$ = RIGHT$(b$, LEN(b$) - NextIn + 1)
  58.                         END IF
  59.                         Form$ = LEFT$(b$, 4)
  60.                         b$ = RIGHT$(b$, LEN(b$) - 4)
  61.                         
  62.                         Another = INSTR(b$, "@X")
  63.                         IF Another THEN
  64.                                 a$ = a$ + LEFT$(b$, Another - 1)
  65.                                 b$ = RIGHT$(b$, LEN(b$) - Another + 1)
  66.                         END IF
  67.                 ELSE
  68.                         a$ = a$ + b$
  69.                         EXIT DO
  70.                 END IF
  71.                 it = 2
  72. LOOP
  73.  
  74. PCBFilter$ = a$
  75.  
  76. END FUNCTION
  77.  
  78. SUB PcbPrint (StringInput$) STATIC
  79. b$ = StringInput$
  80. DO
  81.         NextIn = INSTR(b$, "@X")
  82.         it = 1
  83.                 IF NextIn THEN
  84.                         IF it = 1 AND NextIn <> 1 THEN
  85.                             PRINT LEFT$(b$, NextIn - 1);
  86.                             b$ = RIGHT$(b$, LEN(b$) - NextIn + 1)
  87.                         END IF
  88.                         Form$ = LEFT$(b$, 4)
  89.                         b$ = RIGHT$(b$, LEN(b$) - 4)
  90.                         GOSUB FormatCheck:
  91.                         Another = INSTR(b$, "@X")
  92.                         IF Another THEN
  93.                                 PRINT LEFT$(b$, Another - 1);
  94.                                 b$ = RIGHT$(b$, LEN(b$) - Another + 1)
  95.                         END IF
  96.                 ELSE
  97.                         EXIT DO
  98.                 END IF
  99.                 it = 2
  100. LOOP
  101.     PRINT b$;
  102.     EXIT SUB
  103. FormatCheck:
  104.         IF LEN(Form$) <> 4 THEN RETURN
  105.         Code$ = RIGHT$(Form$, 2)
  106.         IF Code$ = "CR" THEN
  107.         'If RIGHT$(Form$, 2) = "CR" THEN
  108.         PRINT
  109.         ELSEIF Code$ = "00" THEN           'Save current colors
  110.                 CBSaved = CBColor         '(No Black on Black)
  111.                 CFSaved = CFColor
  112.         ELSEIF Code$ = "FF" THEN           'Restore Saved Colors
  113.                 CBColor = CBSaved         ' (No blink on bright)
  114.                 CFColor = CFSaved
  115.                 COLOR CFColor, CBColor
  116.  
  117.  
  118.         ELSE
  119.         fg$ = MID$(Form$, 4, 1)      'Last one is FG     ----\
  120.         bg$ = MID$(Form$, 3, 1)      'First one is BG    ---\|
  121.         IF fg$ = "," THEN                                  '||
  122.                 CBColor = VAL("&h" + bg$)                  '||
  123.                 COLOR , CBColor                   '       @X12
  124.         ELSEIF bg$ = "," THEN
  125.                 CFColor = VAL("&h" + fg$)
  126.                 COLOR CFColor
  127.         ELSE
  128.                 CBColor = VAL("&h" + bg$)
  129.                 CFColor = VAL("&h" + fg$)
  130.                 COLOR CFColor, CBColor
  131.         END IF
  132.         END IF
  133.         RETURN
  134.         
  135.     END SUB
  136.  
  137.