Main Page | Modules | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages

kernel/macro.h File Reference

Kernel - Generators of virtual properties, graphic object information and debuging tools. More...

Go to the source code of this file.

Defines

#define I_STRUCT_OFFSET   IG_STRUCT + GO_SUBTYPE_ID
#define PTU_UNSPECIFIED_TYPE   PT_UNS
#define PTU_COLOR_TYPE   PT_UNS
#define PTU_FONT_TYPE   PT_UNS
#define PTU_CONIC_TYPE_0P_TYPE   PT_UNS
#define PTU_CONIC_TYPE_1P_TYPE   PT_UNS
#define PTU_CONIC_TYPE_2P_TYPE   PT_UNS
#define PTU_CONIC_TYPE_3P_TYPE   PT_UNS
#define PTU_BOOLEAN_TYPE   PT_UNS
#define PTU_CAP_STYLE_TYPE   PT_UNS
#define PTU_JOIN_STYLE_TYPE   PT_UNS
#define PTU_STROKE_STYLE_TYPE   PT_UNS
#define PTU_ALIGNMENT_X_TYPE   PT_UNS
#define PTU_ALIGNMENT_Y_TYPE   PT_UNS
#define PTU_ARROW_FRONT_TYPE   PT_UNS
#define PTU_ARROW_BACK_TYPE   PT_UNS
#define PTU_ARROW_ALIGN_TYPE   PT_UNS
#define PTP_UNSPECIFIED_TYPE   PT_POINTER
#define PTP_TRANSFORM_TYPE   PT_POINTER
#define PTP_TEX_PROCESS_TYPE   PT_POINTER
#define PTS_UNSPECIFIED_TYPE   PT_STRING
#define PTS_FILE_NAME_TYPE   PT_STRING
#define PTS_LARGE_TEXT_TYPE   PT_STRING
#define PTR_UNSPECIFIED_TYPE   PT_REAL
#define PTR_POSITIVE_TYPE   PT_REAL
#define PTR_COORDINATE_TYPE   PT_REAL
#define PTR_LENGTH_TYPE   PT_REAL
#define PTR_ANGLE_PI_TYPE   PT_REAL
#define PTR_ANGLE_2PI_TYPE   PT_REAL
#define PTR_ANGLE_4PI_TYPE   PT_REAL
#define PTR_REFERENCE_TYPE   PT_REAL
#define PTU_UNSPECIFIED_UNION   u
#define PTU_COLOR_UNION   u
#define PTU_FONT_UNION   u
#define PTU_CONIC_TYPE_0P_UNION   u
#define PTU_CONIC_TYPE_1P_UNION   u
#define PTU_CONIC_TYPE_2P_UNION   u
#define PTU_CONIC_TYPE_3P_UNION   u
#define PTU_BOOLEAN_UNION   u
#define PTU_CAP_STYLE_UNION   u
#define PTU_JOIN_STYLE_UNION   u
#define PTU_STROKE_STYLE_UNION   u
#define PTU_ALIGNMENT_X_UNION   u
#define PTU_ALIGNMENT_Y_UNION   u
#define PTU_ARROW_FRONT_UNION   u
#define PTU_ARROW_BACK_UNION   u
#define PTU_ARROW_ALIGN_UNION   u
#define PTP_UNSPECIFIED_UNION   v
#define PTP_TRANSFORM_UNION   t
#define PTP_TEX_PROCESS_UNION   v
#define PTS_UNSPECIFIED_UNION   s
#define PTS_FILE_NAME_UNION   s
#define PTS_LARGE_TEXT_UNION   s
#define PTR_UNSPECIFIED_UNION   r
#define PTR_POSITIVE_UNION   r
#define PTR_COORDINATE_UNION   r
#define PTR_LENGTH_UNION   r
#define PTR_ANGLE_PI_UNION   r
#define PTR_ANGLE_2PI_UNION   r
#define PTR_ANGLE_4PI_UNION   r
#define PTR_REFERENCE_UNION   r
#define PROP_TYPE(_prop_subtype)   GLUEE(_prop_subtype, _TYPE)
 Generates typ of property for given subtype of property.

#define PROP_UNION(_prop_subtype)   GLUEE(_prop_subtype, _UNION)
 Generates variable in enum prop_value for given subtype of property.

#define PSTRUCT_SID(_name, _sid)   GLUEE3(GO_SUBNAME(GO_ID, _sid), _prop_, _name)
 Name of structure of property.

#define PSTRUCT(_name)   PSTRUCT_SID(_name, GO_SUBID)
 Name of structure of property.

#define PGET(_name)   GLUEE4(GO_SUBNAME_ID, _prop_, _name, _get)
 Name of function which returns value of property.

#define PSET(_name)   GLUEE4(GO_SUBNAME_ID, _prop_, _name, _set)
 Name of function which tries to change value of property.

#define PLOW(_name)   GLUEE4(GO_SUBNAME_ID, _prop_, _name, _set_low)
 Name of function which changes value of property; called only by undo.

#define PGETU(_name)   GLUEE4(GO_SUBNAME_ID, _prop_, _name, _get_unit)
 Name of function which returns unit of property.

#define PSETU(_name)   GLUEE4(GO_SUBNAME_ID, _prop_, _name, _set_unit)
 Name of function which changes unit of property.

#define PINIT(_sid)   GLUEE(GO_SUBNAME(GO_ID, _sid), _virtual_prop_init)
 Name of function which initialises property.

#define PFINISH(_sid)   GLUEE(GO_SUBNAME(GO_ID, _sid), _virtual_prop_finish)
 Name of function which destroys property.

#define PROP_VIRTUAL()
 Generates functions for initialising and destroying list of virtual properties.

#define PROP_GET(_name, _var, _prop_subtype)
 Generates function which returns value _var of property _name.

#define RECOMPUTE_CHANGED   tsort_dirty_recompute(&g->go)
#define RECOMPUTE_ALTERED   go_altered(&g->go)
#define PROP_SET(_name, _var, _prop_subtype, _cond, _msg, _recomp)
 Generates function which changes value _var of property _name and writes the change into undo history and calls recompute _recomp if condition _cond holds; otherwise calls trans_fail with message _msg.

#define PROP_SET_READ(_name)
 Read-only property is not possible to change so only trans_fail is called.

#define PROP_SET_REHANG_X(_name, _var, _anchor, _msg)
 Generates function which change X-coordinate of anchor. Property _name corresponds to position of anchor _anchor and the function rehangs the anchor if it hangs on mouse-click; otherwise calls trans_fail with message _msg.

#define PROP_SET_REHANG_Y(_name, _var, _anchor, _msg)
 Generates function which change Y-coordinate of anchor. Property _name corresponds to position of anchor _anchor and the function rehangs the anchor if it hangs on mouse-click; otherwise calls trans_fail with message _msg.

#define PROP_SET_BOOLEAN(_name, _var, _mask, _recomp)
 Like macro PROP_SET but specialised for boolean variables stored in flags of graphic object,.

#define PROP_SET_LOW(_name, _var, _prop_subtype)
 Generates function that changes value of property; function is called only by undo.

#define PROP_SET_LOW_BOOLEAN(_name, _var, _mask)
 Like macro PROP_SET_LOW but specialised for boolean variables stored in flags of graphic object,.

#define PROP_SET_LOW_DIE(_name,)
 Undo never change this property.

#define PROP_UNIT_GET(_name, _var)
 Generates function which returns unit of property.

#define PROP_UNIT_GET_DIE(_name)
 Given property has not a unit.

#define PROP_UNIT_SET(_name, _var)
 Generates function which changes unit of property.

#define PROP_UNIT_SET_DIE(_name)
 Given property has not a unit.

#define PROP_STRUCT(_name, _next, _prop_subtype, _flags, _undo_mask)
 Generates structure of property.

#define PROP_ALL_WITHOUT_SET(_name, _next, _prop_subtype, _var, _low, _flags, _undo_mask)
 Generates structure of property and functions which returns and changes unit and returns value and undo's changes.

#define PROP_ALL(_name, _next, _prop_subtype, _var, _cond, _msg, _recomp, _low, _flags, _undo_mask)
 Generates structure of property and all functions for manipulation with property.

#define PROP_ALL_REHANG(_name, _next, _var, _anchor, _msg, _flags)
 Generates two property which correspond to X and Y coordinate of anchor.

#define PROP_ALL_READ(_name, _next, _prop_subtype, _var, _flags, _undo_mask)
 Generates function for obtaining value of read only property.

#define PROP_ALL_WITHOUT_UNIT_AND_SET(_name, _next, _prop_subtype, _var, _low, _flags, _undo_mask)
 Like PROP_ALL_WITHOUT_SET but for property which has not unit.

#define PROP_ALL_WITHOUT_UNIT(_name, _next, _prop_subtype, _var, _cond, _msg, _recomp, _low, _flags, _undo_mask)
 Like PROP_ALL but for property which has not unit.

#define PROP_ALL_BOOLEAN(_name, _next, _var, _mask, _recomp, _flags, _undo_mask)
 Like PROP_ALL but for boolean property.

#define IG_STRUCT_FCE(_name, _struct, _init, _finish, _subgo_count)
#define IG_STRUCT_ONE(_sid, _hc, _curve, _hstart_, _hend, _center, _ac, _astart, _aend, _vp)
#define IG_STRUCT_1(_sid, _name, _hc, _curve, _hstart_, _hend, _center, _ac, _astart, _aend, _vp)   IG_STRUCT_ONE(_sid, _hc, _curve, _hstart_, _hend, _center, _ac, _astart, _aend, _vp)
#define IG_STRUCT_2(_sid, _name, _hc, _curve, _hstart_, _hend, _center, _ac, _astart, _aend, _vp,)   IG_STRUCT_ONE(_sid, _hc, _curve, _hstart_, _hend, _center, _ac, _astart, _aend, _vp) IG_STRUCT_1(__VA_ARGS__)
#define IG_STRUCT_3(_sid, _name, _hc, _curve, _hstart_, _hend, _center, _ac, _astart, _aend, _vp,)   IG_STRUCT_ONE(_sid, _hc, _curve, _hstart_, _hend, _center, _ac, _astart, _aend, _vp) IG_STRUCT_2(__VA_ARGS__)
#define IG_STRUCT_4(_sid, _name, _hc, _curve, _hstart_, _hend, _center, _ac, _astart, _aend, _vp,)   IG_STRUCT_ONE(_sid, _hc, _curve, _hstart_, _hend, _center, _ac, _astart, _aend, _vp) IG_STRUCT_3(__VA_ARGS__)
#define IG_STRUCT_5(_sid, _name, _hc, _curve, _hstart_, _hend, _center, _ac, _astart, _aend, _vp,)   IG_STRUCT_ONE(_sid, _hc, _curve, _hstart_, _hend, _center, _ac, _astart, _aend, _vp) IG_STRUCT_4(__VA_ARGS__)
#define IG_INIT_ONE(_sid, _name)   IG_STRUCT[GO_SUBTYPE(GO_ID, _sid)].name = string_lookup_ref(_name); IH_INIT(_sid)(); IA_INIT(_sid)(); PINIT(_sid)();
#define IG_INIT_1(_sid, _name, _hc, _curve, _hstart, _hend, _center, _ac, _astart, _aend, _vp)   IG_INIT_ONE(_sid, _name)
#define IG_INIT_2(_sid, _name, _hc, _curve, _hstart, _hend, _center, _ac, _astart, _aend, _vp,)   IG_INIT_ONE(_sid, _name) IG_INIT_1(__VA_ARGS__)
#define IG_INIT_3(_sid, _name, _hc, _curve, _hstart, _hend, _center, _ac, _astart, _aend, _vp,)   IG_INIT_ONE(_sid, _name) IG_INIT_2(__VA_ARGS__)
#define IG_INIT_4(_sid, _name, _hc, _curve, _hstart, _hend, _center, _ac, _astart, _aend, _vp,)   IG_INIT_ONE(_sid, _name) IG_INIT_3(__VA_ARGS__)
#define IG_INIT_5(_sid, _name, _hc, _curve, _hstart, _hend, _center, _ac, _astart, _aend, _vp,)   IG_INIT_ONE(_sid, _name) IG_INIT_4(__VA_ARGS__)
#define IG_FINISH_ONE(_sid)   PFINISH(_sid) ();
#define IG_FINISH_1(_sid, _name, _hc, _curve, _hstart, _hend, _center, _ac, _astart, _aend, _vp)   IG_FINISH_ONE(_sid)
#define IG_FINISH_2(_sid, _name, _hc, _curve, _hstart, _hend, _center, _ac, _astart, _aend, _vp,)   IG_FINISH_ONE(_sid) IG_FINISH_1(__VA_ARGS__)
#define IG_FINISH_3(_sid, _name, _hc, _curve, _hstart, _hend, _center, _ac, _astart, _aend, _vp,)   IG_FINISH_ONE(_sid) IG_FINISH_2(__VA_ARGS__)
#define IG_FINISH_4(_sid, _name, _hc, _curve, _hstart, _hend, _center, _ac, _astart, _aend, _vp,)   IG_FINISH_ONE(_sid) IG_FINISH_3(__VA_ARGS__)
#define IG_FINISH_5(_sid, _name, _hc, _curve, _hstart, _hend, _center, _ac, _astart, _aend, _vp,)   IG_FINISH_ONE(_sid) IG_FINISH_4(__VA_ARGS__)
#define IH_STRUCT_FCE(_struct, _fce)   static struct hanger_info IH_STRUCT_ID[] = { _struct }; static void IH_INIT_ID(void) { _fce }
#define IH_STRUCT_ONE(_i, _q, _var, _get, _lin)
#define IH_STRUCT_1(_i, _n, _q, _var, _get, _lin)   IH_STRUCT_ONE(_i, _q, _var, _get, _lin)
#define IH_STRUCT_2(_i, _n, _q, _var, _get, _lin,)   IH_STRUCT_ONE(_i, _q, _var, _get, _lin) IH_STRUCT_1(_i + 1, __VA_ARGS__)
#define IH_STRUCT_3(_i, _n, _q, _var, _get, _lin,)   IH_STRUCT_ONE(_i, _q, _var, _get, _lin) IH_STRUCT_2(_i + 1, __VA_ARGS__)
#define IH_STRUCT_4(_i, _n, _q, _var, _get, _lin,)   IH_STRUCT_ONE(_i, _q, _var, _get, _lin) IH_STRUCT_3(_i + 1, __VA_ARGS__)
#define IH_FCE_ONE(_i, _n)   IH_STRUCT_ID[_i].name = string_lookup_ref(_n); glt_kernel_init_hanger(&IH_STRUCT_ID[_i]);
#define IH_FCE_1(_i, _n, _q, _var, _get, _lin)   IH_FCE_ONE(_i, _n)
#define IH_FCE_2(_i, _n, _q, _var, _get, _lin,)   IH_FCE_ONE(_i, _n) IH_FCE_1(_i + 1, __VA_ARGS__)
#define IH_FCE_3(_i, _n, _q, _var, _get, _lin,)   IH_FCE_ONE(_i, _n) IH_FCE_2(_i + 1, __VA_ARGS__)
#define IH_FCE_4(_i, _n, _q, _var, _get, _lin,)   IH_FCE_ONE(_i, _n) IH_FCE_3(_i + 1, __VA_ARGS__)
#define IA_STRUCT_FCE(_struct, _fce)   static struct anchor_info IA_STRUCT_ID[] = { _struct }; static void IA_INIT_ID (void) { _fce }
#define IA_STRUCT_ONE(_i, _q, _lin)   { NULL, _q, OFFSETOF(GO_STRUCT_ID, a[_i]), I_STRUCT_OFFSET, _lin },
#define IA_STRUCT_1(_i, _n, _q, _lin)   IA_STRUCT_ONE(_i, _q, _lin)
#define IA_STRUCT_2(_i, _n, _q, _lin,)   IA_STRUCT_ONE(_i, _q, _lin) IA_STRUCT_1(_i + 1, __VA_ARGS__)
#define IA_STRUCT_3(_i, _n, _q, _lin,)   IA_STRUCT_ONE(_i, _q, _lin) IA_STRUCT_2(_i + 1, __VA_ARGS__)
#define IA_STRUCT_4(_i, _n, _q, _lin,)   IA_STRUCT_ONE(_i, _q, _lin) IA_STRUCT_3(_i + 1, __VA_ARGS__)
#define IA_FCE_ONE(_i, _n)   IA_STRUCT_ID[_i].name = string_lookup_ref(_n); glt_kernel_init_anchor(&IA_STRUCT_ID[_i]);
#define IA_FCE_1(_i, _n, _q, _lin)   IA_FCE_ONE(_i, _n)
#define IA_FCE_2(_i, _n, _q, _lin,)   IA_FCE_ONE(_i, _n) IA_FCE_1(_i + 1, __VA_ARGS__)
#define IA_FCE_3(_i, _n, _q, _lin,)   IA_FCE_ONE(_i, _n) IA_FCE_2(_i + 1, __VA_ARGS__)
#define IA_FCE_4(_i, _n, _q, _lin,)   IA_FCE_ONE(_i, _n) IA_FCE_3(_i + 1, __VA_ARGS__)
#define MSG_UNIT(_name)   msg("\tunit_" #_name " = %u, %s\n", go->unit_##_name, go->unit_##_name == PROP_UNIT_MAX ? "default unit" : unit_array[go->unit_##_name].name->text)
#define ASSERT_GO_TYPE_ID(_o)   ASSERT_GO_TYPE(_o, GO_ID)
#define ASSERT_GO_SUBTYPE_ID(_o)   ASSERT_GO_SUBTYPE(_o, GO_ID, GO_SUBID)
#define GO_TYPE_SWITCH()
#define GO_SUBTYPE_SWITCH(_id,)
#define ASSERT_KERNEL()   do { } while(0);
#define ASSERT_KERNEL_SLOW()   do { } while(0);
#define DANGEROUS()   do { } while(0)
#define DBG_O()   do { } while(0)
#define DBG_TSORT()   do { } while(0)
#define DBG_TRANS()   do { } while(0)
#define TRANS_FAIL1()   TRANS_FAIL((__VA_ARGS__), (__VA_ARGS__))
#define TRANS_FAIL(_release, _debug)   trans_fail _release;
#define ASSERT_META_TRANS   ASSERT(trans_present && trans_page == page_universum)
#define ASSERT_GO_TRANS(_go)   ASSERT(trans_present && void2page(trans_page) == ((_go) ? go_get_page(_go) : trans_page))
#define ASSERT_O_TRANS(_o)   ASSERT(trans_present && void2o(_o)->kind == T_OBJ ? trans_page == page_universum : void2page(trans_page) == go_get_page(o2go(_o)))
#define ASSERT_GO_TYPE(_o, _id)   ASSERT((_o) && ((struct o*)(_o))->kind == T_GO && ((struct o*)(_o))->type == GO_TYPE(_id))
#define ASSERT_GO_SUBTYPE(_o, _id, _sid)
#define ASSERT_HANGER(_h)   ASSERT((_h) && ((struct hanger*)(_h))->info && hanger_get_go((struct hanger*)(_h))->kind == T_GO)
#define ASSERT_ANCHOR(_a)   ASSERT((_a) && ((struct anchor*)(_a))->info && anchor_get_go((struct anchor*)(_a))->kind == T_GO)


Detailed Description

Kernel - Generators of virtual properties, graphic object information and debuging tools.

Copyright (c) 2004-2005 The VRR Team <vrr@ucw.cz> This program is distributed under GNU General Public License, see COPYING.

Generators of virtual properties hanger, anchors and graphic object information.

Various graphic objects have similar virtual properties, hangers, anchors and graphic object information. Follow sophistic macro makes writing new graphic object easier but most of the work is hidden in eery code.

Following macros must be defined before using those generators. They are defined in kernel/go_internal.h (expect user defined graphic object).

In source files of graphic object macros GO_ID and GO_SUBID must define type and subtype (suffix to type) of graphic object.

Common argument of generators of virtual properties.


Define Documentation

#define ASSERT_GO_SUBTYPE _o,
_id,
_sid   ) 
 

Value:

ASSERT((_o) && ((struct o*)(_o))->kind == T_GO && \
                ((struct o*)(_o))->type == GO_TYPE(_id) && ((struct o*)(_o))->subtype == GO_SUBTYPE(_id, _sid))

#define GO_SUBTYPE_SWITCH _id   ) 
 

Value:

case GO_TYPE(_id): { \
                UNUSED GO_STRUCT(_id) *spec = (GO_STRUCT(_id)*)go; \
                switch(go->subtype) { \
                        __VA_ARGS__ \
                        default: die("Function %s hasn't label for the go type[%d] %s, subtype[%d] %s.\n", \
                        __func__, go->type, string_go_type[go->type]->text, go->subtype, go_get_info(go)->name->text); } break; }

 
#define GO_TYPE_SWITCH  ) 
 

Value:

switch(void2go(go)->type) \
        {       __VA_ARGS__; \
                default: die("Function %s hasn't label for the go type %d - %s.\n", __func__, go->type, string_go_type[go->type]->text); \
        }

#define IG_STRUCT   GLUEE(GO_NAME_ID, _info)
 

Generates name of structures and functions.

#define IG_STRUCT_FCE _name,
_struct,
_init,
_finish,
_subgo_count   ) 
 

Value:

struct go_info IG_STRUCT[] = { _struct }; \
        void ALL_INIT(void) { string_go_type[GO_TYPE_ID] = string_lookup_ref(_name); _init } \
        void ALL_FINISH(void) { go_info_finish(IG_STRUCT, _subgo_count); _finish }

#define IG_STRUCT_ONE _sid,
_hc,
_curve,
_hstart_,
_hend,
_center,
_ac,
_astart,
_aend,
_vp   ) 
 

Value:

[GO_SUBTYPE(GO_ID, _sid)] = \
        { NULL, _hc, OFFSETOF(GO_STRUCT_ID, h), 0, IH_STRUCT(_sid), _curve, _hstart_, _hend, _center, _ac, \
        OFFSETOF(GO_STRUCT_ID, a), IA_STRUCT(_sid), _astart, _aend, &PSTRUCT_SID(_vp, _sid) },

#define IH_STRUCT_ONE _i,
_q,
_var,
_get,
_lin   ) 
 

Value:

{ NULL, _q, OFFSETOF(GO_STRUCT_ID, h[_i]), I_STRUCT_OFFSET, \
        OFFSETOF(GO_STRUCT_ID, _var) - OFFSETOF(GO_STRUCT_ID, h[_i]), _get, _lin },

 
#define INFO_ANCHOR_0  )     IA_STRUCT_FCE(,)
 

Generators of anchor information.

The suffix _n in macros INFO_ANCHOR_n is number of anchor. In the @'...@' arguments there is information about each anchor.

#define INFO_GO_1 _name   )     IG_STRUCT_FCE(_name, IG_STRUCT_1(__VA_ARGS__), IG_INIT_1(__VA_ARGS__), IG_FINISH_1(__VA_ARGS__), 1)
 

Generators of graphic object information.

The suffix _n in macros INFO_GO_n is number of subtypes.

_name Name of type of graphic object stored in array string_go_type.

In the @'...@' arguments there is information about each subtype.

  • _sid Subtype of subtype of graphic object.
  • _name Name of subtype of graphic object.
    • _hc Number of hangers in fixed-size array.
  • _curve Index of hanger reprezenting whole curve. -1 if go is not parametrizable.
  • _hstart Index of hanger reprezenting start point of curve. -1 if go hasn't start.
  • _hend Index of hanger reprezenting end point of curve. -1 if go hasn't end.
  • _center Index of hanger reprezenting center of curve. -1 if go hasn't center.
  • _ac Number of anchors in fixed-size array.
  • _astart Index of anchor reprezenting start point of curve. -1 if go hasn't start.
  • _aend Index of anchor reprezenting end point of curve. -1 if go hasn't end.
  • _vp The first property in the link list of virtual properties.

#define INFO_HANGER_0   static struct hanger_info IH_STRUCT_ID[1]; static void IH_INIT_ID(void) { }
 

Generators of hanger information.

The suffix _n in macros INFO_HANGER_n is number of hanger. In the @'...@' arguments there is information about each hanger.

  • _n Name of hanger.
  • _q Type of dependence, see enum quantity_type.
  • _var Offset of hanger and value of hanger in structure of graphic object. It is itself (i.e. h[i]) if there is no value (type of dependence is curve) or the value is not stored in structure of graphic object.
  • _get Function which returns value of hanger if the value is not stored in structure of graphic object.
  • _lin Behavior during affine transformation, see enum linearity_type.

#define PROP_ALL _name,
_next,
_prop_subtype,
_var,
_cond,
_msg,
_recomp,
_low,
_flags,
_undo_mask   ) 
 

Value:

PROP_ALL_WITHOUT_SET(_name, _next, _prop_subtype, _var, _low, _flags, _undo_mask)       \
PROP_SET(_name, _var, _prop_subtype, _cond, _msg, _recomp)
Generates structure of property and all functions for manipulation with property.

#define PROP_ALL_BOOLEAN _name,
_next,
_var,
_mask,
_recomp,
_flags,
_undo_mask   ) 
 

Value:

static struct prop_virtual PSTRUCT(_name);      \
PROP_GET(_name, _var & _mask ? 1 : 0, PTU_UNSPECIFIED)  \
PROP_SET_BOOLEAN(_name, _var, _mask, _recomp) \
PROP_SET_LOW_BOOLEAN(_name, _var, _mask) \
PROP_UNIT_GET_DIE(_name)        \
PROP_UNIT_SET_DIE(_name)        \
PROP_STRUCT(_name, _next, PTU_BOOLEAN, _flags, _undo_mask)
Like PROP_ALL but for boolean property.

#define PROP_ALL_READ _name,
_next,
_prop_subtype,
_var,
_flags,
_undo_mask   ) 
 

Value:

PROP_ALL_WITHOUT_SET(_name, _next, _prop_subtype, _var, LOW_DIE, _flags | PTF_READ_ONLY, _undo_mask)    \
PROP_SET_READ(_name)
Generates function for obtaining value of read only property.

#define PROP_ALL_REHANG _name,
_next,
_var,
_anchor,
_msg,
_flags   ) 
 

Value:

PROP_ALL_WITHOUT_SET(_name##_y, _next, PTR_COORDINATE, _var.y, LOW_DIE, _flags, UINT_MAX)       \
PROP_ALL_WITHOUT_SET(_name##_x, PSTRUCT(_name##_y), PTR_COORDINATE, _var.x, LOW_DIE, _flags, UINT_MAX)  \
PROP_SET_REHANG_Y(_name, _var, _anchor, _msg) \
PROP_SET_REHANG_X(_name, _var, _anchor, _msg)
Generates two property which correspond to X and Y coordinate of anchor.

#define PROP_ALL_WITHOUT_SET _name,
_next,
_prop_subtype,
_var,
_low,
_flags,
_undo_mask   ) 
 

Value:

static struct prop_virtual PSTRUCT(_name);      \
PROP_GET(_name, _var, _prop_subtype)    \
static void PSET(_name) (struct o *o, prop_value value); \
PROP_SET_##_low(_name, _var, _prop_subtype) \
PROP_UNIT_GET(_name, unit_##_name)      \
PROP_UNIT_SET(_name, unit_##_name)      \
PROP_STRUCT(_name, _next, _prop_subtype, _flags, _undo_mask)
Generates structure of property and functions which returns and changes unit and returns value and undo's changes.

#define PROP_ALL_WITHOUT_UNIT _name,
_next,
_prop_subtype,
_var,
_cond,
_msg,
_recomp,
_low,
_flags,
_undo_mask   ) 
 

Value:

PROP_ALL_WITHOUT_UNIT_AND_SET(_name, _next, _prop_subtype, _var, _low, _flags, _undo_mask)      \
PROP_SET(_name, _var, _prop_subtype, _cond, _msg, _recomp) \
Like PROP_ALL but for property which has not unit.

#define PROP_ALL_WITHOUT_UNIT_AND_SET _name,
_next,
_prop_subtype,
_var,
_low,
_flags,
_undo_mask   ) 
 

Value:

static struct prop_virtual PSTRUCT(_name);      \
PROP_GET(_name, _var, _prop_subtype)    \
static void PSET(_name) (struct o *o, prop_value value); \
PROP_SET_##_low(_name, _var, _prop_subtype) \
PROP_UNIT_GET_DIE(_name)        \
PROP_UNIT_SET_DIE(_name)        \
PROP_STRUCT(_name, _next, _prop_subtype, _flags, _undo_mask)
Like PROP_ALL_WITHOUT_SET but for property which has not unit.

#define PROP_FILL_COLOR
 

Value:

PROP_ALL_WITHOUT_UNIT(fill_color, PSTRUCT(invisible), PTU_COLOR, fill_color, \
                1, (("Cannot fail."), ("Bug, fix me.")), ALTERED, LOW, PTF_SAVE | PTF_RECYCLABLE, UINT_MAX)

#define PROP_GET _name,
_var,
_prop_subtype   ) 
 

Value:

static prop_value PGET(_name) (struct o *o)     \
{       \
        ASSERT_GO_SUBTYPE_ID(o);        \
        return (prop_value){.PROP_UNION(_prop_subtype) = ((GO_STRUCT_ID *)o)->_var};    \
}
Generates function which returns value _var of property _name.

#define PROP_INVISIBLE   PROP_ALL_BOOLEAN(invisible, o_prop_name, go.flags, GOF_INVISIBLE, ALTERED, PTF_SAVE | PTF_RECYCLABLE, UINT_MAX)
 

Generates stypes virtual properties. That is flag invisible, fill and stroke color, width of line, way of ending line and joining two lines, style of line (dashed, dotter, ...). Macros *_INIT are used as argument for PROP_VIRTUAL.

#define PROP_SET _name,
_var,
_prop_subtype,
_cond,
_msg,
_recomp   ) 
 

Value:

static void PSET(_name) (struct o *o, prop_value value) \
{       \
        ASSERT_GO_SUBTYPE_ID(o);        \
        GO_STRUCT_ID *g = (GO_STRUCT_ID *)o;    \
        if(!(_cond))    \
                TRANS_FAIL _msg;        \
        trans_new_undo_prop_virtual(o, &PSTRUCT(_name), (prop_value){.PROP_UNION(_prop_subtype) = g->_var}); \
        g->_var = value.PROP_UNION(_prop_subtype); \
        RECOMPUTE_##_recomp;    \
}
Generates function which changes value _var of property _name and writes the change into undo history and calls recompute _recomp if condition _cond holds; otherwise calls trans_fail with message _msg.

#define PROP_SET_BOOLEAN _name,
_var,
_mask,
_recomp   ) 
 

Value:

static void PSET(_name) (struct o *o, prop_value value) \
{       \
        ASSERT_GO_SUBTYPE_ID(o);        \
        GO_STRUCT_ID *g = (GO_STRUCT_ID *)o;    \
        if(((g->_var & _mask) == 0) ^ (value.u != 0)) \
                return; \
        trans_new_undo_prop_virtual(o, &PSTRUCT(_name), (prop_value){.u = g->_var & _mask}); \
        g->_var ^= _mask; \
        RECOMPUTE_##_recomp;    \
}
Like macro PROP_SET but specialised for boolean variables stored in flags of graphic object,.

#define PROP_SET_LOW _name,
_var,
_prop_subtype   ) 
 

Value:

static void PLOW(_name) (struct o *o, prop_value value) \
{       \
        ASSERT_GO_SUBTYPE_ID(o);        \
        ((GO_STRUCT_ID *)o)->_var = value.PROP_UNION(_prop_subtype);    \
}
Generates function that changes value of property; function is called only by undo.

#define PROP_SET_LOW_BOOLEAN _name,
_var,
_mask   ) 
 

Value:

static void PLOW(_name) (struct o *o, prop_value value) \
{       \
        ASSERT_GO_SUBTYPE_ID(o);        \
        GO_STRUCT_ID *g = (GO_STRUCT_ID *)o;    \
        ASSERT(((g->_var & _mask) == 0) ^ (value.u == 0)); \
        g->_var ^= _mask;       \
}
Like macro PROP_SET_LOW but specialised for boolean variables stored in flags of graphic object,.

#define PROP_SET_LOW_DIE _name   ) 
 

Value:

static void PLOW(_name) (struct o *o UNUSED, prop_value value UNUSED)   \
{       \
        ASSERT_GO_SUBTYPE_ID(o);        \
        die("Value of the property %s cannot set by low_set function because this is not a basic property of this subtype.", #_name); \
}
Undo never change this property.

#define PROP_SET_READ _name   ) 
 

Value:

static void PSET(_name) (struct o *o UNUSED, prop_value value UNUSED)   \
{       \
        ASSERT_GO_SUBTYPE_ID(o);        \
        trans_fail("Property %s is read only.", #_name); \
}
Read-only property is not possible to change so only trans_fail is called.

#define PROP_SET_REHANG_X _name,
_var,
_anchor,
_msg   ) 
 

Value:

static void PSET(_name##_x) (struct o *o, prop_value value)     \
{       \
        ASSERT_GO_SUBTYPE_ID(o);        \
        ASSERT(isfinite(value.r));      \
        GO_STRUCT_ID *g = (GO_STRUCT_ID *)o;    \
        struct anchor *a = go_get_anchor(o2go(o), _anchor); \
        if(!hanger_is_mc(a->h)) \
                trans_fail(_msg);       \
        struct geom_point pos = {value.r, g->_var.y}; \
        anchor_rehang(a, hanger_new_mc(&pos)); \
}
Generates function which change X-coordinate of anchor. Property _name corresponds to position of anchor _anchor and the function rehangs the anchor if it hangs on mouse-click; otherwise calls trans_fail with message _msg.

#define PROP_SET_REHANG_Y _name,
_var,
_anchor,
_msg   ) 
 

Value:

static void PSET(_name##_y) (struct o *o, prop_value value)     \
{       \
        ASSERT_GO_SUBTYPE_ID(o);        \
        ASSERT(isfinite(value.r));      \
        GO_STRUCT_ID *g = (GO_STRUCT_ID *)o;    \
        struct anchor *a = go_get_anchor(o2go(o), _anchor); \
        if(!hanger_is_mc(a->h)) \
                trans_fail(_msg);       \
        struct geom_point pos = {g->_var.x, value.r}; \
        anchor_rehang(a, hanger_new_mc(&pos)); \
}
Generates function which change Y-coordinate of anchor. Property _name corresponds to position of anchor _anchor and the function rehangs the anchor if it hangs on mouse-click; otherwise calls trans_fail with message _msg.

#define PROP_STROKE_CAP
 

Value:

PROP_ALL_WITHOUT_UNIT(stroke_cap, PSTRUCT(stroke_join), PTU_CAP_STYLE, stroke_cap, \
                value.u < PSC_MAX, (("Invalid value."), ("Stroke cap cannot be %u.", value.u)), ALTERED, LOW, PTF_SAVE | PTF_RECYCLABLE, UINT_MAX)

#define PROP_STROKE_COLOR
 

Value:

PROP_ALL_WITHOUT_UNIT(stroke_color, PSTRUCT(fill_color), PTU_COLOR, stroke_color, \
                1, (("Cannot fail."), ("Bug, fix me.")), ALTERED, LOW, PTF_SAVE | PTF_RECYCLABLE, UINT_MAX)

#define PROP_STROKE_JOIN
 

Value:

PROP_ALL_WITHOUT_UNIT(stroke_join, PSTRUCT(stroke_width), PTU_JOIN_STYLE, stroke_join, \
                value.u < PSJ_MAX, (("Invalid value."), ("Stroke join cannot be %u.", value.u)), ALTERED, LOW, PTF_SAVE | PTF_RECYCLABLE, UINT_MAX)

#define PROP_STROKE_STYLE
 

Value:

PROP_ALL_WITHOUT_UNIT(stroke_style, PSTRUCT(stroke_cap), PTU_STROKE_STYLE, stroke_style, \
                value.u < PSS_MAX, (("Invalid value."), ("Stroke style cannot be %u.", value.u)), ALTERED, LOW, PTF_SAVE | PTF_RECYCLABLE, UINT_MAX)

#define PROP_STROKE_WIDTH
 

Value:

PROP_ALL(stroke_width, PSTRUCT(stroke_color), PTR_LENGTH, stroke_width, \
                value.r >= 0, (("Stroke width cannot be negative number."), ("Stroke width cannot be %f.", value.r)), CHANGED, LOW, PTF_SAVE | PTF_RECYCLABLE, UINT_MAX)

#define PROP_STRUCT _name,
_next,
_prop_subtype,
_flags,
_undo_mask   ) 
 

Value:

static struct prop_virtual PSTRUCT(_name) = {   \
        { { &_next.p.n }, NULL, {0}, PROP_TYPE(_prop_subtype), _prop_subtype, _flags | PTF_VIRTUAL, 0 },        \
        _undo_mask, PGET(_name), PSET(_name), PLOW(_name),      PGETU(_name), PSETU(_name)      \
};
Generates structure of property.

#define PROP_STYLES_SET_DEFAULT_VALUE _go   ) 
 

Value:

(_go)->fill_color = PROP_INIT_FILL_COLOR; \
        (_go)->stroke_color = PROP_INIT_STROKE_COLOR; \
        (_go)->stroke_width = PROP_INIT_STROKE_WIDTH; \
        (_go)->stroke_cap = PROP_INIT_STROKE_CAP; \
        (_go)->stroke_join = PROP_INIT_STROKE_JOIN; \
        (_go)->stroke_style = PROP_INIT_STROKE_STYLE; \
        (_go)->unit_stroke_width = PROP_UNIT_MAX; \

#define PROP_UNIT_GET _name,
_var   ) 
 

Value:

static uns PGETU(_name) (struct o *o) \
{ \
        ASSERT_GO_SUBTYPE_ID(o);        \
        return ((GO_STRUCT_ID *)o)-> _var; \
}
Generates function which returns unit of property.

#define PROP_UNIT_GET_DIE _name   ) 
 

Value:

static uns PGETU(_name) (struct o *o UNUSED)    \
{       \
        ASSERT_GO_SUBTYPE_ID(o);        \
        die("Property %s hasn't unit.", #_name); \
}
Given property has not a unit.

#define PROP_UNIT_SET _name,
_var   ) 
 

Value:

static void PSETU(_name) (struct o *o, uns unit) \
{ \
        ASSERT_GO_SUBTYPE_ID(o);        \
        ((GO_STRUCT_ID *)o)-> _var = unit; \
}
Generates function which changes unit of property.

#define PROP_UNIT_SET_DIE _name   ) 
 

Value:

static void PSETU(_name) (struct o *o UNUSED, uns unit UNUSED) \
{ \
        ASSERT_GO_SUBTYPE_ID(o);        \
        die("Property %s hasn't unit.", #_name); \
}
Given property has not a unit.

 
#define PROP_VIRTUAL  ) 
 

Value:

static inline void PINIT(GO_SUBID) (void) { prop_virtual_init(0, __VA_ARGS__, NULL); } \
static inline void PFINISH(GO_SUBID) (void) { prop_virtual_finish(0, __VA_ARGS__, NULL); }
Generates functions for initialising and destroying list of virtual properties.


Function Documentation

void prop_virtual_init uns  count,
... 
 

Initialise and destroy list of virtual properties.

For every virtual property there is a pair struct prop_virtual* and char* and the function set or destroy name of property. The last argument has to be NULL.

Parameters:
count Ignored.


Generated on Tue Dec 9 16:30:09 2008 for Vrr by doxygen 1.3.5