Arc (transition) definitions & utilities.
More...
#include <gfsmSemiring.h>
#include <stdarg.h>
#include <gfsmArc.hi>
Go to the source code of this file.
Typedefs |
typedef guint32 | gfsmArcCompMask |
| Prioritized list of up to 5 elementary arc comparisons packed as a guint32 The primary comparison is encoded as a gfsmArcComp in the least significant 4-bit nybble of the integer, the secondary comparison is left-shifted by 4 bits, and so on.
|
typedef gfsmArcCompMask | gfsmArcSortMode |
| Semi-compatible typedef for arc sort mode.
|
Enumerations |
enum | gfsmLabelSide { gfsmLSBoth = 0,
gfsmLSLower = 1,
gfsmLSUpper = 2
} |
| Type for identifying arc-label "sides" in a transducer (lower vs. upper) More...
|
enum | gfsmArcComp {
gfsmACNone = 0x0,
gfsmACLower = 0x1,
gfsmACUpper = 0x2,
gfsmACWeight = 0x3,
gfsmACSource = 0x4,
gfsmACTarget = 0x5,
gfsmACUser = 0x6,
gfsmACUnused1 = 0x7,
gfsmACReverse = 0x8,
gfsmACLowerR = 0x9,
gfsmACUpperR = 0xa,
gfsmACWeightR = 0xb,
gfsmACSourceR = 0xc,
gfsmACTargetR = 0xd,
gfsmACUserR = 0xe,
gfsmACAll = 0xf
} |
| Enum type for elementary builtin comparisons on gfsmArc. More...
|
enum | gfsmArcSortModeE {
gfsmASMNone = 0x0,
gfsmASMLower = (gfsmACLower|(gfsmACUpper<< 4 )|(gfsmACTarget<<(2* 4 ))),
gfsmASMUpper = (gfsmACUpper|(gfsmACLower<< 4 )|(gfsmACTarget<<(2* 4 ))),
gfsmASMWeight = gfsmACWeight,
gfsmASMLowerWeight = (gfsmACLower|(gfsmACWeight<< 4 )),
gfsmASMUpperWeight = (gfsmACUpper|(gfsmACWeight<< 4 )),
gfsmASMUser = gfsmACUser
} |
Functions |
|
static gint | gfsm_arc_compare_bymask_inline (gfsmArc *a1, gfsmArc *a2, gfsmArcCompData *acdata) |
gint | gfsm_arc_compare_bymask (gfsmArc *a1, gfsmArc *a2, gfsmArcCompData *acdata) |
static gint | gfsm_arc_compare_bymask_1_ (gfsmArc *a1, gfsmArc *a2, gfsmArcComp cmp, gfsmArcCompData *acdata) |
gfsmArcCompMask | gfsm_acmask_from_chars (const char *maskchars) |
gfsmArcCompMask | gfsm_acmask_from_args (gfsmArcComp cmp0,...) |
static gfsmArcCompMask | gfsm_acmask_new (gfsmArcComp cmp, gint nth) |
static gfsmArcComp | gfsm_acmask_nth (gfsmArcCompMask m, gint nth) |
static gfsmArcComp | gfsm_acmask_nth_comp (gfsmArcCompMask m, gint nth) |
static gboolean | gfsm_acmask_nth_reverse (gfsmArcCompMask m, gint nth) |
static gchar | gfsm_acmask_nth_char (gfsmArcCompMask m, gint nth) |
const gchar * | gfsm_acmask_nth_string (gfsmArcCompMask m, gint nth) |
gchar * | gfsm_acmask_to_chars (gfsmArcCompMask m, gchar *chars) |
GString * | gfsm_acmask_to_gstring (gfsmArcCompMask m, GString *gstr) |
static const gchar * | gfsm_arc_sortmode_to_name (gfsmArcCompMask m) |
Detailed Description
Macro Definition Documentation
#define gfsm_arc_source |
( |
|
arcptr | ) |
((arcptr)->source) |
Get source node of an arc – may be gfsmNoState
#define gfsm_arc_target |
( |
|
arcptr | ) |
((arcptr)->target) |
Get target node of an arc – may be gfsmNoState
#define gfsm_arc_lower |
( |
|
arcptr | ) |
((arcptr)->lower) |
Get lower label of an arc – may be gfsmNoLabel
#define gfsm_arc_upper |
( |
|
arcptr | ) |
((arcptr)->upper) |
Get upper label of an arc – may be gfsmNoLabel
#define gfsm_arc_weight |
( |
|
arcptr | ) |
((arcptr)->weight) |
Get weight of an arc – may be gfsmNoWeight
Typedef Documentation
Enumeration Type Documentation
- Enumerator:
gfsmLSBoth |
Both sides (lower and upper)
|
gfsmLSLower |
Lower side only.
|
gfsmLSUpper |
Upper side only.
|
- Since
- v0.0.10
- Enumerator:
gfsmACNone |
'_': no comparison at all
|
gfsmACLower |
'l': compare lower labels (ascending order)
|
gfsmACUpper |
'u': compare upper labels (ascending order)
|
gfsmACWeight |
'w': compare semiring weights (ascending order)
|
gfsmACSource |
's': compare source states (if supported and meaningful, ascending order)
|
gfsmACTarget |
't': compare target states (if supported and meaningful, ascending order)
|
gfsmACUser |
'x': pseudo-field indicating a user-defined comparison
|
gfsmACUnused1 |
unused
|
gfsmACReverse |
not really a comparison: the bit 0x8 is set for all "reverse" comparisons
|
gfsmACLowerR |
'L': compare lower labels (descending order)
|
gfsmACUpperR |
'U': compare upper labels (descending order)
|
gfsmACWeightR |
'W': compare semiring weights (descending order)
|
gfsmACSourceR |
'S': compare source states (if supported and meaningful, descending order)
|
gfsmACTargetR |
'T': compare target states (if supported and meaningful, descending order)
|
gfsmACUserR |
'X': pseudo-field for reversed user-defined comparisons, for symmetry
|
gfsmACAll |
'*': pseudo-field for mask of all known elementary comparisons
|
Useful aliases for builtin arcsort modes, including backwards-compatible gfsmASMLower etc.
- Enumerator:
gfsmASMNone |
no sort
|
gfsmASMLower |
(lower,upper,target)
|
gfsmASMUpper |
(upper,lower,target)
|
gfsmASMWeight |
(weight)
|
gfsmASMLowerWeight |
(lower,weight)
|
gfsmASMUpperWeight |
(upper,weight)
|
gfsmASMUser |
user-defined sort
|
Function Documentation
static gfsmArc* gfsm_arc_new |
( |
void |
| ) |
|
|
inlinestatic |
Create and return a new (empty) gfsmArc
Initialize a gfsmArc
- Parameters
-
a | arc to initialize |
src | ID of source state |
dst | ID of target state |
lo | ID of lower label |
hi | ID of upper label |
w | arc weight |
- Returns
- initialized arc a
Convenience macro to simultaneously create and initialize a gfsmArc
- Parameters
-
src | ID of source state |
dst | ID of target state |
lo | ID of lower label |
hi | ID of upper label |
w | arc weight |
- Returns
- newly allocated and initalized gfsmArc
Create an exact copy of the gfsmArc src
static void gfsm_arc_free |
( |
gfsmArc * |
a | ) |
|
|
inlinestatic |
Generic 3-way comparison on arcs (inline version)
- Parameters
-
a1 | first arc to compare |
a2 | second arc to compare |
acdata | specifies comparison priorities |
- Returns
- negative, zero, or positive integer depending on whether a1 is less-than, equal-to, or greater-than a2 according to acdata.
Generic 3-way comparison on arcs (extern version) Really just a wrapper for gfsm_arc_compare_mask_inline()
Parse a NUL-terminated string into a gfsmArcCompMask
- Parameters
-
maskchars | A NUL-terminated string representing the precedence among elementary comparisons. Each character represents a single elementary comparison. The primary comparison is the first character of the string. Correspondence of characters to comparisons is:
|
- Returns
- a gfsmArcCompMask for maskchars
Create and return a gfsmArcCompMask from a variable argument list of gfsmArcComp The argument list must be terminated with a zero (e.g. gfsmACNone)
- Parameters
-
cmp0 | primary comparison |
... | secondary, tertiary, ... comparisons |
- Returns
- gfsmArcCompMask for specified comparisons
Get basic nth basic (sub-)comparison from a gfsmArcCompMask, disregarding sort order
Get sort order for nth (sub-)comparison of a gfsmArcCompMask.
- Returns
- a true value if nth sub-comparison is reversed (descending order), otherwise FALSE.
Get a static human-readable string representing the nth field of arc comparison mask m
Populate a character string representing a gfsmArcCompMask.
- Parameters
-
mask[in] | mask to convert to a string |
chars[out] | character string representing mask, in the format acepted by gfsm_acmask_from_chars(), or NULL to allocate a new string. If specified and non-NULL, chars should be long enough to hold gfsmACMaxN+1 characters, since a terminating NUL is implicitly added as the final character. |
- Returns
- chars if specified, otherwise a newly allocated string.
- Note
- User is responsible for freeing the returned string with g_free() when it is no longer needed.
Populate a GString* with a human-readable representation of a gfsmArcCompMask.
- Parameters
-
mask[in] | mask to convert to a string |
gstr[out] | GString representing mask, in human-readable format, or NULL to allocate a new GString*. |
- Returns
- gstr if specified, otherwise a newly allocated GString*.
- Note
- User is responsible for freeing the returned GString* with g_string_free() when it is no longer needed.