home *** CD-ROM | disk | FTP | other *** search
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ; Enhanced Bulletin Lister v1.0
- ; Written by Drew [PWA]
- ; Last updated 04-06-95
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
-
-
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ; function/procedure decl's
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- declare procedure Initialize()
- declare function GetBullList() string
- declare function GetMaxLength() byte
- declare procedure GetInput()
- declare procedure CheckHotKey(byte ascii, var byte currow, var byte curblt)
- declare procedure ParseSelected(byte curblt)
- declare procedure PrintMenu()
- declare procedure PrintBulletin(byte curblt)
- declare procedure PrintCredits()
- declare procedure PrintHighlight(byte currow)
- declare procedure RestoreText(byte currow)
- declare procedure GetManualInput(string select)
-
-
-
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ; global var's.
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- string bltlstfile ; the BLT.LST file
- string bltmenu ; the BLT menu
- string lb_colour ; colour of lightbar
- string save_text ; used to save and restore highlighted text
- byte numblt ; number of bulletins
- byte startrow ; starting row for lightbar
- byte startcol ; starting column for lightbar
- byte numskiprow ; number of rows to skip per lightbar movement
- byte lb_length ; lightbar length
- boolean autopause ; pause after displaying every bulletin
-
-
-
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ; main
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- begin
- Initialize()
- PrintMenu()
- GetInput()
- end
-
-
-
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ; gets input from user, moves lightbar, etc.
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- procedure GetInput()
- boolean done
- byte curblt
- byte ascii
- byte currow
-
- ansipos startcol, startrow
- currow = startrow
- PrintHighlight(currow)
-
- curblt = 1
- done = FALSE
- while (!done) do
- ascii = asc(inkey())
- delay 1
- select case (ascii)
- case 13
- ; carriage return - print the bulletin, and remain in the ppe
- ;
- PrintBulletin(curblt)
- PrintMenu()
- PrintHighlight(currow)
- case 76, 85, 56
- ; left arrow, up arrow, 8
- RestoreText(currow)
- dec curblt
- if (curblt < 1) curblt = numblt
- currow = currow - numskiprow
- if (currow < startrow) currow= startrow + (numblt * numskiprow) - 2
- PrintHighlight(currow)
- case 82, 68, 50
- ; right arrow, down arrow, 2
- RestoreText(currow)
- inc curblt
- if (curblt > numblt) curblt = 1
- currow = currow + numskiprow
- if (currow > startrow + (numblt * numskiprow) - 1) currow= startrow
- PrintHighlight(currow)
- case 27, 81, 113
- ; ESC, Q, q - quit
- done = TRUE
- default
- ; make sure the parameter is the ascii # of the lower case letter.
- ; variables "done" and "curblt" cat get updated here.
- ;
- CheckHotKey(asc(lower(chr(ascii))) - 96, currow, curblt)
- endselect
- endwhile
-
- PrintCredits()
- endproc
-
-
-
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ; check if the user hit a hotkey corresponding to the bulletin. if so, then
- ; print the bulletin and remain in the ppe
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- procedure CheckHotKey(byte ascii, var byte currow, var byte curblt)
- if ((ascii >= 1) && (ascii <= numblt)) then
- RestoreText(currow)
- currow = currow + ((ascii - curblt) * numskiprow)
- PrintHighlight(currow)
- curblt = ascii
- PrintBulletin(curblt)
- PrintMenu()
- PrintHighlight(currow)
- endif
- endproc
-
-
-
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ; i hope no one minds. :)
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- procedure PrintCredits()
- ansipos 1, u_pagelen
- defcolor
- println "@X08Enhanced Bulletin Lister v1.0 by Drew [PWA]@X07"
- endproc
-
-
-
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ; save the old text and then print the lightbar
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- procedure PrintHighlight(byte currow)
- save_text = scrtext(startcol, currow, lb_length, TRUE)
- ansipos startcol, currow
- print lb_colour + stripatx(save_text)
- endproc
-
-
-
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ; restore text (after moving lightbar)
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- procedure RestoreText(byte currow)
- ansipos startcol, currow
- print save_text
- endproc
-
-
-
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ; print the BLT file
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- procedure PrintMenu()
- ; make sure we clear the screen
- cls
- dispfile bltmenu, DEFS
- endproc
-
-
-
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ; print the bulletin. reads from BLT.LST automatically. :)
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- procedure PrintBulletin(byte curblt)
- string foo
-
- ; get the full pathname of the bulletin
- ;
- fopen 1, bltlstfile, O_RD, S_DW
- fseek 1, (curblt-1) * 30, seek_set
- fread 1, foo, 30
- fclose 1
-
- ; show the darn bulletin, trimming any trailing spaces
- ;
- ansipos 1, u_pagelen
- dispfile rtrim(foo, " "), DEFS
- if (autopause) wait
- endproc
-
-
-
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ; does a whole bunch of initializing. see inline documentation for more
- ; details (should be straight forward).
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- procedure Initialize()
- byte numtok, i, confnum
- string cnames
- string ebl_cfg
- string foo, foo2
- string select
- boolean found
-
- ; if the user does something like "b 1", then kbdstuff accordingly
- ;
- numtok = tokcount()
- if (numtok) then
- foo = "B "
- for i = 1 to numtok
- foo = foo + " " + gettoken()
- next i
- kbdstuff foo
- end
- endif
-
- ; get the CNAMES file
- ;
- cnames = readline(pcbdat(), 31)
- if (!exist(cnames)) then
- println cnames + " does not exist. Bad path in PCBOARD.DAT"
- end
- endif
-
- ; get the BLT menu file (uses the CNAMES file)
- ;
- bltmenu = readline(cnames, (curconf() * 33) + 24)
-
- ; we might want to do something if the menu doesn't exist...
- ; if (!exist(bltmenu)) then
- ; println "@X0CWarning! Bulletin menu does not exist!@X07"
- ; endif
-
-
- ; get the full BLT.LST pathname (uses the CNAMES file)
- ;
- bltlstfile = readline(cnames, (curconf() * 33) + 25)
- if (!exist(bltlstfile)) then
- ; no bulletins, so stuffing "B" alone should automatically make
- ; pcboard display the "no bulletins" message
- ;
- kbdstuff "B"
- end
- endif
-
- ; calculate number of bulletins
- ;
- numblt = fileinf(bltlstfile, 4) / 30
-
-
- ; check our config file
- ;
- ebl_cfg = ppepath() + "EBL.CFG"
- if (!exist(ebl_cfg)) then
- println "@X0CError! " + ebl_cfg + " does not exist!@X07"
- end
- endif
-
- ; the first line is used if there is no line in the config file that
- ; corresponds with the current conference.
- ;
- fopen 1, ebl_cfg, O_RD, S_DW
- fdefin 1
-
- fdget foo
- if (lower(foo) == "yes") then
- autopause = TRUE
- else
- autopause = FALSE
- endif
-
- fdget select
-
-
- ; otherwise, get a line, see if the first token corresponds to the
- ; current conference.
- ;
- fdget foo
- found = FALSE
- while (foo != "<eof>") do
- tokenize foo
- foo2 = gettoken()
- if ((lower(foo2) == "main") && (curconf() == 0)) then
- found = TRUE
- break
- else
- confnum = s2i(foo2, 10)
- if ((curconf() != 0) && (confnum == curconf())) then
- found = TRUE
- break
- else
- fdget foo
- endif
- endif
- endwhile
- fclose 1
-
- ; first token matches current conf, so parse the rest of the line to
- ; get the necessary information.
- ;
- if (found) then
- startrow = s2i(gettoken(), 10)
- startcol = s2i(gettoken(), 10)
- numskiprow = s2i(gettoken(), 10)
- lb_length = s2i(gettoken(), 10)
- lb_colour = gettoken()
- else
- ; if none of the lines has the first token matching the current conf,
- ; then we prompt them the old fashioned way.
- ;
- GetManualInput(select)
- endif
-
- getuser
- endproc
-
-
-
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ; get which bulletin to view the old fashioned way.
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- procedure GetManualInput(string select)
- string text
-
- newline
- inputstr select, text, @X07, 3, MASK_NUM() + CHR(13), AUTO + NEWLINE
- if (text != "") then
- kbdstuff "B " + text
- endif
-
- end
- endproc
-
-