Duplicating a Field

5 views
Skip to first unread message

toolbox

unread,
Jun 15, 2021, 11:44:08 AM6/15/21
to Shoebox/Toolbox Field Linguist's Toolbox
Someone just sent a request for a CC table that can duplicate a field with a different marker.

I dug around and discovered this one. It can process any number of fields at a time. This can be done using a Standard Format export from Toolbox. I recommend choosing the Automatically load output option.

I added some extra comments to clarify matters.

Hmmm, tried three times to post this message with an attachment, so now I'm just inserting the table into the message. I put in the table with most of the comments trimmed out, and with the full comments. Feel free to ask any questions:

In brief (I even trimmed out one of the fields to be duplicated).
c Duplicate a field for later modification

c =============================
group(Main)
c =============================
c This specific example will duplicate 
c \lx with a \ph marker
c \ge with a \phg marker

'\lx ' > dup
         store(mkr) '\ph ' endstore
         store(contents)
         use(EndField)

'\ge ' > dup
         store(mkr) '\phg ' endstore
         store(contents)
         use(EndField)

c =============================
group(EndField)
c =============================
c Wait for the next field
c (or catch the end of the file)

endfile > next
'\' > out(contents)
      out(mkr,contents)
      dup back(1) use(Main)


=========================================================
With full comments:
c Duplicate a field for later modification

c =============================
group(Main)
c =============================
c For the fields to be duplicated
c output the original marker
c store the marker for the duplicated field
c open the store to (begin to) collect the
c contents of the field
c switch to the group EndField to detect
c the end of the field -- the point when
c all the contents are stored

c This specific example will duplicate 
c \lx with a \ph marker
c \se with a \ph marker
c \ge with a \phg marker

'\lx ' > dup
         store(mkr) '\ph ' endstore
         store(contents)
         use(EndField)

'\se ' > dup
         store(mkr) '\ph ' endstore
         store(contents)
         use(EndField)

'\ge ' > dup
         store(mkr) '\phg ' endstore
         store(contents)
         use(EndField)

c =============================
group(EndField)
c =============================
c Wait for the backslash signalling the
c beginning of the marker at the beginning
c of the next field
c (or catch the end of the file)
c Before outputting the backslash
c output the contents of the field that
c was just collected.
c Then create the duplicate field by
c outputting the (new) marker and the
c contents of the original field.
c output the backslash and send it to 
c the Main group.

endfile > next
'\' > out(contents)
      out(mkr,contents)
      dup back(1) use(Main)


Karen
Toolbox Support

Tony Naden

unread,
Jun 15, 2021, 12:07:24 PM6/15/21
to shoeboxtoolbox-fiel...@googlegroups.com
OK, yes, it was the store (mkr) command that I had forgotten or has been added since I tried to learn more than basic find/replace CC.

--
You received this message because you are subscribed to the Google Groups "Shoebox/Toolbox Field Linguist's Toolbox" group.
To unsubscribe from this group and stop receiving emails from it, send an email to shoeboxtoolbox-field-ling...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/shoeboxtoolbox-field-linguists-toolbox/5a67a35e-2dd0-496e-a85b-23c12e70bc03n%40googlegroups.com.


--
Address: "Lost Marbles", 31, Reading Road,
Pangbourne, Berks., RG8 7HY  -

Tel.: 01189842368

Keep us, good Lord,
under the shadow of your mercy
in this time of uncertainty and distress.
Sustain and support the anxious and fearful,
and lift up all who are brought low;
that we may rejoice in your comfort
knowing that nothing can separate us from your love
in Christ Jesus our Lord.
Amen.


ToolBox Support

unread,
Jun 15, 2021, 12:26:10 PM6/15/21
to shoeboxtoolbox-fiel...@googlegroups.com
The store command was part of the original CC, so you must have just forgotten it.

In the original, one could only use numbers, so store(2) instead of store(mkr). Made things really hard to follow!

Karen
Toolbox (and CC) Support


Tony Naden

unread,
Jun 15, 2021, 1:09:31 PM6/15/21
to shoeboxtoolbox-fiel...@googlegroups.com
OK, this is just an ordinary store you name 'mkr'  --  I had the method, will have to find time to practise.

Tony Naden

unread,
Sep 18, 2021, 12:55:12 PM9/18/21
to shoeboxtoolbox-fiel...@googlegroups.com
Finally got to the stage where I needed this and it worked a dream, thanks a bundle!

On Tue, 15 Jun 2021 at 16:44, toolbox <too...@sil.org> wrote:
--
You received this message because you are subscribed to the Google Groups "Shoebox/Toolbox Field Linguist's Toolbox" group.
To unsubscribe from this group and stop receiving emails from it, send an email to shoeboxtoolbox-field-ling...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/shoeboxtoolbox-field-linguists-toolbox/5a67a35e-2dd0-496e-a85b-23c12e70bc03n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages