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

Function gen_event_init

src/gpre/languages/cob.cpp:2285–2349  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2283//
2284
2285static void gen_event_init( const act* action)
2286{
2287#ifdef GIVING_SUPPORTED
2288 const TEXT *pattern1 =
2289 "CALL \"%S1\" USING %RF%S4%N1A%RE, %RF%S4%N1B%RE, %VF%N2%VE, %RF%S6%RE GIVING %S4%N1L";
2290#else
2291 const TEXT *pattern1 =
2292 "CALL \"%S1\" USING %RF%S4%N1A%RE, %RF%S4%N1B%RE, %VF%N2%VE, %RF%S6%RE, %RF%S4%N1L%RE";
2293#endif
2294 const TEXT *pattern2 =
2295 "CALL \"%S2\" USING %V1, %RF%DH%RE, %VF%S4%N1L%VE, %VF%S4%N1A%VE, %VF%S4%N1B%VE";
2296 const TEXT *pattern3 =
2297 "CALL \"%S3\" USING %S5, %VF%S4%N1L%VE, %VF%S4%N1A%VE, %VF%S4%N1B%VE";
2298
2299 const gpre_nod* init = (gpre_nod*) action->act_object;
2300 const gpre_nod* event_list = init->nod_arg[1];
2301
2302 const SSHORT column = static_cast<SSHORT>(strlen(names[COLUMN]));
2303
2304 PAT args;
2305 args.pat_database = (gpre_dbb*) init->nod_arg[3];
2306 args.pat_vector1 = status_vector(action);
2307 args.pat_value1 = (int) (IPTR) init->nod_arg[2];
2308 args.pat_value2 = (int) event_list->nod_count;
2309 args.pat_string1 = ISC_EVENT_BLOCK;
2310 args.pat_string2 = ISC_EVENT_WAIT;
2311 args.pat_string3 = ISC_EVENT_COUNTS;
2312 args.pat_string4 = names[isc_a_pos];
2313 args.pat_string5 = names[ISC_EVENTS_VECTOR];
2314 args.pat_string6 = names[ISC_EVENT_NAMES_VECTOR];
2315
2316 // generate call to dynamically generate event blocks
2317
2318 TEXT variable[MAX_REF_SIZE];
2319 const gpre_nod *const *ptr, *const *end;
2320 SSHORT count;
2321 for (ptr = event_list->nod_arg, count = 0, end = ptr + event_list->nod_count; ptr < end; ptr++)
2322 {
2323 count++;
2324 const gpre_nod* node = *ptr;
2325 if (node->nod_type == nod_field)
2326 {
2327 const ref* reference = (ref*) node->nod_arg[0];
2328 gen_name(variable, reference, true);
2329 printa(names[COLUMN], false, "MOVE %s TO %s(%d)", variable, names[ISC_EVENT_NAMES2], count);
2330 }
2331 else
2332 printa(names[COLUMN], false, "MOVE %s TO %s(%d)",
2333 (TEXT *) node->nod_arg[0], names[ISC_EVENT_NAMES2], count);
2334
2335 printa(names[COLUMN], true, EVENT_MOVE_TEMPLATE, ISC_BADDRESS,
2336 names[ISC_EVENT_NAMES2], count, names[ISC_EVENT_NAMES], count);
2337 }
2338
2339 PATTERN_expand(column, pattern1, &args);
2340
2341 // generate actual call to event_wait
2342

Callers 1

COB_actionFunction · 0.70

Calls 5

PATTERN_expandFunction · 0.85
status_vectorFunction · 0.70
gen_nameFunction · 0.70
printaFunction · 0.70
set_sqlcodeFunction · 0.70

Tested by

no test coverage detected