I'm trying to pass a pointer to a particular structure in an array of
structures. I think I'm doing something wrong!
Here are the structure definitions:
// Define a structure to build a caption line in
struct tCaptionLine{
uint8_t Text[100]; // allow up to 100 characters per line. Max
is really 32 or so, but they may use
to do more than one per line
uint8_t HAlign; // align line to left or right border, or
center it
float VPosition; // position of this line
};
// Define a structure to build the caption in
struct tCaption{
uint32_t SpotNum; // Spot or caption number
uint32_t TimeIn; // How many 4ms periods from start we want to show
this caption
uint32_t TimeOut; // How many 4ms periods from start when we want to
stop showing this caption
uint32_t Duration; // TimeOut minus TimeIn
uint8_t VAlign; // Vertical align to Top, Bottom, or Center
struct tCaptionLine Line[3]; // 3 caption lines
uint8_t state; // Used by ParseXml to keep track of where we are in
parsing input
uint8_t buf[100]; // build strings here in ParseXml
uint8_t index; // Where we'll put the next character into buf in
ParseXml
uint8_t TextLineNum; // which line we're going to put text in to (0..2).
Used in ParseXml
};
Here's an array of the structure:
// Globals
struct tCaption CaptionBuffer[MaxLanguage+1];
Here's a function to initialize each of the structures:
void InitCaptionBuffer(struct tCaption pCaptionBuffer){
// Initializes the buffer, including state, etc.)
ClearCaptionBuffer(pCaptionBuffer); // clear spot number, time in, out,
duration, alignment, and text
pCaptionBuffer.state=0; // initial state
pCaptionBuffer.buf[0]=0; // make input buffer empty
pCaptionBuffer.index=0; // next location in input buffer to be
filled is zero
pCaptionBuffer.TextLineNum=0; // First line of text goes in Line[0]
}
And, here's my call of the initialization function:
uint8_t n;
for(n=0;n