[comp.lang.pascal] String formatting function needed

tomm@tekig5.TEK.COM (Tom Milligan) (08/26/87)

Greetings,

	I am looking for a Pascal implementation of a string formatting 
function.  It should have functionality similar to the "sprintf" function 
available to "C" programmers.  Does any such implementation exist?  If I 
get any responses, I will post a summary to the net.

			Thanks,

			Tom Milligan
			tektronix!tekig5!tomm

			

agnew@trwrc.UUCP (R.A. Agnew) (09/04/87)

In article <1833@tekig5.TEK.COM> tomm@tekig5.TEK.COM (Tom Milligan) writes:
>
>	I am looking for a Pascal implementation of a string formatting 
>function.  It should have functionality similar to the "sprintf" function 
>			
I have written a very extensive dynamically allocated string package
for Green Hills Pascal, Sun/Berkeley Pascal, and Ada. It utilizes many
of the built-in Unix c functions, including sprintf, by just declaring
them external to a compatible type. The following is part of Strings.h

type
    string16 = packed array[1..16] of char; (* This is a dummy def *)
    String = ^string16;


  function  strlen(S: String): integer; external;
  function  strcpy(S1, S2: String): String; external;
  function  strcmp(S1, S2: String): integer; external;
  function  strcat(S1, S2: String): String; external;
  function  strsave(S: String): String; external;
  function  atol(s: String): integer; external;
  function  atof(s: String): real; external;
  function  gets(s: String): String; external;
  function  malloc(size: integer): String; external;
  function  realloc(S: String; size: integer): String; external;
  function  free(S: String): String; external;
  function  printf(s: String): integer; external;
  function  sprintf(S, format: String; n: integer): String; external;
  function  eprintf(s: String): integer; external;