2 The Underlying Data Structure

Every barcode-related function acts on a data structure defined in the barcode.h header, which must be included by any C source file that uses the library. The header is installed by make install.

The definition of the data structure is included here for reference:

struct Barcode_Item {
    int flags;         /* type of encoding and other flags */
    char *ascii;       /* malloced */
    char *partial;     /* malloced too */
    char *textinfo;    /* information about text placement */
    char *encoding;    /* code name, filled by encoding engine */
    int width, height; /* output units */
    int xoff, yoff;    /* output units */
    int margin;        /* output units */
    double scalef;     /* requested scaling for barcode */
    int error;         /* an errno-like value, in case of failure */
};

The exact meaning of each field and the various flags implemented are described in the following sections.

Even though you won’t usually need to act on the contents of this structure, some of the functions in the library receive arguments that are directly related to one or more of these fields.