Back to index

texmacs  1.0.7.15
Public Member Functions | Public Attributes
texmacs_input_rep Struct Reference

#include <input.hpp>

Inheritance diagram for texmacs_input_rep:
Inheritance graph
[legend]
Collaboration diagram for texmacs_input_rep:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 texmacs_input_rep (string type)
int get_mode (string s)
void begin_mode (string s)
void begin_channel (string s)
void end ()
bool put (char c)
void bof ()
void eof ()
void write (tree t)
tree get (string channel)
void flush (bool force=false)
void verbatim_flush (bool force=false)
void scheme_flush (bool force=false)
void latex_flush (bool force=false)
void html_flush (bool force=false)
void ps_flush (bool force=false)
void math_flush (bool force=false)
void ispell_flush (bool force=false)
void channel_flush (bool force=false)
void command_flush (bool force=false)
void xformat_flush (bool force=false)

Public Attributes

string type
int status
string buf
string format
int mode
string channel
tree stack
hashmap< string, treedocs
int ref_count

Detailed Description

Definition at line 17 of file input.hpp.


Constructor & Destructor Documentation

Definition at line 38 of file input.cpp.

                                                 :
  type (type2),
  status (STATUS_NORMAL),
  buf (""),
  format ("verbatim"),
  mode (get_mode (format)),
  channel (type),
  stack (""),
  docs (tree (DOCUMENT, "")) { bof (); }

Here is the call graph for this function:


Member Function Documentation

Definition at line 77 of file input.cpp.

                                          {
  stack  = tuple (format, channel, stack);
  channel= s;
  if ((channel == "prompt") || (channel == "input"))
    docs (channel)= tree (DOCUMENT, "");
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 70 of file input.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 145 of file input.cpp.

                        {
  format = "verbatim";
  channel= type;
  docs (channel)= tree (DOCUMENT, "");
}

Here is the caller graph for this function:

void texmacs_input_rep::channel_flush ( bool  force = false)

Definition at line 291 of file input.cpp.

                                            {
  if (force) {
    if ((buf == "prompt") || (buf == "input"))
      docs (buf)= tree (DOCUMENT, "");
    stack[1]= buf;
    buf= "";
  }
}

Here is the caller graph for this function:

void texmacs_input_rep::command_flush ( bool  force = false)

Definition at line 301 of file input.cpp.

                                            {
  if (force) {
    eval ("(begin " * buf * ")");
    buf= "";
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 85 of file input.cpp.

                        {
  if (stack != "") {
    format = stack[0]->label;
    mode   = get_mode (format);
    channel= stack[1]->label;
    stack  = stack[2];
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 152 of file input.cpp.

                        {
  flush (true);
}

Here is the call graph for this function:

void texmacs_input_rep::flush ( bool  force = false)

Definition at line 187 of file input.cpp.

                                    {
  if ((!force) && (channel == "error") && (stack != "")) return;
  switch (mode) {
  case MODE_VERBATIM:
    verbatim_flush (force);
    break;
  case MODE_SCHEME:
    scheme_flush (force);
    break;
  case MODE_LATEX:
    latex_flush (force);
    break;
  case MODE_HTML:
    html_flush (force);
    break;
  case MODE_PS:
    ps_flush (force);
    break;
  case MODE_MATH:
    math_flush (force);
    break;
  case MODE_CHANNEL:
    channel_flush (force);
    break;
  case MODE_COMMAND:
    command_flush (force);
    break;
  case MODE_XFORMAT:
    xformat_flush (force);
    break;
  default:
    FAILED ("invalid mode");
    break;
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 172 of file input.cpp.

                                 {
  if (!docs->contains (channel))
    docs (channel)= tree (DOCUMENT, "");
  tree& doc= docs (ch);
  if (doc == tree (DOCUMENT, "")) return "";
  tree t= doc;
  doc= tree (DOCUMENT, "");
  return t;
}

Definition at line 56 of file input.cpp.

                                     {
  if (s == "verbatim")  return MODE_VERBATIM;
  if (s == "latex") return MODE_LATEX;
  if (s == "scheme") return MODE_SCHEME;
  if (s == "html")  return MODE_HTML;
  if (s == "ps")  return MODE_PS;
  if (s == "math")  return MODE_MATH;
  if (s == "channel")  return MODE_CHANNEL;
  if (s == "command")  return MODE_COMMAND;
  if (as_bool (call ("format?", s))) return MODE_XFORMAT;
  return MODE_VERBATIM;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void texmacs_input_rep::html_flush ( bool  force = false)

Definition at line 248 of file input.cpp.

                                         {
  if (force || ends (buf, "</P>")) {
    write (compound ("html-text", generic_to_tree (buf, "html-snippet")));
    buf= "";
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void texmacs_input_rep::ispell_flush ( bool  force = false)
void texmacs_input_rep::latex_flush ( bool  force = false)

Definition at line 240 of file input.cpp.

                                          {
  if (force || ends (buf, "\n\n") || ends (buf, "\r\n\r\n")) {
    write (generic_to_tree (buf, "latex-snippet"));
    buf= "";
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void texmacs_input_rep::math_flush ( bool  force = false)

Definition at line 280 of file input.cpp.

                                         {
  if (force) {
    object obj= call ("string->object", buf);
    object cvr= call ("cas->stree", obj);
    tree t= as_tree (call ("tm->tree", cvr));
    write (tree (WITH, MODE, "math", t));
    buf= "";
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void texmacs_input_rep::ps_flush ( bool  force = false)

Definition at line 256 of file input.cpp.

                                       {
  if (force) {
    string w= "";
    string h= "";
    string b= copy (buf);
    while (true)
      if (starts (b, "width=") || starts (b, "height=")) {
       int i=0;
       for (i=0; i<N(b); i++)
         if (b[i] == '\n') break;
       if (i == N(b)) break;
       if (b[0] == 'w') w= b (6, i);
       else h= b (7, i);
       b= b (i+1, N(b));
      }
      else break;
    tree t (IMAGE, tuple (tree (RAW_DATA, b), "ps"));
    t << w << h << "" << "";
    write (t);
    buf= "";
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

bool texmacs_input_rep::put ( char  c)

Definition at line 99 of file input.cpp.

                              { // returns true when expecting input
  /*
  if (c == DATA_BEGIN) cout << "[BEGIN]";
  else if (c == DATA_END) cout << "[END]";
  else if (c == DATA_ESCAPE) cout << "[ESCAPE]";
  else cout << c;
  */

  bool block_done= false;
  switch (status) {
  case STATUS_NORMAL:
    if (c == DATA_ESCAPE) status= STATUS_ESCAPE;
    else if (c == DATA_BEGIN) {
      flush (true);
      status= STATUS_BEGIN;
    }
    else if (c == DATA_END) {
      flush (true);
      end ();
      block_done= (stack == "");
    }
    else buf << c;
    break;
  case STATUS_ESCAPE:
    buf << c;
    status= STATUS_NORMAL;
    break;
  case STATUS_BEGIN:
    if (c == ':') {
      begin_mode (buf);
      buf   = "";
      status= STATUS_NORMAL;
    }
    else if (c == '#') {
      begin_channel (buf);
      buf   = "";
      status= STATUS_NORMAL;
    }
    else buf << c;
    break;
  }
  if (status == STATUS_NORMAL) flush ();
  return block_done;
}

Here is the call graph for this function:

void texmacs_input_rep::scheme_flush ( bool  force = false)

Definition at line 232 of file input.cpp.

                                           {
  if (force) {
    write (simplify_correct (scheme_to_tree (buf)));
    buf= "";
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void texmacs_input_rep::verbatim_flush ( bool  force = false)

Definition at line 224 of file input.cpp.

                                             {
  if (force || ends (buf, "\n")) {
    write (verbatim_to_tree (buf));
    buf= "";
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 157 of file input.cpp.

                                {
  if (!docs->contains (channel))
    docs (channel)= tree (DOCUMENT, "");
  tree& t= docs (channel);
  if (!is_document (u)) u= tree (DOCUMENT, u);
  if (t[N(t)-1] == "") t[N(t)-1]= u[0];
  else if (u[0] != "") {
    if (!is_concat (t[N(t)-1])) t[N(t)-1]= tree (CONCAT, t[N(t)-1]);
    if (!is_concat (u[0])) u[0]= tree (CONCAT, u[0]);
    t[N(t)-1] << A(u[0]);
  }
  if (N(u)>1) t << A (u (1, N(u)));
}

Here is the call graph for this function:

Here is the caller graph for this function:

void texmacs_input_rep::xformat_flush ( bool  force = false)

Definition at line 309 of file input.cpp.

                                            {
  if (force) {
    write (generic_to_tree (buf, format * "-snippet"));
    buf= "";
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Definition at line 20 of file input.hpp.

Definition at line 23 of file input.hpp.

Definition at line 25 of file input.hpp.

Definition at line 21 of file input.hpp.

Definition at line 22 of file input.hpp.

int concrete_struct::ref_count [inherited]

Definition at line 135 of file basic.hpp.

Definition at line 24 of file input.hpp.

Definition at line 19 of file input.hpp.

Definition at line 18 of file input.hpp.


The documentation for this struct was generated from the following files: