libubx/ubx.c
void __port_write(const ubx_port_t *port, const ubx_data_t *data)
{
	/* int i; */
	const char *tp;
	ubx_block_t **iaptr;

	if (port == NULL) {
		ERR("port is NULL");
		goto out;
	}

	if ((port->attrs & PORT_DIR_OUT) == 0) {
		ubx_err(port->block, "not an OUT-port");
		goto out;
	};

	if (port->out_type != data->type) {
		tp = get_typename(data);
		ubx_err(port->block,
			"port_write %s: type mismatch: data: %s, port: %s",
			port->name, tp, port->out_type->name);
		goto out;
	}

	/* port completely unconnected? */
	if (port->out_interaction == NULL)
		goto out;

	/* pump it out */
	for (iaptr = port->out_interaction; *iaptr != NULL; iaptr++) {
		if ((*iaptr)->block_state == BLOCK_STATE_ACTIVE) {
			(*iaptr)->write(*iaptr, data);
			(*iaptr)->stat_num_writes++;
		}
	}

	((ubx_port_t *)port)->stat_writes++;

 out:
	return;
}
/**
 * __port_write - write a sample to a port
 * @param port
 * @param data
 *
 * This function will check if the type matches.
 */
write a sample to a port
@param port
@param data

This function will check if the type matches.
write a sample to a port @param port @param data This function will check if the type matches .
void __port_write(const ubx_port_t *port, const ubx_data_t *data)
{
	const char *tp;
	ubx_block_t **iaptr;
	if (port == NULL) {
		ERR("port is NULL");
		goto out;
	}
	if ((port->attrs & PORT_DIR_OUT) == 0) {
		ubx_err(port->block, "not an OUT-port");
		goto out;
	};
	if (port->out_type != data->type) {
		tp = get_typename(data);
		ubx_err(port->block,
			"port_write %s: type mismatch: data: %s, port: %s",
			port->name, tp, port->out_type->name);
		goto out;
	}
	if (port->out_interaction == NULL)
		goto out;
	for (iaptr = port->out_interaction; *iaptr != NULL; iaptr++) {
		if ((*iaptr)->block_state == BLOCK_STATE_ACTIVE) {
			(*iaptr)->write(*iaptr, data);
			(*iaptr)->stat_num_writes++;
		}
	}
	((ubx_port_t *)port)->stat_writes++;
 out:
	return;
}
void __port_write ( const ubx_port_t * port , const ubx_data_t * data ) { const char * tp ; ubx_block_t * * iaptr ; if ( port == NULL ) { ERR ( " " ) ; goto out ; } if ( ( port -> attrs & PORT_DIR_OUT ) == 0 ) { ubx_err ( port -> block , " " ) ; goto out ; } ; if ( port -> out_type != data -> type ) { tp = get_typename ( data ) ; ubx_err ( port -> block , " " , port -> name , tp , port -> out_type -> name ) ; goto out ; } if ( port -> out_interaction == NULL ) goto out ; for ( iaptr = port -> out_interaction ; * iaptr != NULL ; iaptr ++ ) { if ( ( * iaptr ) -> block_state == BLOCK_STATE_ACTIVE ) { ( * iaptr ) -> write ( * iaptr , data ) ; ( * iaptr ) -> stat_num_writes ++ ; } } ( ( ubx_port_t * ) port ) -> stat_writes ++ ; out : return ; }
__port_write - write a sample to a port
 @param port
 @param data
__port_write - write a sample to a port @param port @param data
/* int i; */ /* port completely unconnected? */ /* pump it out */