/* ***************************************************************************** * * * Copyright 1978 Compaq Computer Corporation * * * * Compaq and the Compaq logo Registered in U.S. Patent and Trademark Office.* * * * Confidential computer software. Valid license from Compaq required for * * possession, use or copying. Consistent with FAR 12.211 and 12.212, * * Commercial Computer Software, Computer Software Documentation, and * * Technical Data for Commercial Items are licensed to the U.S. Government * * under vendors standard commercial license. * * * ***************************************************************************** * FACILITY: SDL * * ABSTRACT: This module converts a string according to the replacement * rules supplied. It expands out such characters as ' to '' * which some languages may require in their strings. * * ENVIRONMENT: VAX/VMS * * AUTHOR: P. Goodwin * * CREATION DATE: 11-Jan-1988 * * MODIFIED BY: */ /* C H A N G E L O G Date ! Name ! Description ________________!_______!______________________________________________________ | | ________________|_______|______________________________________________________ 8-Dec-2000 | LJK | EV1-65 Change copyright notice to Compaq format. ________________|_______|______________________________________________________ * **/ /** * FUNCTIONAL DESCRIPTION: SDL$CVTSTR * * Takes a string and expands out special characters * * * FORMAL PARAMETERS: * * inbuf input buffer * outbuf output buffer * cvtstr convert string in the format 'xyy' where x is the * character to look for, yy is the replacement. For example * in CC, '"' is replaced by '\"' so xyy is '"\"'. * * IMPLICIT INPUTS: * * None. * * IMPLICIT OUTPUTS: * * None. * * ROUTINE VALUE: * COMPLETION CODES: * * None. * */ sdl$cvtstr: proc (inbuf, outbuf, cvtstr) options(ident('X3.2-0')); dcl inbuf char(128) var; /* input string */ dcl outbuf char(128) var; /* output string */ dcl cvtstr char(128) var; /* conversion rules */ dcl (i,j) fixed bin; /* indexes into input string and conversion rules */ dcl flag fixed bin(1); /* to say if conversion has occured */ /* empty the output string */ outbuf=''; /* step along input string */ do i=1 to length(inbuf) by 1; flag = 0; /* step along conversion rules, which are packed in groups of three characters */ do j=1 to length(cvtstr) by 3; /* does the input match the current conversion character? */ if substr(inbuf,i,1) = substr(cvtstr,j,1) then do; /* there is a match, set the flag, and output the converted characters */ flag = 1; outbuf = outbuf || substr(cvtstr,j+1,2); end; end; /* if there was no match at all, pass the input straight to the output */ if flag = 0 then outbuf = outbuf || substr(inbuf,i,1); end; end;