| 1784 | // |
| 1785 | |
| 1786 | static void gen_event_init( const act* action, int column) |
| 1787 | { |
| 1788 | const TEXT* pattern1 = |
| 1789 | "gds__%N1l := GDS__EVENT_BLOCK_A (%RFgds__%N1a, %RFgds__%N1b, %N2, %RFgds__event_names%RE);"; |
| 1790 | const TEXT* pattern2 = "%S1 (%V1, %RF%DH, gds__%N1l, gds__%N1a, gds__%N1b);"; |
| 1791 | const TEXT* pattern3 = "%S2 (gds__events, gds__%N1l, gds__%N1a, gds__%N1b);"; |
| 1792 | |
| 1793 | if (action->act_error) |
| 1794 | begin(column); |
| 1795 | begin(column); |
| 1796 | |
| 1797 | gpre_nod* init = (gpre_nod*) action->act_object; |
| 1798 | gpre_nod* event_list = init->nod_arg[1]; |
| 1799 | |
| 1800 | PAT args; |
| 1801 | args.pat_database = (gpre_dbb*) init->nod_arg[3]; |
| 1802 | args.pat_vector1 = status_vector(action); |
| 1803 | args.pat_value1 = (int)(IPTR) init->nod_arg[2]; |
| 1804 | args.pat_value2 = (int) event_list->nod_count; |
| 1805 | args.pat_string1 = GDS_EVENT_WAIT; |
| 1806 | args.pat_string2 = GDS_EVENT_COUNTS; |
| 1807 | |
| 1808 | // generate call to dynamically generate event blocks |
| 1809 | |
| 1810 | TEXT variable[MAX_REF_SIZE]; |
| 1811 | gpre_nod** ptr; |
| 1812 | gpre_nod** end; |
| 1813 | SSHORT count; |
| 1814 | for (ptr = event_list->nod_arg, count = 0, end = ptr + event_list->nod_count; ptr < end; ptr++) |
| 1815 | { |
| 1816 | count++; |
| 1817 | const gpre_nod* node = *ptr; |
| 1818 | if (node->nod_type == nod_field) |
| 1819 | { |
| 1820 | const ref* reference = (const ref*) node->nod_arg[0]; |
| 1821 | gen_name(variable, reference, true); |
| 1822 | printa(column, "gds__event_names2[%d] := %s;", count, variable); |
| 1823 | } |
| 1824 | else |
| 1825 | printa(column, "gds__event_names2[%d] := %s;", count, node->nod_arg[0]); |
| 1826 | |
| 1827 | printa(column, "gds__event_names[%d] := %s (gds__event_names2[%d]);", |
| 1828 | count, ISC_BADDRESS, count); |
| 1829 | } |
| 1830 | |
| 1831 | PATTERN_expand(column, pattern1, &args); |
| 1832 | |
| 1833 | // generate actual call to event_wait |
| 1834 | |
| 1835 | PATTERN_expand(column, pattern2, &args); |
| 1836 | |
| 1837 | // get change in event counts, copying event parameter block for reuse |
| 1838 | |
| 1839 | PATTERN_expand(column, pattern3, &args); |
| 1840 | |
| 1841 | if (action->act_error) |
| 1842 | endp(column); |
| 1843 | set_sqlcode(action, column); |
no test coverage detected