Gfsm

 view release on metacpan or  search on metacpan

Trie.xs  view on Meta::CPAN

##--------------------------------------------------------------
## Methods: find prefix
void
gfsm_trie_find_prefix(gfsmTrie *trie, gfsmLabelVector *lo, gfsmLabelVector *hi)
PREINIT:
 gfsmStateId qid;
 guint lo_i;
 guint hi_i;
 gfsmWeight w_last;
 guint nitems = 1;
PPCODE:
{
  qid = gfsm_trie_find_prefix(trie, lo,hi, &lo_i,&hi_i,&w_last, NULL);
  //
  //
  //-- return stack
  ST(0) = newSVuv(qid);
  sv_2mortal(ST(0));
  if (GIMME_V == G_ARRAY) {
    nitems = 4;
    ST(1) = newSVuv(lo_i);

Trie.xs  view on Meta::CPAN

## Methods: find prefix (+states)
void
gfsm_trie_find_prefix_states(gfsmTrie *trie, gfsmLabelVector *lo, gfsmLabelVector *hi)
PREINIT:
 gfsmStateIdVector *qpath;
 AV *qpath_av;
 guint lo_i;
 guint hi_i;
 gfsmWeight w_last;
 guint nitems = 1;
PPCODE:
{
  qpath = g_ptr_array_sized_new(lo->len + hi->len);
  gfsm_trie_find_prefix(trie, lo,hi, &lo_i,&hi_i,&w_last, qpath);
  //
  //
  //-- return stack
  qpath_av = gfsm_perl_ptr_array_to_av_uv(qpath);
  ST(0) = newRV((SV*)qpath_av);
  sv_2mortal(ST(0));
  if (GIMME_V == G_ARRAY) {



( run in 1.115 second using v1.01-cache-2.11-cpan-5511b514fd6 )