PIPS
variable.c File Reference
#include <stdio.h>
#include <string.h>
#include "boolean.h"
#include "arithmetique.h"
#include "vecteur.h"
+ Include dependency graph for variable.c:

Go to the source code of this file.

Functions

bool variable_equal (Variable v1, Variable v2)
 package vecteur - routines sur les variables More...
 
char * variable_default_name (Variable v)
 char * variable_default_name(Variable v): returns the name of variable v More...
 
char * variable_dump_name (Variable v)
 variable_dump_name() returns an unambiguous name for variable v, based on the pointer used to really identify variables in the vecteur package; the name starts with the letter X and contains the hexadecimal representation of v More...
 
void init_variable_debug_name (char *(*name)(Variable))
 This function is mostly intended for use from within gdb. More...
 
void reset_variable_debug_name (void)
 
Variable variable_make (char *name)
 Variable variable_make(char * name): defines a new variable of a given name. More...
 

Variables

char *(* variable_debug_name )(Variable) = variable_dump_name
 Debug support: pointer to the function used by debug print outs. More...
 

Function Documentation

◆ init_variable_debug_name()

void init_variable_debug_name ( char *(*)(Variable name)

This function is mostly intended for use from within gdb.

Definition at line 117 of file variable.c.

118 {
119  variable_debug_name = name;
120 }
char *(* variable_debug_name)(Variable)
Debug support: pointer to the function used by debug print outs.
Definition: variable.c:114

References variable_debug_name.

◆ reset_variable_debug_name()

void reset_variable_debug_name ( void  )

Definition at line 121 of file variable.c.

122 {
124 }
char * variable_dump_name(Variable v)
variable_dump_name() returns an unambiguous name for variable v, based on the pointer used to really ...
Definition: variable.c:96

References variable_debug_name, and variable_dump_name().

+ Here is the call graph for this function:

◆ variable_default_name()

char* variable_default_name ( Variable  v)

char * variable_default_name(Variable v): returns the name of variable v

Type variable is assumed here to be char *

Definition at line 81 of file variable.c.

83 {
84  return((char *)v);
85 }

Referenced by add_var_sup(), eq_in_ineq(), main(), primal(), primal_pivot(), primal_positive(), rec_ident(), sc_variable_name_init(), show_nredund(), test_file(), and var_ecart_sup().

+ Here is the caller graph for this function:

◆ variable_dump_name()

char* variable_dump_name ( Variable  v)

variable_dump_name() returns an unambiguous name for variable v, based on the pointer used to really identify variables in the vecteur package; the name starts with the letter X and contains the hexadecimal representation of v

Bugs:

  • the name is build in a local buffer; so a call to this function overwrite the previous returned value

Room for X0x1234567812345678\0 for example on 64 bit address architecture since Variable is a pointer to something:

Definition at line 96 of file variable.c.

96  {
97  /* Room for X0x1234567812345678\0 for example on 64 bit address
98  architecture since Variable is a pointer to something: */
99  static char buffer[sizeof(void *)*2+4];
100 
101  buffer[0] = 'X';
102  (void) sprintf(&buffer[1],"%p", v);
103  return(buffer);
104 }
static string buffer
Definition: string.c:113

References buffer.

Referenced by fprint_message(), main(), mk_rn(), reset_variable_debug_name(), sg_dump(), and sg_without_line().

+ Here is the caller graph for this function:

◆ variable_equal()

bool variable_equal ( Variable  v1,
Variable  v2 
)

package vecteur - routines sur les variables

variable.c

Francois Irigoin

Notes:

Modifications: INTLIBRARY bool variable_equal(Variable v1, Variable v2): returns true if variables v1 and v2 have the same VALUE

Type Variable is assumed here to be char *

Modifications:

  • no assumptions are made on type Variable; v1 and v2 may be of any type; all computations in vecteur.dir are based on pointer comparisons (FI, 28/12/89); this may lead to disaster for unit testing (FI, 11/12/2011)
Parameters
v11
v22

Definition at line 62 of file variable.c.

65 {
66  /*
67  * if(v1==NULL&&v2==NULL)
68  * return(true);
69  * else if (v1==NULL||v2==NULL)
70  * return(false);
71  *
72  * return(!strcmp(v1,v2));
73  */
74  return v1==v2;
75 }

Referenced by base_add_variable(), base_contains_variable_p(), base_find_variable(), sc_base_add_variable(), vect_add_variable(), and vect_contains_variable_p().

+ Here is the caller graph for this function:

◆ variable_make()

Variable variable_make ( char *  name)

Variable variable_make(char * name): defines a new variable of a given name.

Parameters
nameame

Definition at line 129 of file variable.c.

131 {
132  return((Variable) strdup(name));
133 }
char * strdup()
void * Variable
arithmetique is a requirement for vecteur, but I do not want to inforce it in all pips files....
Definition: vecteur-local.h:60

References strdup().

Referenced by creat_new_var(), and vect_read().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

◆ variable_debug_name

char*(* variable_debug_name) (Variable) ( Variable  ) = variable_dump_name