#include <stdio.h> #include "mpe.h" void CLOG_cput( ptr ) double **ptr;This function moves records from one of the three buffers being merged intothe output buffer. When the output buffer is filled, it is sent to theparent. A separate output routine handles output on the root. If the inputbuffer is emptied (endblock record is read) and corresponds to a child, a newbuffer is received from the child. When an endlog record is read on the inputbuffer, the number of sources is decremented and the time is set to positiveinfinity so that the empty input source will never have the lowest time.
At entry we assume that *p is pointing to a log record that is not anend-of-block record, and that outbuf is pointing to a buffer that hasroom in it for the record. We ensure that these conditions are met onexit as well, by sending (or writing, if we are the root) and receivingblocks as necessary.