浏览代码

+ get/putansistring

git-svn-id: branches/usersections@17153 -
florian 14 年之前
父节点
当前提交
e4656050a7
共有 1 个文件被更改,包括 30 次插入0 次删除
  1. 30 0
      compiler/ppu.pas

+ 30 - 0
compiler/ppu.pas

@@ -186,6 +186,8 @@ type
     nr   : byte;
   end;
 
+  { tppufile }
+
   tppufile=class
   private
     f        : file;
@@ -260,6 +262,7 @@ type
     function getaword:aword;
     function  getreal:ppureal;
     function  getstring:string;
+    function  getansistring:ansistring;
     procedure getnormalset(var b);
     procedure getsmallset(var b);
     function  skipuntilentry(untilb:byte):boolean;
@@ -280,6 +283,7 @@ type
     procedure putaword(i:aword);
     procedure putreal(d:ppureal);
     procedure putstring(const s:string);
+    procedure putansistring(const s:ansistring);
     procedure putnormalset(const b);
     procedure putsmallset(const b);
     procedure tempclose;
@@ -789,6 +793,22 @@ begin
 end;
 
 
+function tppufile.getansistring: ansistring;
+var
+  l : longint;
+begin
+  l:=getlongint;
+  if entryidx+l>entry.size then
+   begin
+     error:=true;
+     exit;
+   end;
+  SetLength(Result,l);
+  ReadData(result[1],l);
+  inc(entryidx,l);
+end;
+
+
 procedure tppufile.getsmallset(var b);
 var
   i : longint;
@@ -1131,6 +1151,16 @@ procedure tppufile.putstring(const s:string);
   end;
 
 
+procedure tppufile.putansistring(const s: ansistring);
+  var
+    l : longint;
+  begin
+    l:=length(s);
+    putdata(l,4);
+    putdata(s[1],l);
+  end;
+
+
 procedure tppufile.putsmallset(const b);
   var
     l : longint;