Back to index

texmacs  1.0.7.15
Functions
tmfs_properties.cpp File Reference
#include "tmfs.hpp"

Go to the source code of this file.

Functions

static void property_treat (transaction &t, property p, int i, property val, int eps)
transaction as_transaction (property p, int eps)
void tmfs_set_property (property p)
void tmfs_set_properties (properties ps)
void tmfs_reset_property (property p)
void tmfs_reset_properties (properties ps)
void property_wildcards (property query, property &p, property &v)
solutions decode_solutions (collection t, property v)
solutions tmfs_get_solutions (property query)
collection tmfs_get_values (property query)
solutions tmfs_get_solutions (solutions sols1, property query)
solutions tmfs_var_get_solutions (solutions sols1, property p)

Function Documentation

transaction as_transaction ( property  p,
int  eps 
)

Definition at line 38 of file tmfs_properties.cpp.

                                     {
  p= property_quote (p);
  transaction t;
  property_treat (t, p, 0, property (), eps);
  return t;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 91 of file tmfs_properties.cpp.

                                            {
  solutions sols;
  iterator<string> it= iterate (t);
  while (it->busy ()) {
    solution sol;
    string s= it->next ();
    property d= property_unquote (property_unappend (s));
    if (t[s] > 0 && N(v) <= N(d))
      for (int i=0; i<N(v); i++)
       sol(v[i])= d[i];
    sols << sol;
  }
  return sols;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void property_treat ( transaction t,
property  p,
int  i,
property  val,
int  eps 
) [static]

Definition at line 19 of file tmfs_properties.cpp.

                                                                          {
  //cout << "Property treat " << p << ", " << i << ", "
  //<< val << ", " << eps << "\n";
  int j, n= N(p);
  for (j=1; j<n; j++)
    if (p[j] != "*") {
      add (t, property_append (p), property_append (val), eps);
      break;
    }
  for (j=i; j<n; j++) {
    property p2  = copy (p);
    property val2= copy (val);
    p2[j]= "*";
    val2 << p[j];
    property_treat (t, p2, j+1, val2, eps);
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void property_wildcards ( property  query,
property p,
property v 
)

Definition at line 79 of file tmfs_properties.cpp.

                                                              {
  p= property_quote (query);
  v= property ();
  int i, n= N(query);
  for (i=0; i<n; i++)
    if (is_unknown (query[i])) {
      p[i]= "*";
      v << query[i];
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 107 of file tmfs_properties.cpp.

                                    {
  // cout << "  Query: " << query << "\n";
  property p;
  property v;
  property_wildcards (query, p, v);
  collection c= tmfs_get (property_append (p));
  return decode_solutions (c, v);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 126 of file tmfs_properties.cpp.

                                                     {
  //cout << "Get property " << sols1 << ", " << query << "\n";
  solutions sols2;
  hashmap<string,solutions> cache;
  for (int i=0; i<N(sols1); i++) {
    property p= substitute (query, sols1[i]);
    string s= property_append (p);
    if (!cache->contains (s))
      cache(s)= tmfs_get_solutions (p);
    solutions sols3; sols3 << sols1[i];
    sols2 << combine (sols3, cache[s]);
  }
  return sols2;
}

Here is the call graph for this function:

Definition at line 117 of file tmfs_properties.cpp.

                                 {
  return as_collection (tmfs_get_solutions (query), query);
}

Here is the call graph for this function:

Definition at line 69 of file tmfs_properties.cpp.

                                      {
  for (int i=0; i<N(ps); i++)
    tmfs_reset_property (ps[i]);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 57 of file tmfs_properties.cpp.

                                 {
  for (int i=0; i<N(p); i++)
    if (is_unknown (p[i])) {
      properties ps= substitute (p, tmfs_get_solutions (p));
      for (int j=0; j<N(ps); j++)
       tmfs_write (as_transaction (ps[j], -1));
      return;
    }
  tmfs_write (as_transaction (p, -1));
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 51 of file tmfs_properties.cpp.

                                    {
  for (int i=0; i<N(ps); i++)
    tmfs_set_property (ps[i]);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 46 of file tmfs_properties.cpp.

                               {
  tmfs_write (as_transaction (p, 1));
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 150 of file tmfs_properties.cpp.

                                                     {
  property query= simplify (p, sols1);
  solutions sols2= tmfs_get_solutions (query);
  return combine (sols1, sols2);
}

Here is the call graph for this function: