Data Structures | Variables
gfsmAutomaton.h File Reference

Automaton definitions and low-level access. More...

#include <gfsmAlphabet.h>
#include <gfsmState.h>
#include <gfsmWeightMap.h>
#include <gfsmBitVector.h>
#include <gfsmAutomaton.hi>
Include dependency graph for gfsmAutomaton.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  gfsmAutomatonFlags
 Automaton status flags . More...
struct  gfsmAutomaton
 "Heavy" automaton type More...

Functions

API: Constructors etc.
static gfsmAutomatongfsm_automaton_new_full (gfsmAutomatonFlags flags, gfsmSRType srtype, gfsmStateId n_states)
static gfsmAutomatongfsm_automaton_new (void)
static gfsmAutomatongfsm_automaton_clone (gfsmAutomaton *fsm)
static gfsmAutomatongfsm_automaton_copy_shallow (gfsmAutomaton *dst, gfsmAutomaton *src)
gfsmAutomatongfsm_automaton_copy (gfsmAutomaton *dst, gfsmAutomaton *src)
static gfsmAutomatongfsm_automaton_shadow (gfsmAutomaton *fsm)
static void gfsm_automaton_swap (gfsmAutomaton *fsm1, gfsmAutomaton *fsm2)
void gfsm_automaton_clear (gfsmAutomaton *fsm)
static void gfsm_automaton_free (gfsmAutomaton *fsm)
API: Automaton Semiring
static gfsmSemiringgfsm_automaton_get_semiring (gfsmAutomaton *fsm)
static gfsmSemiringgfsm_automaton_set_semiring (gfsmAutomaton *fsm, gfsmSemiring *sr)
static void gfsm_automaton_set_semiring_type (gfsmAutomaton *fsm, gfsmSRType srtype)

Variables

const gfsmStateId gfsmAutomatonDefaultSize
const gfsmAutomatonFlags gfsmAutomatonDefaultFlags
const gfsmSRType gfsmAutomatonDefaultSRType

API: Automaton Structure

#define gfsm_automaton_reserve(fsm, n_states)   gfsm_automaton_reserve_states((fsm),(n_states))
static void gfsm_automaton_reserve_states (gfsmAutomaton *fsm, gfsmStateId n_states)
static void gfsm_automaton_reserve_arcs (gfsmAutomaton *fsm, guint n_arcs)
static gfsmStateId gfsm_automaton_n_states (gfsmAutomaton *fsm)
static gfsmStateId gfsm_automaton_n_final_states (gfsmAutomaton *fsm)
static guint gfsm_automaton_n_arcs (gfsmAutomaton *fsm)
static gfsmStateId gfsm_automaton_get_root (gfsmAutomaton *fsm)
static void gfsm_automaton_set_root (gfsmAutomaton *fsm, gfsmStateId new_root_id)
static void gfsm_automaton_finals_foreach (gfsmAutomaton *fsm, GTraverseFunc func, gpointer data)
static gfsmStateWeightPairArraygfsm_automaton_finals_to_array (gfsmAutomaton *fsm, gfsmStateWeightPairArray *array)

API: Automaton Properties

Currently quite sketchy; better tracking and checking of automaton flags should be implemented.

#define gfsm_automaton_is_transducer(fsm)   ((fsm)->flags.is_transducer)
#define gfsm_automaton_is_weighted(fsm)   ((fsm)->flags.is_weighted)
#define gfsm_automaton_sortmode(fsm)   ((gfsmArcSortMode)(gfsm_acmask_nth((fsm)->flags.sort_mode,0)))
#define gfsm_automaton_is_acyclic(fsm)   (!gfsm_automaton_is_cyclic(fsm))
guint gfsm_automaton_n_arcs_full (gfsmAutomaton *fsm, guint *n_lo_epsilon, guint *n_hi_epsilon, guint *n_both_epsilon)
gboolean gfsm_automaton_is_cyclic_state (gfsmAutomaton *fsm, gfsmStateId qid, gfsmBitVector *visited, gfsmBitVector *completed)
gboolean gfsm_automaton_is_cyclic (gfsmAutomaton *fsm)
gfsmAlphabetgfsm_automaton_get_alphabet (gfsmAutomaton *fsm, gfsmLabelSide which, gfsmAlphabet *alph)
void gfsm_automaton_renumber_states (gfsmAutomaton *fsm)
void gfsm_automaton_renumber_states_full (gfsmAutomaton *fsm, GArray *old2new, gfsmStateId n_new_states)
void gfsm_automaton_truncate_invalid_states (gfsmAutomaton *fsm)

API: gfsmState

#define gfsm_automaton_find_state(fsm, qid)   gfsm_automaton_open_state((fsm),(qid))
#define gfsm_automaton_find_state_const(fsm, qid)   ((const gfsmState*)(gfsm_automaton_open_state((fsm),(qid))))
#define gfsm_automaton_get_state(fsm, qid)   gfsm_automaton_open_state_force((fsm),(qid))
static gfsmStategfsm_automaton_open_state (gfsmAutomaton *fsm, gfsmStateId qid)
static gfsmStategfsm_automaton_open_state_force (gfsmAutomaton *fsm, gfsmStateId qid)
static void gfsm_automaton_close_state (gfsmAutomaton *fsm, gfsmState *qp)

API: Automaton States

#define gfsm_automaton_is_final_state(fsm, qid)   gfsm_automaton_state_is_final((fsm),(qid))
static gboolean gfsm_automaton_has_state (gfsmAutomaton *fsm, gfsmStateId qid)
static gfsmStateId gfsm_automaton_add_state_full (gfsmAutomaton *fsm, gfsmStateId qid)
static gfsmStateId gfsm_automaton_ensure_state (gfsmAutomaton *fsm, gfsmStateId qid)
static gfsmStateId gfsm_automaton_add_state (gfsmAutomaton *fsm)
static void gfsm_automaton_remove_state (gfsmAutomaton *fsm, gfsmStateId qid)
static gboolean gfsm_automaton_lookup_final (gfsmAutomaton *fsm, gfsmStateId qid, gfsmWeight *wp)
static gboolean gfsm_automaton_state_is_final (gfsmAutomaton *fsm, gfsmStateId qid)
static gfsmWeight gfsm_automaton_get_final_weight (gfsmAutomaton *fsm, gfsmStateId qid)
static void gfsm_automaton_set_final_state_full (gfsmAutomaton *fsm, gfsmStateId qid, gboolean is_final, gfsmWeight final_weight)
static void gfsm_automaton_set_final_state (gfsmAutomaton *fsm, gfsmStateId qid, gboolean is_final)
static guint gfsm_automaton_out_degree (gfsmAutomaton *fsm, gfsmStateId qid)

Accessors: Automaton Arcs

#define gfsm_automaton_arcsort_with_data(fsm, cmpfunc, data)   gfsm_automaton_arcsort_full((fsm),(cmpfunc),(data))
static void gfsm_automaton_add_arc (gfsmAutomaton *fsm, gfsmStateId qid1, gfsmStateId qid2, gfsmLabelId lo, gfsmLabelId hi, gfsmWeight w)
static void gfsm_automaton_add_arc_node (gfsmAutomaton *fsm, gfsmState *sp, gfsmArcList *node)
static void gfsm_automaton_remove_arc_ptr (gfsmAutomaton *fsm, gfsmArc *a)
static void gfsm_automaton_remove_arc_node (gfsmAutomaton *fsm, gfsmState *sp, gfsmArcList *node)
static gfsmAutomatongfsm_automaton_arcsort (gfsmAutomaton *fsm, gfsmArcCompMask mode)
void gfsm_automaton_arcsort_full (gfsmAutomaton *fsm, GCompareDataFunc cmpfunc, gpointer data)
gfsmAutomatongfsm_automaton_arcuniq (gfsmAutomaton *fsm)

Detailed Description

Macro Definition Documentation

#define gfsm_automaton_reserve (   fsm,
  n_states 
)    gfsm_automaton_reserve_states((fsm),(n_states))
#define gfsm_automaton_is_transducer (   fsm)    ((fsm)->flags.is_transducer)

True iff automaton is a transducer

#define gfsm_automaton_is_weighted (   fsm)    ((fsm)->flags.is_weighted)

True iff automaton is weighted

#define gfsm_automaton_sortmode (   fsm)    ((gfsmArcSortMode)(gfsm_acmask_nth((fsm)->flags.sort_mode,0)))

Get current automaton arc-sort mode (primary sort)

#define gfsm_automaton_is_acyclic (   fsm)    (!gfsm_automaton_is_cyclic(fsm))

Test whether automaton is acyclic

#define gfsm_automaton_find_state (   fsm,
  qid 
)    gfsm_automaton_open_state((fsm),(qid))

Backwards-compatible alias for gfsm_automaton_open_state(). This alias is expected to disappear when calling gfsm_automaton_close_state() becomes mandatory.

#define gfsm_automaton_find_state_const (   fsm,
  qid 
)    ((const gfsmState*)(gfsm_automaton_open_state((fsm),(qid))))

Backwards-compatible alias for gfsm_automaton_open_state(). This alias is expected to disappear when calling gfsm_automaton_close_state() becomes mandatory.

#define gfsm_automaton_get_state (   fsm,
  qid 
)    gfsm_automaton_open_state_force((fsm),(qid))

Backwards-compatible alias for gfsm_automaton_open_state_force() This alias is expected to disappear when calling gfsm_automaton_close_state() becomes mandatory.

#define gfsm_automaton_is_final_state (   fsm,
  qid 
)    gfsm_automaton_state_is_final((fsm),(qid))

Backwards-compatible alias for gfsm_automaton_state_is_final()

#define gfsm_automaton_arcsort_with_data (   fsm,
  cmpfunc,
  data 
)    gfsm_automaton_arcsort_full((fsm),(cmpfunc),(data))

Function Documentation

static gfsmAutomaton* gfsm_automaton_new_full ( gfsmAutomatonFlags  flags,
gfsmSRType  srtype,
gfsmStateId  n_states 
)
inlinestatic

Create a new gfsmAutomaton, preallocating n_states states

static gfsmAutomaton* gfsm_automaton_new ( void  )
inlinestatic

Create and return a new gfsmAutomaton, using default flags, semiring type and size

static gfsmAutomaton* gfsm_automaton_clone ( gfsmAutomaton fsm)
inlinestatic

Create a new gfsmAutomaton as a deep exact copy of fsm.

Parameters
fsmautomaton to be cloned
Returns
new deep copy of src
static gfsmAutomaton* gfsm_automaton_copy_shallow ( gfsmAutomaton dst,
gfsmAutomaton src 
)
inlinestatic

Assign non-structural contents (flags, semiring) of src to dst, without altering dst's topology.

Parameters
dsttarget automaton
srcsource automaton
Returns
modified dst
Warning
Earlier versions of this function also set the root state of dst to that of src, but you should no longer rely on this being the case!
gfsmAutomaton* gfsm_automaton_copy ( gfsmAutomaton dst,
gfsmAutomaton src 
)

Assign the contents of fsm src to fsm dst

Returns
dst
static gfsmAutomaton* gfsm_automaton_shadow ( gfsmAutomaton fsm)
inlinestatic

Create a new gfsmAutomaton whose non-structural contents match those of fsm.

Parameters
fsmsource automaton
Returns
new automaton whose non-structural fields match those of fsm
static void gfsm_automaton_swap ( gfsmAutomaton fsm1,
gfsmAutomaton fsm2 
)
inlinestatic

Swap the contents of automata fsm1 and fsm2

void gfsm_automaton_clear ( gfsmAutomaton fsm)

Clear an automaton

static void gfsm_automaton_free ( gfsmAutomaton fsm)
inlinestatic

Destroy an automaton: all associated states and arcs will be freed.

static gfsmSemiring* gfsm_automaton_get_semiring ( gfsmAutomaton fsm)
inlinestatic

Get pointer to the semiring associated with this automaton

static gfsmSemiring* gfsm_automaton_set_semiring ( gfsmAutomaton fsm,
gfsmSemiring sr 
)
inlinestatic

Set the semiring associated with this automaton

Parameters
fsmautomaton to modify
srsemiring to be copied into fsm->sr
Returns
pointer to the (new) semiring for fsm
Note
  • Implicitly frees the semiring previously associated with fsm, if any.
Warning
Prior to libgfsm-v0.0.9 this function returned the parameter sr itself
static void gfsm_automaton_set_semiring_type ( gfsmAutomaton fsm,
gfsmSRType  srtype 
)
inlinestatic

Set the semiring associated with this automaton by type.

Parameters
fsmautomaton whose semiring is to be set
srtypetype of new semiring
Note
  • If fsm's semiring is already of type srtype, this function does nothing.
  • If srtype is gfsmSRTUser, fsm's new semiring will be unitialized
  • Implicitly frees the semiring previously associated with fsm, if any.
static void gfsm_automaton_reserve_states ( gfsmAutomaton fsm,
gfsmStateId  n_states 
)
inlinestatic

Reserve space for at least n_states states (may do nothing)

Parameters
fsmautomaton to modify
n_statesnumber of states to reserve, if supported by implementation
static void gfsm_automaton_reserve_arcs ( gfsmAutomaton fsm,
guint  n_arcs 
)
inlinestatic

Reserve space for at least n_arcs arcs

Parameters
fsmautomaton to modify
n_arcsnumber of arcs to reserve
Note
Currently does nothing.
static gfsmStateId gfsm_automaton_n_states ( gfsmAutomaton fsm)
inlinestatic

Get the number of states in an automaton (modulo 'gaps' in state ID numbering).

Parameters
fsmautomaton to examine
Returns
The least gfsmStateId q such that for all r >= q, fsm has no state with ID r.
static gfsmStateId gfsm_automaton_n_final_states ( gfsmAutomaton fsm)
inlinestatic

Get number of final states in fsm

static guint gfsm_automaton_n_arcs ( gfsmAutomaton fsm)
inlinestatic

Get total number of arcs in fsm.

Note
Currently just a wrapper for gfsm_automaton_n_arcs_full(), so time is O(n_arcs)
static gfsmStateId gfsm_automaton_get_root ( gfsmAutomaton fsm)
inlinestatic

Get ID of root state, or gfsmNoState if undefined

static void gfsm_automaton_set_root ( gfsmAutomaton fsm,
gfsmStateId  new_root_id 
)
inlinestatic

Set ID of root state, creating state if necessary.

Parameters
fsmautomaton whose root state is to be set
new_root_idID of new root state
  • If new_root_id is gfsmNoState, fsm is marked as 'unrooted'
  • otherwise, a new state with ID new_root_id is implicitly created if none already existed
static void gfsm_automaton_finals_foreach ( gfsmAutomaton fsm,
GTraverseFunc  func,
gpointer  data 
)
inlinestatic
Call a user-defined function \a func for each final state of \a fsm.
\param fsm  automaton whose final states are to be traversed
\param func \c GTraverseFunc for final states, as for \c g_tree_foreach()
\param data user data for \a func
\warning
  \a func may \e not directly alter any final weights of \a fsm.
  See GLib documentaion of g_tree_foreach() for details and a workaround.
\note
  \a func will be called as <tt>(*func)(gpointer final_stateid, gpointer final_weight, gpointer data)</tt>;
  that is, both the ::gfsmStateId \a final_stateid and the final weight \a final_weight will be encoded
  as (gpointers).  They can be decoded with GPOINTER_TO_UINT() and gfsm_ptr2weight(), respectively, e.g.
gboolean my_final_func(gpointer id_p, gpointer fw_p, gpointer data) {
gfsmStateId final_id = GPOINTER_TO_UINT(id_p); //-- decode state id
gfsmWeight final_weight = gfsm_ptr2weight(fw_p); //-- decode final weight
do_something_interesting(); //-- ... whatever ...
return FALSE; //-- continue traversal
}
See Also
gfsm_automaton_finals_to_array()
static gfsmStateWeightPairArray* gfsm_automaton_finals_to_array ( gfsmAutomaton fsm,
gfsmStateWeightPairArray array 
)
inlinestatic

Get a GArray of gfsmStateWeightPair values for final states of fsm.

Parameters
fsmautomaton from which to extract final states
arrayarray to be populated, or NULL to allocate a new array
Returns
new array, or a newly allocated gfsmStateWeightPairArray
Note
Caller is responsible for freeing the array returned when it is no longer needed.
guint gfsm_automaton_n_arcs_full ( gfsmAutomaton fsm,
guint *  n_lo_epsilon,
guint *  n_hi_epsilon,
guint *  n_both_epsilon 
)

Get verbose summary arc information (linear time w/ number of arcs)

Parameters
[in]fsmautomaton to examine
[out]n_lo_epsilonon return holds number of arcs with lower label gfsmEpsilon, or NULL
[out]n_hi_epsilonon return holds number of arcs with upper label gfsmEpsilon, or NULL
[out]n_both_epsilonon return holds number of arcs with both lower and upper labels gfsmEpsilon, or NULL
Returns
total number of arcs
gboolean gfsm_automaton_is_cyclic_state ( gfsmAutomaton fsm,
gfsmStateId  qid,
gfsmBitVector visited,
gfsmBitVector completed 
)

Low-level utility function for gfsm_automaton_is_cyclic()

gboolean gfsm_automaton_is_cyclic ( gfsmAutomaton fsm)

Test whether automaton is cyclic

gfsmAlphabet* gfsm_automaton_get_alphabet ( gfsmAutomaton fsm,
gfsmLabelSide  which,
gfsmAlphabet alph 
)

Extract automaton-internal labels to alph. If alph is NULL, a new default alphabet will be created and returned (you will need to free it yourself).

The alphabet should be able to match literal label values to themselves (so don't pass a string alphabet)

Parameters
[in]fsmautomaton to examine
[in]whichdetermines which label side(s) to extract
[out]alphalphabet to which labels are extracted, or NULL to create a new alphabet
Returns
alph, or a newly allocated and populated alphabet
void gfsm_automaton_renumber_states ( gfsmAutomaton fsm)

Renumber states of the automaton fsm. Destructively alters fsm. On return, fsm should have no 'gaps' in its state enumeration function, and its root state should have the ID 0 (zero).

Deprecated:
prefer gfsm_statesort_aff()
void gfsm_automaton_renumber_states_full ( gfsmAutomaton fsm,
GArray *  old2new,
gfsmStateId  n_new_states 
)

Renumber states of an FSM using user-specified state-ID map old2new. Destructively alters fsm.

Parameters
fsmAutomaton whose states are to be renumbered
old2newGArray of gfsmStateId such that qid_new=old2new[qid_old]. qid_new may be gfsmNoState to ignore the corresponding qid_old
n_new_statesMaximum qid_new gfsmStateId value in old2new, or 0 (zero) to auto-compute.
Deprecated:
prefer gfsm_statemap_apply()
void gfsm_automaton_truncate_invalid_states ( gfsmAutomaton fsm)

Truncate any invalid states off the end state vector: fast

static gfsmState* gfsm_automaton_open_state ( gfsmAutomaton fsm,
gfsmStateId  qid 
)
inlinestatic

Open and return a pointer to a gfsmState struct for gfsmStateId qid in fsm.

Warning
The pointer returned should be closed with gfsm_automaton_close_state()
Parameters
fsmautomaton from which to draw state information
qidID of state to be opened
Returns
gfsmState* for state with ID qid in fsm, or NULL if no such state exists.
Deprecated:
prefer gfsm_automaton_has_state(), gfsm_automaton_state_is_final(), gfsm_arciter_open() etc.
static gfsmState* gfsm_automaton_open_state_force ( gfsmAutomaton fsm,
gfsmStateId  qid 
)
inlinestatic

Open and return a pointer to a gfsmState struct for gfsmStateId qid in fsm, creating state if it does not already exists.

Warning
The pointer returned should be closed with gfsm_automaton_close_state().
Parameters
fsmautomaton from which to draw state information
qidID of state to be opened
Returns
gfsmState* for (possibly new) state with ID qid in fsm
Deprecated:
prefer gfsm_automaton_has_state(), gfsm_automaton_state_is_final(), gfsm_arciter_open() etc.
static void gfsm_automaton_close_state ( gfsmAutomaton fsm,
gfsmState qp 
)
inlinestatic

Close a pointer to a gfsmState opened with gfsm_automaton_open_state() for fsm.

Parameters
fsmautomaton from which state was opened.
qppointer as returned by gfsm_automaton_open_state()
Note
Currently does nothing.
static gboolean gfsm_automaton_has_state ( gfsmAutomaton fsm,
gfsmStateId  qid 
)
inlinestatic
static gfsmStateId gfsm_automaton_add_state_full ( gfsmAutomaton fsm,
gfsmStateId  qid 
)
inlinestatic

Add a new state, specifying state ID.

Parameters
fsmautomaton to modify
qidID of new state, or gfsmNoState to use the first available state ID.
Returns
Id of the (new) state
Note
  • Implicitly sets fsm's root state if fsm was previously unrooted.
  • Does nothing if fsm already has a state with ID qid.
static gfsmStateId gfsm_automaton_ensure_state ( gfsmAutomaton fsm,
gfsmStateId  qid 
)
inlinestatic

Ensures that state id exists

Returns
qid Really just an alias for gfsm_automaton_add_state_full().
static gfsmStateId gfsm_automaton_add_state ( gfsmAutomaton fsm)
inlinestatic

Add a new state to fsm. Really just an alias for

static void gfsm_automaton_remove_state ( gfsmAutomaton fsm,
gfsmStateId  qid 
)
inlinestatic

Remove the state with id qid, if any.

Parameters
fsmautomaton from which to remove a state
qidID of the state to be removed
Note
Any incoming arcs for state qid are NOT removed, although any outgoing arcs are removed and freed.
static gboolean gfsm_automaton_lookup_final ( gfsmAutomaton fsm,
gfsmStateId  qid,
gfsmWeight wp 
)
inlinestatic

Lookup final weight for state with ID qid in automaton fsm.

Parameters
fsmautomaton to examine
qidID of state to examine
wpoutput parameter for final weight
Returns
TRUE if state qid is final, FALSE otherwise
static gboolean gfsm_automaton_state_is_final ( gfsmAutomaton fsm,
gfsmStateId  qid 
)
inlinestatic

Check whether the state with ID qid is final in fsm. Really just a wrapper for gfsm_automaton_lookup_final().

Parameters
fsmautomaton to examine
qidID of state to check for finality
Returns
TRUE if qid is final in fsm, FALSE otherwise.
static gfsmWeight gfsm_automaton_get_final_weight ( gfsmAutomaton fsm,
gfsmStateId  qid 
)
inlinestatic

Get final weight.

Returns
final weight if state qid is final, else fsm->sr->zero
static void gfsm_automaton_set_final_state_full ( gfsmAutomaton fsm,
gfsmStateId  qid,
gboolean  is_final,
gfsmWeight  final_weight 
)
inlinestatic

Set final-weight and/or final-states membership flag for state with ID qid in fsm.

Parameters
fsmautomaton to modify
qidID of state to modified
is_finalwhether state should be considered final
final_weightIf is_final is true, final weight for state. Otherwise, final weight is implicitly fsm->sr->zero
static void gfsm_automaton_set_final_state ( gfsmAutomaton fsm,
gfsmStateId  qid,
gboolean  is_final 
)
inlinestatic

Backwards-compatble wrapper for gfsm_automaton_set_final_state_fulll(fsm,qid,is_final,fsm->sr->one)

See Also
gfsm_automaton_set_final_state_full()
static guint gfsm_automaton_out_degree ( gfsmAutomaton fsm,
gfsmStateId  qid 
)
inlinestatic

Get number of outgoing arcs from qid in fsm

static void gfsm_automaton_add_arc ( gfsmAutomaton fsm,
gfsmStateId  qid1,
gfsmStateId  qid2,
gfsmLabelId  lo,
gfsmLabelId  hi,
gfsmWeight  w 
)
inlinestatic

Add an arc from state with ID qid1 to state with ID qid2 on labels (lo,hi) with weight w. Missing states should be implicitly created.

Parameters
fsmAutomaton to modify
qid1ID of source state
qid2ID of target state
loLower label
hiUpper label
wArc weight
static void gfsm_automaton_add_arc_node ( gfsmAutomaton fsm,
gfsmState sp,
gfsmArcList node 
)
inlinestatic

Add an arc given pointers sp to the state and link to a single-element arclist to be added. No states are implicitly created.

Deprecated:
prefer gfsm_automaton_add_arc()
static void gfsm_automaton_remove_arc_ptr ( gfsmAutomaton fsm,
gfsmArc a 
)
inlinestatic

Remove an arc (pointer), without freeing it

static void gfsm_automaton_remove_arc_node ( gfsmAutomaton fsm,
gfsmState sp,
gfsmArcList node 
)
inlinestatic

Remove an arc node (without freeing it)

static gfsmAutomaton* gfsm_automaton_arcsort ( gfsmAutomaton fsm,
gfsmArcCompMask  mode 
)
inlinestatic

Sort all arcs in an automaton by one of the built-in comparison functions.

Parameters
fsmAutomaton to modify
modeSpecifies built-in arc comparison priorities
Returns
modified fsm
Note
void gfsm_automaton_arcsort_full ( gfsmAutomaton fsm,
GCompareDataFunc  cmpfunc,
gpointer  data 
)

Sort all arcs in an automaton by a user-specified comparison function.

Parameters
fsmAutomaton to modify
cmpfunc3-way comparison function, called as (*cmpfunc)(gfsmArc *a1, gfsmArc *a2, gpointer data) to compare arcs a1 and a2.
dataUser data for cmpfunc
Returns
Modified fsm
gfsmAutomaton* gfsm_automaton_arcuniq ( gfsmAutomaton fsm)

Collect weights on adjacent otherwise identical arcs. Really only meaningful if automaton is arc-sorted e.g. by gfsmASMLower.

Parameters
fsmAutomaton to modify
Returns
modified fsm

Variable Documentation

const gfsmStateId gfsmAutomatonDefaultSize

Default initial automaton size (number of states)

const gfsmAutomatonFlags gfsmAutomatonDefaultFlags

Default initial automaton flags

const gfsmSRType gfsmAutomatonDefaultSRType

Default semiring for automaton arc weights