| 2089 | // |
| 2090 | |
| 2091 | static void gen_event_wait( const act* action, int column) |
| 2092 | { |
| 2093 | TEXT s[64]; |
| 2094 | const TEXT* pattern1 = "isc_wait_for_event (%V1, &%DH, isc_%L1l, isc_%L1a, isc_%L1b);"; |
| 2095 | const TEXT* pattern2 = "isc_event_counts (isc_events, isc_%L1l, isc_%L1a, isc_%L1b);"; |
| 2096 | |
| 2097 | if (action->act_error) |
| 2098 | begin(column); |
| 2099 | begin(column); |
| 2100 | |
| 2101 | const gpre_sym* event_name = (gpre_sym*) action->act_object; |
| 2102 | |
| 2103 | // go through the stack of gpreGlob.events, checking to see if the |
| 2104 | // event has been initialized and getting the event identifier |
| 2105 | |
| 2106 | const gpre_dbb* database = NULL; |
| 2107 | int ident = -1; |
| 2108 | for (const gpre_lls* stack_ptr = gpreGlob.events; stack_ptr; stack_ptr = stack_ptr->lls_next) |
| 2109 | { |
| 2110 | const act* event_action = (const act*) stack_ptr->lls_object; |
| 2111 | const gpre_nod* event_init = (gpre_nod*) event_action->act_object; |
| 2112 | const gpre_sym* stack_name = (gpre_sym*) event_init->nod_arg[0]; |
| 2113 | if (!strcmp(event_name->sym_string, stack_name->sym_string)) |
| 2114 | { |
| 2115 | ident = (IPTR) event_init->nod_arg[2]; |
| 2116 | database = (gpre_dbb*) event_init->nod_arg[3]; |
| 2117 | } |
| 2118 | } |
| 2119 | |
| 2120 | if (ident < 0) |
| 2121 | { |
| 2122 | sprintf(s, "event handle \"%s\" not found", event_name->sym_string); |
| 2123 | CPR_error(s); |
| 2124 | return; |
| 2125 | } |
| 2126 | |
| 2127 | PAT args; |
| 2128 | args.pat_database = database; |
| 2129 | args.pat_vector1 = status_vector(action); |
| 2130 | args.pat_long1 = ident; |
| 2131 | |
| 2132 | // generate calls to wait on the event and to fill out the gpreGlob.events array |
| 2133 | |
| 2134 | PATTERN_expand((USHORT) column, pattern1, &args); |
| 2135 | PATTERN_expand((USHORT) column, pattern2, &args); |
| 2136 | |
| 2137 | if (action->act_error) |
| 2138 | endp(column); |
| 2139 | set_sqlcode(action, column); |
| 2140 | } |
| 2141 | |
| 2142 | |
| 2143 | //____________________________________________________________ |
no test coverage detected