Rev 739 | Rev 743 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 739 | Rev 740 | ||
---|---|---|---|
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); |
70 | procedure ListBubbleSortSubIds(oid: POid); |
71 | var |
71 | var |
72 | n, i: integer; |
72 | n, i: integer; |
73 | a, b: string; |
73 | a, b: string; |
- | 74 | swapped: boolean; |
|
74 | begin |
75 | begin |
75 | n := ListCount(oid^.SubIds); |
76 | n := ListCount(oid^.SubIds); |
76 | while n>1 do |
77 | while n>1 do |
77 | begin |
78 | begin |
78 | i := 0; |
79 | i := 0; |
- | 80 | swapped := false; |
|
79 | while i<n-1 do |
81 | while i<n-1 do |
80 | begin |
82 | begin |
81 | a := DotNotationPart(ListGetElement(oid^.SubIds, i)); |
83 | a := DotNotationPart(ListGetElement(oid^.SubIds, i)); |
82 | b := DotNotationPart(ListGetElement(oid^.SubIds, i+1)); |
84 | b := DotNotationPart(ListGetElement(oid^.SubIds, i+1)); |
83 | if CompareOID(a, b) > 0 then |
85 | if CompareOID(a, b) > 0 then |
84 | begin |
86 | begin |
85 | ListSwapElement(oid^.SubIds, i, i+1); |
87 | ListSwapElement(oid^.SubIds, i, i+1); |
- | 88 | swapped := true; |
|
86 | end; |
89 | end; |
87 | Inc(i); |
90 | Inc(i); |
88 | end; |
91 | end; |
- | 92 | if not swapped then break; |
|
89 | Dec(n); |
93 | Dec(n); |
90 | end; |
94 | end; |
91 | end; |
95 | end; |
92 | 96 | ||
93 | procedure WriteOidFile(filename: string; oid: POid); |
97 | procedure WriteOidFile(filename: string; oid: POid); |
Line 106... | Line 110... | ||
106 | WriteLn(f,'SELF' + oid^.FileId + oid^.DotNotation); |
110 | WriteLn(f, 'SELF' + oid^.FileId + oid^.DotNotation); |
107 | 111 | ||
108 | WriteLn(f,'SUPR' + oid^.Parent); |
112 | WriteLn(f, 'SUPR' + oid^.Parent); |
109 | 113 | ||
110 | (* Sort sub IDs *) |
114 | (* Sort sub IDs *) |
111 | BubbleSortSubIds(oid); |
115 | ListBubbleSortSubIds(oid); |
- | 116 | ||
112 | for i := 0 to ListCount(oid^.SubIds)-1 do |
117 | for i := 0 to ListCount(oid^.SubIds)-1 do |
113 | begin |
118 | begin |
114 | sTmp := ListGetElement(oid^.SubIds, i); |
119 | sTmp := ListGetElement(oid^.SubIds, i); |
115 | WriteLn(f, 'CHLD' + sTmp); |
120 | WriteLn(f, 'CHLD' + sTmp); |
116 | end; |
121 | end; |
Line 186... | Line 191... | ||
186 | oid^.Description := oid^.Description + line + #13#10; |
191 | oid^.Description := oid^.Description + line + #13#10; |
187 | end; |
192 | end; |
188 | end; |
193 | end; |
189 | 194 | ||
190 | (* Sort sub IDs *) |
195 | (* Sort sub IDs *) |
191 | BubbleSortSubIds(oid); |
196 | ListBubbleSortSubIds(oid); |
192 | 197 | ||
193 | (* Remove last CRLF *) |
198 | (* Remove last CRLF *) |
194 | oid^.Description := Copy(oid^.Description, 1, Length(oid^.Description)-Length(#13#10)); |
199 | oid^.Description := Copy(oid^.Description, 1, Length(oid^.Description)-Length(#13#10)); |
195 | 200 | ||
196 | (* Check if something is not correct *) |
201 | (* Check if something is not correct *) |