/* Copyright (c) 1996 by R. A. Vowels, from "Introduction to PL/I, Algorithms, and */
/* Structured Programming". Permission is given to reproduce and to use these procedures */
/* as part of a program, and to include them as part of a larger work to be sold for profit. */
/* However, the user is not permitted to sell the procedures separately. Provided always */
/* that these procedures and this copyright notice are reproduced in full. */
DECLARE COPY GENERIC
(COPY_graphic WHEN (GRAPHIC, *),
COPY_char WHEN (CHARACTER, *),
COPY_bit WHEN (BIT, *),
COPY_char WHEN (*, *) );
/* This function procedure returns TIMES copies of the character string STRING, joined */
/* together. */
COPY_char:
PROCEDURE (STRING, TIMES) RETURNS (CHARACTER (32767) VARYING );
/* INCOMING: STRING = the character string to be copied; */
/* TIMES = the number of copies required. */
DECLARE STRING CHARACTER (*) VARYING;
DECLARE TIMES FIXED BINARY (31);
IF TIMES <= 0 THEN RETURN ( '' );
RETURN (REPEAT (STRING, TIMES-1) );
END COPY_char;
/* This function procedure returns TIMES copies of the graphic string STRING, joined */
/* together. */
COPY_graphic:
PROCEDURE (STRING, TIMES) RETURNS (GRAPHIC (16383) VARYING );
/* INCOMING: STRING = the character string to be copied; */
/* TIMES = the number of copies required. */
DECLARE STRING GRAPHIC (*) VARYING;
DECLARE TIMES FIXED BINARY (31);
IF TIMES <= 0 THEN RETURN ( '' );
RETURN (REPEAT (STRING, TIMES-1) );
END COPY_graphic;
/* This function procedure returns TIMES copies of the bit string STRING, joined together. */
COPY_bit:
PROCEDURE (STRING, TIMES) RETURNS (BIT (4095) VARYING );
/* INCOMING: STRING = the bit string to be copied. */
/* TIMES = the number of copies required. */
DECLARE STRING BIT (*) VARYING;
DECLARE TIMES FIXED BINARY (31);
IF TIMES <= 0 THEN RETURN ( ''B );
RETURN (REPEAT (STRING, TIMES-1) );
END COPY_bit;