Discussion:
Looking for guru on #translate or #xtranslate
(too old to reply)
John Ward
2018-07-24 15:46:41 UTC
Permalink
I need to perform a large update to Clipper code and thought it would be easier to use #translate or #xtranslate.

I have a field I need to change the name on.

I need to change:
dbname1->fieldname1

to:
dbname1->fieldname2

I figure out how to do the simple version and just reference the field name, but I am concerned about the impact.

#xtranslate fieldname1 => fieldname2

Does anyone know the sytnax to include the ">" as part of the translate matchPattern?

This syntax does not work:
#xtranslate '>ownconstate' => '>ownconstat'
mirda
2018-07-24 18:27:49 UTC
Permalink
Post by John Ward
I need to perform a large update to Clipper code and thought it would be easier to use #translate or #xtranslate.
I have a field I need to change the name on.
dbname1->fieldname1
dbname1->fieldname2
I figure out how to do the simple version and just reference the field name, but I am concerned about the impact.
#xtranslate fieldname1 => fieldname2
Does anyone know the sytnax to include the ">" as part of the translate matchPattern?
#xtranslate '>ownconstate' => '>ownconstat'
Hi John!

have you tried with:

#xtranslate dbname1->fieldname1 => dbname1->fieldname2

Regards

Damir
John Ward
2018-07-24 18:35:06 UTC
Permalink
Post by mirda
Post by John Ward
I need to perform a large update to Clipper code and thought it would be easier to use #translate or #xtranslate.
I have a field I need to change the name on.
dbname1->fieldname1
dbname1->fieldname2
I figure out how to do the simple version and just reference the field name, but I am concerned about the impact.
#xtranslate fieldname1 => fieldname2
Does anyone know the sytnax to include the ">" as part of the translate matchPattern?
#xtranslate '>ownconstate' => '>ownconstat'
Hi John!
#xtranslate dbname1->fieldname1 => dbname1->fieldname2
Regards
Damir
Thanks! I do not know why I did not think to try the who thing. It seems to work.

John
lohen
2018-07-24 18:38:55 UTC
Permalink
Hi John,

Be aware that a pp rule cannot start with a match marker (in Harbour it
_can_, not in Clipper), that's a starter
Some operators pose a problem since < and > are also (match/result) marker
delimiters to the pp, but that's easy to circumvent by inserting a \ before
the > or <, although in your case the -> operator is seen as one token by
the pp, so here no \ is needed (yet in the <= and >= operators, because < or
is upfront)
#xtranslate -> fieldname1 => -> fieldname2

is supported; but it's a half measure; also whatever -> fieldname1 will
trigger; moreover, what if your code also contains dbname1 -> ( FIELDPOS(
"fieldname1" ))?

iow, i don't think it's a good idea; a batch search and replace with manual
confirmation from within an editor is much safer

hth,

Frank
I need to perform a large update to Clipper code and thought it would be
easier to use #translate or #xtranslate.
I have a field I need to change the name on.
dbname1->fieldname1
dbname1->fieldname2
I figure out how to do the simple version and just reference the field
name, but I am concerned about the impact.
#xtranslate fieldname1 => fieldname2
Does anyone know the sytnax to include the ">" as part of the translate matchPattern?
#xtranslate '>ownconstate' => '>ownconstat'
s***@gmail.com
2018-08-16 18:29:15 UTC
Permalink
I haven't seen a reference to the PP in over 18 years :-)
lohen
2018-08-16 18:54:50 UTC
Permalink
Post by s***@gmail.com
I haven't seen a reference to the PP in over 18 years :-)
Hi Steve,

fyi, the CA-Clipper pp is at the heart of a transpiler implementation which
converts a proprietary language into pure Clipper (with Class(y)), allowing
that project to redesign the whole CA-Clipper api's into full Object
Oriented syntax; iow, the CA-Clipper pp is tremendously powerful (but it
took years to push it that far)

you're the author to alot of interesting books, which i'm currently
rereading :-)

Perhaps have a visit at my site, the project is called "_o_ceans (for
CA-Clipper)" - a download or two showcase the runtime, and gives the best
results combined with vDosPlus (even for 64bit Windows)

best regards,

Frank
s***@gmail.com
2018-08-16 21:09:24 UTC
Permalink
Frank - yes I am aware of the PP... I did an audio tape series on the subject. I also remember Class(y); although in the new world I wouldn't call it object oriented by any stretch.

Thanks but I apologize up front for my books... it's like the old saying, "It seemed like a good idea at the time"....

Steve

Loading...