[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 2/6] * variable.h: Add support of struct value_records and parent
From: |
Macpaul Lin |
Subject: |
[PATCH 2/6] * variable.h: Add support of struct value_records and parent_records |
Date: |
Thu, 14 Aug 2014 15:37:35 +0800 |
(struct parent_record): add struct parent_record,
for constructing variables dependencies.
(struct value_record): add struct value_record for record
each value is assigned to a variable.
(variable_name_extract): add support to extract variable name
with [$()] prefix.
(alloc_parent_record): a function allocate memory for a parent_record
(do_variable_definition): add a paremeter of parent_records which will keep
related parent_variable occured in conditional_line.
(try_variable_definition): add a paremeter of parent_records to make
parent_record be associaited when the variable is defined.
Signed-off-by: Macpaul Lin <address@hidden>
---
variable.h | 27 +++++++++++++++++++++++++--
1 file changed, 25 insertions(+), 2 deletions(-)
diff --git a/variable.h b/variable.h
index 3e2328a..03ba18b 100644
--- a/variable.h
+++ b/variable.h
@@ -47,6 +47,23 @@ enum variable_flavor
#define EXP_COUNT_BITS 15 /* This gets all the bitfields into 32 bits */
#define EXP_COUNT_MAX ((1<<EXP_COUNT_BITS)-1)
+struct parent_record
+ {
+ struct variable *parent; /* a pointer to a parent which defined
+ a value of a variable */
+ struct parent_record *next; /* a pointer to next parent which defined
+ the same value */
+ };
+
+struct value_record
+ {
+ char *value; /* defined value of a variable. */
+ struct parent_record *p_records; /* a list of parents which defined
+ this value */
+ struct value_record *next; /* a pointer to next defined value */
+ };
+
+
struct variable
{
char *name; /* Variable name. */
@@ -78,6 +95,8 @@ struct variable
v_ifset, /* Export it if it has a non-default value. */
v_default /* Decide in target_environment. */
} export ENUM_BITFIELD (2);
+ struct value_record *v_records;
+ /* a list of defined values of this variable */
};
/* Structure that represents a variable set. */
@@ -119,6 +138,7 @@ char *allocated_variable_expand_for_file (const char *line,
struct file *file);
#define allocated_variable_expand(line) \
allocated_variable_expand_for_file (line, (struct file *) 0)
char *expand_argument (const char *str, const char *end);
+char *variable_name_extract (char *p, char **ps);
char *variable_expand_string (char *line, const char *string, long length);
void install_variable_buffer (char **bufp, unsigned int *lenp);
void restore_variable_buffer (char *buf, unsigned int len);
@@ -152,17 +172,20 @@ void print_file_variables (const struct file *file);
void print_target_variables (const struct file *file);
void merge_variable_set_lists (struct variable_set_list **to_list,
struct variable_set_list *from_list);
+struct parent_record *alloc_parent_record (struct variable *parent);
struct variable *do_variable_definition (const gmk_floc *flocp,
const char *name, const char *value,
enum variable_origin origin,
enum variable_flavor flavor,
- int target_var);
+ int target_var,
+ struct parent_record *parents);
char *parse_variable_definition (const char *line,
struct variable *v);
struct variable *assign_variable_definition (struct variable *v, const char
*line);
struct variable *try_variable_definition (const gmk_floc *flocp, const char
*line,
enum variable_origin origin,
- int target_var);
+ int target_var,
+ struct parent_record *parents);
void init_hash_global_variable_set (void);
void hash_init_function_table (void);
void define_new_function(const gmk_floc *flocp, const char *name,
--
1.9.1