Rev 735 | Rev 740 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 735 | Rev 739 | ||
---|---|---|---|
Line 36... | Line 36... | ||
36 | function DotNotationPart(s: string): string; |
36 | function DotNotationPart(s: string): string; |
37 | 37 | ||
38 | implementation |
38 | implementation |
39 | 39 | ||
40 | uses |
40 | uses |
41 | VtsFuncs; |
41 | VtsFuncs, OidUtils; |
42 | 42 | ||
43 | const |
43 | const |
44 | WANT_VERS = '2022'; |
44 | WANT_VERS = '2022'; |
45 | 45 | ||
46 | procedure CreateOidDef(var oid: POid); |
46 | procedure CreateOidDef(var oid: POid); |
Line 65... | Line 65... | ||
65 | begin |
65 | begin |
66 | FreeOidDef(oid); |
66 | FreeOidDef(oid); |
67 | CreateOidDef(oid); |
67 | CreateOidDef(oid); |
68 | end; |
68 | end; |
69 | 69 | ||
- | 70 | procedure BubbleSortSubIds(oid: POid); |
|
- | 71 | var |
|
- | 72 | n, i: integer; |
|
- | 73 | a, b: string; |
|
- | 74 | begin |
|
- | 75 | n := ListCount(oid^.SubIds); |
|
- | 76 | while n>1 do |
|
- | 77 | begin |
|
- | 78 | i := 0; |
|
- | 79 | while i<n-1 do |
|
- | 80 | begin |
|
- | 81 | a := DotNotationPart(ListGetElement(oid^.SubIds, i)); |
|
- | 82 | b := DotNotationPart(ListGetElement(oid^.SubIds, i+1)); |
|
- | 83 | if CompareOID(a, b) > 0 then |
|
- | 84 | begin |
|
- | 85 | ListSwapElement(oid^.SubIds, i, i+1); |
|
- | 86 | end; |
|
- | 87 | Inc(i); |
|
- | 88 | end; |
|
- | 89 | Dec(n); |
|
- | 90 | end; |
|
- | 91 | end; |
|
- | 92 | ||
70 | procedure WriteOidFile(filename: string; oid: POid); |
93 | procedure WriteOidFile(filename: string; oid: POid); |
71 | var |
94 | var |
72 | f: Text; |
95 | f: Text; |
73 | i: integer; |
96 | i: integer; |
74 | lines: PStringList; |
97 | lines: PStringList; |
Line 82... | Line 105... | ||
82 | 105 | ||
83 | WriteLn(f,'SELF' + oid^.FileId + oid^.DotNotation); |
106 | WriteLn(f,'SELF' + oid^.FileId + oid^.DotNotation); |
84 | 107 | ||
85 | WriteLn(f,'SUPR' + oid^.Parent); |
108 | WriteLn(f,'SUPR' + oid^.Parent); |
86 | 109 | ||
- | 110 | (* Sort sub IDs *) |
|
- | 111 | BubbleSortSubIds(oid); |
|
87 | for i := 0 to ListCount(oid^.SubIds)-1 do |
112 | for i := 0 to ListCount(oid^.SubIds)-1 do |
88 | begin |
113 | begin |
89 | sTmp := ListGetElement(oid^.SubIds, i); |
114 | sTmp := ListGetElement(oid^.SubIds, i); |
90 | WriteLn(f, 'CHLD' + sTmp); |
115 | WriteLn(f, 'CHLD' + sTmp); |
91 | end; |
116 | end; |
Line 160... | Line 185... | ||
160 | begin |
185 | begin |
161 | oid^.Description := oid^.Description + line + #13#10; |
186 | oid^.Description := oid^.Description + line + #13#10; |
162 | end; |
187 | end; |
163 | end; |
188 | end; |
164 | 189 | ||
- | 190 | (* Sort sub IDs *) |
|
- | 191 | BubbleSortSubIds(oid); |
|
- | 192 | ||
165 | (* Remove last CRLF *) |
193 | (* Remove last CRLF *) |
166 | oid^.Description := Copy(oid^.Description, 1, Length(oid^.Description)-Length(#13#10)); |
194 | oid^.Description := Copy(oid^.Description, 1, Length(oid^.Description)-Length(#13#10)); |
167 | 195 | ||
168 | (* Check if something is not correct *) |
196 | (* Check if something is not correct *) |
169 | if (version <> WANT_VERS) or (oid^.FileId = '') then |
197 | if (version <> WANT_VERS) or (oid^.FileId = '') then |