Back to index

texmacs  1.0.7.15
scheme.hpp
Go to the documentation of this file.
00001 
00002 /******************************************************************************
00003 * MODULE     : scheme.hpp
00004 * DESCRIPTION: Abstract interface for the manipulation of scheme objects
00005 * COPYRIGHT  : (C) 1999  Joris van der Hoeven
00006 *******************************************************************************
00007 * This software falls under the GNU general public license version 3 or later.
00008 * It comes WITHOUT ANY WARRANTY WHATSOEVER. For details, see the file LICENSE
00009 * in the root directory or <http://www.gnu.org/licenses/gpl-3.0.html>.
00010 ******************************************************************************/
00011 
00012 #ifndef SCHEME_HH
00013 #define SCHEME_HH
00014 
00015 #include "tree.hpp"
00016 #include "path.hpp"
00017 #include "command.hpp"
00018 #include "url.hpp"
00019 
00020 void start_scheme (int argc, char** argv, void (*call_back) (int, char**));
00021 void initialize_scheme ();
00022 
00023 class object_rep : concrete_struct {
00024   friend class object;
00025 };
00026 
00027 
00028 class tmscm_object_rep;
00029 
00030 struct object {
00031        CONCRETE(object);
00032        object ();
00033     object (tmscm_object_rep* o);
00034        object (void *); // left intentionally undefined to inhibith implicit conversion of pointers to bool
00035        object (bool b); // implicit conversion to bool is dangerous!!! (all pointers match this conversion)
00036        object (int i);
00037        object (double x);
00038        object (const char* s);
00039        object (string s);
00040        object (tree t);
00041        object (list<string> l);
00042        object (list<tree> l);
00043        object (path p);
00044        object (url u);
00045 };
00046 CONCRETE_CODE(object);
00047 
00048 
00049 
00050 
00051 tm_ostream& operator << (tm_ostream& out, object obj);
00052 bool operator == (object obj1, object obj2);
00053 bool operator != (object obj1, object obj2);
00054 int hash (object obj);
00055 
00056 
00057 object null_object ();
00058 object list_object (object obj1);
00059 object list_object (object obj1, object obj2);
00060 object list_object (object obj1, object obj2, object obj3);
00061 object symbol_object (string s);
00062 object cons (object obj1, object obj2);
00063 object car (object obj);
00064 object cdr (object obj);
00065 object caar (object obj);
00066 object cdar (object obj);
00067 object cadr (object obj);
00068 object cddr (object obj);
00069 object caddr (object obj);
00070 object cadddr (object obj);
00071 
00072 bool is_null (object obj);
00073 bool is_list (object obj);
00074 bool is_bool (object obj);
00075 bool is_int (object obj);
00076 bool is_double (object obj);
00077 bool is_string (object obj);
00078 bool is_symbol (object obj);
00079 bool is_tree (object obj);
00080 bool is_path (object obj);
00081 bool is_url (object obj);
00082 
00083 bool as_bool (object obj);
00084 int as_int (object obj);
00085 double as_double (object obj);
00086 string as_string (object obj);
00087 string as_symbol (object obj);
00088 tree as_tree (object obj);
00089 scheme_tree as_scheme_tree (object obj);
00090 list<string> as_list_string (object obj);
00091 list<tree> as_list_tree (object obj);
00092 path as_path (object obj);
00093 array<object> as_array_object (object obj);
00094 url as_url (object obj);
00095 command as_command (object obj);
00096 #ifdef WIDGET_H // FIXME: dirty hack
00097 widget as_widget (object obj);
00098 promise<widget> as_promise_widget (object obj);
00099 #endif
00100 
00101 object tree_to_stree (tree t);
00102 tree   stree_to_tree (object obj);
00103 tree   content_to_tree (object obj);
00104 object string_to_object (string s);
00105 string object_to_string (object obj);
00106 object scheme_cmd (const char* s);
00107 object scheme_cmd (string s);
00108 object scheme_cmd (object cmd);
00109 
00110 
00111 void notify_preferences_loaded ();
00112 string get_preference (string var);
00113 
00114 
00115 object eval (const char* expr);
00116 object eval (string expr);
00117 object eval (object expr);
00118 object eval_secure (string expr);
00119 object eval_file (string name);
00120 bool   exec_file (url u);
00121 void   exec_delayed (object cmd);
00122 void   exec_delayed_pause (object cmd);
00123 void   exec_pending_commands ();
00124 void   clear_pending_commands ();
00125 
00126 object call (const char* fun);
00127 object call (const char* fun, object a1);
00128 object call (const char* fun, object a1, object a2);
00129 object call (const char* fun, object a1, object a2, object a3);
00130 object call (const char* fun, object a1, object a2, object a3, object a4);
00131 object call (const char* fun, array<object> a);
00132 object call (string fun);
00133 object call (string fun, object a1);
00134 object call (string fun, object a1, object a2);
00135 object call (string fun, object a1, object a2, object a3);
00136 object call (string fun, object a1, object a2, object a3, object a4);
00137 object call (string fun, array<object> a);
00138 object call (object fun);
00139 object call (object fun, object a1);
00140 object call (object fun, object a1, object a2);
00141 object call (object fun, object a1, object a2, object a3);
00142 object call (object fun, object a1, object a2, object a3, object a4);
00143 object call (object fun, array<object> a);
00144 
00145 
00146 #endif // defined SCHEME_HH