| 1850 | // |
| 1851 | |
| 1852 | static void gen_event_wait( const act* action, int column) |
| 1853 | { |
| 1854 | const TEXT* pattern1 = "%S1 (%V1, %RF%DH, gds__%N1l, gds__%N1a, gds__%N1b);"; |
| 1855 | const TEXT* pattern2 = "%S2 (gds__events, gds__%N1l, gds__%N1a, gds__%N1b);"; |
| 1856 | |
| 1857 | if (action->act_error) |
| 1858 | begin(column); |
| 1859 | begin(column); |
| 1860 | |
| 1861 | gpre_sym* event_name = (gpre_sym*) action->act_object; |
| 1862 | |
| 1863 | // go through the stack of gpreGlob.events, checking to see if the |
| 1864 | // event has been initialized and getting the event identifier |
| 1865 | |
| 1866 | const gpre_dbb* database = NULL; |
| 1867 | int ident = -1; |
| 1868 | for (gpre_lls* stack_ptr = gpreGlob.events; stack_ptr; stack_ptr = stack_ptr->lls_next) |
| 1869 | { |
| 1870 | const act* event_action = (const act*) stack_ptr->lls_object; |
| 1871 | gpre_nod* event_init = (gpre_nod*) event_action->act_object; |
| 1872 | gpre_sym* stack_name = (gpre_sym*) event_init->nod_arg[0]; |
| 1873 | if (!strcmp(event_name->sym_string, stack_name->sym_string)) |
| 1874 | { |
| 1875 | ident = (int)(IPTR) event_init->nod_arg[2]; |
| 1876 | database = (gpre_dbb*) event_init->nod_arg[3]; |
| 1877 | } |
| 1878 | } |
| 1879 | |
| 1880 | if (ident < 0) |
| 1881 | { |
| 1882 | TEXT s[64]; |
| 1883 | sprintf(s, "event handle \"%s\" not found", event_name->sym_string); |
| 1884 | CPR_error(s); |
| 1885 | return; |
| 1886 | } |
| 1887 | |
| 1888 | PAT args; |
| 1889 | args.pat_database = database; |
| 1890 | args.pat_vector1 = status_vector(action); |
| 1891 | args.pat_value1 = ident; |
| 1892 | args.pat_string1 = GDS_EVENT_WAIT; |
| 1893 | args.pat_string2 = GDS_EVENT_COUNTS; |
| 1894 | |
| 1895 | // generate calls to wait on the event and to fill out the gpreGlob.events array |
| 1896 | |
| 1897 | PATTERN_expand(column, pattern1, &args); |
| 1898 | PATTERN_expand(column, pattern2, &args); |
| 1899 | |
| 1900 | if (action->act_error) |
| 1901 | endp(column); |
| 1902 | set_sqlcode(action, column); |
| 1903 | } |
| 1904 | |
| 1905 | |
| 1906 | //____________________________________________________________ |
no test coverage detected