"sorry about the flame"

No offense taken. I'm really just a n00b in perl. On the other hand, I am somewhat more fluent in TeX & friends, so I was assuming that the concept of a TeX property list was immediately clear to everyone. That was wrong.

A property list has three large blocks:

1. The header giving the basic information. This must be kept as is, exept for a line saying CHECKSUM XXX, this must be deleted.

2. A large block beginning with

(LIGTABLE

and ending with

)

on a line of its own. This is where I need to insert some lines.

3. A block beginning with CHARACTER, describing every one of the 256 characters. This must be kept as is.

So block 2 is the interesting part. The data in this block consists of subsections that are always introduced by a line (LABEL XXX). Unofrtunately, the XXX has three different forms:

LABEL O with an octal number;

LABEL C with letters A-Z and a-z (describing the letters of the alphabet) for values between octal 101 and 132 and between octal 141 and 172.

LABEL C with numbers 0-9 (describing the numerals), for values between octal 57 and octal 71.

Any given property list can have any number from 0 to 256 LABEL entries in the LIGTABLE. I.e., some fonts will have huge instructions sets for kerning pairs, adding some rules to almost every LABEL, and some fonts have nothing of that sort, so the LIGTABLE may be completely empty.

I need to insert about 250 additional rules into 53 LABELS of this LIGTABLE. If I try to describe what I need to do, there are three different options:

A. The label already exists; a new instruction needs to be inserted. In that case, everything that was in the original entry must be kept as is, preceded by the new instructions.

B. The entry exists, no new instructions. Everything must be kept as is.

C. The entry does not exist. In that case, create a new entry with the appropriate (LABEL) header and insert at the appropriate position.

If the LABEL does not exist and no new instructions need to be added, of course, nothing needs to be done.

Your flame actually made me realize that the hardest part of what I wanted to do was describe it in a comprehensible manner. So I'm really grateful for your help. But don't spend too much time on it, my 256 if loops are ugly as hell, but they do what I want...


In reply to Re^8: adding lines at specific addresses by pindar
in thread adding lines at specific addresses by pindar

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.