~ubuntu-branches/ubuntu/hardy/uim/hardy

« back to all changes in this revision

Viewing changes to uim/uim-scm.h

  • Committer: Bazaar Package Importer
  • Author(s): Masahito Omote
  • Date: 2007-04-21 03:46:09 UTC
  • mfrom: (1.1.6 upstream)
  • Revision ID: james.westby@ubuntu.com-20070421034609-gpcurkutp8vaysqj
Tags: 1:1.4.1-3
* Switch to dh_gtkmodules for the gtk 2.10 transition (Closes:
  #419318)
  - debian/control: Add ${misc:Depends} and remove libgtk2.0-bin on
    uim-gtk2.0.
  - debian/uim-gtk2.0.post{inst,rm}: Removed.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
2
 
3
 
  Copyright (c) 2003-2006 uim Project http://uim.freedesktop.org/
 
3
  Copyright (c) 2003-2007 uim Project http://uim.freedesktop.org/
4
4
 
5
5
  All rights reserved.
6
6
 
67
67
*/
68
68
typedef struct uim_opaque * uim_lisp;
69
69
typedef void (*uim_func_ptr)(void);
 
70
typedef void *(*uim_gc_gate_func_ptr)(void *);
70
71
 
71
72
#define UIM_SCM_FALSEP(x)  (uim_scm_eq((x), uim_scm_f()))
72
73
#define UIM_SCM_NFALSEP(x) (!uim_scm_eq((x), uim_scm_f()))
109
110
uim_scm_set_lib_path(const char *path);
110
111
 
111
112
#if UIM_SCM_GCC4_READY_GC
112
 
#ifdef __GNUC__
113
 
#define UIM_SCM_NOINLINE __attribute__((__noinline__))
114
 
#else
115
 
#define UIM_SCM_NOINLINE
116
 
#endif /* __GNUC__ */
117
 
 
118
 
/*
119
 
 * Function caller with protecting lisp objects on stack from GC
120
 
 *
121
 
 * The protection is safe against with variable reordering on a stack
122
 
 * frame performed in some compilers as anti-stack smashing or
123
 
 * optimization.
124
 
 */
125
 
#define UIM_SCM_GC_PROTECTED_CALL(ret, ret_type, func, args)                 \
126
 
    UIM_SCM_GC_PROTECTED_CALL_INTERNAL(ret = , ret_type, func, args)
127
 
 
128
 
#define UIM_SCM_GC_PROTECTED_CALL_VOID(func, args)                           \
129
 
    UIM_SCM_GC_PROTECTED_CALL_INTERNAL((void), void, func, args)
130
 
 
131
 
#define UIM_SCM_GC_PROTECTED_CALL_INTERNAL(exp_ret, ret_type, func, args)    \
132
 
    do {                                                                     \
133
 
        /* ensure that func is uninlined */                                  \
134
 
        ret_type (*volatile fp)() = (ret_type (*)())&func;                   \
135
 
        uim_lisp *stack_start;                                               \
136
 
                                                                             \
137
 
        if (0) exp_ret func args;  /* compile-time type check */             \
138
 
        stack_start = uim_scm_gc_current_stack();                            \
139
 
        uim_scm_gc_protect_stack(stack_start);                               \
140
 
        exp_ret (*fp)args;                                                   \
141
 
        uim_scm_gc_unprotect_stack(stack_start);                             \
142
 
    } while (/* CONSTCOND */ 0)
143
 
 
144
 
/*
145
 
 * Ordinary programs should not call these functions directly. Use
146
 
 * UIM_SCM_GC_PROTECTED_CALL*() instead.
147
 
 */
148
 
#ifdef __GNUC__
149
 
#define uim_scm_gc_current_stack uim_scm_gc_current_stack_internal
150
 
#define uim_scm_gc_protect_stack uim_scm_gc_protect_stack_internal
151
 
#else /* __GNUC__ */
152
 
#define uim_scm_gc_current_stack (*uim_scm_gc_current_stack_ptr)
153
 
#define uim_scm_gc_protect_stack (*uim_scm_gc_protect_stack_ptr)
154
 
#endif /* __GNUC__ */
155
113
void
156
114
uim_scm_gc_protect(uim_lisp *location);
157
115
void
158
 
uim_scm_gc_unprotect_stack(uim_lisp *stack_start);
159
 
 
160
 
uim_lisp *
161
 
uim_scm_gc_current_stack_internal(void) UIM_SCM_NOINLINE;
162
 
uim_lisp *
163
 
uim_scm_gc_protect_stack_internal(uim_lisp *stack_start) UIM_SCM_NOINLINE;
 
116
uim_scm_gc_unprotect(uim_lisp *location);
 
117
void *
 
118
uim_scm_call_with_gc_ready_stack(uim_gc_gate_func_ptr func, void *arg);
164
119
#else /* UIM_SCM_GCC4_READY_GC */
165
120
void
166
121
uim_scm_gc_protect(uim_lisp *location);
179
134
uim_scm_eval(uim_lisp obj);
180
135
uim_lisp
181
136
uim_scm_eval_c_string(const char *str);
 
137
/* uim_scm_return_value() should only used to retrieve result of
 
138
 * UIM_EVAL_FSTRINGn() or UIM_EVAL_STRING(). */
182
139
uim_lisp
183
140
uim_scm_return_value(void);
184
141
/*
260
217
uim_lisp
261
218
uim_scm_cons(uim_lisp car, uim_lisp cdr);
262
219
uim_lisp
263
 
uim_scm_car(uim_lisp cell);
264
 
uim_lisp
265
 
uim_scm_cdr(uim_lisp cell);
266
 
uim_lisp
267
 
uim_scm_cadr(uim_lisp cell);
268
 
uim_lisp
269
 
uim_scm_caar(uim_lisp cell);
270
 
uim_lisp
271
 
uim_scm_cdar(uim_lisp cell);
272
 
uim_lisp
273
 
uim_scm_cddr(uim_lisp cell);
274
 
uim_lisp
275
 
uim_scm_length(uim_lisp list);
276
 
uim_lisp
277
 
uim_scm_reverse(uim_lisp cell);
 
220
uim_scm_car(uim_lisp pair);
 
221
uim_lisp
 
222
uim_scm_cdr(uim_lisp pair);
 
223
uim_lisp
 
224
uim_scm_cadr(uim_lisp lst);
 
225
uim_lisp
 
226
uim_scm_caar(uim_lisp lst);
 
227
uim_lisp
 
228
uim_scm_cdar(uim_lisp lst);
 
229
uim_lisp
 
230
uim_scm_cddr(uim_lisp lst);
 
231
uim_lisp
 
232
uim_scm_length(uim_lisp lst);
 
233
uim_lisp
 
234
uim_scm_reverse(uim_lisp lst);
 
235
 
278
236
 
279
237
#ifdef __cplusplus
280
238
}