Beispiel #1
0
int main()
{

    int array[6] = {2, 4, 6. , 8, 10, 12};
    node *head = create_link_list_by_array(array, 6);
    print_link_list(head);
    
    LRU_insert(&head, 1024);
    print_link_list(head);
    
    int ret = LRU_access_one_node(&head, 12);
    printf("the ret flag %d.\n", ret);
    print_link_list(head);
    
}
void print_link_list(Azimuth_hash *list)
{
  if (list == NULL) {
	printf("\n");
	return;
  }
  printf("ray# %d azim %f, hi# %d lo# %d|", list->ray->h.ray_num, list->ray->h.azimuth, list->ray_high->ray->h.ray_num, list->ray_low->ray->h.ray_num);
  print_link_list(list->next);
}
node* revers_link_list(node* head)
{
	print_link_list(head);
	node* pre = NULL;
	node* pnext = NULL;
	while (head != NULL)
	{
		pnext = head->next;
		head->next = pre;
		pre = head;
		head = pnext;
	}
	return pre;
}
void print_hash_table (Sweep *s)
{
  int i;
  int sweep_index;
  Azimuth_hash *index;
  float azim;
  float res;

  if (s == NULL) return;
  sweep_index = SWEEP_INDEX(s);
  res = 360.0/RSL_sweep_list[sweep_index].hash->nindexes;
  printf("Azimuth resolution = %f for %d bins.\n", res, RSL_sweep_list[sweep_index].hash->nindexes);
  for (i=0; i<RSL_sweep_list[sweep_index].hash->nindexes; i++) {
	index = RSL_sweep_list[sweep_index].hash->indexes[i];
	azim = i/res;
	printf("RSL_sweep_list[%d].hash->indexes[%d] = ", sweep_index, i);
	
	if (index == NULL) 
	  printf("IS NULL\n");
	else 
	  print_link_list(index);
  }
}