home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / INFO / BASIC / EZLIST.ZIP / EZLIST.DOC < prev    next >
Encoding:
Text File  |  1987-05-20  |  4.5 KB  |  67 lines

  1.         EZLIST Formatted Listing of BASIC Programs
  2.                 by Joseph E. Laferriere
  3.             from Computer Shopper June 1987
  4.  
  5.         If you frequently write long programs in BASIC, you're well aware of 
  6. how debugging can be even more time consuming and frustrating than writing the 
  7. original program.  Since speed in BASIC often requires multiple statement 
  8. lines, the listing produced by the LIST and LLIST commands can be confusing 
  9. and hard to follow.  A readout of the program in a more structured format, 
  10. along with a list of GOTO and GOSUB statements, can help tremendously in 
  11. tracking down elusive bugs and preventing them from giving rise to swarms of 
  12. many-legged offspring.
  13.         This program is based in part on an idea published by Geff Purcell in 
  14. Soft Sector in April 1985 (Vol. 1, No. 9, pp 60-63).  He suggested presenting 
  15. programs in a structured format, with each portion of a multiple line printed 
  16. as a separate line, as well as indenting the lines to show the connections 
  17. between the beginnings and endings of FOR/NEXT and WHILE/WEND loops, and the 
  18. relations between different parts of IF/THEN/ELSE statements.  The result is a 
  19. listing which is much easier to read than the standard BASIC listings.
  20.         The variation presented here contains many of the basic principles of 
  21. his original program, but with an improved searching algorithm, plus a few 
  22. innovations of my own.  One added feature is that the program in this article 
  23. lists programs SAVEd in either ASCII or non-ASCII format.  I do not generally 
  24. store programs as ASCII files, since this requires more disk space than saving 
  25. it in the non-ASCII mode.  EZLIST offers you the option of listing files saved 
  26. in option of listing files saved in the ASCII mode, but also is capable of 
  27. handling non-ASCII files.  It does this by starting the line numbering at 
  28. 65000 (65535 being the maximum acceptable line number in BASIC), and CHAIN 
  29. MERGE-ing the files to be listed.  EZLIST then SAVE's itself, together with 
  30. the files to be listed, in ASCII format as "TEMP.BAS", and lists this file 
  31. until it reaches the maximum line number you previously specified.  Very few 
  32. programs use line numbers this high (this is the only one I've ever seen 
  33. published); hence this program can list almost any program.
  34.         EZLIST allows you to determine the beginning and ending lines to be 
  35. listed, in case you only want to list part of the program.  Default values are 
  36. printed in square brackets on the screen.  You need not know the actual 
  37. minimum and maximum line numbers in your program;  EZLIST will proceed until 
  38. the line number exceeds the maximum limits you have set.  This property can 
  39. also be used to let EZLIST list itself, simply by entering an ending line 
  40. number greater than or equal to 65470.  The program also INPUTs the maximum 
  41. number of lines per page and increments the lines printed as it goes along.  
  42. If you are using continuous feed pater, you may wish to consider changing line 
  43. 65330 to read
  44. 65330 M=M+1:LPRINT CHR$(-12*(M/N=M/N):RETURN
  45.         At the head of the listing, EZLIST will print the name of the program, 
  46. the date, and the length of the program listed.  At the end it will print the 
  47. number of lines of code and the number of separate command statements.  It 
  48. will then proceed to list all the GOTO and GOSUB statements in the program, 
  49. sorted numerically.  This even includes multiple statements such as "ON X 
  50. GOSUB 100,200,300,400," and implied GOTO statements lacking the actual 
  51. command, like "IF X THEN 100 ELSE 200."  EZLIST stores the information on line 
  52. numbers in temporary files ("TEMP.BBS" and "TEMP.BCS") until after the program 
  53. listing is complete, then retrieves the information, and sorts it using a 
  54. Shell-Metzger sorting routine according to the number after the GOTO or GOSUB 
  55. command.  It then prints all the line numbers containing the given branching 
  56. command.  This is especially useful if it is necessary to change variable 
  57. names to remove a bug or change the way values must be assigned to variables 
  58. prior to the execution of the subroutine; the list of which lines contain the 
  59. errant GOSUB statement may well prevent you from creating new bugs to replace 
  60. the old ones.
  61.         The program then erases all three temporary files and DELETEs all 
  62. lines up to and including 64999.  This returns you to the BASIC command mode.  
  63. All you have to do to list another program is enter RUN.
  64.         Good luck!  I hope this program saves you some time and headaches 
  65. debugging programs.
  66.  
  67.