/* Copyright (c) 1995 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 REPEAT GENERIC (REPEAT_graphic WHEN (GRAPHIC, *), REPEAT_char WHEN (CHARACTER, *), REPEAT_bit WHEN (BIT, *), REPEAT_char WHEN (*, *) ); /* This function procedure returns TIMES+1 copies of the character string STRING, joined */ /* together. */ REPEAT_char: PROCEDURE (String_arg, Times) RETURNS (CHARACTER (32767) VARYING ); /* INCOMING: String_arg = the character string to be copied; */ /* Times = the number of copies required. */ DECLARE String_arg CHARACTER (*) VARYING; DECLARE Times FIXED BINARY (31); DECLARE S (MAX(Times+1, 1) ) CHARACTER (LENGTH(String_arg)); DECLARE STRING BUILTIN; S = String_arg; RETURN (STRING (S) ); END REPEAT_char; /* This function procedure returns TIMES+1 copies of the graphic string STRING, joined */ /* together. */ REPEAT_graphic: PROCEDURE (String_arg, Times) RETURNS (GRAPHIC (16383) VARYING ); /* INCOMING: STRING = the character string to be copied; */ /* TIMES = the number of copies required. */ DECLARE String_arg GRAPHIC (*) VARYING; DECLARE Times FIXED BINARY (31); DECLARE S (MAX(Times+1, 1) ) CHARACTER (LENGTH(String_arg)); DECLARE STRING BUILTIN; S = String_arg; RETURN (STRING (S) ); END REPEAT_graphic; /* This function procedure returns TIMES+1 copies of the bit string STRING, joined together. */ REPEAT_bit: PROCEDURE (String_arg, Times) RETURNS (BIT (4095) VARYING ); /* INCOMING: String_arg = the bit string to be copied. */ /* Times = the number of copies required. */ DECLARE String_arg BIT (*) VARYING; DECLARE Times FIXED BINARY (31); DECLARE S (MAX(Times+1, 1) ) CHARACTER (LENGTH(String_arg)); DECLARE STRING BUILTIN; S = String_arg; RETURN (STRING (S) ); END REPEAT_bit;