home *** CD-ROM | disk | FTP | other *** search
/ ftp.barnyard.co.uk / 2015.02.ftp.barnyard.co.uk.tar / ftp.barnyard.co.uk / cpm / walnut-creek-CDROM / CPM / CATLOG / PRINTLST.LBR / KPPRTLST.BQS / KPPRTLST.BAS
BASIC Source File  |  2000-06-30  |  9KB  |  430 lines

  1. REM -------------[ PRINTLST.BAS (Prints MAST.LST files) ]-----------------\
  2.     \
  3.     Program written and (C) 1984 by Steven L. Sanders\
  4.     \
  5.     Date written - November 24, 1984\
  6.     \
  7.     Version 1, revision 2\
  8.     \
  9.     Language - CBASIC Compiler (CB80)\
  10.     \
  11.     Designed for use with a video-able Kaypro computer or\
  12.     ADM3-A terminal.\
  13.     \
  14.     This program will output the contents of the MAST.LST file\
  15.     generated by XCATxx.COM into a 3-across format either to the\
  16.     CRT, printer, or diskfile.  I found all the other listing programs\
  17.     to be big space-wasters when it came to the number of sheets\
  18.     needed to print-out a big catalog.  PRINTLST ignores all other\
  19.     disk numbers except for the first one generated by XCAT, if you\
  20.     need a cross-ref listing then use XCAT's list output function.\
  21.     \
  22.     To use, run XCATxx on your MAST.CAT file first and choose the\
  23.     diskfile output option and generate the needed MAST.LST file.\
  24.     PRINTLST will look for MAST.LST on the logged du:, read it in\
  25.     and then generate the 3-across format to CRT, printer, or disk.\
  26.     \
  27. ----------------------------[ (C)opyrights ]---------------------------------\
  28.  
  29.     copyright1$ =\
  30.     "Portions of this program (C)1983, 1984 by Digital Research  "
  31.  
  32.     copyright2$ =\
  33.     "  The rest is (C) 1984 by Steven L. Sanders"
  34.  
  35. REM ------------------------[ DEFINE CONSTANTS ]-----------------------------\
  36.  
  37.     false% =     0        REM true and false used for
  38.     true% =     NOT false%    REM while/wend loops
  39.     bell$ =     CHR$(07h)    REM console bell
  40.     cr$ =         CHR$(0dh)    REM carriage return
  41.     clr$ =        CHR$(1ah)    REM clear screen
  42.     esc$ =        CHR$(1bh)    REM ESCape
  43.     eos$ =        CHR$(017h)    REM clear to end of screen
  44.     formfeed$ =    CHR$(0ch)    REM printer formfeed
  45.  
  46. REM ----------------------[ KAYPRO VIDEO CODES ]-----------------------------\
  47.  
  48.     inv.on$ =     esc$ + "B0"    REM inverse video ON
  49.     inv.off$ =     esc$ + "C0"    REM inverse video OFF
  50.     half.on$ =    esc$ + "B1"    REM half intensity ON
  51.     half.off$ =    esc$ + "C1"    REM half intensity OFF
  52.     blink.on$ =    esc$ + "B2"    REM blink ON
  53.     blink.off$ =    esc$ + "C2"    REM blink OFF
  54.  
  55. REM --------------------[ DEFINE FUNCTIONS ]----------------------------------\
  56.  
  57. REM position cursor
  58.  
  59.     DEF fn.cursor$(v%,h%)
  60.         PRINT esc$ + "=" + CHR$(v%+32) + CHR$(h%+32);
  61.         RETURN
  62.     FEND
  63.     
  64. REM turns up a clean page under title header
  65.  
  66.     DEF fn.new.screen%
  67.         PRINT FN.CURSOR$(4,0);eos$;
  68.         RETURN
  69.     FEND
  70.  
  71.     DEF fn.screen.two%
  72.         PRINT FN.CURSOR$(2,0);eos$;
  73.         RETURN
  74.     FEND
  75.  
  76.     file.mast$ =    "mast.lst"    REM source MAST.LST
  77.  
  78.     sep$ =        "  |  "        REM file seperator
  79.     fil.sep$ =    " | "        REM output file seperator
  80.  
  81. REM -------------------[ program code begins ]--------------------------\
  82.  
  83. begin:
  84.  
  85.     ON ERROR GOTO error.handler    REM take care of problems
  86.  
  87.     PRINT clr$ + inv.on$ + \
  88. "  PRINTLST v1.2 - Formats the MAST.LST file  (C)1984 Steven L. Sanders  " +\
  89.      inv.off$
  90.  
  91.     PRINT:PRINT:PRINT:PRINT\
  92. "  Output to: <P>rinter, <C>RT, or <D>iskfile?  (P, C, or D): ";
  93.  
  94. well:
  95.  
  96.     PRINT bell$;
  97.  
  98.     answer% = INKEY
  99.  
  100.     IF UCASE$(CHR$(answer%)) = "P" THEN\
  101.     PRINT "Printer":\
  102.     GOTO list.it
  103.  
  104.     IF UCASE$(CHR$(answer%)) = "D" THEN\
  105.     PRINT "Diskfile":\
  106.     GOTO create.it
  107.  
  108.     IF UCASE$(CHR$(answer%)) <> "C" THEN GOTO well
  109.  
  110.     PRINT "CRT"
  111.  
  112. REM -----------------------[ output to crt ]----------------------------------\
  113.  
  114.     IF NOT SIZE(file.mast$) THEN \
  115.     PRINT:PRINT:PRINT "Unable to open MAST.LST on current du:" + bell$:\
  116.     STOP \
  117.     ELSE \
  118.     OPEN file.mast$ AS 1
  119.  
  120.     IF END #1 THEN thats.all
  121.  
  122.     count% = 1
  123.     line% = 1
  124.  
  125.     dummy% = fn.screen.two%
  126.  
  127.     PRINT\
  128. "filename.typ  -  dsk  |  filename.typ  -  dsk  |  filename.typ  -  dsk"
  129.     PRINT\
  130. "----------------------------------------------------------------------"
  131.  
  132.     PRINT
  133.  
  134.     WHILE true%
  135.  
  136. do.it:
  137.  
  138.         IF count% > 3 THEN\
  139.         count% = 1:\
  140.         PRINT
  141.  
  142.         READ #1;LINE input.line$
  143.  
  144.         IF MID$(input.line$,4,5) = "DONE:" THEN\
  145.         PRINT input.line$:\
  146.         GOTO do.it
  147.  
  148.         IF LEFT$(input.line$,9) = "         " THEN\
  149.         PRINT input.line$:\
  150.         GOTO thats.all
  151.  
  152.         PRINT LEFT$(input.line$,20);
  153.  
  154.         IF count% = 1 OR count% = 2 THEN \
  155.         PRINT sep$;
  156.  
  157.         line% = line% + 1
  158.         count% = count% + 1
  159.  
  160.         IF line% <= 45 THEN GOTO do.it
  161.  
  162.         line% = 1
  163.  
  164.         PRINT:PRINT blink.on$ + " [ any key or <Q>uit ] " +\
  165.          blink.off$;
  166.  
  167. go.or.no:
  168.  
  169.         dummy% = INKEY
  170.  
  171.         IF UCASE$(CHR$(dummy%)) = "Q" THEN\
  172.         PRINT cr$;"                         ";cr$;:\
  173.         CLOSE 1:\
  174.         STOP\
  175.         ELSE\
  176.         dummy% = fn.new.screen%:\
  177.         GOTO do.it
  178.  
  179.     WEND
  180.  
  181. thats.all:
  182.  
  183.     PRINT
  184.     PRINT "All done." + bell$
  185.  
  186.     STOP
  187.  
  188. REM ------------------------[ output to printer ]----------------------------\
  189.  
  190. list.it:
  191.  
  192.     IF NOT SIZE(file.mast$) THEN \
  193.     PRINT:PRINT:PRINT "Unable to open MAST.LST on current du:" + bell$:\
  194.     STOP \
  195.     ELSE \
  196.     OPEN file.mast$ AS 1
  197.  
  198. enter.date:
  199.  
  200.     dummy% = fn.new.screen%
  201.  
  202.     PRINT bell$:INPUT\
  203. "             Enter today's date (MM/DD/YY): ";LINE todays.date$
  204.  
  205.     IF LEN(todays.date$) <> 8 THEN GOTO enter.date
  206.  
  207.     dummy% = fn.new.screen%
  208.  
  209.     PRINT:PRINT:PRINT\
  210. "                 ++ Outputting MAST.LST to the printer ++";
  211.  
  212.     IF END #1 THEN all.printed
  213.  
  214.     count% = 1
  215.     line% = 1
  216.     page% = 1
  217.  
  218.     LPRINTER WIDTH 80
  219.  
  220. new.page:
  221.  
  222.     PRINT\
  223. "MAST.LST - Master CP/M Catalog as of " + todays.date$ + \
  224.     "                  page";page%
  225.  
  226.     PRINT:PRINT\
  227. "filename.typ  -  dsk  |  filename.typ  -  dsk  |  filename.typ  -  dsk"
  228.     PRINT\
  229. "----------------------------------------------------------------------"
  230.  
  231.     IF page% = 1 THEN PRINT
  232.  
  233.     WHILE true%
  234.  
  235. doing.it:
  236.  
  237.         IF count% > 3 THEN\
  238.         count% = 1:\
  239.         PRINT
  240.  
  241.         READ #1;LINE input.line$
  242.  
  243.         IF MID$(input.line$,4,5) = "DONE:" THEN\
  244.         PRINT input.line$:\
  245.         GOTO doing.it
  246.  
  247.         IF LEFT$(input.line$,9) = "         " THEN\
  248.         PRINT input.line$:\
  249.         GOTO all.printed
  250.  
  251.         PRINT LEFT$(input.line$,20);
  252.  
  253.         IF count% = 1 OR count% = 2 THEN \
  254.         PRINT sep$;
  255.  
  256.         line% = line% + 1
  257.         count% = count% + 1
  258.  
  259.         IF line% <= 171 THEN GOTO doing.it
  260.  
  261.         line% = 1
  262.  
  263.         PRINT formfeed$
  264.  
  265.         page% = page% + 1
  266.  
  267.         GOTO new.page
  268.  
  269.     WEND
  270.  
  271. all.printed:
  272.  
  273.     CONSOLE
  274.  
  275.     CLOSE 1
  276.  
  277.     dummy% = fn.new.screen%
  278.  
  279.     PRINT:PRINT "All done." + bell$
  280.  
  281.     STOP
  282.  
  283. REM ------------------------[ output to diskfile ]----------------------------\
  284.  
  285. create.it:
  286.  
  287.     IF NOT SIZE(file.mast$) THEN \
  288.     PRINT:PRINT:PRINT "Unable to open MAST.LST on current du:" + bell$:\
  289.     STOP \
  290.     ELSE \
  291.     OPEN file.mast$ AS 1
  292.  
  293. enter.the.date:
  294.  
  295.     dummy% = fn.new.screen%
  296.  
  297.     PRINT bell$:INPUT\
  298. "             Enter today's date (MM/DD/YY): ";LINE todays.date$
  299.  
  300.     IF LEN(todays.date$) <> 8 THEN GOTO enter.the.date
  301.  
  302.     dummy% = fn.new.screen%
  303.  
  304.     PRINT:PRINT:PRINT\
  305. "Enter drive to create MASTER.LST on (A,B,C,or c/r for default): ";
  306.  
  307. which.drive:
  308.  
  309.     PRINT bell$;
  310.  
  311.     answer% = INKEY
  312.  
  313.     IF answer% = 0dh THEN\
  314.     PRINT "Default":\
  315.     file.form$ = "MASTER.LST":\
  316.     GOTO get.on.with.it
  317.  
  318.     IF UCASE$(CHR$(answer%)) = "A" THEN\
  319.     PRINT "A":\
  320.     file.form$ = "A:MASTER.LST":\
  321.     GOTO get.on.with.it
  322.  
  323.     IF UCASE$(CHR$(answer%)) = "B" THEN\
  324.     PRINT "B":\
  325.     file.form$ = "B:MASTER.LST":\
  326.     GOTO get.on.with.it
  327.  
  328.     IF UCASE$(CHR$(answer%)) = "C" THEN\
  329.     PRINT "C":\
  330.     file.form$ = "C:MASTER.LST":\
  331.     GOTO get.on.with.it
  332.  
  333.     GOTO which.drive
  334.  
  335. get.on.with.it:
  336.  
  337.     IF SIZE(file.form$) THEN\
  338.     dummy% = fn.new.screen%:\
  339.     PRINT:PRINT:PRINT:PRINT bell$ +\
  340. "          Program ABORTED!  MASTER.LST file already exists!":\
  341.     STOP\
  342.     ELSE\
  343.     CREATE file.form$ AS 2
  344.  
  345.     PRINT:PRINT:PRINT:PRINT blink.on$ +\
  346. "                ++ Creating  " + blink.off$ + file.form$ + "  file ++";
  347.  
  348.     IF END #1 THEN all.formatted
  349.  
  350.     count% = 1
  351.  
  352.     PRINT USING "&";#2;\
  353.     "MASTER.LST - Master CP/M Catalog as of " + todays.date$
  354.  
  355.     PRINT USING "&";#2;" "
  356.     PRINT USING "&";#2;\
  357. "filename.typ  -  dsk  |  filename.typ  -  dsk  |  filename.typ  -  dsk"
  358.     PRINT USING "&";#2;\
  359. "----------------------------------------------------------------------"
  360.  
  361.     WHILE true%
  362.  
  363. formatting.it:
  364.  
  365.         IF count% = 4 THEN\
  366.         count% = 1:\
  367.         GOSUB output.the.line
  368.  
  369.         READ #1;LINE input.line$
  370.  
  371.         IF MID$(input.line$,4,5) = "DONE:" THEN\
  372.         done$ = input.line$:\
  373.         PRINT USING "&";#2;input.line$:\
  374.         GOTO formatting.it
  375.  
  376.         IF LEFT$(input.line$,9) = "         " THEN\
  377.         done2$ = input.line$:\
  378.         PRINT USING "&";#2;input.line$:\
  379.         GOTO all.formatted
  380.  
  381.         IF count% = 1 THEN file1$ = LEFT$(input.line$,20)
  382.  
  383.         IF count% = 2 THEN file2$ = LEFT$(input.line$,20)
  384.  
  385.         IF count% = 3 THEN file3$ = LEFT$(input.line$,20)
  386.  
  387.         count% = count% + 1
  388.  
  389.         GOTO formatting.it
  390.  
  391.     WEND
  392.  
  393. output.the.line:
  394.  
  395.     PRINT USING "& & & & &";#2;file1$,fil.sep$,file2$,fil.sep$,file3$
  396.  
  397.     RETURN
  398.  
  399. all.formatted:
  400.  
  401.     CLOSE 1
  402.     CLOSE 2
  403.  
  404.     dummy% = fn.new.screen%
  405.  
  406.     PRINT:PRINT:PRINT:PRINT\
  407. "                         " + done$
  408.     PRINT\
  409. "                         " + done2$ + bell$
  410.  
  411.     STOP
  412.  
  413. REM ----------------------------[ error handler ]----------------------------\
  414.  
  415. error.handler:
  416.  
  417.     IF ERR = "DW" OR ERR = "ME" THEN\
  418.     dummy% =fn.new.screen%:\
  419.     PRINT:PRINT\
  420. "                Operating system reports an error!!":\
  421.     PRINT:PRINT\
  422. "                Check disk for FREE space available" + bell$\
  423.     ELSE\
  424.     dummy% = fn.new.screen%:\
  425.     PRINT:PRINT bell$ +\
  426. "                Error Code --> ";err
  427.  
  428.     STOP
  429.  
  430. REM --------------------------[ the end ... ]-------------------------------\