-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathadvance.pas
806 lines (739 loc) · 22.8 KB
/
advance.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
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
{/////////////////////////////////////////////////////////////////////////
//
// Dos Navigator Open Source 1.51.08
// Based on Dos Navigator (C) 1991-99 RIT Research Labs
//
// This programs is free for commercial and non-commercial use as long as
// the following conditions are aheared to.
//
// Copyright remains RIT Research Labs, and as such any Copyright notices
// in the code are not to be removed. If this package is used in a
// product, RIT Research Labs should be given attribution as the RIT Research
// Labs of the parts of the library used. This can be in the form of a textual
// message at program startup or in documentation (online or textual)
// provided with the package.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// 1. Redistributions of source code must retain the copyright
// notice, this list of conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// 3. All advertising materials mentioning features or use of this software
// must display the following acknowledgement:
// "Based on Dos Navigator by RIT Research Labs."
//
// THIS SOFTWARE IS PROVIDED BY RIT RESEARCH LABS "AS IS" AND ANY EXPRESS
// OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
// GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
// IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// The licence and distribution terms for any publically available
// version or derivative of this code cannot be changed. i.e. this code
// cannot simply be copied and put under another distribution licence
// (including the GNU Public Licence).
//
//////////////////////////////////////////////////////////////////////////}
{$I STDEFINE.INC}
{AK155 = Alexey Korop, 2:461/155@fidonet}
{Cat = Aleksej Kozlov, 2:5030/1326.13@fidonet}
unit Advance;
interface
uses
Dos,
Strings,
Objects2, Lfnvp {DataCompBoy}
, Defines, Streams
;
{$IFDEF DNPRG}
{$I Version.Inc}
{DataCompBoy: DO NOT INCLUDE Version.inc IN OTHER UNITS!}
{simple add in USES Advance}
{$ENDIF}
type
TNameFormatMode = (nfmNull, nfmHidden, nfmSystem, nfmHiddenSystem);
const
NameFormatChar: array[TNameFormatMode] of Char =
('.', #176, #177, #178);
(* flnPreferName = 1; { ¥ ⠡㫨஢ ®¥ à áè¨à¥¨¥;
¯à¨ í⮬ ¢á¥£¤ ExtSize = 0}
flnHardExtArea = 2; { ’ ¡ã«¨à®¢ âì à áè¨à¥¨¥
¯à¨ í⮬ ¢á¥£¤ ExtSize <> 0}
{ flnUseCutChar = 8; Ž ¢á¥£¤ 㦥 }
*)
flnPreserveExt = 1; { ¥á«¨ ¯à¨ ¥â ¡ã«¨à®¢ ®¬ ¯®ª §¥ à áè¨à¥¨¥
楫¨ª®¬ ¥ ¯®¬¥é ¥âáï, â® á®åà ¨âì ExtSize ᨬ¢®«®¢ ¤«ï
¯®«ï à áè¨à¥¨ï (¢ª«îç ï ᨬ¢®« ®¡à¥§ª¨)}
flnAutoHideDot = 4; { ‡ ¬¥ïâì â®çªã ¯¥à¥¤ à áè¨à¥¨¥¬ ¯à®¡¥«;
¡ë¢ ¥â ⮫쪮 ¯à¨ ExtSize <> 0}
flnHighlight = 16;
flnUpCase = 32;
flnLowCase = 64;
flnCapitalCase = 128;
flnPadRight = 256;
flnHandleTildes = 512;
flnSelected = 1024;
const
TextReaderBufSize = $1000;
type
TTextReaderBuf = array[0..TextReaderBufSize-1] of Char;
PTextReader = ^TTextReader;
TTextReader = object
Eof: Boolean;
constructor Init(const FName: String); {DataCompBoy}
function GetStr: String;
function FileName: String; {DataCompBoy}
destructor Done; virtual;
private
Handle: lFile; {DataCompBoy}
BufSz: Integer;
BufPos: Integer;
Buf: TTextReaderBuf;
Skip1: Boolean;
end;
{ TColorIndexes }
PColorIndex = ^TColorIndex;
TColorIndex = record
GroupIndex: Byte;
ColorSize: Byte;
ColorIndex: array[0..255] of Byte;
end;
{ TCharImage = array [0..15] of Byte;}
type
TCountryInfo = record
{`„ ë¥ ¤«ï ¤¨ «®£ áâ஥ª áâà ë }
DateFmt: Word; {Radiobuttons}
{`0:MM-DD-YY, 1: DD-MM-YY, 2: YY-MM-DD`}
TimeFmt: Word; {Radiobuttons}
{`0:12hour, 1: 24hour`}
DateSep: String[1]; {Inputline}
TimeSep: String[1]; {Inputline}
ThouSep: String[1]; {Inputline}
DecSep: String[1]; {Inputline}
DecSign: String[1]; {Inputline}
CurrencyFmt: Word; {Radiobuttons}
{` 0:'$123.00', 1:'123.00$', 2:'$ 123.00', 3:'123.00 $' 4: 123$00 `}
Currency: String[4]; {Inputline}
KbdToggleLayout: String[79]; {Inputline}
ABCSortTable: String[79]; {Inputline}
WinCodeTable: String[79]; {Inputline}
CodeTables: String[255]; {Inputline}
end; {`}
var
RK: Byte;
const
ColorIndexes: PColorIndex = nil;
opUnk = 0; { Unknown }
opDOS = 1; { DOS }
opOS2 = 2; { OS/2 }
opWin = 4; { Wind0ze }
opDV = 8; { DesqView }
opWNT = 16; { Win NT & Win y2k }
opDPMI32 = 32; { DPMI32 }
{Cat: ¥çâ® á।¥¥ ¬¥¦¤ã DOS ¨ Win32, ¯®í⮬㠮⤥«ì® ®â DOS}
Abort: Boolean = False;
opSys: Byte = opUnk;
{ useful under OS2 with WinAPI emulator: if (opSys and opWin)=opWin then ...}
procedure CheckOS;
{ Check for OS - For checking API please use error codes }
{ Automatically called while program started }
procedure ClrIO;
function MemOK: Boolean;
function GetMeMemoStream: PStream; {-$VOL}
function MemAdjust(L: LongInt): LongInt;
procedure FillWord(var B; Count, W: Word);
procedure LocateCursor(X, Y: Byte);
procedure TinySlice;
{` Žâ¤ ç á¨á⥬¥ ª¢ ⠢६¥¨. â ¯à®æ¥¤ãà ¢ë§ë¢ ¥âáï ¨§
横« ᮡë⨩ TGroup.Execute, áâ «® ¡ëâì, ¢ «î¡®© á¨âã 樨,
ª®£¤ à ¡®â ¥â Desktop ¨«¨ ¤¨ «®£. …᫨ ¦¥ ªâ®-â® á ¬ ªàãâ¨â
横« ( ¯à¨¬¥à, á GetEvent), â® ® á ¬ ¤®«¦¥ ¨ TinySlice ¢ë§ë¢ âì,
¥á«¨ 㦮. ਬ¥à ⮣®, ª ª íâ® ¤¥« ¥âáï, á¬. ¢ TView.MouseEvent `}
function FormatLongName(Name: String; Size, ExtSize: Byte;
{` ”®à¬ â¨à®¢ âì ¤«¨®¥ ¨¬ï ¯®¤ ®¡éãî ¤«¨ã Size, ¢ ⮬ ç¨á«¥
¯®¤ ⠡㫨஢ ®¥ à áè¨à¥¨¥ - ExtSize.
Žâ¤¥«ìë¥ ¡¨âë Options § ¤ î⠮ᮡ¥®á⨠ä®à¬ â¨à®¢ ¨ï (ª®áâ âë
á ¨¬¥ ¬¨ ¢à®¤¥ flnHighlight.
FormatMode ®¯à¥¤¥«ï¥â ᨬ¢®«, ¢ë¢®¤¨¬ë© ¢¬¥áâ® â®çª¨.}
Options: Word;
FormatMode: TNameFormatMode): String; (* X-Man *)
{`}
{ ¥à¥¬¥ë¥ FormatLongName, ®áâ â®çë¥ § ç¥¨ï ª®â®àëå ¬®£ãâ
¯à¥¤áâ ¢«ïâì ¨â¥à¥á: }
var
flnNLength: Integer;
{` ®á«¥ FormatLongName ¤«¨ ᮡá⢥® ¨¬¥¨, ¡¥§ ®¡à¥§ ¨ï `}
flnNSize: Integer;
{` ®á«¥ FormatLongName ¤«¨ ¨¬¥¨ ¯®á«¥ ®¡à¥§ ¨ï `}
flnDotPos: Integer;
{` ®á«¥ FormatLongName १ã«ìâ¨àãîé ï ¯®§¨æ¨ï â®çª¨ (¥á«¨
¥ ⠡㫨à㥬) ¨«¨ ¯®á«¥¤¥£® ¯à®¡¥« ¯¥à¥¤ ¯®«¥¬ à áè¨à¥¨ï
(¥á«¨ ⠡㫨à㥬) `}
flnPanelName: String;
{` ®á«¥ FormatLongName ®âä®à¬ â¨à®¢ ®¥ ¨¬ï (¡¥§ ¤®¡ ¢®çëå
ᨬ¢®«®¢ ã¯à ¢«¥¨ï ¯®¤á¢¥âª®© `}
const
BreakChars: set of Char = [',', ' ', '[', ']', '{', '}', '(', ')',
':', ';', '.', '^',
'&', '*', '!', '#', '$', '/', '\', '"', '%', '>', '<',
'-', '+', '=', '|', '?', #13, #10, #9, #26, #12, '@'];
HexStr: array[0..$F] of Char = '0123456789ABCDEF';
N_O_E_M_S: array[1..5] of Char = 'NOEMS';
cTEMP_: String[5] = 'TEMP:';
cLINK_: String[5] = 'LINK:';
cNET_: String[7] = 'Network';
{.$IFNDEF OS2}
x_x: String[3] = '*.*';
{.$ELSE}
{x_x : string[3] = '*';}
{.$ENDIF}
var
OS2exec: Boolean; { use OS2exec to determine if starting of OS/2 }
{ programs is supported }
{ use opsys and opOS2 <> 0 to determine if OS/2 }
{ is running }
Win32exec: Boolean; {starting of Win32 programs is supported }
FreeStr: String;
FreeLongStr: LongString;
InterfaceStr: String;
{` ‘â â¨ç¥áª ï áâப ¤«ï ¯¥à¥¤ ç¨ ¤ ëå ¬¥¦¤ã ¯à®£à ¬¬ ¬¨.
ˆá¯®«ì§®¢ âì ¥ñ ¡¥§ ªà ©¥© ¥®¡å®¤¨¬®á⨠¥ á«¥¤ã¥â. `}
DNNumber: Byte;
{Cat: ¯®à冷ª ¯¥à¥¬¥ëå ¥ ¬¥ïâì, ¨ ç¥ ¡ã¤ã⠯஡«¥¬ë á ¯« £¨ ¬¨}
var
{-DataCompBoy-}
StartupDir: String;
{` Š â «®£, ®âªã¤ ¢ë§¢ DN.EXE. ‘ '\' ¢ ª®æ¥ `}
SourceDir: String;
{` Š â «®£, £¤¥ «¥¦ â ª®ä¨£¨ ¨ ¨áâ®à¨¨. ‘ '\' ¢ ª®æ¥.
“¯à ¢«ï¥âáï Env-¯¥à¥¬¥®© DN2. `}
TempDir: String;
{` ‚६¥ë© ª â «®£. ‘ '\' ¢ ª®æ¥ `}
TempFile: String;
TempFileSWP: String; {JO}
LngFile: String;
SwpDir: String;
{` Š â «®£ ¤«ï ¢à¬¥ëå ª®¬ ¤ëå ä ©«®¢ ¨ ᯨ᪮¢,
¢ DPMI32 - ¤«ï ᢮¯ ¢à¥¬ï ¢ë¯®«¥¨ï ¢¥è¥© ¯à®£à ¬¬ë.
‘ '\' ¢ ª®æ¥. “¯à ¢«ï¥âáï Env-¯¥à¥¬¥®© DNSWAP ¨ ª«î稪®¬ /S. `}
{-DataCompBoy-}
const
DirToChange: String = ''; {DataCompBoy}
{$IFDEF DPMI32}
DirToMoveContent: String = ''; {JO}
{$ENDIF}
const
CL_SafeBuf = $8000;
Linker: Pointer = nil;
NeedLocated: LongInt = 0;
const
CountryInfo: TCountryInfo =
{`‘â â¨ç¥áª ï ¯¥à¥¬¥ ï; ¢á¥£¤ ª®à४⮠§ ¯®«¥ `}
(DateFmt: 0;
TimeFmt: 0;
DateSep: '.';
TimeSep: ':';
ThouSep: ' ';
DecSep: '.';
DecSign: '$';
CurrencyFmt: 0;
Currency: '$';
KbdToggleLayout: 'ru441.xlt';
ABCSortTable: 'sort866.xlt';
{$IFDEF DPMI32}
WinCodeTable: 'win866r.xlt';
{$ELSE} {$IFDEF Win32}
WinCodeTable: '1251';
{$ELSE} //OS2
WinCodeTable: '0';
{$ENDIF}
{$ENDIF}
CodeTables: 'KOI:koi8-r.xlt'
);
type
TCrc_Table = array[0..255] of LongInt;
const
Crc_Table_Empty: Boolean = True;
Crc_Table: ^TCrc_Table = nil;
type
TPosArray = array[1..9] of TPoint;
TFPos = record X: Integer; Y: TFileSize end;
TFPosArray = array [1..9] of TFPos;
implementation
uses
xTime, Startup, Advance1, VPUtils,
VpSysLow, Advance2,
Commands
;
procedure ClrIO;
begin
InOutRes := 0;
DosError := 0;
Abort := False;
end;
function MemOK: Boolean;
begin
MemOK := True
end; {JO}
{-DataCompBoy-}
constructor TTextReader.Init;
var
FileSz: TFileSize;
ToRead: Integer;
begin
ClrIO;
FileMode := $40;
lAssignFile(Handle, FName);
lResetFile(Handle, 1);
if (IOResult <> 0) or Abort then
Fail;
FileSz := FileSize(Handle.F);
if (IOResult <> 0) or Abort then
Fail;
Eof := FileSz = 0;
if not Eof then
begin
ToRead := MinBufSize(FileSz, TextReaderBufSize);
BlockRead(Handle.F, Buf, ToRead, BufSz);
if (IOResult <> 0) or Abort or (ToRead <> BufSz) then
begin
ClrIO;
Close(Handle.F);
ClrIO;
Fail;
end;
end;
BufPos := 0;
end { TTextReader.Init };
{-DataCompBoy-}
{-DataCompBoy-}
function TTextReader.FileName: String;
begin
FileName := lFileNameOf(Handle);
end;
{-DataCompBoy-}
{-DataCompBoy-}
function TTextReader.GetStr: String;
var
CurStr: String;
BufBeg: Integer;
Was: Boolean;
procedure aStr(D: Integer);
var
Grow: Integer;
begin
Grow := Min((BufPos-BufBeg)-D-Byte(Was), 255-Length(CurStr));
if Grow > 0 then
begin
Move(Buf[BufBeg], CurStr[Length(CurStr)+1], Grow);
SetLength(CurStr, Length(CurStr)+Grow);
end;
end;
var
PrevC: Integer;
C: Char;
begin { TTextReader.GetStr: }
CurStr := '';
if not Eof then
begin
PrevC := -1;
SetLength(CurStr, 0);
BufBeg := BufPos;
Was := False;
repeat
if BufPos = BufSz then
begin
aStr(0);
ClrIO;
BlockRead(Handle.F, Buf, TextReaderBufSize, BufSz);
if BufSz = 0 then
begin
Eof := True;
Break;
end;
BufPos := 0;
BufBeg := 0;
if Was then
begin
Skip1 := True;
Break
end;
end;
C := Buf[BufPos];
Inc(BufPos);
case C of
#0, #10, #13:
begin
if Skip1 then
begin
BufBeg := BufPos;
Skip1 := False;
Continue;
end;
if Was then
begin
aStr(1);
Dec(BufPos, Integer(PrevC = Integer(C)));
Break;
end
else
Was := True;
PrevC := Integer(C);
end;
else {case}
begin
if Was then
begin
aStr(1);
Dec(BufPos);
Break;
end;
Skip1 := False
end;
end {case};
until False;
end;
GetStr := CurStr;
end { TTextReader.GetStr: };
{-DataCompBoy-}
{-DataCompBoy-}
destructor TTextReader.Done;
begin
ClrIO;
Close(Handle.F);
ClrIO;
end;
{-DataCompBoy-}
{AK155 19.05.05 ‚ᥠ¤¨ ¬¨ç¥áª¨¥ PString § ¬¥¨« á⥪®¢ë¥ String.
Ÿ ᮬ¥¢ îáì ¢ ¯®«¥§®á⨠íâ¨å PString ¤ ¦¥ ¢ 16bit ¢¥àᨨ,
¢ 32bit - í⮠ᮢ¥à襮 «¨è¥¥.
€ â ª¦¥ ¢¢ñ« ¯ àã ¬¥«ª¨å ®¯â¨¬¨§ 権 ¨ ¤®¡ ¢¨« ª®¬¬¥â ਥ¢.}
function FormatLongName(Name: String; Size, ExtSize: Byte;
Options: Word;
FormatMode: TNameFormatMode): String;
var
PSize, ESize: Integer; {PathSize, ExtensionSize}
P, N, E: String; { Path, Name, Extension }
EFlag, i: Byte;
Hi: Boolean; { ¯à¨§ ª ⮣®, çâ® ¤ ë© á¨¬}
Hi1, Hi2, Hi3: Integer; { ®§¨æ¨¨, ª®â®àë¥ ¤®«¦ë ¡ëâì ¢ë¤¥¤¥ë 梥⮬.
Hi1 - ᨬ¢®« ®¡à¥§ª¨ ¯ã⨠(¯®¤®§à¥¢ î, ç⮠ॠ«ì® ¥ 㦥,
â ª ª ª ¯ãâì ¨ª®£¤ ¥ ¡ë¢ ¥â ¢¬¥á⥠á 梥⮬);
Hi2 - ᨬ¢®« ®â¬¥âª¨ ä ©« ¨«¨ ®¡à¥§ª¨ ¨¬¥¨ ¯¥à¥¤ à áè¨à¥¨¥¬;
Hi3 - ᨬ¢®« ®¡à¥§ª¨ ¯à ¢®¬ ª®æ¥ ¯®«ï.
}
l: Integer;
label
MakeResult;
begin { FormatLongName }
if (Name = '..') or (Name = '.' {¡ë¢ ¥â ¢ãâਠç㦨å à娢®¢}) then
begin
Result := AddSpace(Name, Size);
Exit;
end;
if (Options and flnUpCase) <> 0 then
UpStr(Name)
else if (Options and (flnLowCase or flnCapitalCase)) <> 0 then
LowStr(Name);
lFSplit(Name, P, N, E);
Delete(E, 1, 1);
if (Options and flnCapitalCase) <> 0 then
N[1] := UpCase(N[1]);
SetLength(flnPanelName, Size);
Hi1 := 0;
Hi2 := 0;
Hi3 := 0;
if Size < 5+ExtSize then
begin
FillChar(flnPanelName[1], Size, FMSetup.RestChar[1]);
Hi1 := Size;
goto MakeResult;
end;
flnNLength := Length(N);
flnNSize := flnNLength;
ESize := Length(E); { 㦥 ¡¥§ â®çª¨ }
EFlag := Byte(ESize > 0);
if Options and flnPreserveExt <> 0 then
begin
l := (Length(N) + Min(3, Length(P)));
{ ᪮«ìª® å®ç¥âáï ¯ãâì ¨ ¨¬ï ¯à¨ ¬ ªá¨¬ «ì®© ®¡à¥§ª¥ ¯ã⨠}
if (Size - l > ESize) { áè¨à¥¨¥ ¯®¬¥é ¥âáï } or
(l < Size-ExtSize) { ˆ¬ï ¥ 㦮 ®¡à¥§ âì }
then
ExtSize := 0 { ¥ ⠡㫨à㥬 }
else if ESize < ExtSize then
ExtSize := ESize; { ’ ¡ã«¨à㥬, ® ¬¨¨¬¨§¨à㥬 ®¡à¥§ªã ¨¬¥¨ }
end;
if (ExtSize <> 0) and (ESize > ExtSize) then
begin { Ž¡à¥§ª à áè¨à¥¨ï ¯à¨ ⠡㫨஢ ®¬ ¯®ª §¥ }
ESize := ExtSize;
Hi3 := Size;
end;
PSize := Max(3, Size-(ESize+EFlag)-flnNSize);
if PSize >= Length(P) then
PSize := Length(P)
else
begin { Ž¡à¥§ª ¯ã⨠}
P[PSize] := FMSetup.RestChar[1];
Hi1 := PSize
end;
{ Ž¡à¥§ª à áè¨à¥¨ï ¯à¨ ¥â ¡ã«¨à®¢ ®¬ ¯®ª §¥.
…ñ ¥«ì§ï ®¡ê¥¤¨¨âì á ®¡à¥§ª®© ¨¬¥¨, â ª ª ª ¢ ¯®§¨æ¨î ¯®á«¥¤¥©
â®çª¨ ¬®¦¥â § ®á¨âìáï ¯à¨§ ª áªàë⮣®-á¨á⥬®£® ä ©« .}
if (ExtSize <> 0) then
i := ExtSize+1
else
begin
ESize := Min(Length(E), Max(0, Size-EFlag-PSize-flnNSize));
EFlag := Byte(ESize > 0);
i := ESize+EFlag;
if ESize < Length(E) then
Hi3 := Size;
end;
{ ‘¥©ç á i - è¨à¨ ¯®«ï à áè¨à¥¨ï, ¢ª«îç ï ¯®§¨æ¨î â®çª¨ }
{ Ž¡à¥§ª ¨¬¥¨ }
flnNSize := Min(Length(N), Max(1, Size-i-PSize));
FillChar(flnPanelName[1], Size, ' ');
if ExtSize = 0 then
flnDotPos := PSize+flnNSize+1
else
flnDotPos := Size-ExtSize;
{ ‘¥©ç á flnDotPos - íâ® ¯®§¨æ¨ï â®çª¨, ¥á«¨ ® ¢ ¯à¥¤¥« å ¯®«ï,
«¨¡® Size+1, ¥á«¨ â®çª ¢ë室¨â § ¯®«¥ ¨§-§ ᫨誮¬ ¤«¨®£®
¨¬¥¨ ¢ ०¨¬¥ ¡¥§ â ¡ã«ï樨 à áè¨à¥¨© }
for i := 1 to PSize do
flnPanelName[i] := P[i];
for i := 1 to flnNSize do
flnPanelName[PSize+i] := N[i];
for i := 1 to ESize do
flnPanelName[flnDotPos+i] := E[i];
if (FormatMode <> nfmNull) or
((Options and flnAutoHideDot = 0) and (ESize <> 0))
then
flnPanelName[flnDotPos] := NameFormatChar[FormatMode];
{ ‡ ¥á¥¨¥ ¯à¨§ ª âਡã⮢ ¨«¨ ¢®ááâ ®¢«¥¨¥ â®çª¨.
…᫨ ¯®§¨æ¨ï â®çª¨ ¢¥ ¯®«ï (â® ¥áâì ¡ã¤¥â ®¡à¥§ª ), â® âਡãâë
¥ ¡ã¤ãâ ¨¤¨æ¨à®¢ âìáï. Œ®¦¥â, íâ® ¨ ¥¯à ¢¨«ì®, ® â ª
¡ë«® ¢á¥£¤ .}
if flnNSize < Length(N) then
begin { Ž¡à¥§ª ¨¬¥¨ }
Hi2 := PSize+flnNSize + byte(flnDotPos <= Size);
{…᫨ ¯®§¨æ¨ï â®çª¨ ¨¤¨æ¨àã¥âáï, â® ®¡à¥§ªã áâ ¢¨¬ ¢¬¥áâ® ¥ñ,
¥á«¨ ¥â - ¯à¨å®¤¨âáï ®¡à¥§ âì 1 ᨬ¢®« ¡®«ìè¥ }
flnPanelName[Hi2] := FMSetup.RestChar[1];
end;
if Hi3 <> 0 then {Ž¡à¥§ª à áè¨à¥¨ï. Ž ¬®¦¥â á ¬®¬ ¤¥«¥
®¡à¥§ âì ¨¬ï, ¥á«¨ ¯®ª § ¥â ¡ã«¨à®¢ ë©. ‚ í⮬ á«ãç ¥ ®â¬¥âª
(¥á«¨ ® ¥áâì) ¤®«¦ «¥çì ¯®¢¥àå ®¡à¥§ª¨, ¯®í⮬ã
¤ ë© äà £¬¥â ¤®«¦¥ áâ®ïâì ¤® § ¥á¥¨ï ᨬ¢®« ®â¬¥âª¨. }
flnPanelName[Hi3] := FMSetup.RestChar[1];
if (Options and flnSelected) <> 0 then
begin { Žâ¬¥âª }
Hi2 := flnDotPos - byte(flnDotPos > Size);
{…᫨ ¯®§¨æ¨ï â®çª¨ ¨¤¨æ¨àã¥âáï, â® ®â¬¥âªã áâ ¢¨¬ ¢¬¥áâ® ¥ñ,
¥á«¨ ¥â - ¯®á«¥¤¨© ¨¤¨æ¨àã¥¬ë© á¨¬¢®«. Ž¡à¥§ª ¯à¨ í⮬
¯®¤ ¢«ï¥âáï }
flnPanelName[Hi2] := FMSetup.TagChar[1];
end;
MakeResult:
Result := '';
if (Options and flnPadRight) = 0 then
DelRight(flnPanelName);
{AK155 13.05.2005 ‡¤¥áì, ¨ ¢ ª®æ¥ ¯®¤¯à®£à ¬¬ë, ⨫ì¤ë ¤®¡ ¢«ïîâáï,
¢ GetFull á ¨¬¨ ¢¥¤ñâáï ¡®àì¡ ¯à¨ ¯®¬®é¨ ª®¤ 梥â . à®é¥ ¥
¤®¡ ¢«ïâì ¨ ¥ ¡®à®âìáï.
if ( (Options and flnSelected) <> 0) and
( (Options and flnHighlight) <> 0)
then
AddStr(Res^, '~');
/AK155}
for i := 1 to Length(flnPanelName) do
begin
Hi := { ¯à¨§ ª ⮣®, çâ® ¤ ë© á¨¬¢®« ¤® ¯®¤á¢¥â¨âì }
( (Options and flnHighlight) <> 0) and
( (i = Hi1) or (i = Hi2) or (i = Hi3));
if Hi then
AddStr(Result, '~');
if (flnPanelName[i] = '~') and ((Options and flnHandleTildes) <> 0) then
AddStr(Result, #0);
AddStr(Result, flnPanelName[i]);
{AK155: § 祬 íâ®â ¢â®à®© #0 - ¯à¨¤ã¬ âì ¥ ᬮ£, ¯®í⮬ã ã¡à « ¥£®.
€ ®â®á¨â¥«ì® ¯¥à¢®£® #0 ¤®£ ¤ «áï, çâ® ® ¤®«¦¥ ®¡¥á¯¥ç¨¢ âì
®âà¨á®¢ªã ⨫ì¤ë. ˆ ¢¥á ᮮ⢥âáâ¢ãîéãî ª®à४æ¨î ¢
drivers._vp.MoveCStr. 06.01.2001}
{
if (flnPanelName[i]='~') and ((Options and flnHandleTildes)<>0)
then AddStr(Res^,#0);}
{/AK155}
if Hi then
AddStr(Result, '~');
end;
{AK155 13.05.2005 - á¬. ¢ëè¥
if ( (Options and flnSelected) <> 0) and
( (Options and flnHighlight) <> 0)
then
AddStr(Res^, '~');
/AK155}
end { FormatLongName };
procedure CheckOS;
begin
{$IFDEF OS2}opSys := opOS2; {$ENDIF}
{$IFDEF WIN32}
if SysPlatformId = 1 then
opSys := opWin
else
opSys := opWNT;
{$ENDIF}
{$IFDEF DPMI32}
opSys := opDPMI32;
asm
{OS2}
mov AX, 4010h
int 2Fh
cmp AX, 4010h
JZ @nonOS2
{OS2 detected}
or opSys, opOS2
@nonOS2:
mov ax, 3306h
int 21h { get true dos version }
{WinNT}{since WinNT don't support GetWinVer via int2f}
cmp bx,3205h
jne @nonWNT
{Win NT based OS detected }
or opSys, opWNT+opWin
@nonWNT:
{DOS}
cmp bl,3
jb @nonDOS
cmp bl,7
ja @nonDOS
{DOS detected}
or opSys, opDos
@nonDOS:
{DV}
mov ax, 2B01h
mov cx, 4445h
mov dx, 5351h
int 21h { Desqview Installed? }
cmp al, 255
je @nonDV
{DesqView detected}
or opSys, opDV
@nonDV:
{WIN 3.x and 9x}
mov ax, 160Ah
int 2Fh { Windows Install? }
or ax,ax
jne @nonWin
{Windows detected}
or opSys, opWin
@nonWin:
end; { checkos }
{$ENDIF}
end;
function GetMeMemoStream: PStream; {-$VOL begin}
const
_1: Byte = 1;
var
S: PStream;
Pos: LongInt;
begin
S := New(PMemoryStream, Init(2048, 2048));
{Cat: ⥯¥àì § ¯¨è¥¬ â㤠¥¤¨¨çªã, çâ®¡ë ¤à㣨¥ £«ã¯ë¥ ¯à®æ¥¤ãàë, }
{ ª®â®àë¥ ç¨â îâ ¨§ ¯®â®ª â®, çâ® ®¨ â㤠¥ § ¯¨áë¢ «¨, áç¨â «¨, }
{ çâ® è ¯®â®ª ᮤ¥à¦¨â ¤«¨ë¥ áâப¨ }
S^.Seek(0);
S^.Write(_1, 1);
S^.Seek(0);
{/Cat}
if S^.Status <> stOK then
begin
Dispose(S, Done);
S := nil
end;
GetMeMemoStream := S;
end; {-$VOL end}
function MemAdjust(L: LongInt): LongInt;
begin
if Linker <> nil then
begin
if L > CL_SafeBuf then
L := L-CL_SafeBuf
else
L := 0;
end;
MemAdjust := L;
end;
procedure FillWord(var B; Count, W: Word);
assembler;
{&Frame-} {$USES EDI, ECX}
asm
cld
mov eax, W
mov edi, B
mov ecx, Count
rep stosw
end;
procedure LocateCursor(X, Y: Byte);
begin
SysTVSetCurPos {GotoXY}(X, Y)
end;
procedure TinySlice;
begin
{$IFNDEF DPMI32}
SysCtrlSleep(1);
{ ‚®®¡é¥-â®, Idle-横« ¢ DN ¢¥áì¬ âï¦ñ«ë©, ¯®í⮬㠯 ã§ã ¦¥« ⥫ì®
¤¥« âì ª ª ¬®¦® ¡®«ìè¥. ® ¯à¨ í⮬ 㦮 á®åà ïâì ¤®áâ â®ç® ¡ëáâàãî
ॠªæ¨î ¢â®¯®¢â®à¥¨ï ª« ¢¨ âãàë (¯¥à¨®¤ 33 ¬á), ¨ ç¥ ¢áñ ç¨ ¥â
à §¤à ¦ îé¥ â®à¬®§¨âì ¨«¨ ¤ñ࣠âìáï. ’ ª ¢®â, ¯®¤ Win NT (ª¢ â 10 ¬á)
¤ ¦¥ 9 ¯à¨¢®¤¨â ª § ¬¥â®¬ã ¤ñ࣠¨î. ’ ª çâ® ¯ãáâì ¡ã¤¥â 1. € ¯®¤ OS/2
(32 ¬á ®¡ëç®) ¤ñ࣠¥âáï ¢áñ à ¢®, ¨ ¥á«¨ 㢥«¨ç¨âì ç¨á«®, â® ¤ñ࣠¥âáï
¥éñ ᨫ쥥.
}
{$ELSE}
// give_up_cpu_time;
//piwamoto: it crashes under W2K, so i get code from DN OSP
{AK155 ®¤ OS/2 int $28 à §£à㧪¨ ¯à®æ¥áá®à ¥ ¤ ñâ,
int $2f (DPMI Idle) - ¤ ñâ. ‚¥à®ïâ®, ¤«ï DPMI32 int $2f
¥¯à¨¬¥¨¬®. ’ ª çâ® ®áâ ¢¨« ¡¥§ãá«®¢® DPMI Idle}
asm
mov ax,$1680
int $2f
end;
{$ENDIF}
end;
begin
CheckOS;
{ Starting of OS/2 programs is possible under: }
{ - OS/2 2.10+, OS2COMSPEC environment variable is required }
{ - OS/2 Warp 3+, no additional requirements }
{ - OS/2 for PPC, future versions for IA64 (I hope) }
{$IFDEF DPMI32}
OS2exec := (opSys and opOS2 <> 0) and
( (Lo(DosVersion) > 20) or
( (Lo(DosVersion) = 20) and
( (Hi(DosVersion) >= 30) or
( (Hi(DosVersion) >= 10) and (GetEnv('OS2COMSPEC') <> ''))
)));
Win32exec := opSys and opWin <> 0; {¤«ï NT ¯®ª ¥ à ¡®â ¥â}
{$ENDIF}
{$IFDEF OS2}
OS2exec := True;
Win32exec := False;
{$ENDIF}
{$IFDEF WIN32}
OS2exec := False;
Win32exec := True;
{$ENDIF}
end.