Back to index

texmacs  1.0.7.15
Defines | Functions
concat_active.cpp File Reference
#include "concater.hpp"
#include "file.hpp"
#include "image_files.hpp"
#include "sys_utils.hpp"
#include "analyze.hpp"
#include "scheme.hpp"
#include "packrat.hpp"

Go to the source code of this file.

Defines

#define error_image(t)

Functions

bool build_locus (edit_env env, tree t, list< string > &ids, string &col, string &ref, string &anchor)
bool build_locus (edit_env env, tree t, list< string > &ids, string &col)

Define Documentation

#define error_image (   t)
Value:
{ \
  typeset_dynamic (tree (ERROR, "bad image", t), ip); \
  return; \
}

Definition at line 251 of file concat_active.cpp.


Function Documentation

bool build_locus ( edit_env  env,
tree  t,
list< string > &  ids,
string col,
string ref,
string anchor 
)

Definition at line 84 of file concat_active.cpp.

                                                                                                {
  //cout << "Typeset " << t << "\n";
  int last= N(t)-1;
  tree body= env->expand (t[last], true);
  //cout << "Typeset " << body << "\n";
  bool accessible= is_accessible (obtain_ip (body));
  bool visited= false;
  ref= "";
  anchor= "";

  if (!is_nil (env->link_env)) {
    int i, j;
    for (i=0; i<last; i++) {
      tree arg= env->exec (t[i]);
      if (is_compound (arg, "id", 1)) {
       string id= as_string (arg[0]);
       if (accessible) env->link_env->insert_locus (id, body);
       else if (N (obtain_ip (body)) > 1) {
         extern tree get_subtree (path p);
         path p= path_up (reverse (descend_decode (obtain_ip (body), 1)));
         env->link_env->insert_locus ("&" * id, get_subtree (p));
       }
       ids= list<string> (id, ids);
       visited= visited || has_been_visited ("id:" * id);
      }
      if (is_compound (arg, "link") && N(arg) >= 2) {
       if (is_func (arg[1], ATTR)) arg= copy (arg);
       else arg= arg (0, 1) * tree (LINK, tree (ATTR)) * arg (1, N(arg));
       arg[1] << tree ("secure")
              << (env->secure? tree ("true"): tree ("false"));
       env->link_env->insert_link (arg);
       for (j=2; j<N(arg); j++) {
         if (is_compound (arg[j], "id", 1) && is_atomic (arg[j][0])) {
           visited= visited || has_been_visited ("id:" * arg[j][0]->label);
           anchor = arg[j][0]->label;
         }
         if (is_compound (arg[j], "url", 1) && is_atomic (arg[j][0])) {
           visited= visited || has_been_visited ("url:" * arg[j][0]->label);
           ref = arg[j][0]->label;
         }
       }
      }
    }
  }

  bool on_paper= (env->get_string (PAGE_PRINTED) == "true");
  bool preserve= (get_locus_rendering ("locus-on-paper") == "preserve");
  string var= (visited? VISITED_COLOR: LOCUS_COLOR);
  string current_col= env->get_string (COLOR);
  string locus_col= env->get_string (var);
  if (locus_col == "preserve") col= current_col;
  else if (on_paper && preserve) col= current_col;
  else if (locus_col == "global") col= get_locus_rendering (var);
  else col= locus_col;

  return accessible;
}

Here is the call graph for this function:

Here is the caller graph for this function:

bool build_locus ( edit_env  env,
tree  t,
list< string > &  ids,
string col 
)

Definition at line 143 of file concat_active.cpp.

                                                                   {
  string ref;
  string anchor;
  return build_locus(env, t, ids, col, ref, anchor);
}

Here is the call graph for this function: