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

Function RMC_print_buffer

src/gpre/languages/rmc.cpp:554–685  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

552//
553
554void RMC_print_buffer(TEXT* output_bufferL, bool function_call)
555{
556 TEXT s[80];
557 bool open_quote = false;
558 bool single_quote = false;
559 bool save_open_quote;
560 bool save_single_quote;
561 const int max_line = 72;
562
563 TEXT* p = s;
564
565 for (const TEXT* q = output_bufferL; *q; q++)
566 {
567 *p++ = *q;
568
569 // If we have a single or double quote, toggle the
570 // quote switch and indicate single or double quote
571 if (*q == '\"')
572 {
573 open_quote = !open_quote;
574 single_quote = false;
575 }
576 else if (*q == '\'')
577 {
578 open_quote = !open_quote;
579 single_quote = true;
580 }
581
582 if ((p - s) > max_line)
583 {
584 const TEXT* tempq = q;
585 save_open_quote = open_quote;
586 save_single_quote = single_quote;
587 if (function_call)
588 {
589 // Back up until we reach a comma
590 for (p--; (p > s); p--, q--)
591 {
592 if (p[1] == '\"' || p[1] == '\'')
593 {
594 // If we have a single or double quote, toggle the
595 // quote switch and indicate single or double quote
596 open_quote = !open_quote;
597 if (open_quote)
598 single_quote = (p[1] == '\'');
599 else
600 single_quote = false;
601 }
602 if (!open_quote && *p == ',')
603 break;
604 }
605 // if p == s, this is a call with no commas. back up to a blank
606 if (p == s)
607 {
608 q = tempq;
609 p = s + max_line;
610 open_quote = save_open_quote;
611 single_quote = save_single_quote;

Callers 15

RMC_actionFunction · 0.85
asgn_fromFunction · 0.85
asgn_toFunction · 0.85
asgn_to_procFunction · 0.85
gen_compileFunction · 0.85
gen_create_databaseFunction · 0.85
gen_databaseFunction · 0.85
gen_ddlFunction · 0.85
gen_emodifyFunction · 0.85
gen_get_segmentFunction · 0.85
gen_put_segmentFunction · 0.85
gen_rawFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected