static void _php_ibase_event_block(ibase_db_link *ib_link, unsigned short count, /* {{{ */ char **events, unsigned short *l, char **event_buf, char **result_buf) { ISC_STATUS dummy_result[20]; unsigned long dummy_count[15]; /** * Unfortunately, there's no clean and portable way in C to pass arguments to * a variadic function if you don't know the number of arguments at compile time. * (And even if there were a way, the Interbase API doesn't provide a version of * this function that takes a va_list as an argument) * * In this case, the number of arguments is limited to 18 by the underlying API, * so we can work around it. */ *l = (unsigned short) isc_event_block(event_buf, result_buf, count, events[0], events[1], events[2], events[3], events[4], events[5], events[6], events[7], events[8], events[9], events[10], events[11], events[12], events[13], events[14]); /** * Currently, this is the only way to correctly initialize an event buffer. * This is clearly something that should be fixed, cause the semantics of * isc_wait_for_event() indicate that it blocks until an event occurs. * If the Firebird people ever fix this, these lines should be removed, * otherwise, events will have to fire twice before ibase_wait_event() returns. */ isc_wait_for_event(dummy_result, &ib_link->handle, *l, *event_buf, *result_buf); isc_event_counts(dummy_count, *l, *event_buf, *result_buf); }
ISC_STATUS API_ROUTINE gds__event_wait(ISC_STATUS * status_vector, FB_API_HANDLE* db_handle, SSHORT events_length, const UCHAR* events, UCHAR* events_update) { return isc_wait_for_event(status_vector, db_handle, events_length, events, events_update); }
EXPORT RM_ENTRY(rmc_wait_for_event) { ClearParamPool(); ISC_STATUS *stat = AllocStatusPool(); isc_wait_for_event(stat, (isc_db_handle *)arg_vector[1].a_address, (short)*CobolToShort(&arg_vector[2]), (ISC_UCHAR *)*(char **)arg_vector[3].a_address, (ISC_UCHAR *)*(char **)arg_vector[4].a_address); StatusToCobol(&arg_vector[0], stat); return (0); }