remake  4.3+dbg-1.5
Data Structures | Macros | Enumerations | Functions | Variables
variable.h File Reference
#include "gnuremake.h"
#include "hash.h"

Go to the source code of this file.

Data Structures

struct  variable
 
struct  variable_set
 
struct  variable_set_list
 
struct  pattern_var
 

Macros

#define EXP_COUNT_BITS   15 /* This gets all the bitfields into 32 bits */
 
#define EXP_COUNT_MAX   ((1<<EXP_COUNT_BITS)-1)
 
#define SIZE_MAX   ((size_t)~(size_t)0)
 
#define allocated_variable_expand(line)   allocated_variable_expand_for_file (line, (struct file *) 0)
 
#define recursively_expand(v)   recursively_expand_for_file (v, NULL)
 
#define define_variable(n, l, v, o, r)
 
#define define_variable_cname(n, v, o, r)
 
#define define_variable_loc(n, l, v, o, r, f)
 
#define define_variable_global(n, l, v, o, r, f)   define_variable_in_set((n),(l),(v),(o),(r),NULL,(f))
 
#define define_variable_for_file(n, l, v, o, r, f)   define_variable_in_set((n),(l),(v),(o),(r),(f)->variables->set,NILF)
 
#define undefine_variable_global(n, l, o)   undefine_variable_in_set((n),(l),(o),NULL)
 
#define warn_undefined(n, l)
 
#define MAKELEVEL_NAME   "MAKELEVEL"
 
#define MAKELEVEL_LENGTH   (CSTRLEN (MAKELEVEL_NAME))
 

Enumerations

enum  variable_origin {
  o_default, o_env, o_file, o_env_override,
  o_command, o_override, o_automatic, o_debugger,
  o_invalid
}
 
enum  variable_flavor {
  f_bogus, f_simple, f_recursive, f_append,
  f_conditional, f_shell, f_append_value
}
 

Functions

char * variable_buffer_output (char *ptr, const char *string, size_t length)
 
char * variable_expand (const char *line)
 
char * variable_expand_for_file (const char *line, struct file *file)
 
char * allocated_variable_expand_for_file (const char *line, struct file *file)
 
char * expand_argument (const char *str, const char *end)
 
char * variable_expand_string (char *line, const char *string, size_t length)
 
void install_variable_buffer (char **bufp, size_t *lenp)
 
void restore_variable_buffer (char *buf, size_t len)
 
int handle_function (char **op, const char **stringp)
 
int pattern_matches (const char *pattern, const char *percent, const char *str)
 
char * subst_expand (char *o, const char *text, const char *subst, const char *replace, size_t slen, size_t rlen, int by_word)
 
char * patsubst_expand_pat (char *o, const char *text, const char *pattern, const char *replace, const char *pattern_percent, const char *replace_percent)
 
char * patsubst_expand (char *o, const char *text, char *pattern, char *replace)
 
char * func_shell_base (char *o, char **argv, int trim_newlines)
 
void shell_completed (int exit_code, int exit_sig)
 
char * recursively_expand_for_file (struct variable *v, struct file *file)
 
struct variable_set_listcreate_new_variable_set (void)
 
const char * origin2str (variable_origin_t origin)
 
void free_variable_set (struct variable_set_list *)
 
struct variable_set_listpush_new_variable_scope (void)
 
void pop_variable_scope (void)
 
void define_automatic_variables (void)
 
void initialize_file_variables (struct file *file, int reading)
 
void print_file_variables (const file_t *p_target, bool b_hash_stats)
 
void print_variable_data_base (void)
 
void print_variable_info (const void *item, void *arg)
 
void print_target_variables (const struct file *file)
 
void print_variable_set (struct variable_set *set, const char *prefix, int pauto)
 
void merge_variable_set_lists (struct variable_set_list **to_list, struct variable_set_list *from_list)
 
struct variabledo_variable_definition (const gmk_floc *flocp, const char *name, const char *value, enum variable_origin origin, enum variable_flavor flavor, int target_var)
 
char * parse_variable_definition (const char *line, struct variable *v)
 
struct variableassign_variable_definition (struct variable *v, const char *line)
 
struct variabletry_variable_definition (const gmk_floc *flocp, const char *line, enum variable_origin origin, int target_var)
 
void init_hash_global_variable_set (void)
 
void hash_init_function_table (void)
 
void define_new_function (const gmk_floc *flocp, const char *name, unsigned int min, unsigned int max, unsigned int flags, gmk_func_ptr func)
 
struct variablelookup_variable (const char *name, size_t length)
 
struct variablelookup_variable_in_set (const char *name, size_t length, const struct variable_set *set)
 
struct variabledefine_variable_in_set (const char *name, size_t length, const char *value, enum variable_origin origin, int recursive, struct variable_set *set, const gmk_floc *flocp)
 
void undefine_variable_in_set (const char *name, size_t length, enum variable_origin origin, struct variable_set *set)
 
char ** target_environment (struct file *file)
 
struct pattern_varcreate_pattern_var (const char *target, const char *suffix)
 

Variables

 v_export
 
 v_noexport
 
 v_ifset
 
 v_default
 
char * variable_buffer
 
struct variable_set_listcurrent_variable_set_list
 
struct variabledefault_goal_var
 
struct variable shell_var
 
int export_all_variables
 

Macro Definition Documentation

◆ allocated_variable_expand

#define allocated_variable_expand (   line)    allocated_variable_expand_for_file (line, (struct file *) 0)

◆ define_variable

#define define_variable (   n,
  l,
  v,
  o,
 
)
Value:
define_variable_in_set((n),(l),(v),(o),(r),\
struct variable * define_variable_in_set(const char *name, size_t length, const char *value, enum variable_origin origin, int recursive, struct variable_set *set, const gmk_floc *flocp)
struct variable_set_list * current_variable_set_list
struct variable_set * set
Definition: variable.h:101
#define NILF
Definition: makeint.h:461

◆ define_variable_cname

#define define_variable_cname (   n,
  v,
  o,
 
)
Value:
define_variable_in_set((n),(sizeof (n) - 1),(v),(o),(r),\
struct variable * define_variable_in_set(const char *name, size_t length, const char *value, enum variable_origin origin, int recursive, struct variable_set *set, const gmk_floc *flocp)
struct variable_set_list * current_variable_set_list
struct variable_set * set
Definition: variable.h:101
#define NILF
Definition: makeint.h:461

◆ define_variable_for_file

#define define_variable_for_file (   n,
  l,
  v,
  o,
  r,
 
)    define_variable_in_set((n),(l),(v),(o),(r),(f)->variables->set,NILF)

◆ define_variable_global

#define define_variable_global (   n,
  l,
  v,
  o,
  r,
 
)    define_variable_in_set((n),(l),(v),(o),(r),NULL,(f))

◆ define_variable_loc

#define define_variable_loc (   n,
  l,
  v,
  o,
  r,
 
)
Value:
define_variable_in_set((n),(l),(v),(o),(r),\
struct variable * define_variable_in_set(const char *name, size_t length, const char *value, enum variable_origin origin, int recursive, struct variable_set *set, const gmk_floc *flocp)
struct variable_set_list * current_variable_set_list
struct variable_set * set
Definition: variable.h:101

◆ EXP_COUNT_BITS

#define EXP_COUNT_BITS   15 /* This gets all the bitfields into 32 bits */

◆ EXP_COUNT_MAX

#define EXP_COUNT_MAX   ((1<<EXP_COUNT_BITS)-1)

◆ MAKELEVEL_LENGTH

#define MAKELEVEL_LENGTH   (CSTRLEN (MAKELEVEL_NAME))

◆ MAKELEVEL_NAME

#define MAKELEVEL_NAME   "MAKELEVEL"

◆ recursively_expand

#define recursively_expand (   v)    recursively_expand_for_file (v, NULL)

◆ SIZE_MAX

#define SIZE_MAX   ((size_t)~(size_t)0)

◆ undefine_variable_global

#define undefine_variable_global (   n,
  l,
 
)    undefine_variable_in_set((n),(l),(o),NULL)

◆ warn_undefined

#define warn_undefined (   n,
 
)
Value:
do{\
error (reading_file, (l), \
_("warning: undefined variable '%.*s'"), \
(int)(l), (n)); \
}while(0)
#define _(msgid)
Definition: make.h:293
int warn_undefined_variables_flag
const gmk_floc * reading_file

Enumeration Type Documentation

◆ variable_flavor

Enumerator
f_bogus 
f_simple 
f_recursive 
f_append 
f_conditional 
f_shell 
f_append_value 

◆ variable_origin

Enumerator
o_default 
o_env 
o_file 
o_env_override 
o_command 
o_override 
o_automatic 
o_debugger 
o_invalid 

Function Documentation

◆ allocated_variable_expand_for_file()

char* allocated_variable_expand_for_file ( const char *  line,
struct file file 
)

◆ assign_variable_definition()

struct variable* assign_variable_definition ( struct variable v,
const char *  line 
)

◆ create_new_variable_set()

struct variable_set_list* create_new_variable_set ( void  )

◆ create_pattern_var()

struct pattern_var* create_pattern_var ( const char *  target,
const char *  suffix 
)

◆ define_automatic_variables()

void define_automatic_variables ( void  )

Define the automatic variables, and record the addresses of their structures so we can change their values quickly.

◆ define_new_function()

void define_new_function ( const gmk_floc flocp,
const char *  name,
unsigned int  min,
unsigned int  max,
unsigned int  flags,
gmk_func_ptr  func 
)

◆ define_variable_in_set()

struct variable* define_variable_in_set ( const char *  name,
size_t  length,
const char *  value,
enum variable_origin  origin,
int  recursive,
struct variable_set set,
const gmk_floc flocp 
)

◆ do_variable_definition()

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 
)

◆ expand_argument()

char* expand_argument ( const char *  str,
const char *  end 
)

◆ free_variable_set()

void free_variable_set ( struct variable_set_list )

◆ func_shell_base()

char* func_shell_base ( char *  o,
char **  argv,
int  trim_newlines 
)

◆ handle_function()

int handle_function ( char **  op,
const char **  stringp 
)

◆ hash_init_function_table()

void hash_init_function_table ( void  )

◆ init_hash_global_variable_set()

void init_hash_global_variable_set ( void  )

◆ initialize_file_variables()

void initialize_file_variables ( struct file file,
int  reading 
)

Initialize FILE's variable set list. If FILE already has a variable set list, the topmost variable set is left intact, but the the rest of the chain is replaced with FILE->parent's setlist. If FILE is a double-colon rule, then we will use the "root" double-colon target's variable set as the parent of FILE's variable set.

If we're READing a makefile, don't do the pattern variable search now, since the pattern variable might not have been defined yet.

Referenced by dbg_cmd_info(), and dbg_cmd_target().

◆ install_variable_buffer()

void install_variable_buffer ( char **  bufp,
size_t *  lenp 
)

◆ lookup_variable()

struct variable* lookup_variable ( const char *  name,
size_t  length 
)

◆ lookup_variable_in_set()

struct variable* lookup_variable_in_set ( const char *  name,
size_t  length,
const struct variable_set set 
)

◆ merge_variable_set_lists()

void merge_variable_set_lists ( struct variable_set_list **  to_list,
struct variable_set_list from_list 
)

◆ origin2str()

const char* origin2str ( variable_origin_t  origin)

Return a string describing origin.

◆ parse_variable_definition()

char* parse_variable_definition ( const char *  line,
struct variable v 
)

◆ patsubst_expand()

char* patsubst_expand ( char *  o,
const char *  text,
char *  pattern,
char *  replace 
)

◆ patsubst_expand_pat()

char* patsubst_expand_pat ( char *  o,
const char *  text,
const char *  pattern,
const char *  replace,
const char *  pattern_percent,
const char *  replace_percent 
)

◆ pattern_matches()

int pattern_matches ( const char *  pattern,
const char *  percent,
const char *  str 
)

◆ pop_variable_scope()

void pop_variable_scope ( void  )

Pop the top set off the current_variable_set_list, and free all its storage. If b_toplevel set we have the top-most global scope and some things don't get freed because they weren't malloc'd.

◆ print_file_variables()

void print_file_variables ( const file_t p_target,
bool  b_hash_stats 
)

Print all the local variables of P_TARGET. Lines output have "# " prepended. If you want hash table statistics too, set b_hash_stats true.

◆ print_target_variables()

void print_target_variables ( const struct file file)

◆ print_variable_data_base()

void print_variable_data_base ( void  )

Print the data base of variables.

◆ print_variable_info()

void print_variable_info ( const void *  item,
void *  arg 
)

Print information for variable V, prefixing it with PREFIX.

Referenced by dbg_cmd_info().

◆ print_variable_set()

void print_variable_set ( struct variable_set set,
const char *  prefix,
int  pauto 
)

Print all the variables in SET. PREFIX is printed before the actual variable definitions (everything else is comments). If you want hash table statistics too, set b_hash_stats true.

◆ push_new_variable_scope()

struct variable_set_list* push_new_variable_scope ( void  )

Create a new variable set, push it on the current setlist, and assign current_variable_set_list to it.

◆ recursively_expand_for_file()

char* recursively_expand_for_file ( struct variable v,
struct file file 
)

◆ restore_variable_buffer()

void restore_variable_buffer ( char *  buf,
size_t  len 
)

◆ shell_completed()

void shell_completed ( int  exit_code,
int  exit_sig 
)

◆ subst_expand()

char* subst_expand ( char *  o,
const char *  text,
const char *  subst,
const char *  replace,
size_t  slen,
size_t  rlen,
int  by_word 
)

◆ target_environment()

char** target_environment ( struct file file)

◆ try_variable_definition()

struct variable* try_variable_definition ( const gmk_floc flocp,
const char *  line,
enum variable_origin  origin,
int  target_var 
)

◆ undefine_variable_in_set()

void undefine_variable_in_set ( const char *  name,
size_t  length,
enum variable_origin  origin,
struct variable_set set 
)

◆ variable_buffer_output()

char* variable_buffer_output ( char *  ptr,
const char *  string,
size_t  length 
)

◆ variable_expand()

char* variable_expand ( const char *  line)

◆ variable_expand_for_file()

char* variable_expand_for_file ( const char *  line,
struct file file 
)

◆ variable_expand_string()

char* variable_expand_string ( char *  line,
const char *  string,
size_t  length 
)

Variable Documentation

◆ current_variable_set_list

struct variable_set_list* current_variable_set_list

◆ default_goal_var

struct variable* default_goal_var

◆ export_all_variables

int export_all_variables

◆ shell_var

struct variable shell_var

◆ v_default

v_default

◆ v_export

v_export

◆ v_ifset

v_ifset

◆ v_noexport

v_noexport

◆ variable_buffer

char* variable_buffer