cvs commit: ALFS/nALFS/src handlers.c handlers.h libXML-tree.c nalfs.c parser.c parser.h

kpfleming at linuxfromscratch.org kpfleming at linuxfromscratch.org
Mon Mar 15 18:09:39 PST 2004


kpfleming    04/03/15 19:09:39

  Modified:    nALFS/src handlers.c handlers.h libXML-tree.c nalfs.c
                        parser.c parser.h
  Log:
  renamed handler for "root" element, it's actually the handler for profiles
  added content storage support to <comment> handler
  move handler-related functions from libXML-tree.c to handlers.c
  move element creation functions to parser.c
  create element creation functions for profile, comment and handler elements
  move "root" element management to parser.c
  move profile addition/removal functions to parser.c
  various other minor cleanups
  
  Revision  Changes    Path
  1.31      +94 -48    ALFS/nALFS/src/handlers.c
  
  Index: handlers.c
  ===================================================================
  RCS file: /home/cvsroot/ALFS/nALFS/src/handlers.c,v
  retrieving revision 1.30
  retrieving revision 1.31
  diff -u -r1.30 -r1.31
  --- handlers.c	14 Mar 2004 07:28:28 -0000	1.30
  +++ handlers.c	16 Mar 2004 02:09:38 -0000	1.31
  @@ -48,25 +48,25 @@
   	handler_s **list;
   } handlers = { 0, NULL };
   
  -/* Embedded "handlers" for the root (profile) element and comment elements. */
  +/* Embedded "handlers" for the profile and comment elements. */
   
  -static int root_main(const element_s * const el)
  +static int profile_main(const element_s * const el)
   {
   	(void) el;
   
   	return 0;
   }
   
  -static int root_valid_child(const element_s * const element,
  -			    const element_s * const child)
  +static int profile_valid_child(const element_s * const element,
  +			       const element_s * const child)
   {
   	(void) element;
   	(void) child;
   	return 1;
   }
   
  -static char *root_data(const element_s * const element,
  -		       const handler_data_e data_requested)
  +static char *profile_data(const element_s * const element,
  +			  const handler_data_e data_requested)
   {
   	(void) element;
   	switch (data_requested) {
  @@ -80,6 +80,42 @@
   	return NULL;
   }
   
  +struct comment_data {
  +	char *content;
  +};
  +
  +static int comment_setup(element_s * const element)
  +{
  +	struct comment_data *data;
  +
  +	if ((data = xmalloc(sizeof(struct comment_data))) == NULL)
  +		return 1;
  +
  +	data->content = NULL;
  +	element->handler_data = data;
  +
  +	return 0;
  +}
  +
  +static void comment_free(const element_s * const element)
  +{
  +	struct comment_data *data = (struct comment_data *) element->handler_data;
  +
  +	xfree(data->content);
  +	xfree(data);
  +}
  +
  +static int comment_content(const element_s * const element,
  +		       const char * const content)
  +{
  +	struct comment_data *data = (struct comment_data *) element->handler_data;
  +
  +	if (strlen(content))
  +		data->content = xstrdup(content);
  +
  +	return 0;
  +}
  +
   static int comment_main(const element_s * const el)
   {
   	(void) el;
  @@ -89,51 +125,25 @@
   
   static handler_info_s embedded_handlers_info[] = {
   	{
  -		.name = "__root",
  -		.description = "root element",
  +		.name = "__profile",
  +		.description = "profile",
   		.syntax_version = "all",
  -		.main = root_main,
  +		.main = profile_main,
   		.type = HTYPE_NORMAL,
  -		.valid_child = root_valid_child,
  +		.valid_child = profile_valid_child,
   		.data = HDATA_SYNTAX_VERSION,
  -		.alloc_data = root_data,
  -	},
  -#if HANDLER_SYNTAX_2_0
  -	{
  -		.name = "comment",
  -		.description = "comment element",
  -		.syntax_version = "2.0",
  -		.main = comment_main,
  -		.type = HTYPE_COMMENT,
  -	},
  -#endif
  -#if HANDLER_SYNTAX_3_0
  -	{
  -		.name = "comment",
  -		.description = "comment element",
  -		.syntax_version = "3.0",
  -		.main = comment_main,
  -		.type = HTYPE_COMMENT,
  +		.alloc_data = profile_data,
   	},
  -#endif
  -#if HANDLER_SYNTAX_3_1
  -	{
  -		.name = "comment",
  -		.description = "comment element",
  -		.syntax_version = "3.1",
  -		.main = comment_main,
  -		.type = HTYPE_COMMENT,
  -	},
  -#endif
  -#if HANDLER_SYNTAX_3_2
   	{
  -		.name = "comment",
  -		.description = "comment element",
  -		.syntax_version = "3.2",
  +		.name = "__comment",
  +		.description = "comment",
  +		.syntax_version = "all",
   		.main = comment_main,
   		.type = HTYPE_COMMENT,
  +		.setup = comment_setup,
  +		.free = comment_free,
  +		.content = comment_content,
   	},
  -#endif
   	{
   		.name = NULL
   	}
  @@ -344,13 +354,13 @@
   	return el->handler->alloc_data(el, HDATA_COMMAND);
   }
   
  -const char *find_parent_with_data(const element_s * const element,
  -				  const handler_data_e data_requested)
  +const char *find_handler_data(const element_s * const element,
  +			      const handler_data_e data_requested)
   {
   	const element_s *s;
   	char *data;
   
  -	for (s = element->parent; s; s = s->parent) {
  +	for (s = element; s; s = s->parent) {
   		if (!s->handler)
   			continue;
   		if ((s->handler->data & data_requested) == 0)
  @@ -366,7 +376,7 @@
   
   const char *alloc_base_dir(const element_s * const element)
   {
  -	return find_parent_with_data(element, HDATA_BASE);
  +	return find_handler_data(element->parent, HDATA_BASE);
   }
   
   int change_to_base_dir(const element_s * const element,
  @@ -396,7 +406,7 @@
   {
   	const char *dir;
   
  -	dir = find_parent_with_data(el, HDATA_SHELL);
  +	dir = find_handler_data(el->parent, HDATA_SHELL);
   
   	if (dir)
   		return dir;
  @@ -416,4 +426,40 @@
   	}
   	xfree(tmp);
   	return tok ? 1 : 0;
  +}
  +
  +const struct handler_attribute *find_handler_attribute(const handler_info_s *handler,
  +						       const char *name)
  +{
  +	int i;
  +	const struct handler_attribute *attr;
  +
  +	if (!handler->attributes)
  +		return NULL;
  +
  +	for (i = 0; (handler->attributes[i].name); ++i) {
  +		attr = &handler->attributes[i];
  +		if (strcmp(attr->name, name) == 0)
  +			return attr;
  +	}
  +
  +	return NULL;
  +}
  +
  +const struct handler_parameter *find_handler_parameter(const handler_info_s *handler,
  +						       const char *name)
  +{
  +	int i;
  +	const struct handler_parameter *param;
  +
  +	if (!handler->parameters)
  +		return NULL;
  +
  +	for (i = 0; (handler->parameters[i].name); ++i) {
  +		param = &handler->parameters[i];
  +		if (strcmp(param->name, name) == 0)
  +			return param;
  +	}
  +
  +	return NULL;
   }
  
  
  
  1.29      +7 -2      ALFS/nALFS/src/handlers.h
  
  Index: handlers.h
  ===================================================================
  RCS file: /home/cvsroot/ALFS/nALFS/src/handlers.h,v
  retrieving revision 1.28
  retrieving revision 1.29
  diff -u -r1.28 -r1.29
  --- handlers.h	14 Mar 2004 06:58:36 -0000	1.28
  +++ handlers.h	16 Mar 2004 02:09:38 -0000	1.29
  @@ -148,8 +148,8 @@
   char *alloc_textdump_file(element_s *el);
   char *alloc_execute_command(element_s *el);
   
  -const char *find_parent_with_data(const element_s * const element,
  -				  const handler_data_e data_requested);
  +const char *find_handler_data(const element_s * const element,
  +			      const handler_data_e data_requested);
   
   const char *alloc_base_dir(const element_s * const element);
   
  @@ -158,5 +158,10 @@
   
   const char *alloc_stage_shell(const element_s * const el);
   int option_in_string(const char * const option, const char * const string);
  +
  +const struct handler_attribute *find_handler_attribute(const handler_info_s *handler,
  +						       const char *name);
  +const struct handler_parameter *find_handler_parameter(const handler_info_s *handler,
  +						       const char *name);
   
   #endif /* H_HANDLER_ */
  
  
  
  1.23      +19 -98    ALFS/nALFS/src/libXML-tree.c
  
  Index: libXML-tree.c
  ===================================================================
  RCS file: /home/cvsroot/ALFS/nALFS/src/libXML-tree.c,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- libXML-tree.c	14 Mar 2004 07:28:29 -0000	1.22
  +++ libXML-tree.c	16 Mar 2004 02:09:38 -0000	1.23
  @@ -90,44 +90,6 @@
    * XML_DOCB_DOCUMENT_NODE=     21
    */
   
  -static unsigned int element_id = 0;
  -
  -static const struct handler_attribute *find_handler_attribute(const handler_info_s *handler,
  -							      const char *name)
  -{
  -	int i;
  -	const struct handler_attribute *attr;
  -
  -	if (!handler->attributes)
  -		return NULL;
  -
  -	for (i = 0; (handler->attributes[i].name); ++i) {
  -		attr = &handler->attributes[i];
  -		if (strcmp(attr->name, name) == 0)
  -			return attr;
  -	}
  -
  -	return NULL;
  -}
  -
  -static const struct handler_parameter *find_handler_parameter(const handler_info_s *handler,
  -							      const char *name)
  -{
  -	int i;
  -	const struct handler_parameter *param;
  -
  -	if (!handler->parameters)
  -		return NULL;
  -
  -	for (i = 0; (handler->parameters[i].name); ++i) {
  -		param = &handler->parameters[i];
  -		if (strcmp(param->name, name) == 0)
  -			return param;
  -	}
  -
  -	return NULL;
  -}
  -
   static int parse_node_attributes(xmlNodePtr node, element_s *element)
   {
   	handler_info_s *handler = element->handler;
  @@ -287,62 +249,29 @@
   	return 0;
   }
   
  -static INLINE element_s *create_element(xmlNodePtr node, element_s *parent)
  -{
  -	xmlChar *c;
  -	handler_s *handler;
  -	element_s *el = init_new_element();
  -	const char *syntax_version;
  -
  -
  -	el->id = element_id++;
  -	el->parent = parent;
  -	syntax_version = find_parent_with_data(el, HDATA_SYNTAX_VERSION);
  -
  -	switch (node->type) {
  -		case XML_ELEMENT_NODE:
  -			el->name = xstrdup((const char *)node->name);
  -			if ((handler = find_handler(el->name, syntax_version))) {
  -				el->type = TYPE_ELEMENT;
  -				el->handler = handler->info;
  -				if (make_handler_element(node, el)) {
  -					free_element(el);
  -					el = NULL;
  -				} else {
  -					/* Add content, if any. */
  -					if (node->children
  -					    && node->children->type == XML_TEXT_NODE
  -					    && node->children->next == NULL) {
  -						if ((c = xmlNodeGetContent(node))) {
  -							el->content = xstrdup((const char *)c);
  -							xfree(c);
  -						}
  -					}
  -				}
  -			} else {
  -				Nprint_err("No handler found for %s (syntax version %s).",
  -					   el->name, syntax_version);
  +static element_s *create_element(xmlNodePtr node,
  +				 const element_s * const parent,
  +				 const element_s * const profile)
  +{
  +	element_s *el = NULL;
  +
  +	if (node->type == XML_ELEMENT_NODE) {
  +		if ((el = create_handler_element(profile, parent,
  +						 (const char *) node->name))) {
  +			if (make_handler_element(node, el)) {
   				free_element(el);
   				el = NULL;
   			}
  -
  -			break;
  -		case XML_COMMENT_NODE:
  -			el->name = xstrdup("comment");
  -			el->type = TYPE_COMMENT;
  -			el->handler = find_handler("comment", syntax_version)->info;
  +		}
  +	} else if (node->type == XML_COMMENT_NODE) {
  +		if ((el = create_comment_element(profile, parent))) {
   			if (make_handler_element(node, el)) {
   				free_element(el);
   				el = NULL;
  -				break;
   			}
  -
  -			break;
  -		default:
  -			break;
  +		}
   	}
   
  -	xfree(syntax_version);
   	return el;
   }
   
  @@ -357,10 +286,10 @@
   		return NULL;
   	}
   
  -	if ((el = create_element(node, parent))) {
  +	if ((el = create_element(node, parent, profile))) {
   		for (child = node->children; child; child = child->next) {
   			if ((c = convert_nodes(child, profile, el))) {
  -				link_element(c, prev, el, profile);
  +				link_element(c, prev);
   				prev = c;
   			}
   		}
  @@ -375,23 +304,15 @@
   	element_s *el, *profile, *prev = NULL;
   	xmlNodePtr child;
   
  -	profile = init_new_element();
  -
   	if ((realpath((const char *)doc->URL, resolved_path))) {
  -		profile->name = xstrdup(resolved_path);
  +		profile = create_profile_element(resolved_path);
   	} else {
  -		profile->name = xstrdup((const char *)doc->URL);
  +		profile = create_profile_element((const char *)doc->URL);
   	}
   
  -	profile->type = TYPE_PROFILE;
  -	profile->id = element_id++;
  -	profile->profile = profile;
  -	profile->handler = find_handler("__root", "all")->info;
  -
   	for (child = doc->children; child; child = child->next) {
   		if ((el = convert_nodes(child, profile, profile))) {
  -			link_element(el, prev, profile, profile);
  -
  +			link_element(el, prev);
   			prev = el;
   		}
   	}
  
  
  
  1.45      +11 -51    ALFS/nALFS/src/nalfs.c
  
  Index: nalfs.c
  ===================================================================
  RCS file: /home/cvsroot/ALFS/nALFS/src/nalfs.c,v
  retrieving revision 1.44
  retrieving revision 1.45
  diff -u -r1.44 -r1.45
  --- nalfs.c	14 Mar 2004 06:26:02 -0000	1.44
  +++ nalfs.c	16 Mar 2004 02:09:38 -0000	1.45
  @@ -82,9 +82,6 @@
   
   static element_s *current_running;	// Currently executing element.
   
  -static element_s *root_element;		// Parent of all profiles.
  -
  -
   /* Timer. */
   
   static struct timer {
  @@ -735,7 +732,7 @@
   	str_copy = xstrdup(str);
   
   	if ((tok = strtok(str_copy, " "))) { /* Profile's name. */
  -		element_s *profile = get_profile_by_name(root_element, tok);
  +		element_s *profile = get_profile_by_name(tok);
   
   		ASSERT(profile != NULL);
   
  @@ -1397,13 +1394,16 @@
   		return 1;
   	}
   
  -	if (!*opt_display_alfs && Is_element_name(el, "alfs")) {
  +/* TODO: is skipping of <alfs> elements really useful? */
  +#if 0
  +	if (!*opt_display_alfs && (el, "alfs")) {
   		if (depth) {
   			--(*depth);
   			el->hide_children = 0;
   		}
   		return 1;
   	}
  +#endif
   
   	if (!*opt_display_doctype && el->type == TYPE_DOCTYPE) {
   		if (depth) {
  @@ -3196,29 +3196,6 @@
    * Profile's functions (adding, removing, reloading, moving).
    */
   
  -static INLINE int remove_profile(element_s *profile)
  -{
  -	/* This is the only profile left, not removing it. */
  -	if (profile->prev == NULL && profile->next == NULL) {
  -		return -1;
  -	}
  -
  -	if (profile->prev == NULL) {
  -		/* It's a first profile. */
  -		profile->parent->children = profile->next;
  -	} else {
  -		profile->prev->next = profile->next;
  -	}
  -
  -	if (profile->next) {
  -		profile->next->prev = profile->prev;
  -	}
  -
  -	free_element(profile);
  -
  -	return 0;
  -}
  -
   static INLINE int reload_profile(element_s *old_profile)
   {
   	element_s *new_profile;
  @@ -3252,7 +3229,6 @@
   static element_s *do_add_profile(const char *profile)
   {
   	struct stat file_stat;
  -	element_s *last_profile;
   	element_s *new_profile;
   
   
  @@ -3267,23 +3243,7 @@
   		return NULL;
   	}
   
  -	if (root_element) {
  -		last_profile = root_element->children;
  -		while (last_profile->next) {
  -			last_profile = last_profile->next;
  -		}
  -
  -		last_profile->next = new_profile;
  -		new_profile->prev = last_profile;
  -
  -	} else {
  -		root_element = init_new_element();
  -		root_element->type = TYPE_ROOT;
  -		root_element->name = xstrdup("Profile collection");
  -		root_element->children = new_profile;
  -	}
  -
  -	new_profile->parent = root_element;
  +	add_profile(new_profile);
   
   	Nprint("Profile added: %s", new_profile->name);
   
  @@ -3295,7 +3255,7 @@
    * a directory, reads all .xml files in it, non-recursively.
    * Returns number of added profiles.
    */
  -static int add_profile(const char *name)
  +static int add_profile_from_path(const char *name)
   {
   	int num = 0;
   	struct stat file_stat;
  @@ -3356,7 +3316,7 @@
   			(const xmlChar *)filename,
   			(const xmlChar *)base);
   
  -		num = add_profile(fullname);
  +		num = add_profile_from_path(fullname);
   
   		xfree(fullname);
   		xfree(base);
  @@ -3380,7 +3340,7 @@
   	/* Second profile. */
   	if (profile->prev->prev == NULL) {
   		/* Now it's first, update root element. */
  -		root_element->children = profile;
  +		profile->parent->children = profile;
   	}
   
   
  @@ -3420,7 +3380,7 @@
   	/* First profile. */
   	if (profile->prev == NULL) {
   		/* Now it's second, update root element. */
  -		root_element->children = profile->next;
  +		profile->parent->children = profile->next;
   	}
   
   
  @@ -4744,7 +4704,7 @@
   
   	/* Add profiles from command line. */
   	for (i = optind; i < argc; ++i) {
  -		add_profile(argv[i]);
  +		add_profile_from_path(argv[i]);
   	}
   
   	if (*opt_log_status_window) {
  
  
  
  1.15      +112 -25   ALFS/nALFS/src/parser.c
  
  Index: parser.c
  ===================================================================
  RCS file: /home/cvsroot/ALFS/nALFS/src/parser.c,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- parser.c	14 Mar 2004 07:28:29 -0000	1.14
  +++ parser.c	16 Mar 2004 02:09:39 -0000	1.15
  @@ -40,15 +40,16 @@
   #include "libXML-tree.h"
   #include "parser.h"
   
  +static unsigned int element_id = 0;
  +element_s *root_element = NULL;
   
   element_s *init_new_element(void)
   {
   	element_s *new = xmalloc(sizeof *new);
   
  -
   	new->type = TYPE_UNKNOWN;
   
  -	new->id = 0;
  +	new->id = element_id++;
   
   	new->name = NULL;
   	new->content = NULL;
  @@ -65,21 +66,114 @@
   	new->children = NULL;
   	new->prev = NULL;
   	new->next = NULL;
  +	new->profile = NULL;
   
   	return new;
   }
   
  +static void create_root_element(void)
  +{
  +	root_element = init_new_element();
  +	root_element->type = TYPE_ROOT;
  +}
  +
  +void add_profile(element_s * const profile)
  +{
  +	ASSERT(profile->type == TYPE_PROFILE);
  +
  +	if (root_element == NULL) {
  +		create_root_element();
  +		root_element->children = profile;
  +	} else {
  +		element_s *last_profile = root_element->children;
  +		while (last_profile->next) {
  +			last_profile = last_profile->next;
  +		}
  +		last_profile->next = profile;
  +		profile->prev = last_profile;
  +	}
  +}
  +
  +void remove_profile(element_s * const profile)
  +{
  +	ASSERT(profile->type == TYPE_PROFILE);
  +
  +	if (profile->prev == NULL) {
  +		/* It's the top profile. */
  +		profile->parent->children = profile->next;
  +	} else {
  +		profile->prev->next = profile->next;
  +	}
  +
  +	if (profile->next) {
  +		profile->next->prev = profile->prev;
  +	}
  +
  +	free_element(profile);
  +}
  +
  +element_s *create_profile_element(const char * const profile_path)
  +{
  +	element_s *profile = init_new_element();
  +
  +	profile->type = TYPE_PROFILE;
  +	profile->parent = root_element;
  +	profile->profile = profile;
  +	profile->handler = find_handler("__profile", "all")->info;
  +	profile->name = xstrdup(profile_path);
  +
  +	return profile;
  +}
  +
  +element_s *create_comment_element(const element_s * const profile,
  +				  const element_s * const parent)
  +{
  +	element_s *el = init_new_element();
  +
  +	el->type = TYPE_COMMENT;
  +	el->parent = parent;
  +	el->profile = profile;
  +	el->handler = find_handler("__comment", "all")->info;
  +	el->name = xstrdup("Xcomment");
  +
  +	return el;
  +}
  +
  +element_s *create_handler_element(const element_s * const profile,
  +				  const element_s * const parent,
  +				  const char * const handler_name)
  +{
  +	element_s *el = NULL;
  +	const char *syntax_version;
  +	handler_s *handler;
  +
  +	syntax_version = find_handler_data(parent, HDATA_SYNTAX_VERSION);
  +	if ((handler = find_handler(handler_name, syntax_version)) != NULL) {
  +		el = init_new_element();
  +		el->type = TYPE_ELEMENT;
  +		el->parent = parent;
  +		el->profile = profile;
  +		el->handler = handler->info;
  +		el->name = xstrdup(handler_name);
  +	} else {
  +		Nprint_err("No handler found for %s (syntax version %s).",
  +			   handler_name, syntax_version);
  +		free_element(el);
  +		el = NULL;
  +	}
  +
  +	xfree(syntax_version);
  +	return el;
  +}
  +
   void free_element(element_s *el)
   {
   	element_s *tmp;
   	element_s *child = el->children;
   
  -
   	while (child) {
   		tmp = child->next;
  -
   		free_element(child);
  -
   		child = tmp;
   	}
   
  @@ -93,22 +187,18 @@
   }
   
   /* Link new element. */
  -void link_element(element_s *el, element_s *prev, element_s *parent,
  -		  element_s *profile)
  +void link_element(element_s *el, element_s *prev)
   {
   	/* Parent<->Child */
  -	if (parent->children == NULL) {
  -		parent->children = el;
  +	if (el->parent->children == NULL) {
  +		el->parent->children = el;
   	}
   
   	/* Previous<->Next */
   	if (prev) {
   		el->prev = prev;
  -
   		prev->next = el;
   	}
  -
  -	el->profile = profile;
   }
   
   static void append_el_parents(char **el_path, element_s *el)
  @@ -125,7 +215,6 @@
   {
   	element_s *el;
   
  -
   	for (el = profile; el; el = get_next_element(el)) {
   		if (el->type == TYPE_UNKNOWN) {
   			/* Print the names of all element's parents and
  @@ -146,7 +235,6 @@
   {
   	element_s *profile;
   
  -
   	if (opt_be_verbose) {
   		Nprint("Parsing %s...", filename);
   	}
  @@ -158,22 +246,20 @@
   	return profile;
   }
   
  -
  -
   /*
    * Different utility funtions.
    */
   
  -element_s *get_profile_by_element(element_s *el)
  +element_s *get_profile_by_element(const element_s * const el)
   {
   	return el->profile;
   }
   
  -element_s *get_profile_by_name(element_s *root, const char *name)
  +element_s *get_profile_by_name(const char * const name)
   {
   	element_s *el;
   
  -	for (el = root->children; el; el = el->next) {
  +	for (el = root_element->children; el; el = el->next) {
   		if (strcmp(el->name, name) == 0) {
   			return el;
   		}
  @@ -182,8 +268,10 @@
   	return NULL;
   }
   
  -element_s *get_next_element(element_s *el)
  +element_s *get_next_element(const element_s * const el)
   {
  +	element_s *tmp;
  +
   	if (el->children) {
   		return el->children;
   	}
  @@ -192,19 +280,18 @@
   		return el->next;
   	}
   
  -	for (el = el->parent; el; el = el->parent) {
  -		if (el->next) {
  -			return el->next;
  +	for (tmp = el->parent; tmp; tmp = tmp->parent) {
  +		if (tmp->next) {
  +			return tmp->next;
   		}
   	}
   
   	return NULL;
   }
   
  -element_s *get_prev_element(element_s *el)
  +element_s *get_prev_element(const element_s * const el)
   {
   	element_s *tmp, *previous;
  -
   
   	if (el->prev) {
   		previous = el->prev;
  
  
  
  1.10      +18 -8     ALFS/nALFS/src/parser.h
  
  Index: parser.h
  ===================================================================
  RCS file: /home/cvsroot/ALFS/nALFS/src/parser.h,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- parser.h	14 Mar 2004 06:26:02 -0000	1.9
  +++ parser.h	16 Mar 2004 02:09:39 -0000	1.10
  @@ -77,17 +77,27 @@
   	struct element_s *profile;
   } element_s;
   
  +element_s *root_element;
  +
  +void add_profile(element_s * const profile);
  +void remove_profile(element_s * const profile);
  +
  +element_s *create_profile_element(const char * const profile_path);
  +element_s *create_comment_element(const element_s * const profile,
  +				  const element_s * const parent);
  +element_s *create_handler_element(const element_s * const profile,
  +				  const element_s * const parent,
  +				  const char * const handler_name);
  +
  +void free_element(element_s * const el);
  +void link_element(element_s * const el, element_s * const prev);
   
  -element_s *init_new_element(void);
  -void free_element(element_s *el);
  -void link_element(element_s *el, element_s *prev, element_s *parent,
  -		  element_s *profile);
   element_s *parse_profile(const char *filename);
   
  -element_s *get_profile_by_element(element_s *el);
  -element_s *get_profile_by_name(element_s *root, const char *name);
  +element_s *get_profile_by_element(const element_s * const el);
  +element_s *get_profile_by_name(const char * const name);
   
  -element_s *get_next_element(element_s *el);
  -element_s *get_prev_element(element_s *el);
  +element_s *get_next_element(const element_s * const el);
  +element_s *get_prev_element(const element_s * const el);
   
   #endif /* H_PARSER_ */
  
  
  



More information about the alfs-log mailing list