Subversion Repositories oidplus

Rev

Rev 740 | Rev 744 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 740 Rev 743
Line 26... Line 26...
26
  end;
26
  end;
27
 
27
 
28
procedure CreateOidDef(var oid: POid);
28
procedure CreateOidDef(var oid: POid);
29
procedure FreeOidDef(oid: POid);
29
procedure FreeOidDef(oid: POid);
30
procedure ClearOidDef(oid: POid);
30
procedure ClearOidDef(oid: POid);
31
procedure WriteOidFile(filename: string; oid: POid);
31
function WriteOidFile(filename: string; oid: POid): boolean;
32
procedure ReadOidFile(filename: string; oid: POid);
32
function ReadOidFile(filename: string; oid: POid): boolean;
33
 
33
 
34
(* For the fields "SubIds" and "Parent" *)
34
(* For the fields "SubIds" and "Parent" *)
35
function FileIdPart(s: string): string;
35
function FileIdPart(s: string): string;
36
function DotNotationPart(s: string): string;
36
function DotNotationPart(s: string): string;
37
 
37
 
Line 92... Line 92...
92
    if not swapped then break;
92
    if not swapped then break;
93
    Dec(n);
93
    Dec(n);
94
  end;
94
  end;
95
end;
95
end;
96
 
96
 
97
procedure WriteOidFile(filename: string; oid: POid);
97
function WriteOidFile(filename: string; oid: POid): boolean;
98
var
98
var
99
  f: Text;
99
  f: Text;
100
  i: integer;
100
  i: integer;
101
  lines: PStringList;
101
  lines: PStringList;
102
  sTmp: string;
102
  sTmp: string;
103
  desc: string;
103
  desc: string;
104
begin
104
begin
105
  Assign(f, filename);
105
  Assign(f, filename);
-
 
106
 
-
 
107
  {$I-}
106
  Rewrite(f);
108
  Rewrite(f);
-
 
109
  {$I+}
-
 
110
  if IoResult <> 0 then
-
 
111
  begin
-
 
112
    WriteOidFile := false;
-
 
113
    (* Must not call Close(f) if file was never opened *)
-
 
114
    Exit;
-
 
115
  end;
107
 
116
 
108
  WriteLn(f, 'VERS' + WANT_VERS);
117
  WriteLn(f, 'VERS' + WANT_VERS);
109
 
118
 
110
  WriteLn(f, 'SELF' + oid^.FileId + oid^.DotNotation);
119
  WriteLn(f, 'SELF' + oid^.FileId + oid^.DotNotation);
111
 
120
 
Line 138... Line 147...
138
    end;
147
    end;
139
    FreeList(lines);
148
    FreeList(lines);
140
  end;
149
  end;
141
 
150
 
142
  Close(f);
151
  Close(f);
-
 
152
 
-
 
153
  WriteOidFile := true;
143
end;
154
end;
144
 
155
 
145
procedure ReadOidFile(filename: string; oid: POid);
156
function ReadOidFile(filename: string; oid: POid): boolean;
146
var
157
var
147
  f: Text;
158
  f: Text;
148
  line, cmd: string;
159
  line, cmd: string;
149
  version: string;
160
  version: string;
150
begin
161
begin
151
  ClearOidDef(oid);
162
  ClearOidDef(oid);
152
  version := '';
163
  version := '';
153
 
164
 
154
  Assign(f, filename);
165
  Assign(f, filename);
-
 
166
  {$I-}
155
  Reset(f);
167
  Reset(f);
-
 
168
  {$I+}
-
 
169
  if IoResult <> 0 then
-
 
170
  begin
-
 
171
    ReadOidFile := false;
-
 
172
    (* Must not call Close(f) if file was never opened *)
-
 
173
    Exit;
-
 
174
  end;
-
 
175
 
156
  while not EOF(f) do
176
  while not EOF(f) do
157
  begin
177
  begin
158
    ReadLn(f, line);
178
    ReadLn(f, line);
159
    cmd := Copy(line,1,4);
179
    cmd := Copy(line,1,4);
160
    Delete(line,1,4);
180
    Delete(line,1,4);
Line 204... Line 224...
204
    (* Invalidate everything *)
224
    (* Invalidate everything *)
205
    ClearOidDef(oid);
225
    ClearOidDef(oid);
206
  end;
226
  end;
207
 
227
 
208
  Close(f);
228
  Close(f);
-
 
229
 
-
 
230
  ReadOidFile := true;
209
end;
231
end;
210
 
232
 
211
function FileIdPart(s: string): string;
233
function FileIdPart(s: string): string;
212
begin
234
begin
213
  FileIdPart := Copy(s,1,8);
235
  FileIdPart := Copy(s,1,8);