Leptonica
1.54
|
Классы | |
struct | L_GenAssoc |
Макросы | |
#define | TEMPLATE1 "stringtemplate1.txt" /* for assembling autogen.*.c */ |
#define | TEMPLATE2 "stringtemplate2.txt" /* for assembling autogen.*.h */ |
Функции | |
static l_int32 | l_getIndexFromType (const char *type, l_int32 *pindex) |
static l_int32 | l_getIndexFromStructname (const char *sn, l_int32 *pindex) |
static l_int32 | l_getIndexFromFile (const char *file, l_int32 *pindex) |
static char * | l_genDataString (const char *filein, l_int32 ifunc) |
static char * | l_genCaseString (l_int32 ifunc, l_int32 itype) |
static char * | l_genDescrString (const char *filein, l_int32 ifunc, l_int32 itype) |
L_STRCODE * | strcodeCreate (l_int32 fileno) |
static void | strcodeDestroy (L_STRCODE **pstrcode) |
l_int32 | strcodeCreateFromFile (const char *filein, l_int32 fileno, const char *outdir) |
l_int32 | strcodeGenerate (L_STRCODE *strcode, const char *filein, const char *type) |
l_int32 | strcodeFinalize (L_STRCODE **pstrcode, const char *outdir) |
l_int32 | l_getStructnameFromFile (const char *filename, char **psn) |
Переменные | |
static const l_int32 | l_ntypes = 20 |
static struct L_GenAssoc | l_assoc [] |
#define TEMPLATE1 "stringtemplate1.txt" /* for assembling autogen.*.c */ |
#define TEMPLATE2 "stringtemplate2.txt" /* for assembling autogen.*.h */ |
static char * l_genCaseString | ( | l_int32 | ifunc, |
l_int32 | itype | ||
) | [static] |
Input: ifunc (index into set of functions in generated file) itype (index into type of function to be used) Return: case string for this decoding function
Notes: (1) and have been validated, so no error can occur
static char * l_genDataString | ( | const char * | filein, |
l_int32 | ifunc | ||
) | [static] |
Input: filein (input file of serialized data) ifunc (index into set of functions in output file) Return: encoded ascii data string, or null on error reading from file
static char * l_genDescrString | ( | const char * | filein, |
l_int32 | ifunc, | ||
l_int32 | itype | ||
) | [static] |
Input: filein (input file of serialized data) ifunc (index into set of functions in generated file) itype (index into type of function to be used) Return: description string for this decoding function
static l_int32 l_getIndexFromFile | ( | const char * | filename, |
l_int32 * | pindex | ||
) | [static] |
Input: filename &index (<return>) Return: 0 if found, 1 on error.
static l_int32 l_getIndexFromStructname | ( | const char * | sn, |
l_int32 * | pindex | ||
) | [static] |
Input: structname (e.g., "Pixa") &index (<return>) Return: 0 if found, 1 if not.
Notes: (1) This is used to identify the type of serialized file; the first word in the file is the structname. (2) For valid structname, == true and > 0.
static l_int32 l_getIndexFromType | ( | const char * | type, |
l_int32 * | pindex | ||
) | [static] |
Input: type (e.g., "PIXA") &index (<return>) Return: 0 if found, 1 if not.
Notes: (1) For valid type, == true and > 0.
l_int32 l_getStructnameFromFile | ( | const char * | filename, |
char ** | psn | ||
) |
Input: filename &sn (<return> structname; e.g., "Pixa") Return: 0 if found, 1 on error.
L_STRCODE* strcodeCreate | ( | l_int32 | fileno | ) |
Input: fileno (integer that labels the two output files) Return: initialized L_StrCode, or null on error
Notes: (1) This struct exists to build two files containing code for any number of data objects. The two files are named autogen.<fileno>.c autogen.<fileno>.h
l_int32 strcodeCreateFromFile | ( | const char * | filein, |
l_int32 | fileno, | ||
const char * | outdir | ||
) |
Input: filein (containing filenames of serialized data) fileno (integer that labels the two output files) outdir (<optional> if null, files are made in /tmp/lept/auto) Return: 0 if OK, 1 on error
Notes: (1) The has one filename on each line. Comment lines begin with "#". (2) The output is 2 files: autogen.<fileno>.c autogen.<fileno>.h
static void strcodeDestroy | ( | L_STRCODE ** | pstrcode | ) | [static] |
Input: &strcode (strcode is set to null after destroying the sarrays) Return: void
l_int32 strcodeFinalize | ( | L_STRCODE ** | pstrcode, |
const char * | outdir | ||
) |
Input: &strcode (destroys after .c and .h files have been generated) outdir (<optional> if null, files are made in /tmp/lept/auto) Return: void
l_int32 strcodeGenerate | ( | L_STRCODE * | strcode, |
const char * | filein, | ||
const char * | type | ||
) |
Input: strcode (for accumulating data) filein (input file with serialized data) type (of data; use the typedef string) Return: 0 if OK, 1 on error.
Notes: (1) The generated function name is l_autodecode_<fileno>() where <fileno> is the index label for the pair of output files. (2) To deserialize this data, the function is called with the argument 'ifunc', which increments each time strcodeGenerate() is called.
struct L_GenAssoc l_assoc[] [static] |
{ {0, "INVALID", "invalid", "invalid" }, {1, "BOXA", "Boxa", "boxaRead" }, {2, "BOXAA", "Boxaa", "boxaaRead" }, {3, "L_DEWARP", "Dewarp", "dewarpRead" }, {4, "L_DEWARPA", "Dewarpa", "dewarpaRead" }, {5, "L_DNA", "L_Dna", "l_dnaRead" }, {6, "L_DNAA", "L_Dnaa", "l_dnaaRead" }, {7, "DPIX", "DPix", "dpixRead" }, {8, "FPIX", "FPix", "fpixRead" }, {9, "NUMA", "Numa", "numaRead" }, {10, "NUMAA", "Numaa", "numaaRead" }, {11, "PIX", "Pix", "pixRead" }, {12, "PIXA", "Pixa", "pixaRead" }, {13, "PIXAA", "Pixaa", "pixaaRead" }, {14, "PIXACOMP", "Pixacomp", "pixacompRead" }, {15, "PIXCMAP", "Pixcmap", "pixcmapRead" }, {16, "PTA", "Pta", "ptaRead" }, {17, "PTAA", "Ptaa", "ptaaRead" }, {18, "RECOG", "Recog", "recogRead" }, {19, "RECOGA", "Recoga", "recogaRead" }, {20, "SARRAY", "Sarray", "sarrayRead" } }