Back to index

texmacs  1.0.7.15
Functions
to_scheme.cpp File Reference
#include "convert.hpp"
#include "drd_std.hpp"

Go to the source code of this file.

Functions

string slash (string s)
static void scheme_tree_to_string (string &out, scheme_tree p)
string scheme_tree_to_string (scheme_tree p)
string scheme_tree_to_block (scheme_tree p)
scheme_tree tree_to_scheme_tree (tree t)
string tree_to_scheme (tree t)

Function Documentation

Definition at line 92 of file to_scheme.cpp.

                                     {
  string out;
  int i, n= N(p);
  for (i=0; i<n; i++)
    out << scheme_tree_to_string (p[i]) << "\n";
  return out;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void scheme_tree_to_string ( string out,
scheme_tree  p 
) [static]

Definition at line 61 of file to_scheme.cpp.

                                                   {
  if (!is_tuple (p)) {
    string s= p->label;
    if (is_quoted (s)) out << scm_quote (raw_unquote (s));
    else out << slash (s);
  }
  else {
    if (is_tuple (p, "\'", 1)) {
      out << "\'";
      scheme_tree_to_string (out, p[1]);
    }
    else {
      int i, n= N(p);
      out << "(";
      for (i=0; i<n; i++) {
       if (i>0) out << " ";
       scheme_tree_to_string (out, p[i]);
      }
      out << ")";
    }
  }
}

Here is the call graph for this function:

Definition at line 85 of file to_scheme.cpp.

                                      {
  string out;
  scheme_tree_to_string (out, p);
  return out;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 20 of file to_scheme.cpp.

                 {
  int i, n= N(s);
  string r;
  for (i=0; i<n; i++)
    switch (s[i]) {
    case '(':
    case ')':
    case ' ': 
    case '\'':
      if ((n<2) || (s[0]!='\042') || (s[n-1]!='\042')) r << "\\";
      r << s[i];
      break;
    case '\\':
      r << '\\' << s[i];
      break;
    case '\042':
      if (((i==0) && (s[n-1]=='\042')) ||
         ((i==(n-1)) && (s[0]=='\042')))
       r << s[i];
      else r << "\\" << s[i];
      break;
    case ((char) 0):
      r << "\\0";
      break;
    case '\t':
      r << "\\t";
      break;
    case '\n':
      r << "\\n";
      break;
    default:
      r << s[i];
    }
  return r;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 130 of file to_scheme.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 105 of file to_scheme.cpp.

                             {
  if (is_atomic (t)) return scm_quote (t->label);
  else if (is_func (t, EXPAND) && is_atomic (t[0])) {
    int i, n= N(t);
    tree u (TUPLE, n);
    u[0]= copy (t[0]);
    for (i=1; i<n; i++)
      u[i]= tree_to_scheme_tree (t[i]);
    return u;    
  }
  else {
    int i, n= N(t);
    tree u (TUPLE, n+1);
    u[0]= copy (as_string (L(t)));
    for (i=0; i<n; i++)
      u[i+1]= tree_to_scheme_tree (t[i]);
    return u;
  }
}

Here is the call graph for this function:

Here is the caller graph for this function: