Introduction of exec_delayed_pause
[texmacs.git] / src / src / Guile / Scheme / object.hpp
blob239ec171562122df9824bbe5d395f066111b8b68
2 /******************************************************************************
3 * MODULE : object.hpp
4 * DESCRIPTION: Scheme objects
5 * COPYRIGHT : (C) 1999 Joris van der Hoeven
6 *******************************************************************************
7 * This software falls under the GNU general public license version 3 or later.
8 * It comes WITHOUT ANY WARRANTY WHATSOEVER. For details, see the file LICENSE
9 * in the root directory or <http://www.gnu.org/licenses/gpl-3.0.html>.
10 ******************************************************************************/
12 #ifndef OBJECT_H
13 #define OBJECT_H
14 #include "tree.hpp"
15 #include "path.hpp"
16 #include "command.hpp"
17 #include "url.hpp"
19 #ifdef __MINGW32__
20 // we redefine some symbols to avoid name clashes with Windows headers (included by Guile)
21 #define PATTERN WIN_PATTERN
22 #define STRING WIN_STRING
23 #define GROUP WIN_GROUP
24 #ifdef IN
25 #define MY_IN IN
26 #undef IN
27 #endif
28 #ifdef OUT
29 #define MY_OUT OUT
30 #undef OUT
31 #endif
32 #ifdef MENU_EVENT
33 #define MY_MENU_EVENT MENU_EVENT
34 #undef MENU_EVENT
35 #endif
36 #include <libguile.h>
37 #undef STRING
38 #undef ERROR
39 #undef PATTERN
40 #undef GROUP
41 #undef IN
42 #undef OUT
43 #undef MENU_EVENT
44 #ifdef MY_MENU_EVENT
45 #define MENU_EVENT MY_MENU_EVENT
46 #undef MY_MENU_EVENT
47 #endif
48 #ifdef MY_IN
49 #define IN MY_IN
50 #undef MY_IN
51 #endif
52 #ifdef MY_OUT
53 #define OUT MY_OUT
54 #undef MY_OUT
55 #endif
56 #else
57 #include <libguile.h>
58 #endif
61 class object_rep: concrete_struct {
62 SCM handle;
63 public:
64 object_rep (SCM obj);
65 ~object_rep ();
66 SCM lookup ();
67 friend struct object;
70 struct object {
71 CONCRETE(object);
72 inline object (SCM obj): rep (tm_new<object_rep> (obj)) {}
73 object ();
74 object (bool b);
75 object (int i);
76 object (const char* s);
77 object (string s);
78 object (tree t);
79 object (list<string> l);
80 object (list<tree> l);
81 object (path p);
82 object (url u);
84 CONCRETE_CODE(object);
86 ostream& operator << (ostream& out, object obj);
87 bool operator == (object obj1, object obj2);
88 bool operator != (object obj1, object obj2);
90 object null_object ();
91 object list_object (object obj1);
92 object list_object (object obj1, object obj2);
93 object list_object (object obj1, object obj2, object obj3);
94 object symbol_object (string s);
95 object cons (object obj1, object obj2);
96 object car (object obj);
97 object cdr (object obj);
98 object caar (object obj);
99 object cdar (object obj);
100 object cadr (object obj);
101 object cddr (object obj);
102 object caddr (object obj);
103 object cadddr (object obj);
105 bool is_null (object obj);
106 bool is_list (object obj);
107 bool is_bool (object obj);
108 bool is_int (object obj);
109 bool is_string (object obj);
110 bool is_symbol (object obj);
111 bool is_tree (object obj);
112 bool is_path (object obj);
113 bool is_url (object obj);
115 bool as_bool (object obj);
116 int as_int (object obj);
117 string as_string (object obj);
118 string as_symbol (object obj);
119 tree as_tree (object obj);
120 scheme_tree as_scheme_tree (object obj);
121 list<string> as_list_string (object obj);
122 list<tree> as_list_tree (object obj);
123 path as_path (object obj);
124 url as_url (object obj);
125 command as_command (object obj);
126 #ifdef WIDGET_H // FIXME: dirty hack
127 widget as_widget (object obj);
128 promise<widget> as_promise_widget (object obj);
129 #endif
131 object tree_to_stree (tree t);
132 tree stree_to_tree (object obj);
133 tree content_to_tree (object obj);
134 object string_to_object (string s);
135 string object_to_string (object obj);
136 object scheme_cmd (const char* s);
137 object scheme_cmd (string s);
138 object scheme_cmd (object cmd);
140 object eval (const char* expr);
141 object eval (string expr);
142 object eval (object expr);
143 object eval_secure (string expr);
144 object eval_file (string name);
145 bool exec_file (url u);
146 void exec_delayed (object cmd);
147 void exec_delayed_pause (object cmd);
148 void exec_pending_commands ();
150 object call (const char* fun);
151 object call (const char* fun, object a1);
152 object call (const char* fun, object a1, object a2);
153 object call (const char* fun, object a1, object a2, object a3);
154 object call (const char* fun, object a1, object a2, object a3, object a4);
155 object call (const char* fun, array<object> a);
156 object call (string fun);
157 object call (string fun, object a1);
158 object call (string fun, object a1, object a2);
159 object call (string fun, object a1, object a2, object a3);
160 object call (string fun, object a1, object a2, object a3, object a4);
161 object call (string fun, array<object> a);
162 object call (object fun);
163 object call (object fun, object a1);
164 object call (object fun, object a1, object a2);
165 object call (object fun, object a1, object a2, object a3);
166 object call (object fun, object a1, object a2, object a3, object a4);
167 object call (object fun, array<object> a);
169 #endif // defined OBJECT_H