There is functionality in ooRexx that I'd like to make use of.
But it's not exactly a superset, because some things don't work quite
the same in ooRexx as they do in Regina.
Has someone compiled a list of "gotchas" I'd hit when migrating?
I have hundreds of programs, and I'd want to make mass changes rather
than find each problem individually.
I'm not looking for all the things oo can do that Regina can't.
I'd just like to see what oo does differently and what Regina (with
all the BIFFs enabled) does that would have to be rewritten for oo.
I can't remember what gotcha I found on my own, but it was
sufficiently pervasive in my programs that I put off migrating. That
was some years ago, and it's time for me to reconsider.
Has someone compiled a list of "gotchas" I'd hit when migrating?
On Sun, 10 Dec 2017 19:14:22 -0500, Arthur T. wrote:
Has someone compiled a list of "gotchas" I'd hit when migrating?
Back in 2012 in message <Z9KdnUeXgrAIcb7NnZ2dnUVZ_tOdnZ2d@bestweb.net> I wrote:
[There's just] one substantial incompatibility: When a stem is assigned
to another stem, in Object Rexx the entire stem object is assigned
rather than just the default value. To make your code compatible, you
need to put the value being assigned into an expression that will cause
it to be evaluated as a string. The simplest way is to concatenate it
with the null string:
x. = y.'' /* x. = y. would assign the stem object in Object Rexx */
z. = f(x)'' /* f(x) *might* return a stem object in Object Rexx */
The one other incompatibility you might run into, depending on what Rexx version you've been using, is the line comment syntax. ooRexx takes
"--" and anything following it as a comment. If you build expressions
for INTERPRET and need to allow for subtracting negative numbers, you'll
have to be sure to pad your minus signs with blanks:
Say 2 - - 2 /* says 4 */
Say 2--2 /* says 2 in ooRexx */
¬R
[There's just] one substantial incompatibility: When a stem is
assigned to another stem, in Object Rexx the entire stem object is
assigned rather than just the default value.
The one other incompatibility you might run into, depending on what Rexx >version you've been using, is the line comment syntax. ooRexx takes
"--" and anything following it as a comment.
wondering if it might have been a difference in (or availability of)
one of the REGUTIL (REXXUTIL) functions.
Error 43.1: Could not find routine "REGSTEMREAD"
And, sure enough, the documentation doesn't show any of the
REGxxx functions.
On Tue, 19 Dec 2017 20:15:35 -0500, Arthur T. wrote:
wondering if it might have been a difference in (or availability of)
one of the REGUTIL (REXXUTIL) functions.
That would definitely make sense. My comments were just about the
language itself.
Oh, here we go, your message <brgj28tbasscv9vlqddjfr2u8id389aste@4ax.com> >from the same thread points out the Regina-specific functions in RegUtil:
I see four more under Stem Manipulation Routines:
RegMultiStemSort
RegStemDoOver
RegStemRead
RegStemWrite
RegStemSearch
I wonder if anyone's gone through and written drop-in replacement ooRexx >routines.
In the SourceForge forum, I see later discussion of some limitations in >SysFileSearch and SysFileTree:
https://sourceforge.net/p/oorexx/discussion/408478/thread/c2fd1bca/
In Message-ID:<0ccm4ddn48b65psqul8hnph8o0md82plgo@4ax.com>,
Glenn Knickerbocker <NotR@bestweb.net> wrote:
On Tue, 19 Dec 2017 20:15:35 -0500, Arthur T. wrote:
wondering if it might have been a difference in (or availability of)
one of the REGUTIL (REXXUTIL) functions.
That would definitely make sense. My comments were just about the
language itself.
Oh, here we go, your message <brgj28tbasscv9vlqddjfr2u8id389aste@4ax.com> >>from the same thread points out the Regina-specific functions in RegUtil:
Wow. You found a 5-year-old message of mine that I had
forgotten I posted. Thank you. I knew that the differences
mentioned earlier were not the ones that hit me.
<snip>
I see four more under Stem Manipulation Routines:
RegMultiStemSort
RegStemDoOver
RegStemRead
RegStemWrite
RegStemSearch
I wonder if anyone's gone through and written drop-in replacement ooRexx
routines.
At first I thought I could look at writing external REXX
programs to perform some of these functions in order to give me
source-level compatibility. Experiment shows that Regina uses the
function package routine when there's an external routine of the same
name.
But then there's the problem of passing the stems back and
forth. That might be a problem. If there's a macro capability in
ooRexx, I might be able to cobble something.
In the SourceForge forum, I see later discussion of some limitations in
SysFileSearch and SysFileTree:
https://sourceforge.net/p/oorexx/discussion/408478/thread/c2fd1bca/
It's late. I will follow that link later.
Don't forget that ooRexx has the USE ARG keyword that will allow you to
pass objects (stems) to a function/subroutine which can then modify
them. A great addition to Rexx that doesn't directly involve OO concepts.
On 1/3/2018 9:50 AM, Gil Barmwater wrote:
Don't forget that ooRexx has the USE ARG keyword that will allow you to
pass objects (stems) to a function/subroutine which can then modify
them. A great addition to Rexx that doesn't directly involve OO concepts.
I was thinking that would make drop-in replacements easy, but then I saw
the problem: The RegUtil routines are just passed variable *names*, not variable references. As external routines, they wouldn't have access to
the caller's variables to resolve the references to find the stem
objects to read and update. And even USE ARG doesn't help any for
updating string variables in the caller. Since string objects are
immutable, there's no way for the called routine to update the string
that the caller's variable points to.
So the drop-in replacements would have to be (or at least have
front-end) internal routines copied into every program. And since they
don't know the variable names until they parse the argument, they can't
use PROCEDURE EXPOSE to expose just the variables they need, so they'd
have to reserve space in .local for their own variables.
Here's a quick pass at one. The local variable names make it look much messier than it really is:
RegStemWrite:
.local~regUtil.stem = Value(Arg(1))
.local~regUtil.array = .array~new
Do .local~regUtil.i = 1 to .regUtil.stem[0]
.regUtil.array~put(.regUtil.stem[.regUtil.i], .regUtil.i)
End
Return .stream~new(Arg(2))~arrayOut(.regUtil.array)
In this case a stub for an external routine actually wouldn't need any
local variables:
RegstemWrite:
Return 'StemWrite'(Value(Arg(1)), Arg(2))
The back-end routine would access the caller's stem with USE ARG:
::routine StemWrite
Use Arg stem, filename
array = .array~new
Do i = 1 to stem[0]
.array~put(stem[i], i)
End
Return .stream~new(filename)~arrayOut(array)
Stubs for RegStemRead and RegStemDoOver, though, would need to copy
strings set or returned by their back-end routines, something like:
RegStemRead:
.local~regUtil.rc = 'StemRead'(Value(Arg(1)), Arg(2))
If Arg(3, 'E') Then Call Value Arg(3), .regUtil.minLen
If Arg(4, 'E') Then Call Value Arg(4), .regUtil.maxLen
Return .regUtil.rc
RegStemDoOver:
If Arg(3, 'E') Then
.local~regUtil.rc = 'StemDoOver'(Value(Arg(1)), Value(Arg(3)))
Else .regUtil.rc = 'StemDoOver'(Value(Arg(1)))
If .regUtil.rc Then Call Value Arg(2), .regUtil.doIndex
Return .regUtil.rc
One thing that's not clear from the doc is whether the stem name may or
must include the dot for all these routines. In the examples for RegStemDoOver it does, but in the example for RegStemSearch it doesn't.
¬R
I'm not sure I followed all of that as I'm not a user of RegUtil but I
sense that you may not be aware that Use Arg even works with external >routines!
I'm not sure I followed all of that as I'm not a user of RegUtil but I
sense that you may not be aware that Use Arg even works with external routines!
use arg filein, stem.
On 1/5/2018 2:43 PM, Arthur T. wrote:
use arg filein, stem.
Anyhow, my main point above is that this will work only when your call
looks like:
Call RegStemRead file, stem.
and not when it looks like:
Call RegStemRead file, 'STEM.'
or:
stemname = 'STEM.'
Call RegStemRead file, stemname
However, I do often pass the filename as a literal. I guess
I'll need to do a PARSE ARG for the filename and a USE ARG for the
stemname.
I'm trying to use the ooRexx executable without having to change
my existing (Regina) programs. So there's no need for arrays in the >subroutine. (I thought there would be, but I also thought there
would be a non-loop way of reading and writing a file.)
do i = 1
stem.i = linein(filein)
end
On Fri, 05 Jan 2018 19:07:54 -0500, Arthur T. wrote:<snip rest>
However, I do often pass the filename as a literal. I guess
I'll need to do a PARSE ARG for the filename and a USE ARG for the >>stemname.
Nope! USE ARG is fine for *reading* strings from the caller. It's just
not any help in *updating* string variables.
On Fri, 05 Jan 2018 14:43:27 -0500, Arthur T. wrote:
I'm trying to use the ooRexx executable without having to change
my existing (Regina) programs. So there's no need for arrays in the >>subroutine. (I thought there would be, but I also thought there
would be a non-loop way of reading and writing a file.)
Arrays are what the Stream class uses in providing that non-loop way.
Instead of this loop:
do i = 1
stem.i = linein(filein)
end
you can read the whole file into an array in one instruction:
array = .stream~new(filein)~arrayIn
then load that array into your stem:
stem.~putAll(array)
and put the count in stem.0:
stem.0 = array~items
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 113 |
Nodes: | 8 (1 / 7) |
Uptime: | 146:26:41 |
Calls: | 2,504 |
Calls today: | 1 |
Files: | 8,700 |
Messages: | 1,928,536 |