home *** CD-ROM | disk | FTP | other *** search
- program qtest;
- { nothing special, just a quickie for testing the functions in
- "QUEUEMAN.TPU" }
- uses
- crt, QueueMan;
-
- type
- qEntry = array[1..64] of char;
- qptr = ^qEntry;
-
- procedure QerrMsg( errnum : word);
- { prints a message based on the error number }
- begin
- case errnum of
- 2 : writeln( 'File Not Found.');
- 3 : writeln( 'Path Not Found.');
- 4 : writeln( 'Too Many Open Files. (Increase FILES= in config.sys)');
- 5 : writeln( 'Access Denied.');
- 8 : writeln( 'Queue Full.');
- 9 : writeln( 'Busy.');
- 12 : writeln( 'Name Too Long.');
- 15 : writeln( 'Invalid Drive.');
- else
- writeln( 'Unknown Error!');
- end; {case}
- end;
-
-
- procedure ShowList;
- var
- qpoint : qptr;
- index : integer;
- begin
- writeln;
- qpoint := QueuePointer; { get print.com's list address }
- if qpoint^[1] = #0 then
- writeln( 'There are no files currently in the queue.')
- ELSE
- begin
- writeln( 'Current queue contents:');
- repeat
- index := 1;
- while qpoint^[index] <> #0 do
- begin { write characters up to the terminator }
- write( qpoint^[index]);
- inc( index);
- end;
- writeln;
- qpoint := ptr( seg(qpoint^), ofs(qpoint^)+64); { move pointer to next }
- until qpoint^[1] = #0;
- end;
- end;
-
- procedure PrintFile;
- var
- SubFile : string;
- tmperror : word;
- begin
- writeln;
- write( 'Enter the name of the file to be printed ->');
- readln( SubFile);
- tmperror := SubmitFile( SubFile);
- if tmperror <> 0 then
- QerrMsg( tmperror)
- ELSE
- writeln( 'File successfully queued.');
- writeln;
- end;
-
- procedure FileCancel;
- var
- CanFile : string;
- tmperror : word;
- begin
- writeln;
- write( 'Enter the name of the file to be cancelled->');
- readln( CanFile);
- tmperror := CancelFile( CanFile);
- if tmperror <> 0 then
- QerrMsg( tmperror)
- ELSE
- writeln( 'File cancelled.');
- writeln;
- end;
-
- procedure AllCancel;
- var
- tmperror : word;
- begin
- writeln;
- writeln( 'Cancelling files. One moment, please.');
- tmperror := KillQueue;
- if tmperror <> 0 then
- QerrMsg( tmperror)
- ELSE
- writeln( 'All files cancelled.');
- writeln;
- end;
-
- var
- tmpchar : char;
- exitmain : boolean;
- begin
- if QueueInstalled then
- begin
- exitmain := FALSE;
- repeat
- writeln( '--- Qtest menu ---');
- writeln( '1) Show queue list');
- writeln( '2) Submit file to queue');
- writeln( '3) Cancel a file');
- writeln( '4) Cancel ALL files');
- writeln( '5) Pause printing');
- writeln( '6) Continue printing after pause');
- writeln( '7) Exit to DOS');
- tmpchar := ReadKey;
- case tmpchar of
- '1' : ShowList;
- '2' : PrintFile;
- '3' : FileCancel;
- '4' : AllCancel;
- '5' : begin
- writeln;
- PauseQueue;
- writeln( 'Printing is paused.');
- writeln;
- end;
- '6' : begin
- writeln;
- ContinueQueue;
- writeln( 'Printing is restarted.');
- writeln;
- end;
- '7' : exitmain := TRUE;
- end; {case}
- writeln;
- until exitmain = TRUE;
- end
- ELSE
- writeln( 'ERROR! Print.com not installed. Aborting.');
- end.