MCPcopy Create free account
hub / github.com/TASEmulators/fceux / readKeyValuePair

Method readKeyValuePair

src/ld65dbg.cpp:155–238  ·  view source on GitHub ↗

---------------------------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

153 }
154 //---------------------------------------------------------------------------------------------------
155 int database::dbgLine::readKeyValuePair( char *keyValueBuffer, size_t keyValueBufferSize )
156 {
157 int charsRead = 0;
158 size_t i,j;
159 bool isStringLiteral = false;
160
161 i=readPtr; j=0;
162 if ( buf[i] != 0 )
163 {
164 while (isspace(buf[i])) i++;
165
166 if ( isalpha(buf[i]) || (buf[i] == '_') )
167 {
168 while ( isalnum(buf[i]) || (buf[i] == '_') )
169 {
170 if (j < keyValueBufferSize)
171 {
172 keyValueBuffer[j] = buf[i]; j++;
173 }
174 i++;
175 }
176 }
177 else if (buf[i] != 0)
178 {
179 if (j < keyValueBufferSize)
180 {
181 keyValueBuffer[j] = buf[i]; j++;
182 }
183 i++;
184 }
185
186 while (isspace(buf[i])) i++;
187 }
188
189 if ( buf[i] == '=' )
190 {
191 if (j < keyValueBufferSize)
192 {
193 keyValueBuffer[j] = buf[i]; j++;
194 }
195 i++;
196
197 while (isspace(buf[i])) i++;
198
199 while ( buf[i] != 0 )
200 {
201 if ( !isStringLiteral && buf[i] == ',' )
202 {
203 break;
204 }
205 else if ( buf[i] == '\"' )
206 {
207 isStringLiteral = !isStringLiteral;
208 }
209 else
210 {
211 if (j < keyValueBufferSize)
212 {

Callers 1

dbgFileLoadMethod · 0.80

Calls 1

isspaceClass · 0.85

Tested by

no test coverage detected