int main(){

	add_node(8);
	add_node(6);
	add_node(10);
	add_node(4);
	add_node(7);
	add_node(9);
	add_node(11);
	add_node(2);
	add_node(5);
	printf("\nTree is builded:\n");
	print_tree(root);
	
	printf("\nNumbers of Nodes: %d\n",count_num(root));
	count = 0;
	
	printf("\nSearch the value: 4\n");
	search_node(4);
	
	printf("\nSearch the value: 90\n");
	search_node(90);
	
	printf("\ndelete the value: 6\n");
	delete_node(6);
	printf("\nThe tree is:\n");
	print_tree(root);
	
	printf("\nNumbers of Nodes: %d\n",count_num(root));
}
Exemple #2
0
char *xdg_mime_type_icon_lookup(const char *mime, int size, const char *themeName)
{
	if (mime)
	{
		XdgTheme **hicolor = (XdgTheme **)search_node(&themes_list->themes_files_map, "hicolor");

		if (hicolor)
		{
			XdgTheme **theme = (XdgTheme **)search_node(&themes_list->themes_files_map, themeName);

			if (theme)
			{
				char *res;
				char *sep;
				char mimeTypeCopy[MIME_TYPE_NAME_BUFFER_SIZE];
				strncpy(mimeTypeCopy, mime, MIME_TYPE_NAME_BUFFER_SIZE);

				if ((sep = strchr(mimeTypeCopy, '/')) != NULL)
					(*sep) = '-';

				if (res = _xdg_mime_find_icon(mimeTypeCopy, size, XdgThemeMimeTypes, *theme, *hicolor))
					return res;
				else
				{
					(*sep) = 0;
					strcat(mimeTypeCopy, "-x-generic");
					mimeTypeCopy[sep + sizeof("-x-generic") - mimeTypeCopy] = 0;
					return _xdg_mime_find_icon(mimeTypeCopy, size, XdgThemeMimeTypes, *theme, *hicolor);
				}
			}
		}
	}

	return NULL;
}
Exemple #3
0
static char *_xdg_mime_lookup_icon(const char *icon, int size, Context context, XdgTheme *theme)
{
	char *res = 0;
	XdgThemeGroup **group = (XdgThemeGroup **)search_node(&theme->groups, "Icon Theme");

	if (group)
	{
		XdgThemeGroupEntry **entry = (XdgThemeGroupEntry **)search_node(&(*group)->entries, "Directories");

		if (entry && (*entry)->values)
		{
			XdgThemeGroup **dirGroup;
			int minimal_size = INT_MAX;
			XdgStringList *directories = NULL;
			XdgStringList *directory = (XdgStringList *)(*entry)->values->list.head;

			const char *closestDirName = 0;
			char *dir;

			do
			{
				if ((dirGroup = (XdgThemeGroup **)search_node(&theme->groups, dir = directory->value)) &&
					_xdg_mime_directory_matches_size_and_context(*dirGroup, size, context, dir, &closestDirName, &minimal_size))
				{
					_xdg_list_string_item_copy(&directories, directory);
				}
			}
			while (directory = (XdgStringList *)directory->list.next);

			if (directories)
			{
				XdgIconSearchFuncArgs data = {theme, icon, directories};

				if (dir = _xdg_search_in_each_theme_dir((XdgIconSearchFunc)_xdg_search_icon_file, &data))
					res = dir;
				else
					if (closestDirName)
					{
						XdgStringList *tmp_directories = NULL;

						_xdg_list_string_item_add(&tmp_directories, closestDirName);
						data.subdirs = tmp_directories;

						if (dir = _xdg_search_in_each_theme_dir((XdgIconSearchFunc)_xdg_search_icon_file, &data))
							res = dir;

						_xdg_list_free((XdgList *)tmp_directories, free);
					}
			}

			_xdg_list_free((XdgList *)directories, free);
		}
	}

	return res;
}
Exemple #4
0
// TODO: move the guts of this method to Node class
Node * Tree::search_node(int key, Node * node) {
  if (node == nullptr) return node;
  if (node->key == key) return node;

  if (node->left != nullptr && key < node->key) {
    return search_node(key, node->left);
  } else if (node->right != nullptr) {
    return search_node(key, node->right);
  }
  return nullptr;
}
void search_node(struct node *current,int element)
{
	if(current==NULL)
		printf("Node Not Found.");
	else
	{
		if(element < current->data)
			search_node(current->left,element);
		else if(element > current->data)
			search_node(current->right,element);
		else
			printf("Node Found.");
	}
}
void main()
{
	 int ch;
	 struct node *start=NULL;
	 start=NULL;
	 while(ch!=5)
	 {
		  system("cls");
		  printf("\n1.Insert\n2.Delete\n3.Search\n4.Display\n5.Exit");
		  printf("\nEnter choice: ");
		  scanf("%d",&ch);
		  switch(ch)
		  {
		   case 1:
				insert_node(&start);
				break;
		   case 2:
				delete_node(&start);
				break;
		   case 3:
				search_node(&start);
				getch();
				break;
		   case 4:
				display(&start);
				getch();
				break;
		   case 5:
			   break;
		   default:
			 printf("Invalid option\n");
		  }
	 }
}
Exemple #7
0
/**********************************************************
 * mm_malloc
 * Allocate a block of size bytes.
 * The type of search is determined by find_fit
 * The decision of splitting the block, or not is determined
 *   in place(..)
 * If no block satisfies the request, the heap is extended
 **********************************************************/
void *mm_malloc(size_t size)
{
    size_t asize; /* adjusted block size */
    size_t extendsize = 0; /* amount to extend heap if no fit */
    char * bp;

    /* Ignore spurious requests */
    if (size == 0)
        return NULL;

    /* Adjust block size to include overhead and alignment reqs. */
    if (size <= DSIZE)
        asize = 2 * DSIZE;
    else
        asize = DSIZE * ((size + (DSIZE) + (DSIZE-1))/ DSIZE);

    PRINTDBG (("mm_malloc invoked: %ld :: %ld\n", size, asize));

    /* Search the free list for a fit */
    if ((bp = search_node(asize)) != NULL) {
        place(bp, asize);
        return bp;
    }

    /* No fit found. Get more memory and place the block */
    extendsize = MAX(asize, CHUNKSIZE);
    if ((bp = extend_heap(extendsize/WSIZE)) == NULL)
        return NULL;

    place(bp, asize);
    return bp;
}
Exemple #8
0
c_node *remove_node(char *index, c_list *list){
	if(list){
		//pthread_rwlock_wrlock((list->lock));
		c_node *tmp = search_node(list, index);
		if(tmp) {
			if(tmp == list->head)
				tmp = evict_list(list);
			else {
				if(tmp->prev) 
					tmp->prev->next = tmp->next;
				if(tmp->next)
					tmp->next->prev = tmp->prev;
				else
					list->tail = tmp->prev;
				list->bytes_left += tmp->length;
			}
			tmp->prev = NULL;
			tmp->next = NULL;
		}
		//pthread_rwlock_unlock((list->lock));
		return tmp;
	}
	
	return NULL;
}
Exemple #9
0
int bi_search_tree_remove(BI_S_TREE *b, void *data)
{
	struct bitree_node *node;
	struct bitree_node **parent_link = &(b->root);

	if (!search_node(b, b->root, data, &parent_link))
		return -1;
	node = *parent_link;

	if (node->right == NULL) {
		*parent_link = node->left;
		if (*parent_link != NULL)
			(*parent_link)->parent = node->parent;
		free_node(b, node);
		return 0;
	}

	if (node->right != NULL) {
		if (node->right->left == NULL) {
			*parent_link = node->right;
			(*parent_link)->left = node->left;
			(*parent_link)->parent = node->parent;
			free_node(b, node);
			return 0;
		}

		*parent_link = successor_replace_node(b, node);
		(*parent_link)->parent = node->parent;

		free_node(b, node);
	}
	return 0;
}
Exemple #10
0
int read_node_content(c_list *list, char *index, char *content, unsigned int *len){
	if(!list)
		return -1;
	
	pthread_rwlock_rdlock((list->lock));
	
	c_node *tmp = search_node(list, index);
	
	if(!tmp)
	{
		pthread_rwlock_unlock((list->lock));
		return -1;
	}
	
	*len = tmp->length;
	memcpy(content, tmp->content,*len);
	
	pthread_rwlock_unlock((list->lock));
	
	pthread_rwlock_wrlock((list->lock));
	add_node(remove_node(index, list), list);
	pthread_rwlock_unlock((list->lock));
	
	return 0;
}
Exemple #11
0
/*Helper function to add new node to the hashtable struct.*/
hash_node *add_node(char *s, int defn, int num, hash_node *hash_table[])
{
	hash_node *new_node;
	/*hashp pnew_node;*/
	unsigned int hashval;

	if ((new_node = search_node(s, hash_table)) == NULL)
	{
		new_node = (hash_node *)malloc(sizeof(* new_node));

		if (new_node == NULL || (new_node->name = duplicate_str(s)) == NULL)
			return NULL;

		else
		{
			hashval = hash_code_gen(s);
			new_node->next = hash_table[hashval];
			hash_table[hashval] = new_node;
		}
	}

	new_node->num = defn;
	new_node->mem_words = num;

	/*Returns pointer to a new created node.*/
	return new_node;
}
Exemple #12
0
/**
 * Reads the previous key (order given by @a keycmp function).
 * @param[in] key
 * @param[in] tree
 * @param[out] data Entry value, can be @b NULL.
 * @return previous key or @b NULL if @a key is the first one.
 */
const void*
piojo_btree_prev(const void *key, const piojo_btree_t *tree, void **data)
{
        iter_t iter;
        PIOJO_ASSERT(tree);
        PIOJO_ASSERT(key);

        iter = search_node(key, tree);
        PIOJO_ASSERT(iter.bnode != NULL);

        if (! iter.bnode->leaf_p && iter.eidx < iter.bnode->ecnt + 1){
                iter.bnode = iter.bnode->children[iter.eidx];
                iter.eidx = iter.bnode->ecnt;
                search_max(&iter);
        }else if (iter.eidx > 0){
                --iter.eidx;
        }else{
                while (iter.bnode->parent != NULL){
                        iter.eidx = iter.bnode->pidx;
                        iter.bnode = iter.bnode->parent;
                        if (iter.eidx > 0){
                                --iter.eidx;
                                if (data != NULL){
                                        *data = entry_val(iter.eidx, iter.bnode, tree);
                                }
                                return entry_key(iter.eidx, iter.bnode, tree);
                        }
                }
                return NULL;
        }
        if (data != NULL){
                *data = entry_val(iter.eidx, iter.bnode, tree);
        }
        return entry_key(iter.eidx, iter.bnode, tree);
}
Exemple #13
0
/* Find a node in the linked list based on the url. */
node* find_node(cache* list, char* url)
{
    if (list == NULL || url == NULL)
        return NULL;

    //reader preference when searching nodes
    P (&(list->mutex_r));
    list->readcnt++;
    if (1 == list->readcnt)
        P (&(list->mutex_w));
    V (&(list->mutex_r));

    node* p = search_node(list, url);
    
    P (&(list->mutex_r));
    readcnt--;
    if (0 == list->readcnt)
        V (&(list->mutex_w));
    V (&(list->mutex_r));


    if (p == NULL)
        return NULL;


    P(&list->mutex_w);
    delete_node(list, p);
    insert_node_end(list, p);
    V(&list->mutex_w);

    return p;
}
Exemple #14
0
/*If symbol exists , the function returns the pointer to this symbol (TAVIT)*/
char * find_symb(input_line * input)
{
	/*hash_node  * temp_node; */
	char * start = (input->line_str);
	skip_spaces(&start);
	while (*(input->line_str))
	{
		if (*(input->line_str) == ':')
		{
			*((input->line_str)++) = '\0';        /*for a reason to save only the name of the symbol*/
			if (!isalpha(start[0]))
			{
				ERROR("The symbol must start by char.", input->line_number)
					error_flag = TRUE;
				return NULL;
			}
			if (!((tmp_node = search_node(start, opNode)) == NULL))
			{
				ERROR("The symbol can't be like assembly command.", input->line_number)
					error_flag = TRUE;
				return NULL;
			}
			return start;
		}
		(input->line_str)++;
	}
	input->line_str = start;

	return NULL;
}
Exemple #15
0
static int search_branch (
	tree_s		*tree,
	branch_s	*parent,
	u64		key,
	search_f	sf,
	void		*data)
{
	void		*child;
	snint		k;
	int		rc;

	k = binary_search_branch(key, parent->br_key, parent->br_num);
	do {
		child = tau_bget(tree_inode(tree), parent->br_key[k].k_block);
		if (!child) return qERR_NOT_FOUND;

		rc = search_node(tree, child, key, sf, data);
		tau_bput(child);
		if (rc != qERR_TRY_NEXT) {
			return rc;
		}
		++k;
	} while (k != parent->br_num);
	return rc;
}
Exemple #16
0
char *xdg_icon_lookup(const char *icon, int size, Context context, const char *themeName)
{
	if (icon)
	{
		XdgTheme **hicolor = (XdgTheme **)search_node(&themes_list->themes_files_map, "hicolor");

		if (hicolor)
		{
			XdgTheme **theme = (XdgTheme **)search_node(&themes_list->themes_files_map, themeName);

			if (theme)
				return _xdg_mime_find_icon(icon, size, context, *theme, *hicolor);
		}
	}

	return NULL;
}
Exemple #17
0
int main(void)
{
  /* Declare YOUR variables here ! */
  Slist mylist;
  int menu_choice;

  /* Seed to random generator and clear the screen.. */
  srand((unsigned int)time(NULL));

  if ((mylist = SLISTinit(my_destroy)) == NULL)
    {
      printf("\nFatal error... - bailing out!");
      SLISTdestroy(mylist);
      exit(-1);
    }

  /* Set match-callback into list structure.. */
  SLISTsetmatch(mylist, my_match);

  /* Populate the (empty) list.. */
  create_random_nodes(mylist, NR_OF_ITEMS);

  /* Enter menu loop... */
  do
    {
      menu_choice = menu(MAIN_MENU_ROW, 0, 5);

      switch (menu_choice)
        {
        case 1:
          ins_nodes(mylist);
          break;
        case 2:
          rem_nodes(mylist);
          break;
        case 3:
          search_node(mylist);
          break;
        case 4:
          sort_list(mylist);
          break;
        case 5:
          print_list(mylist);
          break;
        default:
          final_status(mylist);
          break;
        }
    }
  while (menu_choice); 

  /* ..and finally destroy the list. */
  prompt_and_pause("\n\nLet's tidy up and destroy the list..- Bye!");
  SLISTdestroy(mylist);

  return 0;
}
Exemple #18
0
void * bi_search_tree_search(BI_S_TREE *b, void *data)
{
	struct bitree_node **parent_link = &(b->root);

	if (!search_node(b, b->root, data, &parent_link))
		return NULL;

	return (*parent_link)->data;
}
Exemple #19
0
BINNODE search_node(BINNODE root,int data)
{
	if(root!=NULL)
	{
	if(root->data == data)
		return root;
	else if (root->data > data)
		return search_node(root->left,data);
	else if (root->data < data)
		return search_node(root->right,data);
	else
		return NULL;

	}
	else
		return NULL;

}
Exemple #20
0
int	main()
{
	unsigned int key;
	node *arbre;

	arbre = NULL;
	addnode(&arbre, 30, "la");
	addnode(&arbre, 11, " vie");
	addnode(&arbre, 30, " est");
	addnode(&arbre, 32, " belle");
	addnode(&arbre, 1, " et");
	addnode(&arbre, 4, " la");
	addnode(&arbre, 5, " mort");
	addnode(&arbre, 6, " est");
	addnode(&arbre, 1, " douce");

	ft_putstr("-------------------------------------\n");
	print_tree(arbre);
	ft_putstr("-------------------------------------\n");
	print_reverse_tree(arbre);
	ft_putstr("-------------------------------------\n");

	key = 1;
	if (search_node(arbre, key))
	{
		ft_putstr("la cle existe et vaut : ");
		ft_putnbr(key);
		ft_putstr("\n");
	}
	else
		ft_putstr("la cle n existe pas\n");
	key = 66;
		if (search_node(arbre, key))
	{
		ft_putstr("la cle existe et vaut : ");
		ft_putnbr(key);
		ft_putstr("\n");
	}
	else
		ft_putstr("la cle n existe pas\n");

	clear_tree(&arbre);
	return (0);
}
int main()
{
    int i;
    bst_node* root = NULL;
    // 利用原地随机化方法将其打乱
    int array[10] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
    int length = sizeof(array)/sizeof(int);
    /* srand(GetTickCount()); */
    randomize_in_place(array, length);  
    print_array(array, length);  
    for (i = 0; i < length; i++)
    {
	bst_node* y = (bst_node*)malloc(sizeof(bst_node));
    	construct_node(y, array[i]);
    	root = insert_node(root, y);
	/* printf("%x\n", (unsigned int)root); */
    }
    mid_traverse_node(root);
    print_node(max_node(root));
    print_node(min_node(root));
    int s_value;
    scanf("%d", &s_value);
    fflush(stdin);
    while(s_value != -1)
    {
	bst_node* s_node = search_node(root, s_value);
	if (s_node)
	{
	    root = delete_node(s_node);
	}
	else
	{
	    printf("not in the bst tree\n");
	    fflush(stdout);
	}
	length--;
	mid_traverse_node(root);
	scanf("%d", &s_value);
	/* for(i = 0; i<length; i++) */
	/* { */
	/*     int search_key = random(0, length-1); */
	/*     bst_node* current_node = search_node(root, search_key); */
	/*     /\* bst_node* precursor = precursor_node(current_node); *\/ */
	/*     /\* bst_node* successor = successor_node(current_node); *\/ */
	/*     printf("the search key is %d\n", search_key); */
	/*     if(current_node->parent) */
	/* 	printf("the parent of %d is %d\n",current_node->key, current_node->parent->key); */
	/*     fflush(stdout); */
	/*     /\* if(precursor) *\/ */
	/*     /\*     printf("the precursor of %d is %d\n", current_node->key, precursor->key); *\/ */
	/*     /\* if(successor) *\/ */
	/*     /\*     printf("the successor of %d is %d\n", current_node->key, successor->key); *\/ */
	/* } */
    }
    return 0;
}
Exemple #22
0
static void *read_mime_group_sub_type(void **memory, const AvlTree *app_files_map)
{
	XdgMimeSubType *res = (*memory);
	(*memory) += sizeof(XdgMimeSubType);

	if (res->apps)
	{
		XdgApp **app;
		XdgMimeSubTypeValue *prev;

		res->apps = (*memory);

		if (app = (XdgApp **)search_node(app_files_map, res->apps->name))
			res->apps->app = (*app);
		else
			res->apps->app = 0;

		(*memory) += sizeof(XdgMimeSubTypeValue) + strlen(res->apps->name);

		prev = (XdgMimeSubTypeValue *)res->apps;
		res->apps->list.list.head = (XdgList *)res->apps;

		while ((res->apps = (*memory))->list.list.head)
		{
			prev->list.list.next = (XdgList *)res->apps;
			res->apps->list.list.head = prev->list.list.head;
			prev = res->apps;

			if (app = (XdgApp **)search_node(app_files_map, res->apps->name))
				res->apps->app = (*app);
			else
				res->apps->app = 0;

			(*memory) += sizeof(XdgMimeSubTypeValue) + strlen(res->apps->name);
		}

		(*memory) += sizeof(XdgMimeSubTypeValue);

		res->apps = prev;
	}

	return res;
}
Exemple #23
0
static BOOL _xdg_mime_directory_matches_size_and_context(XdgThemeGroup *dirGroup, int size, Context context, const char *directory, const char **closestDirName, int *minimal_size)
{
	XdgThemeGroupEntry **entry1 = (XdgThemeGroupEntry **)search_node(&dirGroup->entries, "Context");

	if (entry1 && (*entry1)->values &&
		strcmp((*entry1)->values->value, contextes[context]) == 0)
			return _xdg_mime_directory_matches_size(dirGroup, size, directory, closestDirName, minimal_size);

	return FALSE;
}
bst_node* search_node(bst_node* root, int key)
{
    if(root == NULL)
    {
	return NULL;
    }
    if(root->key == key)
    {
	return root;
    }
    else if (key > root->key)
    {
	search_node(root->right, key);
    }
    else 
    {
	search_node(root->left, key);
    }
}
Exemple #25
0
/*
 * request the NIT from stream
 * and find given tp's information
 */ 
static INT32 find_tp_in_nit(UINT16 network_id, UINT16 ts_id, T_NODE *t_node)
{
	INT32 ret;
	UINT8 section_num = 0;
	UINT8 last_section_num;
	struct dmx_device * dmx_dev;
	if((dmx_dev = (struct dmx_device *)dev_get_by_id(HLD_DEV_TYPE_DMX, 0)) == NULL)
	{
		return MULTIFEED_FAILURE;
	}	

	struct get_section_param sr_request;
	struct restrict sr_restrict;

	MEMSET(&sr_request, 0, sizeof(struct get_section_param));
	MEMSET(&sr_restrict, 0, sizeof(struct restrict));

	sr_request.buff = multifeed_table_buff;
	sr_request.buff_len = 1024;
	sr_request.crc_flag = 1;
	sr_request.pid = PSI_NIT_PID;
	sr_request.mask_value = &sr_restrict;	

	sr_request.wai_flg_dly = 6000;

	sr_restrict.mask_len = 7;
	sr_restrict.value_num = 1;
	
	sr_restrict.mask[0] = 0xff;
	sr_restrict.mask[1] = 0x80;
	sr_restrict.mask[6] = 0xff;
	
	sr_restrict.value[0][0] = PSI_NIT_TABLE_ID;
	sr_restrict.value[0][1] = 0x80;

	section_num =0;
	do{
		sr_restrict.value[0][6] = section_num;

		if(dmx_req_section(dmx_dev, &sr_request)!= SUCCESS)
		{
			return MULTIFEED_FAILURE;
		}
		last_section_num = multifeed_table_buff[7];

		ret = search_node(multifeed_table_buff, 1024, network_id, ts_id, t_node);
		
		if(ret == MULTIFEED_SUCCESS)
			break;	
		section_num++;
		
	}while(section_num<=last_section_num);

	return ret;
}
Exemple #26
0
int BTree<T>::search_data(T& key) {
  int nodeid;
  if ((nodeid = search_node(key)) < 0)
    return -1;
  BNode<T> &node = get_node(nodeid);
  int pos = node.findkey(key);
  assert(pos >= 0);
  int dataid = node.next[pos];
  return_node(nodeid);
  return dataid;
}
Exemple #27
0
int main(void)
{
  /* Declare YOUR variables here ! */
  BiTree mytree;
  int menu_choice;

  srand((unsigned int)time(NULL));

  if ((mytree = BITREEinit(my_destroy)) == NULL)
    {
      printf("\nFatal error - bailing out...\n!");
      BITREEdestroy(mytree);
      exit(-1);
    }
  
  /* Don't forget to set the compare callback..! */
  BITREEsetcompare(mytree, my_cmp);

  /* Initialize - and add nodes to the table... */
  create_nodes(mytree, NR_OF_ITEMS);
  
  do
    {
      menu_choice = menu(MAIN_MENU_ROW, 0, 4);

      switch (menu_choice)
        {
        case 1:
          ins_node(mytree);
          break;
        case 2:
          rem_node(mytree);
          break;
        case 3:
          search_node(mytree);
          break;
        case 4:
          my_clearscrn();
          printf("--- PRINT TREE ---\n");
          print_tree(mytree);
          prompt_and_pause("\n\n");
          break;
        default:
          final_status(mytree);
          break;
        }
    }
  while (menu_choice); 

  prompt_and_pause("\n\nLet's tidy up and destroy the tree..- Bye!");
  BITREEdestroy(mytree);
  
  return 0;
}
Exemple #28
0
void config_lock(config_t* cfg, const char *key)
{
	node_l *n;
	configitem *item;

	n = search_node(cfg,key);
	if (n != NULL) {
		item = n->data;
		item->locked = 1;
	}
}
//ths method is not used in the decision tree learning process
//but is added because it can be used for certain inquiries
//for example, to check which attributes form part of the decision tree 
//and which not
bool Dectree_BST::search_node(dectree_node* root, int attribute_id)
{
	
	if(root != NULL)
	{
		if(!((root->type).compare("split")))
			if (attribute_id == root->attribute_id)
				return true;
		
		search_node(root->f, attribute_id);
		search_node(root->t, attribute_id);
				
	}
	else
		return false;

	//added just to make clear that something is "return" for the compiler
	return false;

}
bool muhkuh_split_testdescription::subtests_read_test(wxXmlNode *ptParent, size_t sizSubTestIndex)
{
	bool fResult;
	wxXmlNode *ptNode;
	wxString strData;
	wxArrayString astrParameter;
	wxString strParameterName;
	wxString strParameterValue;


	/* Expect failure. */
	fResult = false;

	/* Search the code node. */
	ptNode = search_node(ptParent->GetChildren(), "Code");
	if( ptNode!=NULL )
	{
		/* Get the node contents. */
		strData = ptNode->GetNodeContent();
		fResult = write_textfile(MUHKUH_TESTDESCRIPTION_TYP_CODE, sizSubTestIndex, strData);
		if( fResult==true )
		{
			/* Collect all parameters. */
			ptNode = ptParent->GetChildren();
			while( ptNode!=NULL )
			{
				if( ptNode->GetType()==wxXML_ELEMENT_NODE && ptNode->GetName()=="Parameter" )
				{
					/* Get the name parameter. */
					if( ptNode->GetAttribute("name", &strParameterName)==false )
					{
						wxLogError(_("The parameter has no name attribute."));
						fResult = false;
						break;
					}

					/* Get the value parameter. */
					strParameterValue = ptNode->GetNodeContent();

					/* Combine the name and value. */
					strData.Printf("_G.__MUHKUH_TEST_PARAMETER[\"%s\"] = \"%s\"\n", strParameterName, strParameterValue);
					astrParameter.Add(strData);
				}
				ptNode = ptNode->GetNext();
			}

			/* Write all parameters to a file. */
			fResult = write_textfile(MUHKUH_TESTDESCRIPTION_TYP_PARAMETER, sizSubTestIndex, astrParameter);
		}
	}

	return fResult;
}