training/name2char.h File Reference

#include "matchdefs.h"

Go to the source code of this file.

Functions


Function Documentation

void CharToName ( CLASS_ID  Char,
char  CharName[] 
)

Converts the specified ascii character to a character name.

Parameters:
Char Character to map to a character name
CharName String to copy character name into
Note:
Globals:
  • NameList = Lookup table for char to name mapping
This is convenient for representing characters which might have special meaning to operating system shells or other programs (e.g. "*?&><" etc.).
Date:
8/26/89, DSJ, Created.

Definition at line 144 of file name2char.cpp.

References NameList, and NULL.

00147 {
00148    int   i;
00149 
00150    /* look for character in table and return a copy of its name if found */
00151    for ( i = 0; NameList[i] != NULL; i++ )
00152       if ( Char == NameList[i][0] )
00153       {
00154          strcpy ( CharName, &NameList[i][1] );
00155          return;
00156       }
00157 
00158       /* if the character is not in the table, then use it as the name */
00159       CharName[0] = Char;
00160       CharName[1] = 0;
00161 
00162 }// CharToName

CLASS_ID NameToChar ( char  CharName[]  ) 

Converts the specified character name to an ascii character.

Exceptions:
ILLEGALCHARNAME. 

Parameters:
CharName Character name to convert to a character
Note:
Globals:
  • NameList = Lookup table for name to char mapping
Returns:
Ascii character that corresponds to the character name.
Date:
8/26/89, DSJ, Created.

Definition at line 112 of file name2char.cpp.

References DoError(), ILLEGALCHARNAME, NameList, and NULL.

Referenced by SetUpForFloat2Int(), WriteNormProtos(), and WriteProtos().

00114 {
00115    int   i;
00116 
00117    // look for name in table and return character if found
00118    for ( i = 0; NameList[i] != NULL; i++ )
00119       if ( strcmp (CharName, &NameList[i][1]) == 0)
00120          return (NameList[i][0]);
00121    if ( strlen (CharName) == 1 )
00122       return (CharName[0]);   //name is not in table but is a single character
00123    else  //illegal character
00124    {
00125       DoError (ILLEGALCHARNAME, "Illegal character name");
00126       return 0;
00127    }
00128 }// NameToChar


Generated on Wed Feb 28 19:49:27 2007 for Tesseract by  doxygen 1.5.1