Example #1
0
File: ant.c Project: taysom/tau
void init_ant (ant_s *ant, ant_caste_s *caste)
{
	zero(*ant);
	init_dq( &ant->a_ants);
	ant->a_caste = caste;
	ant->a_state = ANT_CLEAN;
}
Example #2
0
/*! \fn struct Dequeue* init_dequeue(int size_of_data)
 *  \brief allocate memory to the a new dequeue<br/>
 *  <b> Precondition : The queue structure to which the memory is being allocated should not have been already allocated memory.</b> <br/>
 *  <b> Postcondition : The required memory to represent a dequeue is allocated</b> <br/>
 *  \param size_of_data The size of the data type which the queue will hold
 *  \return a pointer to the allocated memory
 */
struct Dequeue* init_dequeue(int size_of_data)
{
	struct Dequeue *queue = (struct Dequeue *)malloc(sizeof(struct Dequeue));
	queue->queue = init_dq();
	queue->enqueue = x_enqueue;
	queue->dequeue = x_dequeue;
	queue->size_of_data = size_of_data;
	return queue;
}
Example #3
0
int init_msg_tau (const char *name)
{
	key_s	*key;
	unint	i;

	init_tcp(ServerIP);

	strlcpy(Me.pr_name, name, TAU_NAME);

	for (i = MAX_KEYS; i > 0; i--) {
		key = &Me.pr_keys[i];
		*(key_s **)key = Me.pr_top;
		Me.pr_top = key;
	}
	init_dq( &Me.pr_msgq);
	return 0;
}