#include "matchdefs.h"
Go to the source code of this file.
void CharToName | ( | CLASS_ID | Char, | |
char | CharName[] | |||
) |
Converts the specified ascii character to a character name.
Char | Character to map to a character name | |
CharName | String to copy character name into |
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.
ILLEGALCHARNAME. |
CharName | Character name to convert to a character |
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