Nprn - Printer/Spooler Version 1.02 - 1/14/92 This program is owned by Dave Casler. It can not be sold by anyone other then Dave Casler. For now, it is being made public and free for all to use. If you find any bugs or would like some different features installed, please contact me and let me know. My home address is: Dave Casler 820 Blue Oak Drive Lewisville, Tx 75067 (214)436-2965 NOTE: When you click on the NPRN or NPRNResident icons, you may notice that nothing happens. This is not the case, things are happening in the background. Please read the instructions fully before attempting to run this program. This spooler can be printing one file and have up to 20 more files queued. When one file is finished, then the next file in the que is printed. Any file or all files including the current file being printed can be killed. A unique feature of this print program is the source code paging. Special paging can be done on any sequence of characters including the end of line character. If the special paging is enabled, the default string to page on is /*>P*/\n (\n equals the end of line in 'C'). This feature is needed for a better looking printout of the source code. This program can also do a page header, top of page gap, left side margin, condensed and elite printing. The three main features I wanted, was to be able to que print jobs, elite printing and special paging. This program fills this need. The program is actually two programs. The program Nprn is the command line processor and controller for the resident program PrnResident. Once loaded, the resident program will stay in memory until unloaded. The resident program can be in the current directory or in UTL:. The resident program is a process of Nprn and therefor a window can not be closed that was used to load the resident program. I overcame this by putting the command Nprn +l50 in my Shell-Startup script. I never use the WorkBench and only use shell so this works out ok for me. If you should open another shell, this is ok as Nprn checks to see if the resident program is already loaded before trying to load it. The print buffer is only allocated from the system memory when printing a file. The print buffer size can be set from 1K to 500K (default is 10k). If the allocation of the print buffer fails and the buffer size is greater then the default (10K), then the default size will be tried. If this also fails, then an error message will be returned to the command program (Nprn). The resident program does more sleeping then anything else in order not to hog the CPU's time. The priority given to the resident program is -1. Since so little time is spent in the wake mode, the priority will seem much lower. The first thing that has to be done is to load the resident program. This could be done in the startup script. This is done by using the command program with the +l command. The resident program can be unloaded (removed from memory) by the use of the +r command. After the resident program is loaded, then commands can be sent to it to print a file. Only one file can be sent at a time but up to 20 files can be queued for printing. The configuration for each file can be different. Before sending the file job to the resident program, the command program will find the complete path to the file to be printed. It will also check to make sure the file can be opened for reading. After each new print job is sent to the resident, a complete list of all print jobs including the job number is output. There are two commands for killing a job. -kA is used to kill all jobs including the current job being printed. -kn is used to kill just one print job where n is the job number to be killed. If the printer is taken off-line for an extended period of time, the system (Amiga) will ask if the printing should be canceled or to continue. If the Cancel button is selected, that print job will be deleted. If there are any more jobs in the que, then the next job will be started. Commands & Switches: The two types, commands and switches are distinguished by the - or the + character. The commands always start with the + character. These are the commands that are for setup, job listing, job killing and unloading. The switches always start with the - character (except for the file name). These are used to set the configuration of a file. To output the command and switch information, execute the command program with no commands or switches as in Nprn or use the ? command as in Nprn ?. (without the .) To get my name and address, type Nprn =. (without the .). The file name is entered without the + or the - character. -c This switch is used to put the printer in the condensed print mode (132 characters per line). After the file is printed, the printer is returned to the normal 80 character per line mode. -e This switch is used to put the printer in the elite print mode (96 characters per line). After the file is printed, the printer is returned to the normal 80 character per line mode. -g[n] This switch is used to produce a gap (blank lines) at the top of a file. The default if just -g is used is 2 blank lines, otherwise n equals the number of blank lines. The range is 1-60. -m[n] This switch is used to produce a margin (spaces) on the left side of the page. The default if just -m is used is 4 spaces, otherwise n equals the number of spaces to insert on the left side. The range is 1-80 -n This switch is used to enable a page header. The contents of the page header will always include the file name along with the date and time the printing started. If paging has been enabled, the page number will also be included. There is always a blank line included after the header. These two lines are subtracted from whatever the paging is set to (i.e. if paging is set to 62 lines per page, up to 60 lines of text will be printed per page). -p[n] This switch will enable the paging. The default if just -p is used is 62 lines per page, otherwise n equals the number of lines per page. The range is 1-200. -s[s] This switch will enable the special paging. This switch will automatically enable normal paging for 62 lines per page if not already enabled. Normal paging (-p[n]) can be enabled before or after this switch is used to set the number of lines per page. Special paging will page on 1 or more characters. By default the string that special paging will occur on is /*>P*/\n. (the period is not part of the string) In my C source code, this string is on a line by itself and placed within the file to give a better looking printout. The maximum length of the special paging string is 10 characters. The allowed control characters are: \n = LINEFEED \r = RETURN If this switch shares the same - (i.e. -ns) then it must be the last switch listed. Any character (execpt a SPACE) after the s switch is taken a the special paging string. The following is allowed: -s -n -ns -e -ens -nse ERROR, e is now the special paging string +j This command is used to list all jobs (current job & queued jobs). +kA This command is used to kill all jobs (current job & queued jobs). The A must be in upper case. -kn This command is used to kill just one job. It can be the current job or one that is queued. If it is the current job, then the next queued job, if any, will be started. +l[n] This command is used to load the resident part of the print program. n is used to set the print buffer size. By default the print buffer is 10k. The file being printed is read until the print buffer is full. Then the contents of this buffer is printed. When the buffer is empty, then the file is read again to fill the buffer or until the complete file has been read. The file will be closed as soon as the end of file is reached. A large buffer could read most files and free the file for other use while it was still being printed. The print buffer size can be set when loading the resident program by including the size in K bytes (i.e. -l100 would produce a 100K print buffer). This print buffer is only allocated while there is a file being printed. After the file or files have been printed, the buffer is de-allocated until the next print job is received. The print buffer size range is 1K to 500K. The resident program can be in the current directory (where the Nprn +l command is given) or in UTL:. +r This command is used to unload the resident part of the print program. Examples: Nprn l50 Load the resident program and set the print buffer size to 50K. Nprn -nes file Print the file 'file' with a page header, special paging (/*>P*\n) and 96 characters per line. Nprn +j List all jobs Nprn +k24 Kill job number 24 Nprn +r Remove the resident program Known Bugs: 1. The first time the system is powered up, the switches -c and -e have no effect on the first file printed. This bug can be overcome by printing anything to the printer (i.e. directory listing of any small directory). Once something has gone to the printer, all switches work. If the first file printed does not use the -c or -e switches, then everything will be ok. 2. As stated above, the window that is used to load the resident program can not be closed as long as the program stays loaded. I think this is because the resident program is a process and not a task. I am now in the process of learning about tasks and may at some time convert the resident program to a task. The problem can be fixed by loading the resident program in the last shell that you open in your bootup scripts. I have the Nprn +l50 command in my Shell-Startup script and all seems to work ok. If you should open another shell, this is ok as Nprn checks to see if the resident program is already loaded before trying to load it. Hidden Features: If you enter the command ?? as in Nprn ??, you will see two hidden features. These where used in debugging the program and can be used to monitor the program while it is printing. This is something that I am also doing at work and is very useful when running a program in the field.