Tesseract  3.02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
chartoname.cpp File Reference
#include <string.h>
#include <ctype.h>

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.

18  { /*directory to use */
19  char file[3]; /*filename */
20  int index; /*index of namelist */
21  static const char *namelist[] = {
22  "!bang",
23  "\"doubleq",
24  "#hash",
25  "$dollar",
26  "%percent",
27  "&and",
28  "'quote",
29  "(lround",
30  ")rround",
31  "*asterisk",
32  "+plus",
33  ",comma",
34  "-minus",
35  ".dot",
36  "/slash",
37  ":colon",
38  ";semic",
39  "<less",
40  "=equal",
41  ">greater",
42  "?question",
43  "@at",
44  "[lsquare",
45  "\\backsl",
46  "]rsquare",
47  "^uparr",
48  "_unders",
49  "`grave",
50  "{lbrace",
51  "|bar",
52  "}rbrace",
53  "~tilde"
54  };
55 
56  strcpy(name, dir); /*add specific directory */
57  for (index = 0; index < sizeof namelist / sizeof (char *)
58  && c != namelist[index][0]; index++);
59  if (index < sizeof namelist / sizeof (char *))
60  /*add text name */
61  strcat (name, &namelist[index][1]);
62  else {
63  if (isupper (c)) {
64  file[0] = 'c'; /*direct a-z or A-Z */
65  file[1] = c; /*direct a-z or A-Z */
66  file[2] = '\0';
67  }
68  else {
69  file[0] = c; /*direct a-z or A-Z */
70  file[1] = '\0';
71  }
72  strcat(name, file); /*append filename */
73  }
74 }