uservar

uservar

Functions

int (*USER_VAR_FUNC) ()
int user_var_add ()
int user_var_add_or_replace ()
int create_user_var ()
int user_var_delete ()
int user_var_delete_by_name ()
int gretl_is_user_var ()
GretlType user_var_get_type_by_name ()
user_var * get_user_var_by_name ()
user_var * get_user_var_of_type_by_name ()
user_var * get_user_var_by_data ()
const char * user_var_get_name ()
const char * user_var_get_name_by_data ()
void * user_var_get_value ()
double user_var_get_scalar_value ()
int user_var_set_scalar_value ()
void * user_var_get_value_by_name ()
void * user_var_get_value_and_type ()
char * user_string_resize ()
char * user_string_reset ()
void * user_var_steal_value ()
void * user_var_unstack_value ()
int user_var_get_level ()
int user_var_get_flags ()
int user_var_set_flag ()
void user_var_privatize_by_name ()
int user_var_set_name ()
int user_var_adjust_level ()
int user_var_localize ()
void switch_uservar_hash ()
int user_var_unlocalize ()
int copy_as_arg ()
int arg_add_as_shell ()
int * copy_list_as_arg ()
int user_var_replace_value ()
int user_matrix_replace_matrix_by_name ()
void destroy_user_vars ()
int destroy_user_vars_at_level ()
int destroy_private_matrices ()
int destroy_private_uvars ()
int delete_user_vars_of_type ()
int n_user_matrices ()
int n_user_scalars ()
int n_user_lists ()
int n_user_bundles ()
GList * user_var_names_for_type ()
GList * user_var_list_for_type ()
void set_user_var_callback ()
int copy_matrix_as ()
int private_matrix_add ()
double get_scalar_value_by_name ()
int gretl_is_scalar ()
double gretl_scalar_get_value ()
int gretl_scalar_set_value ()
int gretl_scalar_set_value_authorized ()
int gretl_scalar_add ()
int gretl_scalar_add_mutable ()
int gretl_scalar_convert_to_matrix ()
int private_scalar_add ()
int add_auxiliary_scalar ()
void set_auxiliary_scalars ()
void unset_auxiliary_scalars ()
void set_scalar_edit_callback ()
void destroy_private_scalars ()
void print_scalars ()
void print_scalar_by_name ()
char * get_string_by_name ()
char * copy_string_by_name ()
int gretl_is_string ()
int is_user_string ()
char * temp_name_for_bundle ()
int max_varno_in_saved_lists ()
int gretl_lists_revise ()
void gretl_lists_cleanup ()
int serialize_user_vars ()
int deserialize_user_vars ()
int print_user_var_by_name ()
int list_user_vars_of_type ()
int leads_midas_list ()
int in_midas_list ()
const char * get_listname_by_consecutive_content ()

Types and Values

enum UvarAction
enum UVFlags
typedef user_var

Description

Functions

USER_VAR_FUNC ()

int
(*USER_VAR_FUNC) (const char *Param1,
                  GretlType Param2,
                  int Param3);

user_var_add ()

int
user_var_add (const char *name,
              GretlType type,
              void *value);

Adds a new user-variable with the given characteristics. Note that the user-variable takes ownership of the supplied value ; this should be copied first if need be.

Parameters

name

name to give the variable.

 

type

the type of the variable.

 

value

pointer to value for variable.

 

Returns

0 on success, non-zero code on error.


user_var_add_or_replace ()

int
user_var_add_or_replace (const char *name,
                         GretlType type,
                         void *value);

create_user_var ()

int
create_user_var (const char *name,
                 GretlType type);

user_var_delete ()

int
user_var_delete (user_var *uvar);

user_var_delete_by_name ()

int
user_var_delete_by_name (const char *name,
                         PRN *prn);

Deletes the specified user-variable.

Parameters

name

name of the variable to delete.

 

prn

pointer to gretl printer, or NULL.

 

Returns

0 on success, non-zero code on error.


gretl_is_user_var ()

int
gretl_is_user_var (const char *name);

user_var_get_type_by_name ()

GretlType
user_var_get_type_by_name (const char *name);

get_user_var_by_name ()

user_var *
get_user_var_by_name (const char *name);

get_user_var_of_type_by_name ()

user_var *
get_user_var_of_type_by_name (const char *name,
                              GretlType type);

get_user_var_by_data ()

user_var *
get_user_var_by_data (const void *data);

user_var_get_name ()

const char *
user_var_get_name (user_var *uvar);

user_var_get_name_by_data ()

const char *
user_var_get_name_by_data (const void *data);

user_var_get_value ()

void *
user_var_get_value (user_var *uvar);

user_var_get_scalar_value ()

double
user_var_get_scalar_value (user_var *uvar);

user_var_set_scalar_value ()

int
user_var_set_scalar_value (user_var *uvar,
                           double x);

user_var_get_value_by_name ()

void *
user_var_get_value_by_name (const char *name);

user_var_get_value_and_type ()

void *
user_var_get_value_and_type (const char *name,
                             GretlType *type);

user_string_resize ()

char *
user_string_resize (const char *name,
                    size_t len,
                    int *err);

user_string_reset ()

char *
user_string_reset (const char *name,
                   int *err);

user_var_steal_value ()

void *
user_var_steal_value (user_var *uvar);

user_var_unstack_value ()

void *
user_var_unstack_value (user_var *uvar);

user_var_get_level ()

int
user_var_get_level (user_var *uvar);

user_var_get_flags ()

int
user_var_get_flags (user_var *uvar);

user_var_set_flag ()

int
user_var_set_flag (user_var *uvar,
                   UVFlags flag);

user_var_privatize_by_name ()

void
user_var_privatize_by_name (const char *name);

user_var_set_name ()

int
user_var_set_name (user_var *uvar,
                   const char *name);

user_var_adjust_level ()

int
user_var_adjust_level (user_var *uvar,
                       int adj);

user_var_localize ()

int
user_var_localize (const char *origname,
                   const char *localname,
                   GretlType type);

On entry to a function, renames the named variable (provided as an argument) and sets its level so that is is accessible within the function.

Parameters

origname

name of variable at caller level.

 

localname

name to be used within function.

 

Returns

0 on success, non-zero on error.


switch_uservar_hash ()

void
switch_uservar_hash (int level);

user_var_unlocalize ()

int
user_var_unlocalize (const char *localname,
                     const char *origname,
                     GretlType type);

On exit from a function, restores the original name and level of a variable which has been made available as an argument.

Parameters

localname

name of variable within function.

 

origname

name used at caller level.

 

Returns

0 on success, non-zero on error.


copy_as_arg ()

int
copy_as_arg (const char *param_name,
             GretlType type,
             void *value);

arg_add_as_shell ()

int
arg_add_as_shell (const char *name,
                  GretlType type,
                  void *value);

The value in question is added to the stack of named variables matrices under the name name with the shell flag set. This is used (a) when an anonymous matrix is given as a const argument to a user-defined function and (b) when an anonymous bundle is given as the argument corresponding to a bundle-pointer parameter. The value becomes accessible by name within the function, but is protected from destruction on exit from the function.

Parameters

name

the name to be given to the "shell" variable.

 

type

the type of the variable.

 

value

the value pointer

 

Returns

0 on success, non-zero on error.


copy_list_as_arg ()

int *
copy_list_as_arg (const char *param_name,
                  int *list,
                  int *err);

user_var_replace_value ()

int
user_var_replace_value (user_var *uvar,
                        void *value,
                        GretlType type);

Replaces the value of uvar ; the existing value is freed first.

Parameters

uvar

user variable.

 

value

the new value to place as the value or uvar .

 

type

the type of the replacement value.

 

Returns

0 on success, non-zero on error.


user_matrix_replace_matrix_by_name ()

int
user_matrix_replace_matrix_by_name (const char *name,
                                    gretl_matrix *m);

destroy_user_vars ()

void
destroy_user_vars (void);

destroy_user_vars_at_level ()

int
destroy_user_vars_at_level (int level);

Destroys and removes from the stack of user matrices all matrices that were created at the given level . This is part of the cleanup that is performed when a user-defined function terminates.

Parameters

level

stack level of function execution.

 

Returns

0 on success, non-zero on error.


destroy_private_matrices ()

int
destroy_private_matrices (void);

destroy_private_uvars ()

int
destroy_private_uvars (void);

delete_user_vars_of_type ()

int
delete_user_vars_of_type (GretlType type,
                          PRN *prn);

n_user_matrices ()

int
n_user_matrices (void);

n_user_scalars ()

int
n_user_scalars (void);

n_user_lists ()

int
n_user_lists (void);

n_user_bundles ()

int
n_user_bundles (void);

user_var_names_for_type ()

GList *
user_var_names_for_type (GretlType type);

user_var_list_for_type ()

GList *
user_var_list_for_type (GretlType type);

set_user_var_callback ()

void
set_user_var_callback (USER_VAR_FUNC Param1);

Sets the callback function to be invoked when a user-defined matrix is added to or removed from the stack of saved objects. Intended for synchronizing the GUI program with the saved object state.

Parameters

callback

function function to put in place.

 

copy_matrix_as ()

int
copy_matrix_as (const gretl_matrix *m,
                const char *newname,
                int fnarg);

A copy of matrix m is added to the stack of saved matrices under the name newname .

The fnarg argument should be non-zero only if this function is used to handle the case where a matrix is given as the argument to a user-defined function.

Parameters

m

the original matrix.

 

newname

the name to be given to the copy.

 

fnarg

0 for regular use.

 

Returns

0 on success, non-zero on error.


private_matrix_add ()

int
private_matrix_add (gretl_matrix *M,
                    const char *name);

get_scalar_value_by_name ()

double
get_scalar_value_by_name (const char *name,
                          int *err);

gretl_is_scalar ()

int
gretl_is_scalar (const char *name);

gretl_scalar_get_value ()

double
gretl_scalar_get_value (const char *name,
                        int *err);

gretl_scalar_set_value ()

int
gretl_scalar_set_value (const char *name,
                        double val);

gretl_scalar_set_value_authorized ()

int
gretl_scalar_set_value_authorized (const char *name,
                                   double val);

gretl_scalar_add ()

int
gretl_scalar_add (const char *name,
                  double val);

gretl_scalar_add_mutable ()

int
gretl_scalar_add_mutable (const char *name,
                          double val);

gretl_scalar_convert_to_matrix ()

int
gretl_scalar_convert_to_matrix (user_var *uvar);

private_scalar_add ()

int
private_scalar_add (double val,
                    const char *name);

add_auxiliary_scalar ()

int
add_auxiliary_scalar (const char *name,
                      double val);

set_auxiliary_scalars ()

void
set_auxiliary_scalars (void);

unset_auxiliary_scalars ()

void
unset_auxiliary_scalars (void);

set_scalar_edit_callback ()

void
set_scalar_edit_callback ();

destroy_private_scalars ()

void
destroy_private_scalars (void);

Gets rid of private or "internal" scalars whose names begin with '$'.


print_scalars ()

void
print_scalars (PRN *prn);

Prints names and values of any saved scalars.

Parameters

prn

pointer to gretl printing struct.

 

print_scalar_by_name ()

void
print_scalar_by_name (const char *name,
                      PRN *prn);

get_string_by_name ()

char *
get_string_by_name (const char *name);

Parameters

name

the name of the string variable to access.

 

Returns

the value of string variable name , or NULL if there is no such variable. Note that this is the actual string value, not a copy thereof, compare copy_string_by_name().


copy_string_by_name ()

char *
copy_string_by_name (const char *name,
                     int *err);

Parameters

name

the name of the string variable to access.

 

err

location to receive error code.

 

Returns

a copy of the value of string variable name , or NULL on failure.


gretl_is_string ()

int
gretl_is_string (const char *name);

Parameters

name

name to test.

 

Returns

1 if name is the name of a currently defined string variable, otherwise 0.


is_user_string ()

int
is_user_string (const char *name);

temp_name_for_bundle ()

char *
temp_name_for_bundle (void);

max_varno_in_saved_lists ()

int
max_varno_in_saved_lists (void);

gretl_lists_revise ()

int
gretl_lists_revise (const int *dlist,
                    int dmin);

Goes through any saved lists, adjusting the ID numbers they contain to reflect the deletion from the dataset of certain variables: those referenced in dlist , if given, or if dlist is NULL, those variables with IDs greater than or equal to dmin .

Parameters

dlist

list of variables to be deleted (or NULL).

 

dmin

lowest ID number of deleted var (referenced only if dlist is NULL).

 

Returns

0 on success, non-zero code on failure.


gretl_lists_cleanup ()

void
gretl_lists_cleanup (void);

Frees all resources associated with the internal apparatus for saving and retrieving named lists.


serialize_user_vars ()

int
serialize_user_vars (const char *dirname);

deserialize_user_vars ()

int
deserialize_user_vars (const char *dirname);

print_user_var_by_name ()

int
print_user_var_by_name (const char *name,
                        const DATASET *dset,
                        gretlopt opt,
                        PRN *prn);

list_user_vars_of_type ()

int
list_user_vars_of_type (const DATASET *dset,
                        PRN *prn);

leads_midas_list ()

int
leads_midas_list (int ID,
                  const DATASET *dset,
                  char *listname);

in_midas_list ()

int
in_midas_list (int ID,
               const DATASET *dset,
               char *listname);

get_listname_by_consecutive_content ()

const char *
get_listname_by_consecutive_content (int l0,
                                     int l1);

Types and Values

enum UvarAction

Members

UVAR_ADD

   

UVAR_DELETE

   

enum UVFlags

Members

UV_PRIVATE

   

UV_SHELL

   

UV_MAIN

   

UV_NODECL

   

user_var

typedef struct user_var_ user_var;