#include "name2char.h"
#include "matchdefs.h"
#include "danerror.h"
#include <string.h>
Go to the source code of this file.
#define ILLEGALCHARNAME 6001 |
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Definition at line 26 of file name2char.cpp.
Referenced by NameToChar().
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
NameList [static] |
Character ID (ascii code) to character name mapping.
Definition at line 35 of file name2char.cpp.
Referenced by CharToName(), and NameToChar().