编程技巧之表格驱动编程

/* Image format-dependent operations. */ typedef struct { jas_image_t *(*decode)(jas_stream_t *in, char *opts); /* Decode image data from a stream. */ int (*encode)(jas_image_t *image, jas_stream_t *out, char *opts); /* Encode image data to a stream. */ int (*validate)(jas_stream_t *in); /* Determine if stream data is in a particular format. */ } jas_image_fmtops_t; /* Image format information. */ typedef struct { int id; /* The ID for this format. */ char