Back to index

texmacs  1.0.7.15
Public Member Functions | Public Attributes
connection_rep Struct Reference
Inheritance diagram for connection_rep:
Inheritance graph
[legend]
Collaboration diagram for connection_rep:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 connection_rep (string name, string session, tm_link ln)
string start (bool again)
void write (string s)
void read (int channel)
void stop ()
void interrupt ()
void listen ()

Public Attributes

string name
string session
tm_link ln
int status
int prev_status
bool forced_eval
texmacs_input tm_in
texmacs_input tm_err
string res_name

Detailed Description

Definition at line 35 of file connection.cpp.


Constructor & Destructor Documentation

connection_rep::connection_rep ( string  name,
string  session,
tm_link  ln 
)

Definition at line 69 of file connection.cpp.

                                                                         :
  rep<connection> (name2 * "-" * session2),
  name (name2), session (session2), ln (ln2),
  status (CONNECTION_DEAD), prev_status (CONNECTION_DEAD),
  forced_eval (false),
  tm_in ("output"), tm_err ("error") {}

Member Function Documentation

Definition at line 143 of file connection.cpp.

                           {
  if (ln->alive) {
    ln->interrupt ();
    if (status == WAITING_FOR_OUTPUT)
      status= CONNECTION_DYING;
  }
}

Definition at line 178 of file connection.cpp.

                        {
  if (forced_eval) return;
  connection_notify_status (this);
  if (status != CONNECTION_DEAD) {
    read (LINK_ERR);
    connection_notify (this, "error", tm_err->get ("error"));
    read (LINK_OUT);
    connection_notify (this, "output", tm_in->get ("output"));
    connection_notify (this, "prompt", tm_in->get ("prompt"));
    connection_notify (this, "input", tm_in->get ("input"));
    tree t= connection_handlers (name);
    int i, n= N(t);
    for (i=0; i<n; i++) {
      tree doc= tm_in->get (t[i][0]->label);
      if (doc != "") call (t[i][1]->label, doc);
      doc= tm_err->get (t[i][0]->label);
      if (doc != "") call (t[i][1]->label, doc);
    }
  }
  connection_notify_status (this);  
}

Here is the call graph for this function:

Here is the caller graph for this function:

void connection_rep::read ( int  channel)

Definition at line 108 of file connection.cpp.

                                 {
  if (channel == LINK_OUT) {
    string s= ln->read (LINK_OUT);
    int i, n= N(s);
    for (i=0; i<n; i++)
      if (tm_in->put (s[i])) {
       status= WAITING_FOR_INPUT;
       if (DEBUG_IO) cout << LF << HRULE;
      }
  }
  else if (channel == LINK_ERR) {
    string s= ln->read (LINK_ERR);
    int i, n= N(s);
    for (i=0; i<n; i++)
      (void) tm_err->put (s[i]);
  }
  if (!ln->alive) {
    tm_in ->eof ();
    tm_err->eof ();
    status= CONNECTION_DEAD;
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

string connection_rep::start ( bool  again)

Definition at line 77 of file connection.cpp.

                                 {
  string message;
  if (ln->alive) {
    message= "Continuation of '" * name * "' session";
    status = WAITING_FOR_INPUT;
  }
  else {
    message= ln->start ();
    tm_in  = texmacs_input ("output");
    tm_err = texmacs_input ("error");
    status = WAITING_FOR_OUTPUT;
    if (again && (message == "ok")) {
      beep ();
      (void) connection_retrieve (name, session);
    }
  }
  tm_in ->bof ();
  tm_err->bof ();
  ln->set_command (command (connection_callback, this));
  return message;
}

Here is the call graph for this function:

Definition at line 132 of file connection.cpp.

                      {
  if (ln->alive) {
    ln->stop ();
    tm_in ->eof ();
    tm_err->eof ();
    if (status == WAITING_FOR_OUTPUT)
      status= CONNECTION_DYING;
  }
}

Definition at line 100 of file connection.cpp.

                               {
  ln->write (s, LINK_IN);
  tm_in ->bof ();
  tm_err->bof ();
  status= WAITING_FOR_OUTPUT;
}

Member Data Documentation

Definition at line 41 of file connection.cpp.

Definition at line 38 of file connection.cpp.

Definition at line 36 of file connection.cpp.

Definition at line 40 of file connection.cpp.

string rep< connection >::res_name [inherited]

Definition at line 17 of file resource.hpp.

Definition at line 37 of file connection.cpp.

Definition at line 39 of file connection.cpp.

Definition at line 43 of file connection.cpp.

Definition at line 42 of file connection.cpp.


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