12.5.1 LINEDEF Structure

To obtain a pointer to the first LINEDEF structure in the linked list, multiply the value of the ppLineDef member in the current SEGDEF structure by 16, as follows:

pLineDef = (LINEDEF *)(pBuf + (pSegDef->ppLineDef * 16));

Each LINEDEF structure (except the last) contains a pointer to the next LINEDEF structure in the linked list. The pointer in the last LINEDEF structure is zero.

The LINEDEF structure for each line definition has the following form:

typedef struct {
    WORD ppNextLine;      /* ptr to next linedef (0 if last) */
    WORD wReserved1;      /* reserved                        */
    WORD pLines;          /* pointer to line numbers         */
    WORD wReserved2;      /* reserved                        */
    int  cLines;          /* count of line numbers           */
    BYTE cbFileName;      /* filename length                 */
    char achFileName[1];  /* filename (contains lines)       */
} LINEDEF;

Following are the members of the LINEDEF structure:

ppNextLine

Specifies the offset from the beginning of the file to the next LINEDEF structure in the chain. Multiply the value of the ppNextLine member by 16 to obtain the offset. If this member is zero, there is no line-number information for this segment.

wReserved1

Reserved.

pLines

Specifies the offset from the beginning of the current LINEDEF structure to the array of line-information structures.

wReserved2

Reserved.

cLines

Specifies the number of lines in the line-information array.

cbFileName

Specifies the number of characters in the name of the source file. This file was compiled and linked to produce the map file.

achFileName

Specifies a variable-length array of characters containing the name of the source file. The name is not null-terminated.