Tesseract  3.02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
chartoname.h File Reference

Go to the source code of this file.

Functions

void chartoname (register char *name, char c, const char *dir)

Function Documentation

void chartoname ( register char *  name,
char  c,
const char *  dir 
)

Definition at line 16 of file chartoname.cpp.

{ /*directory to use */
char file[3]; /*filename */
int index; /*index of namelist */
static const char *namelist[] = {
"!bang",
"\"doubleq",
"#hash",
"$dollar",
"%percent",
"&and",
"'quote",
"(lround",
")rround",
"*asterisk",
"+plus",
",comma",
"-minus",
".dot",
"/slash",
":colon",
";semic",
"<less",
"=equal",
">greater",
"?question",
"@at",
"[lsquare",
"\\backsl",
"]rsquare",
"^uparr",
"_unders",
"`grave",
"{lbrace",
"|bar",
"}rbrace",
"~tilde"
};
strcpy(name, dir); /*add specific directory */
for (index = 0; index < sizeof namelist / sizeof (char *)
&& c != namelist[index][0]; index++);
if (index < sizeof namelist / sizeof (char *))
/*add text name */
strcat (name, &namelist[index][1]);
else {
if (isupper (c)) {
file[0] = 'c'; /*direct a-z or A-Z */
file[1] = c; /*direct a-z or A-Z */
file[2] = '\0';
}
else {
file[0] = c; /*direct a-z or A-Z */
file[1] = '\0';
}
strcat(name, file); /*append filename */
}
}