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

Function gen_blr

src/gpre/obj_cxx.cpp:1091–1163  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1089//
1090
1091static void gen_blr(void* /*user_arg*/, SSHORT /*offset*/, const char* string)
1092{
1093 char line[256];
1094
1095 int indent = 2 * INDENT;
1096 const char* p = string;
1097 while (*p == ' ')
1098 {
1099 p++;
1100 indent++;
1101 }
1102
1103 // Limit indentation to 192 characters
1104
1105 indent = MIN(indent, 192);
1106
1107 bool first_line = true;
1108 int length = static_cast<int>(strlen(p));
1109 do {
1110 const char* q;
1111 if (length + indent > 255)
1112 {
1113 // if we did not find somewhere to break between the 200th and 256th
1114 // character just print out 256 characters
1115
1116 bool open_quote = false;
1117 for (q = p; (q - p + indent) < 255; q++)
1118 {
1119 if ((q - p + indent) > 220 && *q == ',' && !open_quote)
1120 break;
1121 if (*q == '\'' && *(q - 1) != '\\')
1122 open_quote = !open_quote;
1123 }
1124 ++q;
1125 }
1126 else {
1127 q = p + strlen(p);
1128 }
1129
1130 // Replace all occurrences of gds__ (or gds__) with isc_
1131
1132 char* q1 = line;
1133 for (const char* p1 = p; p1 < q;)
1134 {
1135 if ((*q1++ = *p1++) == 'g')
1136 {
1137 if (p1 < q && (*q1++ = *p1++) == 'd')
1138 {
1139 if (p1 < q && (*q1++ = *p1++) == 's')
1140 {
1141 if (p1 < q && (*q1++ = *p1++) == '_')
1142 {
1143 char d = 0;
1144 if (p1 < q && ((d = *p1++) == '_' || d == '$'))
1145 memcpy(q1 - 4, "isc", 3);
1146 else if (d)
1147 *q1++ = d;
1148 }

Callers

nothing calls this directly

Calls 1

printaFunction · 0.70

Tested by

no test coverage detected