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

Function gen_tpb

src/gpre/c_cxx.cpp:3390–3432  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3388//
3389
3390static void gen_tpb(const tpb* tpb_buffer, int column)
3391{
3392 TEXT buffer[80];
3393 SSHORT length;
3394
3395 printa(column, "static %schar\n", CONST_STR);
3396 column += INDENT;
3397 TEXT* p = buffer;
3398
3399 for (length = 0; length < column; length++)
3400 *p++ = ' ';
3401
3402 sprintf(p, "isc_tpb_%d [%d] = {", tpb_buffer->tpb_ident, tpb_buffer->tpb_length);
3403 while (*p)
3404 p++;
3405
3406 SSHORT tpb_length = tpb_buffer->tpb_length;
3407 const TEXT* text = (TEXT*) tpb_buffer->tpb_string;
3408
3409 while (--tpb_length >= 0)
3410 {
3411 const TEXT c = *text++;
3412 if ((c >= 'A' && c <= 'Z') || c == '$' || c == '_')
3413 sprintf(p, "'%c'", c);
3414 else
3415 sprintf(p, "%d", c);
3416 while (*p)
3417 p++;
3418 if (tpb_length)
3419 *p++ = ',';
3420 if (p - buffer > 60)
3421 {
3422 *p = 0;
3423 fprintf(gpreGlob.out_file, " %s\n", buffer);
3424 p = buffer;
3425 for (length = 0; length < column + INDENT; length++)
3426 *p++ = ' ';
3427 *p = 0;
3428 }
3429 }
3430
3431 fprintf(gpreGlob.out_file, "%s};\n", buffer);
3432}
3433
3434
3435//____________________________________________________________

Callers 1

gen_databaseFunction · 0.70

Calls 1

printaFunction · 0.70

Tested by

no test coverage detected