TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: Ivan Todoroski
from: David Noon
date: 1999-01-16 17:11:04
subject: Pl/I

In a message dated 01-15-99, Ivan Todoroski said to David Noon about "Pl/I"

Hi Ivan,

 DN> infer it is the filename of an input file) you will not be able to
 DN> get back to your original data in Pascal.

IT>  I agree with your point. If the filename had a couple consecutive
IT>  spaces in it, then there would be no way to reconstruct it from the
IT>  ParamStr() fragments. I tried even enclosing the parameter in quotes
IT>  and Turbo Pascal still split them at the white-space :( Don't know if
IT>  any OS/2 native Pascal compilers handles this correctly...

The SpeedSoft compilers are very Borland-compatible. ... :-(

IT>  I also see some similarities between PL/I and REXX you mentioned in
IT>  that earlier message about PL/I. The designers of REXX practically
IT>  ripped off the translate() function from PL/I :)

Mike Cowlishaw was a PL/I programmer for some years when he first designed
REXX. He has said that TRANSLATE() was taken directly from PL/I, with the
addition of being able to omit both the 2nd and 3rd parameters [implying
uppercase translation].

IT>  But I was wondering if there is some PL/I equivalent to REXX's
IT>  xrange(), so that one could avoid typing the translation tables by
IT>  hand?

Not built-in. But read on ...

IT>  In REXX it would simply be:

IT>    say translate(infile, xrange("A","Z"),
xrange("a","z"))

IT>  ignoring for the moment the fact that just translate(infile) without
IT>  the translation tables would uppercase infile by default :)

IT>  Anyway, even if there isn't, I suppose it would be trivial to write
IT>  such a function in PL/I...

=========================== XRANGE.PLI =====================================
 /* Same as REXX's XRANGE() built-in function */
 XRANGE:
 PROC(lb,ub) RETURNS(CHAR(256) VAR) OPTIONS(REENTRANT REORDER);
     DCL  (lb,ub)             CHAR(1) BYVALUE;

     DCL  curr_byte           BIN FIXED(8,0) UNSIGNED,
          result              CHAR(256) VAR INIT(''),
          (BYTE,RANK)         BUILTIN;

     /* Loop through from lower byte to upper byte */
     DO curr_byte = RANK(lb) TO RANK(ub);
          result ||= BYTE(curr_byte);
     END;

     /* Job done */
     RETURN(result);
 END XRANGE;
============================================================================

IT>  And one more thing, does PL/I support variable numbers of parameteres
IT>  like in REXX?

Not like REXX, but like C. The OS/2 compiler uses the same back-end as
Visual Age C++, so many object code issues are handled the same way.

Regards

Dave

___
 * MR/2 2.25 #353 * Bugs come in through open Windows.

--- Maximus/2 3.01
* Origin: DoNoR/2,Woking UK (44-1483-717904) (2:440/4)
SEEN-BY: 396/1 632/0 371 633/260 262 267 270 371 635/444 506 728 639/252
SEEN-BY: 670/218
@PATH: 440/4 255/1 251/25 396/1 633/260 635/506 728 633/267

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.