-
Notifications
You must be signed in to change notification settings - Fork 5
/
COMP.PAS
749 lines (722 loc) · 19.8 KB
/
COMP.PAS
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
{ @author: Sylvain Maltais ([email protected])
@created: 2021
@website(https://www.gladir.com/corail)
@abstract(Target: Turbo Pascal 7, Free Pascal 3.2)
}
Program COMP;
Uses Crt,DOS;
Const
kbNoKey=0;{Pas de touche}
kbDn=$5000;{Fleche Bas}
kbEnter=$1C0D;{Enter}
kbEsc=$011B;{Escape}
kbShiftTab=$0F00;{Shift+Tabulation}
kbTab=$0F09;{Tabulation}
kbUp=$4800;{Fleche Haut}
Var
Language:(_Albanian,_Danish,_French,_English,_Germany,_Italian,_Spain,_Swedish);
TmpLanguage:String;
CurrDialog:Byte;
Ok:Boolean;
ShowASCII128:Boolean;
K:Word;
GUI,Finish,Diff:Boolean;
Option:Set of (_CaseIgnore);
Output:(_Hex,_Dec,_Char);
OutputStatus:(_Offset,_Line);
I:Integer;
FileName1,FileName2,FileNameResult:String;
FileComp1,FileComp2:File;
FileResult:Text;
Buffer1,Buffer2:Array[0..255]of Byte;
ByteReaded1,ByteReaded2:Integer;
CurrPos,CurrLineCount:LongInt;
{$IFNDEF FPC}
Procedure CursorOff;
Var
Regs:Registers;
Begin
Regs.AH:=1;
Regs.CH:=32;
Regs.CL:=0;
Intr($10,Regs);
End;
Procedure CursorOn;
Var
Regs:Registers;
Begin
Regs.AX:=$0100;
Regs.CX:=(7 shl 8)+9;
Intr($10,Regs);
End;
{$ENDIF}
Function StrToUpper(S:String):String;
Var
I:Byte;
Begin
For I:=1 to Length(S)do Begin
If S[I] in['a'..'z']Then S[I]:=Chr(Ord(S[I])-32);
End;
StrToUpper:=S;
End;
Function ByteHex2Str(value:Byte):String;
Const
matrix:Array[0..15]of Char = ('0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F');
Begin
ByteHex2Str:=matrix[(value shr 4) and $0F]+matrix[value and $F];
End;
Function HexWord2Str(value:Word):String;Begin
HexWord2Str:=ByteHex2Str(Hi(value))+ByteHex2Str(Lo(value));
End;
Function DuplicateString(C:Char;Num:Integer):String;
Var
I:Byte;
S:String;
Begin
S:='';
For I:=1 to Num do S:=S+C;
DuplicateString:=S;
End;
Procedure SetASCII128(X:Boolean);Begin
ShowASCII128:=X;
End;
Function GetASCII128:Boolean;Begin
GetASCII128:=ShowASCII128;
End;
Procedure Box(X1,Y1,X2,Y2,Couleur:Byte);Begin
Window(X1,Y1,X2,Y2);
TextBackground((Couleur shr 4)and 15);
{$IFDEF FPC}
If Couleur and $80=$80 Then Begin
TextColor((Couleur and 15)+BLINK);
End
Else
TextColor(Couleur and 15);
{$ELSE}
TextColor(Couleur and 15);
{$ENDIF}
ClrScr;
Window(1,1,80,25);
End;
Procedure FrameEmpty(X1,Y1,X2,Y2,Couleur:Byte);
Var
I:Byte;
ChrHori,ChrVert:Char;
Chr218,Chr192,Chr191,Chr217:Char;
Begin
TextBackground((Couleur shr 4)and 15);
{$IFDEF FPC}
If Couleur and $80=$80 Then Begin
TextColor((Couleur and 15)+BLINK);
End
Else
TextColor(Couleur and 15);
{$ELSE}
TextColor(Couleur and 15);
{$ENDIF}
If(ShowASCII128)Then Begin
ChrHori:='-';
ChrVert:='|';
Chr218:='+';
Chr192:='+';
Chr191:='+';
Chr217:='+';
End
Else
Begin
ChrHori:=#$C4;
ChrVert:=#$B3;
Chr218:=#218;
Chr192:=#192;
Chr191:=#191;
Chr217:=#217;
End;
For I:=Y1+1 to Y2-1 do Begin
GotoXY(X1,I);
Write(ChrVert);
GotoXY(X2,I);
Write(ChrVert);
End;
GotoXY(X1+1,Y1);
Write(DuplicateString(ChrHori,X2-X1-1));
GotoXY(X1+1,Y2);
Write(DuplicateString(ChrHori,X2-X1-1));
GotoXY(X1,Y1);
Write(Chr218);
GotoXY(X1,Y2);
Write(Chr192);
GotoXY(X2,Y1);
Write(Chr191);
GotoxY(X2,Y2);
Write(Chr217);
End;
Procedure DialogBox(X1,Y1,X2,Y2,Couleur:Byte);Begin
Box(X1,Y1,X2,Y2,Couleur);
FrameEmpty(X1,Y1,X2,Y2,Couleur);
TextAttr:=Couleur;
End;
Function ReadLine(Var S:String):Word;
Var
Rec:SearchRec;
K:Char;
X,Y,I:Byte;
CurrHistory:Integer;
Begin
ReadLine:=0;
X:=WhereX;
Y:=WhereY;
Repeat
GotoXY(X,Y);
Write(S);
ClrEol;
K:=ReadKey;
Case K of
#0:Case ReadKey of
#72:Begin
ReadLine:=kbUp;
Exit;
End;
#80:Begin
ReadLine:=kbDn;
Exit;
End;
End;
#8:Begin
If S<>''Then S:=Copy(S,1,Length(S)-1);
End;
#9:Begin
ReadLine:=kbTab;
Exit;
End;
#13:Begin
ReadLine:=kbEnter;
End;
#27:Begin
ReadLine:=kbEsc;
Exit;
End;
Else S:=S+K;
End;
If S[Length(S)]=#13Then Begin
S:=Copy(S,1,Length(S)-1);
K:=#13;
End;
Until K=#13;
GotoXY(X,Y);
WriteLn(S);
End;
Function ReadLineInBox(X1,Y1,X2,Y2:Byte;Var S:String):Word;Begin
Window(X1,Y1,X2,Y2);
ReadLineInBox:=ReadLine(S);
Window(1,1,80,25);
End;
Procedure SetDialogTextColor;Begin
TextBackground(CurrDialog shr 4);
TextColor(CurrDialog and$F);
End;
Procedure SetButtonColor;Begin
TextBackground(Cyan);
TextColor(0);
End;
Procedure SetSelectedButtonColor;Begin
TextBackground(Cyan);
TextColor(Yellow);
End;
Procedure ShowButton(ButtonList:String;PosButton:Byte);
Var
I,CurrPosButton:Integer;
First:Boolean;
CurrButton:String;
Begin
CurrButton:='';
First:=True;
CurrPosButton:=0;
For I:=1 to Length(ButtonList)do Begin
If ButtonList[I]='|'Then Begin
SetDialogTextColor;
If Not(First)Then Write(' ');
If(PosButton=CurrPosButton)Then SetSelectedButtonColor
Else SetButtonColor;
Write(' ',CurrButton,' ');
SetDialogTextColor;
CurrButton:='';
First:=False;
Inc(CurrPosButton);
End
Else
CurrButton:=CurrButton+ButtonList[I];
End;
SetDialogTextColor;
If Not(First)Then Write(' ');
If(PosButton=CurrPosButton)Then SetSelectedButtonColor
Else SetButtonColor;
Write(' ',CurrButton,' ');
End;
Function LengthButton(ButtonList:String):Integer;
Var
I,CurrPosButton,LenButton:Integer;
First:Boolean;
CurrButton:String;
Begin
LengthButton:=0;
LenButton:=0;
CurrButton:='';
First:=True;
CurrPosButton:=0;
For I:=1 to Length(ButtonList)do Begin
If ButtonList[I]='|'Then Begin
If Not(First)Then Inc(LenButton,Length(' '));
Inc(LenButton,Length(' '+CurrButton+' '));
CurrButton:='';
First:=False;
Inc(CurrPosButton);
End
Else
CurrButton:=CurrButton+ButtonList[I];
End;
If Not(First)Then Inc(LenButton,Length(' '));
Inc(LenButton,Length(' '+CurrButton+' '));
LengthButton:=LenButton;
End;
Function ReadHorizontalButton(ButtonList:String):Word;
Var
X,Y:Byte;
K:Char;
I,NumButton,CurrButton:Integer;
Begin
CurrDialog:=TextAttr;
CursorOff;
ReadHorizontalButton:=kbEsc;
CurrButton:=0;
NumButton:=1;
X:=WhereX;
Y:=WhereY;
For I:=1 to Length(ButtonList)do If ButtonList[I]='|'Then Inc(NumButton);
ShowButton(ButtonList,0);
Repeat
K:=ReadKey;
Case K of
#0:Case ReadKey of
#15:Begin { Shift+Tab }
If(CurrButton>0)Then Begin
Dec(CurrButton);
GotoXY(X,Y);
ShowButton(ButtonList,CurrButton);
End
Else
Begin
ReadHorizontalButton:=kbShiftTab;
Break;
End;
End;
#75:Begin { Gauche }
If(CurrButton>0)Then Dec(CurrButton)
Else CurrButton:=NumButton-1;
GotoXY(X,Y);
ShowButton(ButtonList,CurrButton);
End;
#77:Begin { Droite }
If(CurrButton+1>=NumButton)Then CurrButton:=0
Else Inc(CurrButton);
GotoXY(X,Y);
ShowButton(ButtonList,CurrButton);
End;
End;
#9:Begin
If(CurrButton+1>=NumButton)Then Begin
ReadHorizontalButton:=kbTab;
Break;
End
Else
Begin
Inc(CurrButton);
GotoXY(X,Y);
ShowButton(ButtonList,CurrButton);
End;
End;
#13:ReadHorizontalButton:=CurrButton;
#27:ReadHorizontalButton:=kbEsc;
End;
Until K in[#13,#27];
SetDialogTextColor;
CursorOn;
End;
Procedure ShowHorizontalCenterButton(Y:Byte;S:String);Begin
GotoXY((80-LengthButton(S)) shr 1,Y);
ShowButton(S,$FF);
End;
Function ReadHorizontalCenterButton(Y:Byte;S:String):Word;Begin
GotoXY((80-LengthButton(S)) shr 1,Y);
ReadHorizontalCenterButton:=ReadHorizontalButton(S);
End;
Procedure WriteCenter(Y:Byte;Phrase:String;Color:Byte);Begin
GotoXY(40-Length(Phrase) div 2,Y);
TextBackground(Color shr 4);
TextColor(Color and$F);
Write(Phrase);
End;
BEGIN
{$IFDEF FPC}
{$IFDEF WINDOWS}
SetUseACP(False);
{$ENDIF}
{$ENDIF}
Language:=_French;
TmpLanguage:=GetEnv('LANGUAGE');
If TmpLanguage<>''Then Begin
If TmpLanguage[1]='"'Then TmpLanguage:=Copy(TmpLanguage,2,255);
If StrToUpper(Copy(TmpLanguage,1,2))='EN'Then Language:=_English Else
If StrToUpper(Copy(TmpLanguage,1,2))='DK'Then Language:=_Danish Else
If StrToUpper(Copy(TmpLanguage,1,2))='GR'Then Language:=_Germany Else
If StrToUpper(Copy(TmpLanguage,1,2))='IT'Then Language:=_Italian Else
If StrToUpper(Copy(TmpLanguage,1,2))='SE'Then Language:=_Swedish Else
If StrToUpper(Copy(TmpLanguage,1,2))='SP'Then Language:=_Spain Else
If(StrToUpper(Copy(TmpLanguage,1,2))='SQ')or
(StrToUpper(Copy(TmpLanguage,1,3))='ALB')Then Language:=_Albanian;
End;
If(ParamStr(1)='/?')or(ParamStr(1)='--help')or(ParamStr(1)='-h')Then Begin
Case Language of
_English:Begin
WriteLn('COMP : This command compares the contents of two files or sets ');
WriteLn(' of files byte-by-byte.');
WriteLn;
WriteLn('Syntax : COMP file1 file2 [file3] [/A] [/C] [/D] [/L] [/M] [/GUI]');
WriteLn;
WriteLn(' file1 First file to compare');
WriteLn(' file2 Second file to compare');
WriteLn(' file3 File containing the results of the analysis');
WriteLn(' /A Displays differences as characters.');
WriteLn(' /C Performs a comparison that is not case-sensitive.');
WriteLn(' /D Displays differences in decimal format.');
WriteLn(' (The default format is hexadecimal)');
WriteLn(' /GUI Use a GUI to enter the two files to compare');
WriteLn(' /L Displays the number of the line where a difference occurs, ');
WriteLn(' instead of displaying the byte offset.');
WriteLn(' /M Do not ask for further comparisons');
WriteLn(' --version Output version information and exit');
End;
_Germany:Begin
WriteLn('COMP : Vergleicht den Inhalt von zwei Dateien oder Stzen ');
WriteLn(' von Dateien Byte fr Byte.');
WriteLn;
WriteLn('Syntax : COMP file1 file2 [file3] [/A] [/C] [/D] [/L] [/M] [/GUI]');
WriteLn;
WriteLn(' file1 Gibt den Speicherort und den Namen der ersten Datei ');
WriteLn(' oder des Dateisatzes an.');
WriteLn(' file2 Gibt den Speicherort und den Namen der zweiten Datei ');
WriteLn(' oder des Dateisatzes an.');
WriteLn(' file3 Datei mit den Ergebnissen der Analyse');
WriteLn(' /A Zeigt Unterschiede als Zeichen an. ');
WriteLn(' /C Fhrt einen Vergleich aus, bei dem die Groá-/Kleinschreibung ');
WriteLn(' nicht beachtet wird.');
WriteLn(' /D Zeigt Unterschiede im Dezimalformat an.');
WriteLn(' (Das Standardformat ist hexadezimal.)');
WriteLn(' /GUI Verwenden Sie eine GUI, um die beiden zu vergleichenden ');
WriteLn(' Dateien einzugeben');
WriteLn(' /L Affiche le numro de la ligne o une diffrence se produit ');
WriteLn(' au lieu d''afficher le dcalage d''octet.');
WriteLn(' /M Fordern Sie keine weiteren Vergleiche an');
WriteLn(' --version Versionsinformationen ausgeben und beenden');
End;
Else Begin
WriteLn('COMP : Cette commande permet de comparer deux fichiers.');
WriteLn;
WriteLn('Syntaxe : COMP fichier1 fichier2 [fichier3] [/A] [/C] [/D] [/L] [/M] [/GUI]');
WriteLn;
WriteLn(' fichier1 Premier fichier
comparer');
WriteLn(' fichier2 Deuxime fichier
comparer');
WriteLn(' fichier3 Fichier allant contenir les rsultats de l''analyse');
WriteLn(' /A Affiche la diffrence en ASCII');
WriteLn(' /C Affiche la diffrence en Caractre');
WriteLn(' /D Affiche la diffrence en dcimale');
WriteLn(' /GUI Utiliser un GUI pour entrez les deux fichiers
comparer');
WriteLn(' /L Affiche le numro de ligne plutt que le dplacement');
WriteLn(' /M Ne pas poser de question pour d''autres comparaisons');
WriteLn(' --version Demande la version de la commande');
End;
End;
End
Else
If ParamStr(1)='--version'Then Begin
WriteLn('COMP 1.0.2 - Clone Pascal de COMP, MSDOS-0, PCDOS-0, OS2-0 ou Corail');
WriteLn('Licence MIT');
WriteLn;
WriteLn('crit par Sylvain Maltais');
End
Else
If ParamCount>0Then Begin
GUI:=False;
Finish:=False;
Output:=_Hex;
OutputStatus:=_Offset;
FileName1:='';
FileName2:='';
FileNameResult:='';
For I:=1 to ParamCount do Begin
If(ParamStr(I)='/A')or(ParamStr(I)='/a')Then Output:=_Char Else
If(ParamStr(I)='/C')or(ParamStr(I)='/c')Then Include(Option,_CaseIgnore) Else
If(ParamStr(I)='/D')or(ParamStr(I)='/d')Then Output:=_Dec Else
If(StrToUpper(ParamStr(I))='/GUI')Then GUI:=True Else
If(ParamStr(I)='/L')or(ParamStr(I)='/l')Then OutputStatus:=_Line Else
If(ParamStr(I)='/M')or(ParamStr(I)='/m')Then Finish:=True Else
If FileName1=''Then FileName1:=ParamStr(I) Else
If FileName2=''Then FileName2:=ParamStr(I)
Else FileNameResult:=ParamStr(I);
End;
Repeat
If(GUI)Then Begin
Finish:=True;
CurrDialog:=$70;
DialogBox(3,6,76,17,$70);
WriteCenter(6,' Comparaison ',$70);
GotoxY(7,7);
Case Language of
_English:Write('Enter the name of the first file:');
Else Write('Entrez le nom du premier fichier :');
End;
GotoxY(7,11);
Case Language of
_English:Write('Enter the name of the second file:');
Else Write('Entrez le nom du deuxime fichier :');
End;
Ok:=False;
Box(7,13,72,13,$30);
Repeat
Case Language of
_English:ShowHorizontalCenterButton(15,'Compare|Cancel');
Else ShowHorizontalCenterButton(15,'Comparer|Annuler');
End;
Repeat
TextColor(Black);
TextBackground(LightCyan);
K:=ReadLineInBox(7,9,72,9,FileName1);
If(K=kbEsc)Then Begin
TextColor(LightGray);
TextBackground(Black);
ClrScr;
Halt(1);
End;
Until(K=kbTab)or(K=kbEnter);
Repeat
TextColor(Black);
TextBackground(LightCyan);
K:=ReadLineInBox(7,13,72,13,FileName2);
If(K=kbEsc)Then Begin
TextColor(LightGray);
TextBackground(Black);
ClrScr;
Halt(1);
End;
Until(K=kbTab)or(K=kbEnter);
TextColor(0);
TextBackground(LightGray);
Case Language of
_English:K:=ReadHorizontalCenterButton(15,'Compare|Cancel');
Else K:=ReadHorizontalCenterButton(15,'Comparer|Annuler');
End;
If(K=1)or(K=kbEsc)Then Begin
TextColor(LightGray);
TextBackground(Black);
ClrScr;
Halt(1);
Exit;
End;
If(K=0)Then OK:=True;
Until Ok;
TextColor(LightGray);
TextBackground(Black);
ClrScr;
End;
If(FileName1='')or(FileName2='')Then Begin
Case Language of
_English:WriteLn('2 file names are required!');
Else WriteLn('2 noms de fichiers sont requis !');
End;
End
Else
Begin
CurrPos:=0;
CurrLineCount:=1;
{$I-}Assign(FileComp1,FileName1);
Reset(FileComp1,1);{$I+}
If IOResult<>0 Then Begin
WriteLn('Erreur de lecture du premier fichier');
Halt(4);
End;
{$I-}Assign(FileComp2,FileName2);
Reset(FileComp2,1);{$I+}
If IOResult<>0 Then Begin
WriteLn('Erreur de lecture du deuxime fichier');
Halt(5);
End;
If FileNameResult<>''Then Begin
{$I-}Assign(FileResult,FileNameResult);
Rewrite(FileResult);{$I+}
End;
If IOResult<>0 Then Begin
WriteLn('Erreur d''criture du fichier de rsultat');
Halt(6);
End;
While Not EOF(FileComp1)do Begin
BlockRead(FileComp1,Buffer1,SizeOf(Buffer1),ByteReaded1);
BlockRead(FileComp2,Buffer2,SizeOf(Buffer2),ByteReaded2);
If ByteReaded2=0Then Begin
Case Language of
_English:WriteLn('Second shorter file!');
Else WriteLn('Deuxime fichier plus court !');
End;
Break;
End;
For I:=0 to High(Buffer1)do Begin
If(Buffer1[I]=13)Then Inc(CurrLineCount);
If _CaseIgnore in(Option)Then Begin
Diff:=(UpCase(Char(Buffer1[I]))<>UpCase(Char(Buffer2[I])));
End
Else
Begin
Diff:=(Char(Buffer1[I])<>Char(Buffer2[I]));
End;
If(Diff)Then Begin
If FileNameResult<>''Then Begin
Case OutputStatus of
_Offset:WriteLn(FileResult,'Erreur de comparaison au dplacement ',HexWord2Str(CurrPos+I));
_Line:WriteLn(FileResult,'Erreur de comparaison
la ligne ',CurrLineCount);
End;
Case Output of
_Hex:Begin
Case Language of
_English:Begin
WriteLn(FileResult,'file1 = ',ByteHex2Str(Buffer1[I]));
WriteLn(FileResult,'file2 = ',ByteHex2Str(Buffer2[I]));
End;
Else Begin
WriteLn(FileResult,'fichier1 = ',ByteHex2Str(Buffer1[I]));
WriteLn(FileResult,'fichier2 = ',ByteHex2Str(Buffer2[I]));
End;
End;
End;
_Dec:Begin
Case Language of
_English:Begin
WriteLn(FileResult,'file1 = ',Buffer1[I]);
WriteLn(FileResult,'file2 = ',Buffer2[I]);
End;
Else Begin
WriteLn(FileResult,'fichier1 = ',Buffer1[I]);
WriteLn(FileResult,'fichier2 = ',Buffer2[I]);
End;
End;
End;
_Char:Begin
Case Language of
_English:Begin
WriteLn(FileResult,'file1 = ',Char(Buffer1[I]));
WriteLn(FileResult,'file2 = ',Char(Buffer2[I]));
End;
Else Begin
WriteLn(FileResult,'fichier1 = ',Char(Buffer1[I]));
WriteLn(FileResult,'fichier2 = ',Char(Buffer2[I]));
End;
End;
End;
End;
End
Else
Begin
Case OutputStatus of
_Offset:WriteLn('Erreur de comparaison au dplacement ',HexWord2Str(CurrPos+I));
_Line:WriteLn('Erreur de comparaison
la ligne ',CurrLineCount);
End;
Case Output of
_Hex:Begin
Case Language of
_English:Begin
WriteLn('file1 = ',ByteHex2Str(Buffer1[I]));
WriteLn('file2 = ',ByteHex2Str(Buffer2[I]));
End;
Else Begin
WriteLn('fichier1 = ',ByteHex2Str(Buffer1[I]));
WriteLn('fichier2 = ',ByteHex2Str(Buffer2[I]));
End;
End;
End;
_Dec:Begin
Case Language of
_English:Begin
WriteLn('file1 = ',Buffer1[I]);
WriteLn('file2 = ',Buffer2[I]);
End;
Else Begin
WriteLn('fichier1 = ',Buffer1[I]);
WriteLn('fichier2 = ',Buffer2[I]);
End;
End;
End;
_Char:Begin
Case Language of
_English:Begin
WriteLn('file1 = ',Char(Buffer1[I]));
WriteLn('file2 = ',Char(Buffer2[I]));
End;
Else Begin
WriteLn('fichier1 = ',Char(Buffer1[I]));
WriteLn('fichier2 = ',Char(Buffer2[I]));
End;
End;
End;
End;
End;
End;
End;
Inc(CurrPos,ByteReaded1);
End;
If FileNameResult<>''Then Close(FileResult);
Close(FileComp1);
Close(FileComp2);
End;
If Not(Finish)Then Begin
Case Language of
_English:Write('Compare more files (Y/N) ? ');
_Germany:Write('Weitere Dateien vergleichen (J/N)?');
Else Write('Comparer d''autres fichiers (O/N) ? ');
End;
Case ReadKey of
'O','o','Y','y','J','j','S','s':Begin
Case Language of
_English:Begin
WriteLn('Yes');
Write('Name of the first file to compare: ');
End;
Else Begin
WriteLn('Oui');
Write('Nom du premier fichier a comparer : ');
End;
End;
ReadLn(FileName1);
Case Language of
_English:Write('Name of the second file to compare:');
Else Write('Nom du deuxime fichier a comparer : ');
End;
ReadLn(FileName2);
End;
Else Begin
Case Language of
_English:WriteLn('No');
_Germany:WriteLn('Nein');
Else WriteLn('Non');
End;
Finish:=True;
End;
End;
End;
Until Finish;
End
Else
Begin
Case Language of
_English:WriteLn('Missing parameter!');
Else WriteLn('Paramtre requis !');
End;
Halt(2);
End;
END.