Rev 740 | Rev 742 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 740 | Rev 741 | ||
---|---|---|---|
Line 7... | Line 7... | ||
7 | (* License: Apache 2.0 *) |
7 | (* License: Apache 2.0 *) |
8 | (* This file contains: *) |
8 | (* This file contains: *) |
9 | (* - "OIDplus for DOS" program *) |
9 | (* - "OIDplus for DOS" program *) |
10 | (************************************************) |
10 | (************************************************) |
11 | 11 | ||
- | 12 | (* IMPORTANT: *) |
|
- | 13 | (* When you compile this code with Turbo Pascal 7.01, *) |
|
- | 14 | (* it won't run on fast PCs (Runtime Error 200). *) |
|
- | 15 | (* The built EXE file needs to be patched. *) |
|
- | 16 | (* The program "PatchCRT" by Kennedy Software *) |
|
- | 17 | (* WON'T work because it somehow breaks our "_Pause" function. *) |
|
- | 18 | (* Instead, use the tool "TPPATCH" by Andreas Bauer. *) |
|
- | 19 | ||
12 | uses |
20 | uses |
13 | Dos, Crt, StrList, VtsFuncs, VtsCui, OidFile, OidUtils; |
21 | Dos, Crt, StrList, VtsFuncs, VtsCui, OidFile, OidUtils; |
14 | 22 | ||
15 | const |
23 | const |
16 | VERSIONINFO = 'Revision: 2022-02-14'; |
24 | VERSIONINFO = 'Revision: 2022-02-14'; |
Line 91... | Line 99... | ||
91 | end; |
99 | end; |
92 | _ShowASNIds := sTmp; |
100 | _ShowASNIds := sTmp; |
93 | end; |
101 | end; |
94 | 102 | ||
95 | function AsnAlreadyExisting(oid: POID; asnid: string): boolean; |
103 | function AsnAlreadyExisting(oid: POID; asnid: string): boolean; |
96 | var |
- | |
97 | sTmp: string; |
- | |
98 | i: integer; |
- | |
99 | begin |
- | |
100 | for i := 0 to ListCount(oid^.AsnIds)-1 do |
- | |
101 | begin |
104 | begin |
102 | sTmp := ListGetElement(oid^.AsnIds, i); |
105 | AsnAlreadyExisting := ListContains(oid^.AsnIds, asnid); |
103 | if sTmp = asnid then |
- | |
104 | begin |
- | |
105 | AsnAlreadyExisting := true; |
- | |
106 | exit; |
- | |
107 | end; |
- | |
108 | end; |
- | |
109 | AsnAlreadyExisting := false; |
- | |
110 | end; |
106 | end; |
111 | 107 | ||
112 | function AsnEditor(oid: POID): boolean; |
108 | function AsnEditor(oid: POID): boolean; |
113 | var |
109 | var |
114 | asnList: PStringList; |
110 | asnList: PStringList; |
Line 690... | Line 686... | ||
690 | filename := sTmp; |
686 | filename := sTmp; |
691 | end |
687 | end |
692 | else |
688 | else |
693 | begin |
689 | begin |
694 | ShowMessage('File ' + filename + ' not found', 'ERROR', true); |
690 | ShowMessage('File ' + filename + ' not found', 'ERROR', true); |
695 | (* TODO: With PatchCRT, there will be an infinite loop here *) |
- | |
696 | _Pause; |
691 | _Pause; |
697 | end; |
692 | end; |
698 | end; |
693 | end; |
699 | FreeList(subsel); |
694 | FreeList(subsel); |
700 | FreeList(subfiles); |
695 | FreeList(subfiles); |
Line 752... | Line 747... | ||
752 | end; |
747 | end; |
753 | 748 | ||
754 | procedure OP_ReturnToMSDOS; |
749 | procedure OP_ReturnToMSDOS; |
755 | begin |
750 | begin |
756 | ClrScr; |
751 | ClrScr; |
- | 752 | WriteLn('Thank you for using OIDplus for DOS.'); |
|
- | 753 | WRiteLn(''); |
|
757 | end; |
754 | end; |
758 | 755 | ||
759 | function _GetExportLine(oid: POID; indent: integer): string; |
756 | function _GetTreeViewLine(oid: POID; indent: integer): string; |
760 | var |
757 | var |
761 | i: integer; |
758 | i: integer; |
762 | sTmp: string; |
759 | sTmp: string; |
763 | begin |
760 | begin |
764 | (* Build line *) |
761 | (* Build line *) |
Line 781... | Line 778... | ||
781 | end; |
778 | end; |
782 | if Length(sTmp) > TREEVIEW_WIDTH then |
779 | if Length(sTmp) > TREEVIEW_WIDTH then |
783 | begin |
780 | begin |
784 | sTmp := Copy(sTmp, 1, TREEVIEW_WIDTH-3) + '...'; |
781 | sTmp := Copy(sTmp, 1, TREEVIEW_WIDTH-3) + '...'; |
785 | end; |
782 | end; |
786 | _GetExportLine := sTmp; |
783 | _GetTreeViewLine := sTmp; |
787 | end; |
784 | end; |
788 | 785 | ||
789 | procedure _RecTreeExport(oid: POID; var F: Text; indent: integer); |
786 | procedure _RecTreeExport(oid: POID; var F: Text; indent: integer); |
790 | var |
787 | var |
791 | i: integer; |
788 | i: integer; |
792 | sTmp: string; |
789 | sTmp: string; |
793 | suboid: POID; |
790 | suboid: POID; |
794 | childFilename: string; |
791 | childFilename: string; |
795 | begin |
792 | begin |
796 | sTmp := _GetExportLine(oid, indent); |
793 | sTmp := _GetTreeViewLine(oid, indent); |
797 | sTmp := TrimLineToWidth(sTmp, TREEVIEW_WIDTH); |
794 | sTmp := TrimLineToWidth(sTmp, TREEVIEW_WIDTH); |
798 | WriteLn(F, sTmp); |
795 | WriteLn(F, sTmp); |
799 | 796 | ||
800 | (* Recursively call children *) |
797 | (* Recursively call children *) |
801 | for i := 0 to ListCount(oid^.SubIds)-1 do |
798 | for i := 0 to ListCount(oid^.SubIds)-1 do |