littletest10.out

来自「格式化源码的最新板」· OUT 代码 · 共 66 行

OUT
66
字号
unit LittleTest10;

{ AFS 6 July 2003
 This unit compiles but is not semantically meaningfull
 it is test cases for the code formatting utility

 example code submitted by Marcus Fuchs }


interface

uses SysUtils;

function BinToHex(const sBin: string): string;

implementation

uses Math, Classes;

function BinToHex(const sBin: string): string;
var
  ex: extended;
begin
  ex := Power(2, Length('12345'));
  ex := Power(2, Pos('2', '12345'));
end;

function StreamReadln(Source: TStream): string;

  function StreamReadChar(Source: TStream): char;
  begin
    if Source.Read(Result, Sizeof(char)) = 0 then
      Result := #26; // end of file
  end;

var
  bufsize, charsRead: integer;
  ch: char;
begin
  bufsize   := 255;
  charsRead := 0;
  SetLength(Result, bufsize);
  repeat
    ch := StreamReadChar(Source);
    case ch of
      #13: if StreamReadChar(Source) <> #10 then
          Source.Seek(-1, soFromCurrent);
      #10: ch := #13;
      #26:
      begin
        ch := #13;
        Source.Seek(0, soFromEnd);
      end;
      else
      begin
          // ...
      end;{else}
    end;{case}
  until (ch = #13);
  SetLength(Result, charsRead);
end;



end.

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?