Kaynağa Gözat

+ Added support for octal strings (using &)

michael 23 yıl önce
ebeveyn
işleme
b5717d4dde
2 değiştirilmiş dosya ile 41 ekleme ve 2 silme
  1. 35 1
      rtl/inc/sstrings.inc
  2. 6 1
      rtl/inc/systemh.inc

+ 35 - 1
rtl/inc/sstrings.inc

@@ -258,6 +258,18 @@ begin
    end;
 end;
 
+function octstr(val : longint;cnt : byte) : shortstring;
+var
+  i : longint;
+begin
+  octstr[0]:=char(cnt);
+  for i:=cnt downto 1 do
+   begin
+     octstr[i]:=hextbl[val and 7];
+     val:=val shr 3;
+   end;
+end;
+
 
 function binstr(val : longint;cnt : byte) : shortstring;
 var
@@ -285,6 +297,19 @@ begin
 end;
 
 
+function octstr(val : int64;cnt : byte) : shortstring;
+var
+  i : longint;
+begin
+  octstr[0]:=char(cnt);
+  for i:=cnt downto 1 do
+   begin
+     octstr[i]:=hextbl[val and 7];
+     val:=val shr 3;
+   end;
+end;
+
+
 function binstr(val : int64;cnt : byte) : shortstring;
 var
   i : longint;
@@ -373,6 +398,12 @@ begin
               base:=2;
               inc(code);
             end;
+      '&' : begin
+              Base:=8;
+              repeat
+                inc(code);
+              until (code>=length(s)) or (s[code]<>'0');
+            end;      
      end;
   end;
   InitVal:=code;
@@ -580,7 +611,10 @@ end;
 
 {
   $Log$
-  Revision 1.18  2002-01-24 18:27:06  peter
+  Revision 1.19  2002-08-06 20:53:38  michael
+    + Added support for octal strings (using &)
+
+  Revision 1.18  2002/01/24 18:27:06  peter
     * lowercase() overloaded
 
   Revision 1.17  2001/11/16 15:09:47  jonas

+ 6 - 1
rtl/inc/systemh.inc

@@ -357,8 +357,10 @@ Function  upCase(const s:shortstring):shortstring;
 Function  lowerCase(const s:shortstring):shortstring; overload;
 Function  Space(b:byte):shortstring;
 Function  hexStr(Val:Longint;cnt:byte):shortstring;
+Function  OctStr(Val:Longint;cnt:byte):shortstring;
 Function  binStr(Val:Longint;cnt:byte):shortstring;
 Function  hexStr(Val:int64;cnt:byte):shortstring;
+Function  OctStr(Val:int64;cnt:byte):shortstring;
 Function  binStr(Val:int64;cnt:byte):shortstring;
 
 { Char functions }
@@ -579,7 +581,10 @@ const
 
 {
   $Log$
-  Revision 1.50  2002-07-26 22:46:06  florian
+  Revision 1.51  2002-08-06 20:53:38  michael
+    + Added support for octal strings (using &)
+
+  Revision 1.50  2002/07/26 22:46:06  florian
     * interface of system unit for Linux/PowerPC compiles
 
   Revision 1.49  2002/07/26 21:29:03  florian