MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / compile

Function compile

src/common/sdl.cpp:309–469  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

307
308
309static const UCHAR* compile(const UCHAR* sdl, sdl_arg* arg)
310{
311/**************************************
312 *
313 * c o m p i l e
314 *
315 **************************************
316 *
317 * Functional description
318 * Compile an SDL element. If the address of the argument block
319 * is null, parse, but do not generate anything.
320 *
321 **************************************/
322 SLONG n, count, variable, value, sdl_operator = 0;
323 IPTR* label;
324 const UCHAR* expressions[MAX_ARRAY_DIMENSIONS];
325 const UCHAR** expr;
326
327#define STUFF(word, arg) if (!stuff ((IPTR) word, arg)) return NULL
328#define COMPILE(p, arg) if (!(p = compile (p, arg))) return NULL
329
330 const UCHAR* ptr1;
331 const UCHAR* p = sdl;
332
333 UCHAR op = *p++;
334 switch (op)
335 {
336 case isc_sdl_do1:
337 case isc_sdl_do2:
338 case isc_sdl_do3:
339 variable = *p++;
340 if (op == isc_sdl_do1)
341 ptr1 = NULL;
342 else
343 {
344 ptr1 = p;
345 COMPILE(p, 0); // skip over lower bound
346 }
347 COMPILE(p, arg); // upper bound
348 if (op == isc_sdl_do3) {
349 COMPILE(p, arg); // increment
350 }
351 else
352 {
353 STUFF(op_literal, arg);
354 STUFF(1, arg);
355 }
356 if (ptr1) {
357 COMPILE(ptr1, arg); // initial value
358 }
359 else
360 {
361 STUFF(op_literal, arg); // default initial value
362 STUFF(1, arg);
363 }
364 STUFF(op_loop, arg);
365 if (!(label = stuff(op_iterate, arg)))
366 return NULL;

Callers 2

CMP_post_rseFunction · 0.85
SDL_walkFunction · 0.85

Calls 4

stuffFunction · 0.85
GdsClass · 0.85
NumClass · 0.85
errorFunction · 0.70

Tested by

no test coverage detected