libgeda

libgedaguile_priv.h File Reference

#include <missing.h>
#include <libgeda/libgedaguile.h>
Include dependency graph for libgedaguile_priv.h:

Go to the source code of this file.

Defines

#define EDASCM_SMOB_TYPE(x)   (SCM_SMOB_FLAGS (x) & GEDA_SMOB_TYPE_MASK)
#define EDASCM_SMOB_TYPEP(x, type)   (SCM_SMOB_PREDICATE (geda_smob_tag, x) && (EDASCM_SMOB_TYPE (x) == type))
 Test the type of a gEDA smob.
#define EDASCM_SMOB_VALIDP(x)   (SCM_SMOB_PREDICATE (geda_smob_tag, x) && ((void *)SCM_SMOB_DATA (x) != NULL))
 Test whether a gEDA smob is valid.
#define EDASCM_ASSERT_SMOB_VALID(x)
 Assert that a gEDA smob is valid.
#define EDASCM_TOPLEVELP(x)   EDASCM_SMOB_TYPEP(x, GEDA_SMOB_TOPLEVEL)
#define EDASCM_PAGEP(x)   EDASCM_SMOB_TYPEP(x, GEDA_SMOB_PAGE)
#define EDASCM_OBJECTP(x)   EDASCM_SMOB_TYPEP(x, GEDA_SMOB_OBJECT)
#define EDASCM_SMOB_GCP(x)   (SCM_SMOB_PREDICATE (geda_smob_tag, x) && ((SCM_SMOB_FLAGS (x) & GEDA_SMOB_GC_FLAG) != 0))
 Test whether a structure may be garbage-collected.
#define EDASCM_SMOB_SET_GC(x, gc)
 Set whether a structure may be garbage-collected.

Enumerations

enum  geda_smob_flags {
  GEDA_SMOB_TOPLEVEL = 0, GEDA_SMOB_PAGE = 1, GEDA_SMOB_OBJECT = 2, GEDA_SMOB_TYPE_MASK = 0xf,
  GEDA_SMOB_GC_FLAG = 0x100
}

Functions

void edascm_init_smob ()
 Initialise the basic gEDA smob types.
void edascm_init_toplevel ()
 Initialise the TOPLEVEL manipulation procedures.
void edascm_init_object ()
 Initialise the basic gEDA object manipulation procedures.
void edascm_init_complex ()
 Initialise the basic gEDA complex object manipulation procedures.
void edascm_init_page ()
 Initialise the basic gEDA page manipulation procedures.
void edascm_init_attrib ()
 Initialise the basic gEDA attribute manipulation procedures.
void edascm_init_os ()
 Initialise the host platform support procedures.
void edascm_init_deprecated ()
 Initialise the basic gEDA page manipulation procedures.
SCM edascm_from_toplevel (TOPLEVEL *toplevel)
 Get the smob for a TOPLEVEL.
GList * edascm_to_object_glist (SCM objs, const char *subr) G_GNUC_WARN_UNUSED_RESULT
 Convert a Scheme object list to a GList.
SCM edascm_from_object_glist (const GList *objs)
 Convert a GList of objects into a Scheme list.
int edascm_is_object_type (SCM smob, int type)
 Test if an object smob is of a particular type.
void o_page_changed (TOPLEVEL *t, OBJECT *o)
 Flag an object's page as having been changed.

Variables

scm_t_bits geda_smob_tag
SCM edascm_object_state_sym

Detailed Description

Scheme API private declarations and definitions.

Warning:
Don't include from libgeda_priv.h: should only be included by Scheme API source files.

Definition in file libgedaguile_priv.h.


Define Documentation

#define EDASCM_SMOB_TYPE (   x)    (SCM_SMOB_FLAGS (x) & GEDA_SMOB_TYPE_MASK)

Retrieve the type flags for a gEDA smob.

Definition at line 117 of file libgedaguile_priv.h.

#define EDASCM_SMOB_TYPEP (   x,
  type 
)    (SCM_SMOB_PREDICATE (geda_smob_tag, x) && (EDASCM_SMOB_TYPE (x) == type))
Macro Description
Returns non-zero if x is a gEDA smob and the type flags of x match type.

Definition at line 124 of file libgedaguile_priv.h.

#define EDASCM_SMOB_VALIDP (   x)    (SCM_SMOB_PREDICATE (geda_smob_tag, x) && ((void *)SCM_SMOB_DATA (x) != NULL))
Macro Description
Returns non-zero if x is a gEDA smob and the pointer it contains is valid.

Definition at line 132 of file libgedaguile_priv.h.

#define EDASCM_ASSERT_SMOB_VALID (   x)
Value:
do { if (!EDASCM_SMOB_VALIDP(x)) {                                    \
      scm_misc_error (NULL, "Found invalid gEDA smob ~S", scm_list_1 (x)); \
    } } while (0)
Macro Description
Throw an error if assertions are enabled and x is invalid.

Definition at line 142 of file libgedaguile_priv.h.

#define EDASCM_TOPLEVELP (   x)    EDASCM_SMOB_TYPEP(x, GEDA_SMOB_TOPLEVEL)

Tests whether a Scheme value is a TOPLEVEL smob.

Definition at line 152 of file libgedaguile_priv.h.

#define EDASCM_PAGEP (   x)    EDASCM_SMOB_TYPEP(x, GEDA_SMOB_PAGE)

Tests whether a Scheme value is a PAGE smob.

Definition at line 155 of file libgedaguile_priv.h.

#define EDASCM_OBJECTP (   x)    EDASCM_SMOB_TYPEP(x, GEDA_SMOB_OBJECT)

Tests whether a Scheme value is an OBJECT smob.

Definition at line 158 of file libgedaguile_priv.h.

#define EDASCM_SMOB_GCP (   x)    (SCM_SMOB_PREDICATE (geda_smob_tag, x) && ((SCM_SMOB_FLAGS (x) & GEDA_SMOB_GC_FLAG) != 0))
Macro Description
Tests whether the C structure contained by the smob x is only referenced by Scheme code, and thus can be free()'d when x is garbage-collected.

Definition at line 167 of file libgedaguile_priv.h.

#define EDASCM_SMOB_SET_GC (   x,
  gc 
)
Value:
SCM_SET_SMOB_FLAGS (x, gc ? (SCM_SMOB_FLAGS (x) | GEDA_SMOB_GC_FLAG) \
                            : (SCM_SMOB_FLAGS (x) & ~GEDA_SMOB_GC_FLAG))
Macro Description
Set whether the structure contained by the smob x is only referenced by Scheme code, and thus should be free()'d when x is garbage-collected.
Parameters:
xSmob to modify.
gcNon-zero if x should be garbage-collected.

Definition at line 180 of file libgedaguile_priv.h.


Enumeration Type Documentation

The flags used to determine which C structure a smob contains.

Enumerator:
GEDA_SMOB_TOPLEVEL 
GEDA_SMOB_PAGE 
GEDA_SMOB_OBJECT 
GEDA_SMOB_TYPE_MASK 
GEDA_SMOB_GC_FLAG 

Definition at line 108 of file libgedaguile_priv.h.


Function Documentation

void edascm_init_smob ( )
Function Description
Registers the gEDA core smob types and some procedures acting on them. gEDA only uses a single Guile smob, and uses the flags field to multiplex the several different underlying C structures that may be represented by that smob. Should only be called by edascm_init().

Definition at line 455 of file scheme_smob.c.

Here is the call graph for this function:

void edascm_init_toplevel ( )
Function Description
Registers some Scheme procedures for working with TOPLEVEL smobs and creates the TOPLEVEL fluid. Should only be called by scheme_api_init().

Definition at line 133 of file scheme_toplevel.c.

Here is the call graph for this function:

void edascm_init_object ( )
Function Description
Registers some Scheme procedures for working with OBJECT smobs. Should only be called by scheme_api_init().

Definition at line 2206 of file scheme_object.c.

Here is the call graph for this function:

void edascm_init_complex ( )
Function Description
Registers some Scheme procedures for working with complex OBJECT smobs. Should only be called by scheme_api_init().

Definition at line 398 of file scheme_complex.c.

Here is the call graph for this function:

void edascm_init_page ( )
Function Description
Registers some Scheme procedures for working with PAGE smobs. Should only be called by scheme_api_init().

Definition at line 477 of file scheme_page.c.

Here is the call graph for this function:

void edascm_init_attrib ( )
Function Description
Registers some Scheme procedures for working with attributes. Should only be called by scheme_api_init().

Definition at line 299 of file scheme_attrib.c.

Here is the call graph for this function:

void edascm_init_os ( )
Function Description

Registers some Scheme procedures that provide cross-platform support. Should only be called by scheme_api_init().

Definition at line 98 of file scheme_os.c.

Here is the call graph for this function:

void edascm_init_deprecated ( )
Function Description
Registers some Scheme procedures for working with PAGE smobs. Should only be called by scheme_api_init().

Definition at line 88 of file scheme_deprecated.c.

Here is the call graph for this function:

GList* edascm_to_object_glist ( SCM  objs,
const char *  subr 
)
Function Description
Takes a Scheme list of OBJECT smobs, and returns a GList containing the objects. If objs is not a list of OBJECT smobs, throws a Scheme error.
Warning:
If the OBJECT structures in the GList are to be stored by C code and later free()'d directly, the smobs must be marked as unsafe for garbage collection (by calling edascm_c_set_gc()).
Parameters:
[in]objsa Scheme list of OBJECT smobs.
[in]subrthe name of the Scheme subroutine (used for error messages).
Returns:
a #GList of OBJECT.

Definition at line 98 of file scheme_object.c.

Here is the call graph for this function:

SCM edascm_from_object_glist ( const GList *  objs)
Function Description
Takes a GList of OBJECT and returns a Scheme list of corresponding object smobs.
Warning:
If the OBJECT structures are to be subsequently managed only by Scheme, the smobs in the returned list must be marked as safe for garbage collection (by calling edascm_c_set_gc()).
Parameters:
[in]objsa #GList of OBJECT instances.
Returns:
a Scheme list of smobs corresponding to each OBJECT.

Definition at line 133 of file scheme_object.c.

Here is the call graph for this function:

int edascm_is_object_type ( SCM  smob,
int  type 
)
Function Description
Checks if smob contains an OBJECT of the given type. This is intended to be used by C-based Scheme procedures for working with particular object types.
Parameters:
[in]smobScheme value to check type for.
[in]typeType to check against (e.g. OBJ_LINE).
Returns:
non-zero if smob is an OBJECT smob of type.

Definition at line 161 of file scheme_object.c.

Here is the call graph for this function:

void o_page_changed ( TOPLEVEL t,
OBJECT o 
) [inline]

Definition at line 76 of file scheme_object.c.

Here is the call graph for this function:


Variable Documentation

scm_t_bits geda_smob_tag

The tag used to identify gEDA data structures in Scheme.

Definition at line 63 of file scheme_smob.c.

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines