X-Git-Url: https://deadsoftware.ru/gitweb?p=cpc.git;a=blobdiff_plain;f=src%2Fgeneric%2FDsw%2FMod%2FCompilerCPfrontMain.cp;h=1043752445d50c7e03409a631a72ea42eb61c16e;hp=bf5bb1b69fe186c12fb0be1219f6378b9a762f68;hb=738684e6c2f1f191e6bd359507f0398a66e46868;hpb=b90cbbdc859d9aa7436fe5a6e5ae1fc3d76965d1 diff --git a/src/generic/Dsw/Mod/CompilerCPfrontMain.cp b/src/generic/Dsw/Mod/CompilerCPfrontMain.cp index bf5bb1b..1043752 100644 --- a/src/generic/Dsw/Mod/CompilerCPfrontMain.cp +++ b/src/generic/Dsw/Mod/CompilerCPfrontMain.cp @@ -299,44 +299,28 @@ MODULE DswCompilerCPfrontMain; 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; - x: POINTER TO ARRAY OF BYTE; num: ARRAY 32 OF CHAR; BEGIN - src := NIL; 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 + 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 ");