Apple Pascal Lister
Scott Barrus
Ramsey, NJ
Here's an alternative to Apple Pascal's Transfer function when you need hardcopy listings.
The lister program below is written in modules. The first is self-explanatory. It puts a header on the top of the screen. The second module goes with the first. It is used to delay long enough for a person to read the header. If a shorter or longer time is desired, the number 3000 can be changed.
The module Input puts the prompt "File name" on the left-hand side of the screen, 15 spaces down. It also names a string "namefile" to be used with the names module. If a name is entered without a ".text" on the end, this module attaches it. A possible addition would be to prompt and ask if ".text" were wanted.
The module Names builds and writes the Filename and page # on the top of each sheet. It also then puts 79 " = " 's underneath the filename line. Since Pascal does not have a tab function, either a tab type module would have to be written or, just use spaces to separate the word "page" and file names. If a further right position were wanted, then more blanks could be added or a tab module made up.
Getfile does the hard work. It reads a line from the input file and then writes each line to the printer. It does this 55 times and then sends a form feed to the printer. It will keep doing this until it comes across an end of file (EOF) marker at which time this module ends.
Openfile opens the avenue for the program to work. It opens the text file to be read and it activates the printer as a file named outfile.
Procedure Epson is a bit of customizing because the author uses an MX-80 printer. Since the program can print more than one file at a sitting, the change mode option was added to give the user flexibility. If the printer being used does not have all the capabilities of the Epson, either eliminate the lines that cannot be used or eliminate module Epson. If different codes are used on any printer, those codes can be substituted for the Epson codes.
The final section is the body of the program. The program starts by assigning the value of one to "pagenumbers." A header comes next. The file must be opened so that when we state what Epson code is to be used the printer will be able to get the code. All that is left is to let the program get (and print) out the files. When done, the user is prompted for another file. If none is wanted, the screen is cleared and the user gets a cheerful message. Finally the file opened is closed and the program ends.
To run the program, type X from the main prompt line in Pascal. When asked what file to execute, type in the name that was assigned to the compiled code. To run the program as on the example disk, type in List:Lister.code. The program will be off and running.