MCPcopy Create free account
hub / github.com/GarageGames/Torque3D / add

Method add

Engine/source/console/compiler.cpp:134–169  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

132
133
134U32 CompilerStringTable::add(const char *str, bool caseSens, bool tag)
135{
136 // Is it already in?
137 Entry **walk;
138 for(walk = &list; *walk; walk = &((*walk)->next))
139 {
140 if((*walk)->tag != tag)
141 continue;
142
143 if(caseSens)
144 {
145 if(!dStrcmp((*walk)->string, str))
146 return (*walk)->start;
147 }
148 else
149 {
150 if(!dStricmp((*walk)->string, str))
151 return (*walk)->start;
152 }
153 }
154
155 // Write it out.
156 Entry *newStr = (Entry *) consoleAlloc(sizeof(Entry));
157 *walk = newStr;
158 newStr->next = NULL;
159 newStr->start = totalLen;
160 U32 len = dStrlen(str) + 1;
161 if(tag && len < 7) // alloc space for the numeric tag 1 for tag, 5 for # and 1 for nul
162 len = 7;
163 totalLen += len;
164 newStr->string = (char *) consoleAlloc(len);
165 newStr->len = len;
166 newStr->tag = tag;
167 dStrcpy(newStr->string, str);
168 return newStr->start;
169}
170
171U32 CompilerStringTable::addIntString(U32 value)
172{

Callers 8

setCurVarNameCreateMethod · 0.45
execMethod · 0.45
compileSTEtoCodeFunction · 0.45
precompileIdentFunction · 0.45
compileMethod · 0.45
addVariableEntryFunction · 0.45
getAddVariableEntryFunction · 0.45
getAddLocalVariableEntryFunction · 0.45

Calls 5

dStricmpFunction · 0.85
consoleAllocFunction · 0.85
dStrcpyFunction · 0.85
dStrcmpFunction · 0.50
dStrlenFunction · 0.50

Tested by

no test coverage detected