Browse Source

+ TExternalAssembler.AsmWrite(ansistring) (from JVM branch), needed to be
able to write long tasmdirective strings required by AIX target

git-svn-id: trunk@20798 -

Jonas Maebe 13 years ago
parent
commit
7a92d5e912
1 changed files with 53 additions and 0 deletions
  1. 53 0
      compiler/assemble.pas

+ 53 - 0
compiler/assemble.pas

@@ -103,13 +103,17 @@ interface
         Procedure AsmClear;
         Procedure AsmClear;
 
 
         {# Write a string to the assembler file }
         {# Write a string to the assembler file }
+        Procedure AsmWrite(const c:char);
         Procedure AsmWrite(const s:string);
         Procedure AsmWrite(const s:string);
+        Procedure AsmWrite(const s:ansistring);
 
 
         {# Write a string to the assembler file }
         {# Write a string to the assembler file }
         Procedure AsmWritePChar(p:pchar);
         Procedure AsmWritePChar(p:pchar);
 
 
         {# Write a string to the assembler file followed by a new line }
         {# Write a string to the assembler file followed by a new line }
+        Procedure AsmWriteLn(const c:char);
         Procedure AsmWriteLn(const s:string);
         Procedure AsmWriteLn(const s:string);
+        Procedure AsmWriteLn(const s:ansistring);
 
 
         {# Write a new line to the assembler file }
         {# Write a new line to the assembler file }
         Procedure AsmLn;
         Procedure AsmLn;
@@ -455,6 +459,16 @@ Implementation
       end;
       end;
 
 
 
 
+    Procedure TExternalAssembler.AsmWrite(const c: char);
+      begin
+        if OutCnt+1>=AsmOutSize then
+         AsmFlush;
+        OutBuf[OutCnt]:=c;
+        inc(OutCnt);
+        inc(AsmSize);
+      end;
+
+
     Procedure TExternalAssembler.AsmWrite(const s:string);
     Procedure TExternalAssembler.AsmWrite(const s:string);
       begin
       begin
         if OutCnt+length(s)>=AsmOutSize then
         if OutCnt+length(s)>=AsmOutSize then
@@ -465,6 +479,38 @@ Implementation
       end;
       end;
 
 
 
 
+    Procedure TExternalAssembler.AsmWrite(const s:ansistring);
+      var
+        StartIndex, ToWrite: longint;
+      begin
+        if s='' then
+          exit;
+        if OutCnt+length(s)>=AsmOutSize then
+         AsmFlush;
+        StartIndex:=1;
+        ToWrite:=length(s);
+        while ToWrite>AsmOutSize do
+          begin
+            Move(s[StartIndex],OutBuf[OutCnt],AsmOutSize);
+            inc(OutCnt,AsmOutSize);
+            inc(AsmSize,AsmOutSize);
+            AsmFlush;
+            inc(StartIndex,AsmOutSize);
+            dec(ToWrite,AsmOutSize);
+          end;
+        Move(s[StartIndex],OutBuf[OutCnt],ToWrite);
+        inc(OutCnt,ToWrite);
+        inc(AsmSize,ToWrite);
+      end;
+
+
+    procedure TExternalAssembler.AsmWriteLn(const c: char);
+      begin
+        AsmWrite(c);
+        AsmLn;
+      end;
+
+
     Procedure TExternalAssembler.AsmWriteLn(const s:string);
     Procedure TExternalAssembler.AsmWriteLn(const s:string);
       begin
       begin
         AsmWrite(s);
         AsmWrite(s);
@@ -472,6 +518,13 @@ Implementation
       end;
       end;
 
 
 
 
+    Procedure TExternalAssembler.AsmWriteLn(const s: ansistring);
+      begin
+        AsmWrite(s);
+        AsmLn;
+      end;
+
+
     Procedure TExternalAssembler.AsmWritePChar(p:pchar);
     Procedure TExternalAssembler.AsmWritePChar(p:pchar);
       var
       var
         i,j : longint;
         i,j : longint;