Need help - Array with different size elements

Hi all,

I am trying to figure out how to create an array that has elements of different lengths. Each element will contain X/Y coordinates to draw vector characters, and I need to point to any element at random... like this:

static const uint8_t c30[] PROGMEM = { // char 0x30 (0)
    0x14,0x00,0x00,
    0x09,0x1c,0x01,
    0x04,0x18,0x01,
};

static const uint8_t c31[] PROGMEM = { // char 0x31 (1)
    0x14,0x00,0x00,
    0x06,0x18,0x01,
    0x08,0x19,0x01,
    0x0b,0x1c,0x01,
    0x0b,0x07,0x01,
};

static const uint8_t c32[] PROGMEM = { // char 0x32 (2)
    0x14,0x00,0x00,
    0x04,0x17,0x01,
    0x04,0x18,0x01,
    0x05,0x1a,0x01,
    0x06,0x1b,0x01,
    0x08,0x1c,0x01,
    0x03,0x07,0x01,
    0x11,0x07,0x01,
};
//............. etc............

static const uint16_t pointers[] PROGMEM = {
    c30, c31, c32, etc........
};

Note that each set of coordinates (c30, c31, c32, etc...) contain a different number of bytes. The last lines in the code example (pointers) is what I'm trying to do... for example if I do a pgm_read_word (pointers + 0) I want it to point to the first byte in c30, pointers + 1 would point to the first byte in c31, etc... (that is, I want the address of each character set).

I hope I described this correctly. Any ideas how to do this will be appreciated. Thanks!

-- Roger

A series of Iliffe vectors, pointing into a second linear array.

AWOL:
A series of Iliffe vectors, pointing into a second linear array.

Sorry, I have no clue what you mean.

Iliffe vector

Perhaps you could use a STRUCT in place of an array. Or an array of structs if that is needed.

...R

Make the arrays the biggest that you need and use a sentinal, like -1, to signal the end of the array.

How is the renderer (the program that draws the characters) supposed to know how many bytes are in each character representation?

jremington:
How is the renderer (the program that draws the characters) supposed to know how many bytes are in each character representation?

Good question. You can't see it because I hacked out pieces of the table to constrain the size for the example, but each data set ends with 0xFF, 0xFF, 0x00 (which means to the renderer, X=-1, Y=-1, Pen=Up).

AWOL:
A series of Iliffe vectors, pointing into a second linear array.

Isn't that something like the OP was trying to do with his array of pointers?

static const uint16_t pointers PROGMEM = {
c30, c31, c32, etc........
};

Granted, it doesn't work the way I thought it would, and so far, I haven't been able to make an array of pointers that allow me to read bytes from the int arrays. Of course that may be because I have not really looked into reading from PROGMEM.

So, shouldn't an array of pointers to the beginning of each int array be all that's needed to get at the values?

Maybe something long the lines of:

static const uint16_t pointers*[] PROGMEM = {
    c30, c31, c32, etc........
};