diff --git a/src/generic/Dsw/Mod/CompilerCPfrontMain.cp b/src/generic/Dsw/Mod/CompilerCPfrontMain.cp
index bf5bb1b69fe186c12fb0be1219f6378b9a762f68..1043752445d50c7e03409a631a72ea42eb61c16e 100644 (file)
PROCEDURE ReadText (s: Elem): POINTER TO ARRAY OF CHAR;
VAR
PROCEDURE ReadText (s: Elem): POINTER TO ARRAY OF CHAR;
VAR
- i, len, res: INTEGER;
- text: DswDocuments.Text;
- loc: Files.Locator; f: Files.File; r: Files.Reader;
- ssrc: POINTER TO ARRAY OF SHORTCHAR;
+ i, res: INTEGER;
+ m: DswDocuments.Model;
+ r: DswDocuments.Reader;
+ loc: Files.Locator;
src: POINTER TO ARRAY OF CHAR;
src: POINTER TO ARRAY OF CHAR;
- x: POINTER TO ARRAY OF BYTE;
num: ARRAY 32 OF CHAR;
BEGIN
num: ARRAY 32 OF CHAR;
BEGIN
- src := NIL;
loc := Files.dir.This(s.dir);
loc := Files.dir.This(s.dir);
- DswDocuments.Import(loc, s.name, text, res);
- Strings.IntToString(res, num);
- IF res = 0 THEN
- src := text.t
- ELSIF res = 2 THEN
- f := Files.dir.Old(loc, s.name, Files.shared);
- IF f # NIL THEN
- len := f.Length();
- r := f.NewReader(NIL);
- NEW(x, len + 1);
- r.ReadBytes(x, 0, len);
- NEW(ssrc, len + 1);
- FOR i := 0 TO len - 1 DO
- ssrc[i] := SHORT(CHR(x[i]))
- END;
- ssrc[i] := 0X;
- x := NIL;
- NEW(src, len + 1);
- Kernel.Utf8ToString(ssrc, src, res);
- ssrc := NIL;
- f.Close
- END
- ELSE
- IF DevCPM.verbose > 0 THEN
- Console.WriteStr("document error ");
- Console.WriteStr(num);
- Console.WriteLn
+ DswDocuments.Open(loc, s.name, m, res);
+ IF m # NIL THEN
+ r := m.NewReader(NIL);
+ NEW(src, m.Length() + 1);
+ IF src # NIL THEN
+ FOR i := 0 TO m.Length() - 1 DO
+ r.Read; src[i] := r.char
+ END
END
END
+ ELSIF DevCPM.verbose > 0 THEN
+ Strings.IntToString(res, num);
+ Console.WriteStr("document error ");
+ Console.WriteStr(num);
+ Console.WriteLn
END;
IF src = NIL THEN
Console.WriteStr("unable to open file ");
END;
IF src = NIL THEN
Console.WriteStr("unable to open file ");