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

Function COB_print_buffer

src/gpre/languages/cob.cpp:642–780  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

640//
641
642void COB_print_buffer(TEXT* output_bufferL,
643 bool function_call)
644{
645 TEXT s[80];
646 bool open_quote = false;
647 bool single_quote = false;
648 bool save_open_quote;
649 bool save_single_quote;
650 USHORT max_line;
651
652 if (isAnsiCobol(gpreGlob.sw_cob_dialect))
653 max_line = 72;
654 else
655 max_line = 79;
656
657 TEXT* p = s;
658
659 for (const TEXT* q = output_bufferL; *q; q++)
660 {
661 *p++ = *q;
662
663 // If we have a single or double quote, toggle the
664 // quote switch and indicate single or double quote
665 if (*q == '\"')
666 {
667 open_quote = !open_quote;
668 single_quote = false;
669 }
670 else if (*q == '\'')
671 {
672 open_quote = !open_quote;
673 single_quote = true;
674 }
675
676 if ((p - s) > max_line)
677 {
678 const TEXT* tempq = q;
679 save_open_quote = open_quote;
680 save_single_quote = single_quote;
681 if (function_call)
682 {
683 // Back up until we reach a comma
684 for (p--; (p > s); p--, q--)
685 {
686 if (p[1] == '\"' || p[1] == '\'')
687 {
688 // If we have a single or double quote, toggle the
689 // quote switch and indicate single or double quote
690 open_quote = !open_quote;
691 if (open_quote)
692 single_quote = (p[1] == '\'');
693 else
694 single_quote = false;
695 }
696 if (!open_quote && *p == ',')
697 break;
698 }
699 // if p == s, this is a call with no commas. back up to a blank

Callers 15

PATTERN_expandFunction · 0.85
COB_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

Calls 1

isAnsiCobolFunction · 0.85

Tested by

no test coverage detected