


{$P-}
{$M+}
{$E+}


PROGRAM Mock;

   TYPE STR255   = STRING[255];
        C_STRING = PACKED ARRAY [ 1..81 ] OF CHAR;
        C_STR255 = PACKED ARRAY [ 1..256 ] OF CHAR;

(*****************************************************************************
 *                                                                           *
 *                          { STRING FUNCTIONS }                             *
 *                                                                           *
 *****************************************************************************)

   PROCEDURE LeftStr ( source : STR255; n : INTEGER; VAR dest : STR255 );
      BEGIN
          IF n < 0 THEN n := 1;
          IF n > LENGTH(source) THEN n := LENGTH(source);
          dest := COPY ( source,1,n )
      END;

   PROCEDURE RightStr ( source : STR255; n : INTEGER; VAR dest : STR255 );
      BEGIN
          IF n < 0 THEN n := 1;
          IF n > LENGTH(source) THEN n := LENGTH(source);
          dest := COPY ( source,LENGTH(source)-n+1,n )
      END;

   PROCEDURE MidStr ( source : STR255; start,n : INTEGER; VAR dest : STR255 );
      BEGIN
          IF start+n-1 > LENGTH(source) THEN dest := ''
          ELSE dest := COPY ( source,start,n );
      END;

   PROCEDURE StringStr ( replicant : STR255; n : INTEGER; VAR dest : STR255 );
      BEGIN
          IF n < 0 THEN n := 0;
          IF n > 255 THEN n := 255;
          dest := '';
          WHILE LENGTH ( dest ) < n DO
              dest := CONCAT ( dest,replicant );
      END;

PROCEDURE Pascal_To_C ( p_s : STR255; VAR c_s : C_STRING );
   VAR i   : INTEGER;
   BEGIN
       FOR i := 1 TO LENGTH ( p_s ) DO
           c_s[i] := p_s[i];
       c_s[LENGTH(p_s)+1] := CHR(0);
   END;

PROCEDURE C_To_Pascal ( c_s : C_STRING; VAR p_s : STRING );
   VAR i   : INTEGER;
   BEGIN
       p_s := '';
       i := 1;
       WHILE c_s[i] <> CHR(0) DO BEGIN
           p_s := CONCAT ( p_s,c_s[i] );
           i := i+1;
       END;
   END;


BEGIN
END.
