home *** CD-ROM | disk | FTP | other *** search
- { =========================================================================== }
- { Strs42.pas - accesses Str procedure for use as a function ver 4.2, 10-01-88 }
- { }
- { Inline code keeps function from having to copy the string twice and thus }
- { increasing speed. Functions save code in the long run. }
- { Copyright (C) 1988 James H. LeMay }
- { =========================================================================== }
-
- UNIT Strs;
-
- INTERFACE
-
- function StrL (L: longint): string;
- function StrLW (L: longint; Width: integer): string;
- function StrR (R: real): string;
- function StrRW (R: real; Width: integer): string;
- function StrRWD (R: real; Width,Decimals: integer): string;
-
-
- IMPLEMENTATION
-
- function StrL; { (L: longint): string; }
- var Result: ^string;
- begin
- Inline( { Typical code: }
- $89/$EC/ { mov sp,bp ; Drop Result }
- $16/ { push ss ; Result segment }
- $FF/$76/$0A); { push [bp+$0A] ; Result offset ($08 for near) }
- str (L,Result^);
- end;
-
- function StrLW; { (L: longint; Width: integer): string; }
- var Result: ^string;
- begin
- Inline ($89/$EC/$16/$FF/$76/$0C);
- str (L:Width,Result^);
- end;
-
- function StrR; { (R: real): string; }
- var Result: ^string;
- begin
- Inline ($89/$EC/$16/$FF/$76/$0C);
- str (R,Result^);
- end;
-
- function StrRW; { (R: real; Width: integer): string; }
- var Result: ^string;
- begin
- Inline ($89/$EC/$16/$FF/$76/$0E);
- str (R:Width,Result^);
- end;
-
- function StrRWD; { (R: real; Width,Decimals: integer): string; }
- var Result: ^string;
- begin
- Inline ($89/$EC/$16/$FF/$76/$10);
- str (R:Width:Decimals,Result^);
- end;
-
- END.