Back to index

texmacs  1.0.7.15
Classes | Functions | Variables
object.cpp File Reference
#include "object.hpp"
#include "glue.hpp"
#include "config.h"
#include "list.hpp"
#include "array.hpp"
#include "promise.hpp"
#include "widget.hpp"

Go to the source code of this file.

Classes

class  object_command_rep
class  object_promise_widget_rep

Functions

tm_ostreamoperator<< (tm_ostream &out, object obj)
bool operator== (object obj1, object obj2)
bool operator!= (object obj1, object obj2)
int hash (object obj)
object null_object ()
object cons (object obj1, object obj2)
object list_object (object obj1)
object list_object (object obj1, object obj2)
object list_object (object obj1, object obj2, object obj3)
object symbol_object (string s)
object car (object obj)
object cdr (object obj)
object caar (object obj)
object cdar (object obj)
object cadr (object obj)
object cddr (object obj)
object caddr (object obj)
object cadddr (object obj)
bool is_null (object obj)
bool is_list (object obj)
bool is_bool (object obj)
bool is_int (object obj)
bool is_double (object obj)
bool is_string (object obj)
bool is_symbol (object obj)
bool is_tree (object obj)
bool is_path (object obj)
bool is_url (object obj)
bool as_bool (object obj)
int as_int (object obj)
double as_double (object obj)
string as_string (object obj)
string as_symbol (object obj)
tree as_tree (object obj)
scheme_tree as_tmscm_tree (object obj)
list< stringas_list_string (object obj)
list< treeas_list_tree (object obj)
path as_path (object obj)
array< objectas_array_object (object obj)
url as_url (object obj)
widget as_widget (object obj)
object tree_to_stree (scheme_tree t)
tree stree_to_tree (object obj)
tree content_to_tree (object obj)
object string_to_object (string s)
string object_to_string (object obj)
object scheme_cmd (const char *s)
object scheme_cmd (string s)
object scheme_cmd (object cmd)
static array< tmscmarray_lookup (array< object > a)
command as_command (object obj)
promise< widgetas_promise_widget (object obj)
object eval (const char *expr)
object eval (string expr)
object eval (object expr)
object eval_secure (string expr)
object eval_file (string name)
bool exec_file (url u)
object call (const char *fun)
object call (const char *fun, object a1)
object call (const char *fun, object a1, object a2)
object call (const char *fun, object a1, object a2, object a3)
object call (const char *fun, object a1, object a2, object a3, object a4)
object call (const char *fun, array< object > a)
object call (string fun)
object call (string fun, object a1)
object call (string fun, object a1, object a2)
object call (string fun, object a1, object a2, object a3)
object call (string fun, object a1, object a2, object a3, object a4)
object call (string fun, array< object > a)
object call (object fun)
object call (object fun, object a1)
object call (object fun, object a1, object a2)
object call (object fun, object a1, object a2, object a3)
object call (object fun, object a1, object a2, object a3, object a4)
object call (object fun, array< object > a)
void notify_preferences_loaded ()
string get_preference (string var)
void exec_delayed (object cmd)
void exec_delayed_pause (object cmd)
void exec_pending_commands ()
void clear_pending_commands ()

Variables

static list< tmscmdestroy_list
tmscm object_stack
static bool preferences_ok = false
static array< objectdelayed_queue
static array< time_tstart_queue

Function Documentation

static array<tmscm > array_lookup ( array< object a) [inline, static]

Definition at line 296 of file object.cpp.

                               {
       const int n=N(a);
       array<tmscm > tmscm (n);
       int i;
       for (i=0; i<n; i++) tmscm [i]= object_to_tmscm (a[i]);
       return tmscm ;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 223 of file object.cpp.

                             {
       ASSERT (is_list (obj), "list expected");
       array<object> ret;
       while (!is_null (obj)) {
              ret << car (obj);
              obj= cdr (obj);
       }
       return ret;
}

Here is the call graph for this function:

Here is the caller graph for this function:

bool as_bool ( object  obj)

Definition at line 154 of file object.cpp.

                     {
       tmscm  b= object_to_tmscm (obj);
       if (!tmscm_is_bool (b)) return false;
       return tmscm_to_bool (b);
}

Here is the call graph for this function:

Definition at line 316 of file object.cpp.

                        {
       return tm_new<object_command_rep> (obj);
}

Here is the caller graph for this function:

double as_double ( object  obj)

Definition at line 168 of file object.cpp.

                       {
       tmscm  x= object_to_tmscm (obj);
       if (!tmscm_is_double (x)) return 0.0;
       return tmscm_to_double (x);
}

Here is the call graph for this function:

int as_int ( object  obj)

Definition at line 161 of file object.cpp.

                    {
       tmscm  i= object_to_tmscm (obj);
       if (!tmscm_is_int (i)) return 0;
       return tmscm_to_int (i);
}

Here is the call graph for this function:

Definition at line 202 of file object.cpp.

                            {
       tmscm  l= object_to_tmscm (obj);
       if (!tmscm_is_list_string (l)) return list<string> ();
       return tmscm_to_list_string (l);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 209 of file object.cpp.

                          {
       tmscm  l= object_to_tmscm (obj);
       if (!tmscm_is_list_tree (l)) return list<tree> ();
       return tmscm_to_list_tree (l);
}

Here is the call graph for this function:

Here is the caller graph for this function:

path as_path ( object  obj)

Definition at line 216 of file object.cpp.

                     {
       tmscm  t= object_to_tmscm (obj);
       if (!tmscm_is_path (t)) return path ();
       return tmscm_to_path (t);
}

Here is the call graph for this function:

Definition at line 336 of file object.cpp.

                               {
       return tm_new<object_promise_widget_rep> (obj);
}

Here is the caller graph for this function:

Definition at line 175 of file object.cpp.

                       {
       tmscm  s= object_to_tmscm (obj);
       if (!tmscm_is_string (s)) return "";
       return tmscm_to_string (s);
}

Here is the call graph for this function:

Definition at line 182 of file object.cpp.

                       {
       tmscm  s= object_to_tmscm (obj);
       if (!tmscm_is_symbol (s)) return "";
       return tmscm_to_symbol (s);
}

Here is the call graph for this function:

Definition at line 196 of file object.cpp.

                           {
       tmscm  t= object_to_tmscm (obj);
       return tmscm_to_scheme_tree (t);
}

Here is the call graph for this function:

tree as_tree ( object  obj)

Definition at line 189 of file object.cpp.

                     {
       tmscm  t= object_to_tmscm (obj);
       if (!tmscm_is_tree (t)) return tree ();
       return tmscm_to_tree (t);
}

Here is the call graph for this function:

url as_url ( object  obj)

Definition at line 234 of file object.cpp.

                    {
       tmscm  t= object_to_tmscm (obj);
       if (!tmscm_is_url (t)) return url ("");
       return tmscm_to_url (t);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 241 of file object.cpp.

                       {
       tmscm  w= object_to_tmscm (obj);
       if (!tmscm_is_widget (w)) return widget ();
       return tmscm_to_widget (w);
}

Here is the call graph for this function:

Here is the caller graph for this function:

object caar ( object  obj)

Definition at line 105 of file object.cpp.

Here is the call graph for this function:

object cadddr ( object  obj)

Definition at line 115 of file object.cpp.

Here is the call graph for this function:

object caddr ( object  obj)

Definition at line 113 of file object.cpp.

Here is the call graph for this function:

object cadr ( object  obj)

Definition at line 109 of file object.cpp.

Here is the call graph for this function:

object call ( const char *  fun)

Definition at line 358 of file object.cpp.

                              {
       return tmscm_to_object (call_scheme (eval_scheme(fun))); }

Here is the call graph for this function:

object call ( const char *  fun,
object  a1 
)

Definition at line 360 of file object.cpp.

Here is the call graph for this function:

object call ( const char *  fun,
object  a1,
object  a2 
)

Definition at line 362 of file object.cpp.

Here is the call graph for this function:

object call ( const char *  fun,
object  a1,
object  a2,
object  a3 
)

Definition at line 364 of file object.cpp.

Here is the call graph for this function:

object call ( const char *  fun,
object  a1,
object  a2,
object  a3,
object  a4 
)

Definition at line 367 of file object.cpp.

Here is the call graph for this function:

object call ( const char *  fun,
array< object a 
)

Definition at line 370 of file object.cpp.

Here is the call graph for this function:

object call ( string  fun)

Definition at line 373 of file object.cpp.

                         {
       return tmscm_to_object (call_scheme (eval_scheme(fun))); }

Here is the call graph for this function:

object call ( string  fun,
object  a1 
)

Definition at line 375 of file object.cpp.

Here is the call graph for this function:

object call ( string  fun,
object  a1,
object  a2 
)

Definition at line 377 of file object.cpp.

Here is the call graph for this function:

object call ( string  fun,
object  a1,
object  a2,
object  a3 
)

Definition at line 379 of file object.cpp.

Here is the call graph for this function:

object call ( string  fun,
object  a1,
object  a2,
object  a3,
object  a4 
)

Definition at line 382 of file object.cpp.

Here is the call graph for this function:

object call ( string  fun,
array< object a 
)

Definition at line 385 of file object.cpp.

Here is the call graph for this function:

object call ( object  fun)

Definition at line 388 of file object.cpp.

Here is the call graph for this function:

object call ( object  fun,
object  a1 
)

Definition at line 390 of file object.cpp.

Here is the call graph for this function:

object call ( object  fun,
object  a1,
object  a2 
)

Definition at line 392 of file object.cpp.

Here is the call graph for this function:

object call ( object  fun,
object  a1,
object  a2,
object  a3 
)

Definition at line 394 of file object.cpp.

Here is the call graph for this function:

object call ( object  fun,
object  a1,
object  a2,
object  a3,
object  a4 
)

Definition at line 397 of file object.cpp.

Here is the call graph for this function:

object call ( object  fun,
array< object a 
)

Definition at line 400 of file object.cpp.

Here is the call graph for this function:

object car ( object  obj)

Definition at line 101 of file object.cpp.

                        {
       return tmscm_to_object (tmscm_car (object_to_tmscm (obj))); }

Here is the call graph for this function:

object cdar ( object  obj)

Definition at line 107 of file object.cpp.

Here is the call graph for this function:

object cddr ( object  obj)

Definition at line 111 of file object.cpp.

Here is the call graph for this function:

object cdr ( object  obj)

Definition at line 103 of file object.cpp.

                        {
       return tmscm_to_object (tmscm_cdr (object_to_tmscm (obj))); }

Here is the call graph for this function:

Definition at line 466 of file object.cpp.

object cons ( object  obj1,
object  obj2 
)

Definition at line 91 of file object.cpp.

Here is the call graph for this function:

Definition at line 258 of file object.cpp.

                             {
       return tmscm_to_content (object_to_tmscm (obj));
       // return as_tree (call ("content->tree", obj));
}

Here is the call graph for this function:

Here is the caller graph for this function:

object eval ( const char *  expr)

Definition at line 344 of file object.cpp.

                               {
       return tmscm_to_object (eval_scheme (expr)); }

Here is the call graph for this function:

object eval ( string  expr)

Definition at line 346 of file object.cpp.

                          {
       return tmscm_to_object (eval_scheme (expr)); }

Here is the call graph for this function:

object eval ( object  expr)

Definition at line 348 of file object.cpp.

                          {
       return call ("eval", expr); }

Here is the call graph for this function:

object eval_file ( string  name)

Definition at line 352 of file object.cpp.

                               {
       return tmscm_to_object (eval_scheme_file (name)); }

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 350 of file object.cpp.

                                 {
       return eval ("(wrap-eval-secure " * expr * ")"); }

Here is the call graph for this function:

void exec_delayed ( object  cmd)

Definition at line 430 of file object.cpp.

                          {
       delayed_queue << cmd;
       start_queue << (((time_t) texmacs_time ()) - 1000000000);
}

Here is the call graph for this function:

void exec_delayed_pause ( object  cmd)

Definition at line 436 of file object.cpp.

Here is the call graph for this function:

bool exec_file ( url  u)

Definition at line 354 of file object.cpp.

                       {
       object ret= eval_file (materialize (u));
       return ret != object ("#<unspecified>"); }

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 442 of file object.cpp.

                         {
       array<object> a= delayed_queue;
       array<time_t> b= start_queue;
       delayed_queue= array<object> (0);
       start_queue  = array<time_t> (0);
       int i, n= N(a);
       for (i=0; i<n; i++) {
              time_t now= (time_t) texmacs_time ();
              if ((now - b[i]) >= 0) {
                     object obj= call (a[i]);
                     if (is_int (obj) && (now - b[i] < 1000000000)) {
                            //cout << "pause= " << obj << "\n";
                            delayed_queue << a[i];
                            start_queue << (now + as_int (obj));
                     }
              }
              else {
                     delayed_queue << a[i];
                     start_queue << b[i];
              }
       }
}

Here is the call graph for this function:

Definition at line 416 of file object.cpp.

                            {
       if (!preferences_ok) return "uninitialized";
       else return as_string (call ("get-preference", var));
}

Here is the call graph for this function:

Here is the caller graph for this function:

int hash ( object  obj)

Definition at line 81 of file object.cpp.

                  {
       return as_int (call ("hash", obj, object (1234567)));
}

Here is the call graph for this function:

bool is_bool ( object  obj)

Definition at line 125 of file object.cpp.

{ return tmscm_is_bool (object_to_tmscm (obj)); }

Here is the call graph for this function:

bool is_double ( object  obj)

Definition at line 127 of file object.cpp.

{ return tmscm_is_double (object_to_tmscm (obj)); }

Here is the call graph for this function:

bool is_int ( object  obj)

Definition at line 126 of file object.cpp.

{ return tmscm_is_int (object_to_tmscm (obj)); }

Here is the call graph for this function:

bool is_list ( object  obj)

Definition at line 124 of file object.cpp.

{ return tmscm_is_list (object_to_tmscm (obj)); }

Here is the call graph for this function:

Here is the caller graph for this function:

bool is_null ( object  obj)

Definition at line 123 of file object.cpp.

{ return tmscm_is_null (object_to_tmscm (obj)); }

Here is the call graph for this function:

Here is the caller graph for this function:

bool is_path ( object  obj)

Definition at line 131 of file object.cpp.

{ return tmscm_is_path (object_to_tmscm (obj)); }

Here is the call graph for this function:

Here is the caller graph for this function:

bool is_string ( object  obj)

Definition at line 128 of file object.cpp.

{ return tmscm_is_string (object_to_tmscm (obj)); }

Here is the call graph for this function:

bool is_symbol ( object  obj)

Definition at line 129 of file object.cpp.

{ return tmscm_is_symbol (object_to_tmscm (obj)); }

Here is the call graph for this function:

Here is the caller graph for this function:

bool is_tree ( object  obj)

Definition at line 130 of file object.cpp.

{ return tmscm_is_tree (object_to_tmscm (obj)); }

Here is the call graph for this function:

bool is_url ( object  obj)

Definition at line 132 of file object.cpp.

{ return tmscm_is_url (object_to_tmscm (obj)); }

Here is the call graph for this function:

Definition at line 93 of file object.cpp.

                                 {
       return cons (obj1, null_object ()); }

Here is the call graph for this function:

Here is the caller graph for this function:

object list_object ( object  obj1,
object  obj2 
)

Definition at line 95 of file object.cpp.

                                              {
       return cons (obj1, cons (obj2, null_object ())); }

Here is the call graph for this function:

object list_object ( object  obj1,
object  obj2,
object  obj3 
)

Definition at line 97 of file object.cpp.

                                                           {
       return cons (obj1, cons (obj2, cons (obj3, null_object ()))); }

Here is the call graph for this function:

Definition at line 410 of file object.cpp.

                             {
       preferences_ok= true;
}

Here is the caller graph for this function:

Definition at line 89 of file object.cpp.

                      {
       return tmscm_to_object (tmscm_null ()); }

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 269 of file object.cpp.

                              {
       return as_string (call ("object->string", obj));
}

Here is the call graph for this function:

Here is the caller graph for this function:

bool operator!= ( object  obj1,
object  obj2 
)

Definition at line 76 of file object.cpp.

                                       {
       return !(obj1 == obj2);
}
tm_ostream& operator<< ( tm_ostream out,
object  obj 
)

Definition at line 60 of file object.cpp.

                                          {
       out.flush ();
       if (out == cout) call ("write", obj);
       else if (out == cerr) call ("write-err", obj);
       else FAILED ("not yet implemented");
       call ("force-output");
       return out;
}

Here is the call graph for this function:

bool operator== ( object  obj1,
object  obj2 
)

Definition at line 70 of file object.cpp.

                                       {
       tmscm  o1= object_to_tmscm (obj1), o2= object_to_tmscm (obj2);
       return tmscm_is_equal (o1, o2);
}

Here is the call graph for this function:

object scheme_cmd ( const char *  s)

Definition at line 274 of file object.cpp.

                           {
       return eval ("(lambda () " * string (s) * ")");
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 279 of file object.cpp.

                      {
       return eval ("(lambda () " * s * ")");
}

Here is the call graph for this function:

Definition at line 284 of file object.cpp.

                        {
       cmd= cons (cmd, null_object ());
       cmd= cons (null_object (), cmd);
       cmd= cons (eval ("'lambda"), cmd);
       return eval (cmd);
}

Here is the call graph for this function:

Definition at line 253 of file object.cpp.

                           {
       return as_tree (call ("stree->tree", obj));
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 264 of file object.cpp.

                            {
       return call ("string->object", s);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 99 of file object.cpp.

                                {
       return tmscm_to_object ( symbol_to_tmscm  (s) ); }

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 248 of file object.cpp.

                              {
       return call ("tree->stree", t);
}

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

Definition at line 426 of file object.cpp.

list<tmscm > destroy_list [static]

Definition at line 29 of file object.cpp.

Definition at line 474 of file guile_tm.cpp.

bool preferences_ok = false [static]

Definition at line 407 of file object.cpp.

Definition at line 427 of file object.cpp.