Back to index

texmacs  1.0.7.15
Functions | Variables
dictionary.cpp File Reference
#include "dictionary.hpp"
#include "file.hpp"
#include "convert.hpp"
#include "converter.hpp"
#include "drd_std.hpp"

Go to the source code of this file.

Functions

 RESOURCE_CODE (dictionary)
dictionary load_dictionary (string from, string to)
void set_input_language (string s)
string get_input_language ()
void set_output_language (string s)
string get_output_language ()
string translate (string s, string from, string to)
string translate (string s)
string translate (const char *s)
tree tree_translate (tree t, string from, string to)
tree tree_translate (tree t)
static string serialize (tree t)
string translate (tree t, string from, string to)
string translate (tree t)

Variables

static string in_lan ("english")
static string out_lan ("english")

Function Documentation

Definition at line 136 of file dictionary.cpp.

{ return in_lan; }

Here is the caller graph for this function:

Definition at line 138 of file dictionary.cpp.

{ return out_lan; }

Here is the caller graph for this function:

dictionary load_dictionary ( string  from,
string  to 
)

Definition at line 64 of file dictionary.cpp.

                                         {
  string name= from * "-" * to;
  if (dictionary::instances -> contains (name))
    return dictionary (name);
  dictionary dict= tm_new<dictionary_rep> (from, to);
  if (from != to) dict->load (name);
  return dict;
}

Here is the call graph for this function:

Here is the caller graph for this function:

RESOURCE_CODE ( dictionary  )
static string serialize ( tree  t) [static]

Definition at line 191 of file dictionary.cpp.

                   {
  if (is_atomic (t))
    return t->label;
  else if (is_concat (t)) {
    string s;
    for (int i=0; i<N(t); i++) {
      tree u= t[i];
      while (is_concat (u) && N(u) > 0) u= u[0];
      if (i > 0 && is_compound (u, "render-key"))
       if (!is_atomic (t[i-1]) || !ends (t[i-1]->label, " ")) {
         if (use_macos_fonts () || gui_is_qt ()) s << "  ";
         else s << " ";
       }
      s << serialize (t[i]);
    }
    return s;
  }
  else if (is_compound (t, "render-key", 1))
    return serialize (t[0]);
  else if (is_func (t, WITH))
    return serialize (t[N(t)-1]);
  else if (is_compound (t, "math", 1))
    return serialize (t[0]);
  else if (is_compound (t, "op", 1)) {
    t= t[0];
    if (gui_is_qt ()) {
      if (t == "<leftarrow>") return "Left";
      if (t == "<rightarrow>") return "Right";
      if (t == "<uparrow>") return "Up";
      if (t == "<downarrow>") return "Down";
    }
    else {
      if (t == "<leftarrow>") return "left";
      if (t == "<rightarrow>") return "right";
      if (t == "<uparrow>") return "up";
      if (t == "<downarrow>") return "down";
    }
    return serialize (t);
  }
  else return "";
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 135 of file dictionary.cpp.

{ in_lan= s; }

Here is the caller graph for this function:

Definition at line 137 of file dictionary.cpp.

{ out_lan= s; }

Here is the caller graph for this function:

string translate ( string  s,
string  from,
string  to 
)

Definition at line 141 of file dictionary.cpp.

                                             {
  if (N(from)==0) return s;
  dictionary dict= load_dictionary (from, to);
  return dict->translate (s);
}

Here is the call graph for this function:

Definition at line 148 of file dictionary.cpp.

                     {
  return translate (s, "english", out_lan);
}

Here is the call graph for this function:

string translate ( const char *  s)

Definition at line 153 of file dictionary.cpp.

                          {
  return translate (string (s), "english", out_lan);
}

Here is the call graph for this function:

string translate ( tree  t,
string  from,
string  to 
)

Definition at line 234 of file dictionary.cpp.

                                           {
  return serialize (tree_translate (t, from, to));
}

Here is the call graph for this function:

Definition at line 239 of file dictionary.cpp.

                   {
  return serialize (tree_translate (t));
}

Here is the call graph for this function:

tree tree_translate ( tree  t,
string  from,
string  to 
)

Definition at line 162 of file dictionary.cpp.

                                                {
  //cout << "Translating " << t << " from " << from << " into " << to << "\n";
  if (is_atomic (t))
    return translate (t->label, from, to);
  else if (is_compound (t, "verbatim", 1))
    return t[0];
  else if (is_compound (t, "localize", 1))
    return tree_translate (t[0], "english", out_lan);
  else if (is_compound (t, "render-key", 1))
    return compound ("render-key", tree_translate (t[0], from, to));
  else {
    tree r (t, N(t));
    for (int i=0; i<N(t); i++)
      if (!the_drd->is_accessible_child (t, i)) r[i]= t[i];
      else r[i]= tree_translate (t[i], from, to);
    return r;
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 182 of file dictionary.cpp.

                        {
  return tree_translate (t, "english", out_lan);
}

Here is the call graph for this function:


Variable Documentation

string in_lan("english") [static]
string out_lan("english") [static]