home *** CD-ROM | disk | FTP | other *** search
/ Oakland CPM Archive / oakcpm.iso / cpm / bbslists / findrcpm.lbr / FINDRCPM.BQS / FINDRCPM.BAS
Encoding:
BASIC Source File  |  1986-07-15  |  12.1 KB  |  327 lines

  1. 10 REM FINDRCPM Release 1.00 - Copyright (C) 1985 by George M. Sipe.
  2. 20 REM
  3. 30 REM Notice:  This program is NOT public domain.  Copyright is retained by
  4. 40 REM          George M. Sipe, 4873 Scotts Mill Way, Duluth, GA, 30136.
  5. 50 REM
  6. 60 REM          License is granted for free use and re-distribution, providing
  7. 70 REM          such use and re-distribution contain this notice and copyright
  8. 80 REM          notice displayed upon program execution.  No restriction is
  9. 90 REM          placed on commercial use, other than written notice of such to
  10. 100 REM          the copyright holder identified above.
  11. 110 REM
  12. 120 REM This program scans for entries of interest in the monthly RCP/M list
  13. 130 REM generously published by Jud Newell, Kim Levitt, and Steve Sanders.
  14. 140 REM
  15. 150 REM        The format of the specification file is assumed to be...
  16. 160 REM
  17. 170 REM        General requirements (unless always include or exclude):
  18. 180 REM
  19. 190 REM        1.    Minimum storage in megabytes required (e.g. 30.25)
  20. 200 REM        2.    Transmission speed required (e.g. b)
  21. 210 REM      3.  Output filename (e.g. rcpm-#.sum)
  22. 220 REM          (Note:  # gets replaced by 3 digit input number.)
  23. 230 REM      4.  Blank line
  24. 240 REM
  25. 250 REM      Always include if mentioned (unless always excluded):
  26. 260 REM
  27. 270 REM      5.  Minimum storage in megabytes required (e.g. 5.0)
  28. 280 REM      6.  Transmission speed required (e.g. 3b)
  29. 290 REM      7.  Strings to match (case insensitive, 1 per line)
  30. 300 REM      -   Blank line
  31. 310 REM
  32. 320 REM      Always exclude if mentioned (overrides all else):
  33. 330 REM
  34. 340 REM      -   Minimum storage in megabytes to match (e.g. 5.0)
  35. 350 REM      -   Transmission speeds to match (e.g. 3b)
  36. 360 REM      -   Strings to match (case insensitive, 1 per line)
  37. 370 REM
  38. 380 REM      The format of the RCP/M list is assumed to be...
  39. 390 REM
  40. 400 REM      1.  Header is terminated by a blank line
  41. 410 REM      2.  Region names follow lines containing "====="
  42. 420 REM      3.  States' names are on lines with '[' in column 1
  43. 430 REM      4.  Entries have a non-blank in the first column
  44. 440 REM      5.  Entries end with new entries or blank lines
  45. 450 REM      6.  Specifications are in "(baud;size)" format in entries
  46. 460 REM      7.  Specifications are on the second line of each entry
  47. 470 REM      8.  Size is in KB unless followed by M (before ')')
  48. 480 REM      9.  The first entry starts after the first region marker
  49. 490 REM     10.  The last entry ends at the 'region' "NOTES:"
  50. 500 REM
  51. 510 REM This program is compatible with most versions of Microsoft Basic,
  52. 520 REM including CP/M-80 and IBM-PC versions.  For maximum performance, it
  53. 530 REM is suggested that this program be compiled with Microsoft BASCOM.
  54. 540 REM
  55. 550 REM ----------------------------------------------------------------------
  56. 560 REM Make declarations...
  57. 570 REM ----------------------------------------------------------------------
  58. 580 OPTION BASE 1
  59. 590 DEFINT A-Z
  60. 600 DIM SFILE$(25),INUM$(3),IFILE$(25),OFILE$(25)
  61. 610 DIM ENTRY$(25),LCENTRY$(25),TEXT$(3,50),SPEED$(3)
  62. 620 DIM MEG!(3),COUNT(3)
  63. 630 MREGION$="====="
  64. 640 DONE$="NOTES:"
  65. 650 REGION$=""
  66. 660 STATE$=""
  67. 670 COUNT=0
  68. 680 TOTAL=0
  69. 690 REM ----------------------------------------------------------------------
  70. 700 REM Get selection specifications...
  71. 710 REM ----------------------------------------------------------------------
  72. 720 REM (Replace the next line with your terminal's clear code.)
  73. 730 PRINT CHR$(27)+"[2J"
  74. 740 REM (The next line MAY NOT be removed from this program.)
  75. 750 PRINT "FINDRCPM Release 1.00 - Copyright (C) 1985 by George M. Sipe."
  76. 760 PRINT
  77. 770 INPUT "Specification file name [FINDRCPM.DAT]";SFILE$
  78. 780 IF LEN(SFILE$)=0 THEN SFILE$="FINDRCPM.DAT"
  79. 790 OPEN "I",#1,SFILE$
  80. 800 FOR I=1 TO 3
  81. 810 COUNT(I)=0
  82. 820 MEG!(I)=0!
  83. 830 SPEED$(I)=""
  84. 840 NEXT I
  85. 850 ON ERROR GOTO 990
  86. 860 FOR I=1 TO 3
  87. 870 INPUT #1, MEG!(I)
  88. 880 INPUT #1, ILINE$
  89. 890 GOSUB 3030
  90. 900 SPEED$(I)=ILINE$
  91. 910 INPUT #1, ILINE$
  92. 920 IF LEN(ILINE$)=0 THEN 970
  93. 930 GOSUB 3030
  94. 940 COUNT(I)=COUNT(I)+1
  95. 950 TEXT$(I,COUNT(I))=ILINE$
  96. 960 GOTO 910
  97. 970 NEXT I
  98. 980 GOTO 1000
  99. 990 RESUME 1000
  100. 1000 ON ERROR GOTO 2060
  101. 1010 CLOSE
  102. 1020 IF LEN(TEXT$(1,1))=0 THEN 1070
  103. 1030 ILINE$=TEXT$(1,1)
  104. 1040 GOSUB 3130
  105. 1050 TEXT$(1,1)=ILINE$
  106. 1060 GOTO 1080
  107. 1070 TEXT$(1,1)="RCPM-#.SUM"
  108. 1080 COUNT(1)=1
  109. 1090 REM ----------------------------------------------------------------------
  110. 1100 REM Get file name and selection criteria...
  111. 1110 REM ----------------------------------------------------------------------
  112. 1120 INPUT "Which RCP/M list";INUM$
  113. 1130 INUM$=RIGHT$("000"+INUM$,3)
  114. 1140 IFILE$="RCPM-"+INUM$+".LST"
  115. 1150 OFILE$=TEXT$(1,1)
  116. 1160 P1=INSTR(1,OFILE$,"#")
  117. 1170 IF P1=0 THEN 1200
  118. 1180 TEXT$(1,1)=LEFT$(OFILE$,P1-1)+INUM$+RIGHT$(OFILE$,LEN(OFILE$)-P1)
  119. 1190 OFILE$=TEXT$(1,1)
  120. 1200 OPEN "I",#1,IFILE$
  121. 1210 OPEN "O",#2,OFILE$
  122. 1220 REM ----------------------------------------------------------------------
  123. 1230 REM Get heading from file...
  124. 1240 REM ----------------------------------------------------------------------
  125. 1250 LINE INPUT #1, ILINE$
  126. 1260 IF LEN(ILINE$)=0 THEN 1250
  127. 1270 GOTO 1290
  128. 1280 LINE INPUT #1, ILINE$
  129. 1290 PRINT ILINE$
  130. 1300 PRINT #2, ILINE$
  131. 1310 IF LEN(ILINE$)<>0 THEN 1280      
  132. 1320 REM ----------------------------------------------------------------------
  133. 1330 REM Write selection criteria...
  134. 1340 REM ----------------------------------------------------------------------
  135. 1350 PRINT "Selection criteria used:"
  136. 1360 PRINT #2, "Selection criteria used:"
  137. 1370 I=1
  138. 1380 GOSUB 1520
  139. 1390 IF COUNT(2)=0 THEN 1450
  140. 1400 PRINT "    * * * O R * * *"
  141. 1410 PRINT #2, "    * * * O R * * *"
  142. 1420 I=2
  143. 1430 GOSUB 1520
  144. 1440 GOSUB 1580
  145. 1450 IF COUNT(3)=0 THEN 1650
  146. 1460 PRINT "    * * * BUT NEVER * * *"
  147. 1470 PRINT #2, "    * * * BUT NEVER * * *"
  148. 1480 I=3
  149. 1490 GOSUB 1520
  150. 1500 GOSUB 1580
  151. 1510 GOTO 1730
  152. 1520 REM Print disk storage and baud rate info...
  153. 1530 PRINT ,"Minimum disk storage of";MEG!(I);"megabytes on-line."
  154. 1540 PRINT #2, ,"Minimum disk storage of";MEG!(I);"megabytes on-line."
  155. 1550 PRINT ,"Transfer code one of ->";SPEED$(I);"<-."
  156. 1560 PRINT #2, ,"Transfer code one of ->";SPEED$(I);"<-."
  157. 1570 RETURN
  158. 1580 REM Print text strings...
  159. 1590 PRINT ,"Mention of: ";
  160. 1600 PRINT #2, ,"Mention of: ";
  161. 1610 FOR J=1 TO COUNT(I)
  162. 1620 IF LEN(TEXT$(I,J))+POS(0)<70 THEN 1670
  163. 1630 PRINT
  164. 1640 PRINT #2,
  165. 1650 PRINT ,"            ";
  166. 1660 PRINT #2, ,"            ";
  167. 1670 PRINT " '";TEXT$(I,J);"'";
  168. 1680 PRINT #2, " '";TEXT$(I,J);"'";
  169. 1690 NEXT J
  170. 1700 PRINT
  171. 1710 PRINT #2,
  172. 1720 RETURN
  173. 1730 FOR I=1 TO 2
  174. 1740 PRINT
  175. 1750 PRINT #2,
  176. 1760 NEXT I
  177. 1770 REM ----------------------------------------------------------------------
  178. 1780 REM Find first region marker...
  179. 1790 REM ----------------------------------------------------------------------
  180. 1800 LINE INPUT #1,ILINE$
  181. 1810 IF INSTR(1,ILINE$,MREGION$)=0 THEN 1800
  182. 1820 REM ----------------------------------------------------------------------
  183. 1830 REM Look for next entry in file...
  184. 1840 REM ----------------------------------------------------------------------
  185. 1850 IF INSTR(1,ILINE$,MREGION$)=0 THEN 1900
  186. 1860 LINE INPUT #1, REGION$
  187. 1870 IF REGION$=DONE$ THEN 1970
  188. 1880 LINE INPUT #1, ILINE$
  189. 1890 GOTO 1830
  190. 1900 IF LEFT$(ILINE$,1)<>"[" THEN 1940
  191. 1910 STATE$=ILINE$
  192. 1920 LINE INPUT #1, ILINE$
  193. 1930 GOTO 1830
  194. 1940 IF LEN(ILINE$)<>0 AND LEFT$(ILINE$,1)<>" " THEN 2110
  195. 1950 LINE INPUT #1, ILINE$
  196. 1960 IF NOT EOF(1) THEN 1830
  197. 1970 PRINT
  198. 1980 PRINT #2,
  199. 1990 PRINT "Selected ";COUNT;" out of ";TOTAL;" entries."
  200. 2000 PRINT #2, "Selected ";COUNT;" out of ";TOTAL;" entries."
  201. 2010 CLOSE
  202. 2020 PRINT
  203. 2030 PRINT "Done."
  204. 2040 SYSTEM
  205. 2050 GOTO 2040
  206. 2060 REM Check for EOF error...
  207. 2070 IF ERR=62 THEN 1970
  208. 2080 ON ERROR GOTO 0
  209. 2090 SYSTEM
  210. 2100 REM ----------------------------------------------------------------------
  211. 2110 REM Found entry...
  212. 2120 REM ----------------------------------------------------------------------
  213. 2130 TOTAL=TOTAL+1
  214. 2140 ENTRIES=0
  215. 2150 REM ----------------------------------------------------------------------
  216. 2160 REM Add new line to line table...
  217. 2170 REM ----------------------------------------------------------------------
  218. 2180 ENTRIES=ENTRIES+1
  219. 2190 ENTRY$(ENTRIES)=ILINE$
  220. 2200 GOSUB 3030
  221. 2210 LCENTRY$(ENTRIES)=ILINE$
  222. 2220 REM ----------------------------------------------------------------------
  223. 2230 REM Get next line and check for entry terminator...
  224. 2240 REM ----------------------------------------------------------------------
  225. 2250 LINE INPUT #1, ILINE$
  226. 2260 IF LEFT$(ILINE$,1)=" " THEN 2160
  227. 2270 REM ----------------------------------------------------------------------
  228. 2280 REM Find system specifications...
  229. 2290 REM ----------------------------------------------------------------------
  230. 2300 P2=1
  231. 2310 IF ENTRIES<2 THEN 1830
  232. 2320 P1=INSTR(P2,LCENTRY$(2),"(")
  233. 2330 IF P1=0 THEN 1830
  234. 2340 P1=P1+1
  235. 2350 P2=INSTR(P1,LCENTRY$(2),")")
  236. 2360 IF P2=0 THEN 1830
  237. 2370 SPECS$=MID$(LCENTRY$(2),P1,P2-P1)
  238. 2380 P3=INSTR(1,SPECS$,";")
  239. 2390 IF P3=0 THEN 2320
  240. 2400 REM ----------------------------------------------------------------------
  241. 2410 REM Isolate baud rates and disk capacity...
  242. 2420 REM ----------------------------------------------------------------------
  243. 2430 SPEEDS$=LEFT$(SPECS$,P3-1)
  244. 2440 MEGS!=VAL(MID$(SPECS$,P3+1,LEN(SPECS$)-P3))
  245. 2450 IF RIGHT$(SPECS$,1)<>"m" THEN MEGS!=MEGS!/1000
  246. 2460 REM ----------------------------------------------------------------------
  247. 2470 REM Check for must exclude...
  248. 2480 REM ----------------------------------------------------------------------
  249. 2490 I=3
  250. 2500 GOSUB 2860
  251. 2510 IF FLAG=1 THEN 1830
  252. 2520 REM ----------------------------------------------------------------------
  253. 2530 REM Check for must include...
  254. 2540 REM ----------------------------------------------------------------------
  255. 2550 I=2
  256. 2560 GOSUB 2860
  257. 2570 IF FLAG=1 THEN 2650
  258. 2580 REM ----------------------------------------------------------------------
  259. 2590 REM Check for general inclusion...
  260. 2600 REM ----------------------------------------------------------------------
  261. 2610 I=1
  262. 2620 GOSUB 2860
  263. 2630 IF FLAG=0 THEN 1830
  264. 2640 REM ----------------------------------------------------------------------
  265. 2650 REM Output entry...
  266. 2660 REM ----------------------------------------------------------------------
  267. 2670 IF LEN(REGION$)=0 THEN 2730
  268. 2680 PRINT
  269. 2690 PRINT #2,
  270. 2700 PRINT MREGION$;REGION$;MREGION$
  271. 2710 PRINT #2, MREGION$;REGION$;MREGION$
  272. 2720 REGION$=""
  273. 2730 IF LEN(STATE$)=0 THEN 2790
  274. 2740 PRINT
  275. 2750 PRINT #2,
  276. 2760 PRINT STATE$
  277. 2770 PRINT #2, STATE$
  278. 2780 STATE$=""
  279. 2790 FOR I=1 TO ENTRIES
  280. 2800 PRINT ENTRY$(I)
  281. 2810 PRINT #2, ENTRY$(I)
  282. 2820 NEXT I
  283. 2830 COUNT=COUNT+1
  284. 2840 GOTO 1830
  285. 2850 REM ----------------------------------------------------------------------
  286. 2860 REM Check entry against specified conditions...
  287. 2870 REM ----------------------------------------------------------------------
  288. 2880 FLAG=0
  289. 2890 IF MEGS!<MEG!(I) THEN RETURN
  290. 2900 FOR J=1 TO LEN(SPEED$(I))
  291. 2910 IF INSTR(1,SPEEDS$,MID$(SPEED$(I),J,1)) THEN FLAG=1
  292. 2920 NEXT J
  293. 2930 IF FLAG=0 OR I=1 THEN RETURN
  294. 2940 FLAG=0
  295. 2950 IF COUNT(I)=0 THEN RETURN
  296. 2960 FOR J=1 TO COUNT(I)
  297. 2970 FOR K=1 TO ENTRIES
  298. 2980 IF INSTR(1,LCENTRY$(K),TEXT$(I,J)) THEN FLAG=1
  299. 2990 NEXT K
  300. 3000 NEXT J
  301. 3010 RETURN
  302. 3020 REM ----------------------------------------------------------------------
  303. 3030 REM Convert $ILINE to lower case
  304. 3040 REM ----------------------------------------------------------------------
  305. 3050 FOR LC=1 TO LEN(ILINE$)
  306. 3060 CHAR$=MID$(ILINE$,LC,1)
  307. 3070 IF CHAR$<"A" OR CHAR$>"Z" THEN 3100
  308. 3080 CHAR$=CHR$(ASC(CHAR$)+32)
  309. 3090 ILINE$=LEFT$(ILINE$,LC-1)+CHAR$+RIGHT$(ILINE$,LEN(ILINE$)-LC)
  310. 3100 NEXT LC
  311. 3110 RETURN
  312. 3120 REM ----------------------------------------------------------------------
  313. 3130 REM Convert $ILINE to upper case
  314. 3140 REM ----------------------------------------------------------------------
  315. 3150 FOR UC=1 TO LEN(ILINE$)
  316. 3160 CHAR$=MID$(ILINE$,UC,1)
  317. 3170 IF CHAR$<"a" OR CHAR$>"z" THEN 3200
  318. 3180 CHAR$=CHR$(ASC(CHAR$)-32)
  319. 3190 ILINE$=LEFT$(ILINE$,UC-1)+CHAR$+RIGHT$(ILINE$,LEN(ILINE$)-UC)
  320. 3200 NEXT UC
  321. 3210 RETURN
  322. 3220 END
  323. =CHR$(ASC(CHAR$)-32)
  324. 3190 ILINE$=LEFT$(ILINE$,UC-1)+CHAR$+RIGHT$(ILINE$,LEN(ILINE$)-UC)
  325. 3200 NEXT UC
  326. 3210 RETURN
  327. 3220 E