home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Meeting Pearls 3
/
Meeting_Pearls_III.iso
/
Pearls
/
midi
/
misc
/
Midi2TeX
/
src
/
tp_debug.pas
< prev
next >
Wrap
Pascal/Delphi Source File
|
1992-07-28
|
5KB
|
123 lines
UNIT TP_debug;
INTERFACE
uses TP_decl,
PRINTER,
TP_misc;
Procedure WriteDebugInfo(Instring : String);
Procedure ToBothEr(S : STring);
Procedure ErrorExit(errorcode : integer);
Procedure Warning(S:String);
IMPLEMENTATION
(********************************************************)
Procedure WriteDebugInfo(Instring : String);
(********************************************************)
Begin
If debug then
case debugout of
SCREEN : WriteLn(InString);
DEBFILE : WriteLn(DebugFile,Instring);
PRINT : WriteLn(Lst,Instring);
End;
End;
(********************************************)
Procedure Help;
(********************************************)
Begin
(* WriteLn('A correct call to Midi2TeX looks like this :'); *)
WriteLn('');
WriteLn(' MIDI2TEX midifilename [TeXfilename] [-option1] [-option2] ...');
WriteLn('');
WriteLn('Switch -s suppresses note generation for tracks #');
WriteLn('Switch -o determines order of tracks to display on staffs (up-down)');
WriteLn('Switch -b assigns the bass clef to staff # (counted from top to bottom)');
WriteLn('Switch -a1..-a5 assign the alto clefs to staff # (from top to bottom)');
WriteLn('Switch -i assigns 2 or more staffs to one instrument');
WriteLn('Switch -q determines the quantization note time, 1,2,4,8,16,32,64,128');
WriteLn('Switch -p redefines the part time, (default a quarter note)');
WriteLn('Switch -f forces the slopes of the beams to be zero');
WriteLn('Switch -h changes the horizontal size of the score [1600 *0.1mm]');
WriteLn('Switch -v changes the vertical size of the score [2400 *0.1mm]');
WriteLn('Switch -m select music size [20,16]');
WriteLn('Switch -e change \elemskip value (in pt)');
{$IFDEF ST}
WriteLn('Switch -x skips wait for key hit at end of program');
{$ENDIF}
WriteLn('Switch -d@ switches on debugging info, @ can be any of the following :');
WriteLn(' NONE : no debugging, SCREEN : debug info to the screen');
WriteLn(' PRINTER : debug info to the printer, FILE : debug info to a file');
WriteLn('Switch -? displays this help message');
End;
(********************************)
Procedure ToBothEr(S : STring);
(********************************)
Begin
WriteDebugInfo('Fatal error:'+S);
WriteLn('');WriteLn('Fatal error:'+S);
End;
(********************************)
Procedure Warning(S : STring);
(********************************)
Begin
WriteDebugInfo('Warning:'+S);
WriteLn('Warning:'+S);
End;
(********************************************)
Procedure ErrorExit(errorcode : integer);
(********************************************)
Begin
case errorcode of
0 : Help;
1 : ToBothEr(' No input file specified, or file does not exist ');
3 : ToBothEr(' MidiFile track '+B2S(curtrack)+' is not ok');
4 : ToBothEr(' Found a NoteOff without a NoteOn');
5 : ToBothEr(' Can only translate MIDI files of type 1, sorry...');
6 : ToBothEr(' Nil pointer detected in NoteOff search');
7 : ToBothEr(' No. of order indices does not correspond with No. of tracks in file');
8 : ToBothEr(' Staffindex out of range, you tried to change a staff attribute which I cannot handle');
9 : ToBothEr(' Heap exhausted during initializing memory');
10: ToBothEr(' The noteheap appeared to be empty during a note request to the noteheap');
11: ToBothEr(' A note value exceeded 127, probably a program bug');
12: ToBothEr(' Invalid PartTime entered, only one of 1,2,4,8,16,32 allowed');
13: ToBothEr(' Invalid quantization time entered, use switch -? to get proper range');
14: ToBothEr(' Can only define one multi-staff instrument in this version');
15: ToBothEr(' Definition of an instrument of one track is useless');
16: ToBothEr(' The Slurr-array is exhausted, too many slurrs (9) for MusicTeX');
17: ToBothEr(' Process terminated by user ');
18: ToBothEr(' The Beam-array is exhausted, too many beams (9) for MusicTeX');
19: ToBothEr(' -h,-v,-m and -k option can only take one parameter');
20: ToBothEr(' -m option parameter must be either 20 or 16');
21: ToBothEr(' -k option parameter must be between -8 and 8');
22: ToBothEr(' -a1..-a5 option parameter is not correct');
23: ToBothEr(' -s option parameter is not correct');
24: ToBothEr(' Unexpected end of MIDI file reached, file corrupted ?');
Else
ToBothEr(' Unknown error , either a corrupted midi file or a bug..');
end;
WriteDebugInfo('Program Terminated');
Case ErrorCode of
1,7,8,12,13,14,15 : WriteLn('Run program with switch -? to get additional help');
Else
If MIDIFileOpened Then
Begin
WriteLn(TeXFile,'%MIDI2TeX file processing aborted due to a non-run time error');
WriteLn(TexFile,'\finmorceau');
WriteLn(TexFile,'\bye');
End;
End;
Halt;
End; (* ErrorExit *)
Begin
End.