libgeda

s_basic.c File Reference

#include <config.h>
#include <stdio.h>
#include <ctype.h>
#include "libgeda_priv.h"
Include dependency graph for s_basic.c:

Go to the source code of this file.

Functions

OBJECTs_basic_init_object (OBJECT *new_node, int type, char const *name)
 Initialize an already-allocated object.
OBJECTs_basic_new_object (int type, char const *prefix)
 Helper to allocate and initialise an object.
void print_struct_forw (GList *list)
void print_struct (OBJECT *ptr)
void s_delete_object (TOPLEVEL *toplevel, OBJECT *o_current)
void s_delete_object_glist (TOPLEVEL *toplevel, GList *list)
void s_object_weak_ref (OBJECT *object, void(*notify_func)(void *, void *), void *user_data)
 Add a weak reference watcher to an OBJECT.
void s_object_weak_unref (OBJECT *object, void(*notify_func)(void *, void *), void *user_data)
 Remove a weak reference watcher from an OBJECT.
void s_object_add_weak_ptr (OBJECT *object, void *weak_pointer_loc)
 Add a weak pointer to an OBJECT.
void s_object_remove_weak_ptr (OBJECT *object, void *weak_pointer_loc)
 Remove a weak pointer from an OBJECT.
char * remove_nl (char *string)
char * remove_last_nl (char *string)
gchar * s_expand_env_variables (const gchar *string)
 Expand environment variables in string.
const char * s_path_sys_data ()
 Get the directory with the gEDA system data.
const char * s_path_sys_config ()
 Get the directory with the gEDA system configuration.
const char * s_path_user_config ()
 Get the directory with the gEDA user configuration.

Variables

int global_sid = 0

Function Documentation

OBJECT* s_basic_init_object ( OBJECT new_node,
int  type,
char const *  name 
)
Function Description
Initializes the members of the OBJECT structure.
Parameters:
[in]new_nodeA pointer to an allocated OBJECT
[in]typeThe object type; one of the OBJ_* constants.
[in]nameA prefix for the object's session-unique name.
Returns:
A pointer to the initialized object.

Definition at line 59 of file s_basic.c.

OBJECT* s_basic_new_object ( int  type,
char const *  prefix 
)
Function Description
Allocates memory for an OBJECT and then calls s_basic_init_object() on it.
Parameters:
[in]typeThe sub-type of the object to create; one of the OBJ_* constants.
[in]prefixThe name prefix for the session-unique object name.
Returns:
A pointer to the fully constructed OBJECT.

Definition at line 148 of file s_basic.c.

Here is the call graph for this function:

void print_struct_forw ( GList *  list)
Todo:
Finish function documentation!!!
Function Description

Definition at line 159 of file s_basic.c.

Here is the call graph for this function:

void print_struct ( OBJECT ptr)
Todo:
Finish function documentation!!!
Function Description

Definition at line 188 of file s_basic.c.

Here is the call graph for this function:

void s_delete_object ( TOPLEVEL toplevel,
OBJECT o_current 
)
Todo:
Finish function documentation!!!
Function Description

Definition at line 217 of file s_basic.c.

Here is the call graph for this function:

void s_delete_object_glist ( TOPLEVEL toplevel,
GList *  list 
)
Todo:
Finish function documentation!!!
Function Description

Definition at line 319 of file s_basic.c.

Here is the call graph for this function:

void s_object_weak_ref ( OBJECT object,
void(*)(void *, void *)  notify_func,
void *  user_data 
)
Function Description
Adds the weak reference callback notify_func to object. When object is destroyed, notify_func will be called with two arguments: the object, and the user_data.
See also:
s_object_weak_unref
Parameters:
[in,out]objectObject to weak-reference.
[in]notify_funcWeak reference notify function.
[in]user_dataData to be passed to notify_func.

Definition at line 348 of file s_basic.c.

Here is the call graph for this function:

void s_object_weak_unref ( OBJECT object,
void(*)(void *, void *)  notify_func,
void *  user_data 
)
Function Description
Removes the weak reference callback notify_func from object.
See also:
s_object_weak_ref()
Parameters:
[in,out]objectObject to weak-reference.
[in]notify_funcNotify function to search for.
[in]user_dataData to to search for.

Definition at line 367 of file s_basic.c.

Here is the call graph for this function:

void s_object_add_weak_ptr ( OBJECT object,
void *  weak_pointer_loc 
)
Function Description
Adds the weak pointer at weak_pointer_loc to object. The value of weak_pointer_loc will be set to NULL when object is destroyed.
See also:
s_object_remove_weak_ptr
Parameters:
[in,out]objectObject to weak-reference.
[in]weak_pointer_locMemory address of a pointer.

Definition at line 388 of file s_basic.c.

Here is the call graph for this function:

void s_object_remove_weak_ptr ( OBJECT object,
void *  weak_pointer_loc 
)
Function Description
Removes the weak pointer at weak_pointer_loc from object.
See also:
s_object_add_weak_ptr()
Parameters:
[in,out]objectObject to weak-reference.
[in]weak_pointer_locMemory address of a pointer.

Definition at line 405 of file s_basic.c.

Here is the call graph for this function:

char* remove_nl ( char *  string)
Todo:
Finish function documentation!!!
Function Description

Definition at line 419 of file s_basic.c.

char* remove_last_nl ( char *  string)
Todo:
Finish function documentation!!!
Function Description

Definition at line 442 of file s_basic.c.

gchar* s_expand_env_variables ( const gchar *  string)
Function Description
This function returns the passed string with environment variables expanded.

The invocations of environment variable MUST be in the form '${variable_name}', '$variable_name' is not valid here. Environment variable names consists solely of letters, digits and '_'. It is possible to escape a '$' character in the string by repeating it twice.

It outputs error messages to console and leaves the malformed and bad variable names in the returned string.

Parameters:
[in]stringThe string with variables to expand.
Returns:
A newly-allocated string with variables expanded or NULL if input string was NULL.

Definition at line 475 of file s_basic.c.

const char* s_path_sys_data ( )
Function description
Returns the path to be searched for gEDA data shared between all users. If the GEDADATA environment variable is set, returns its value; otherwise, uses a compiled-in path.

On Windows, the compiled in path is *not* used, as it might not match the path where the user has installed gEDA.

Warning:
The returned string is owned by libgeda and should not be modified or free'd.
Todo:
On UNIX platforms we should follow the XDG Base Directory Specification.
Returns:
the gEDA shared data path, or NULL if none could be found.

Definition at line 608 of file s_basic.c.

const char* s_path_sys_config ( )
Function description
Returns the path to be searched for gEDA configuration shared between all users. If the GEDADATARC environment variable is set, returns its value; otherwise, uses a compiled-in path. Finally fallback to using the system data path.
Warning:
The returned string is owned by libgeda and should not be modified or free'd.
Todo:
On UNIX platforms we should follow the XDG Base Directory Specification.
Returns:
the gEDA shared config path, or NULL if none could be found.

Definition at line 647 of file s_basic.c.

Here is the call graph for this function:

const char* s_path_user_config ( )
Function description
Returns the path to be searched for the current user's gEDA configuration. Currently defaults to a directory ".gEDA" in the user's home directory.
Warning:
The returned string is owned by libgeda and should not be modified or free'd.
Todo:
On Windows, we should use APPDATA.
Todo:
On UNIX platforms we should follow the XDG Base Directory Specification.

Definition at line 681 of file s_basic.c.


Variable Documentation

int global_sid = 0

this is modified here and in o_list.c

Definition at line 48 of file s_basic.c.

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines