/usr/include/uim/uim-scm.h is in libuim-dev 1:1.8.6-4ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 | /*
Copyright (c) 2003-2013 uim Project http://code.google.com/p/uim/
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of authors nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
*/
/* !!CAUTION!!
This API is designed for input method plugin and internal uim
implementation. Other developers should not use this API since the
API easily causes fatal crash involving GC if you does not pay
attention enough. Be careful.
This API is not intended to provide all R5RS features. Only 'core'
ones to write Scheme-C adapters should be added. Consider how
frequently it will be used, and whether it should be written by C,
when you add an API function.
2005-01-10 YamaKen
*/
#ifndef UIM_SCM_H
#define UIM_SCM_H
#include <stdlib.h>
#ifdef __cplusplus
extern "C" {
#endif
#define UIM_SCM_USE_DEPRECATED_API 1
#define UIM_SCM_FOR_EACH(elm, lst) \
while (uim_scm_consp(lst) \
&& ((elm) = uim_scm_car(lst), (lst) = uim_scm_cdr(lst), 1))
#ifndef UIM_BOOL_DEFINED
/*
* A boolean type for uim to explicitly indicate intention about values.
*
* *** IMPORTANT ***
*
* Do not test a value with (val == UIM_TRUE). The UIM_TRUE is only A TYPICAL
* VALUE FOR TRUE. Use (val) or (val != UIM_FALSE) instead.
*
*/
typedef int uim_bool;
#define UIM_FALSE 0
#define UIM_TRUE 1
#define UIM_BOOL_DEFINED 1
#endif /* UIM_BOOL_DEFINED */
/*
uim companion tools should treat lisp object as opaque. struct
uim_opaque exists only for type check and has no actual definition.
*/
typedef struct uim_opaque * uim_lisp;
typedef void (*uim_func_ptr)(void);
typedef void *(*uim_gc_gate_func_ptr)(void *);
/* subsystem interfaces */
/* uim_scm_init(), uim_scm_quit() and uim_scm_set_fatal_error_hook() are
* called from libuim internal. Ordinary user must not call it directly. */
void uim_scm_init(const char *system_load_path);
void uim_scm_quit(void);
uim_bool uim_scm_is_initialized(void);
void uim_scm_set_fatal_error_hook(void (*hook)(void));
void uim_scm_set_lib_path(const char *path);
/* GC protections */
void uim_scm_gc_protect(uim_lisp *location);
void uim_scm_gc_unprotect(uim_lisp *location);
void *uim_scm_call_with_gc_ready_stack(uim_gc_gate_func_ptr func, void *arg);
uim_bool uim_scm_gc_protectedp(uim_lisp obj);
uim_bool uim_scm_gc_protected_contextp(void);
/* for semantic assertions */
#define uim_scm_gc_any_contextp() \
(uim_scm_is_initialized() \
&& (!uim_scm_gc_protected_contextp() || uim_scm_gc_protected_contextp()))
/* errors: can be caught by SRFI-34 'guard' */
void uim_scm_error(const char *msg);
void uim_scm_error_obj(const char *msg, uim_lisp errobj);
#define UIM_SCM_ENSURE(cond, msg) \
((cond) || (uim_scm_error(msg), UIM_TRUE))
#define UIM_SCM_ENSURE_OBJ(cond, msg, obj) \
((cond) || (uim_scm_error_obj((msg), (obj)), UIM_TRUE))
#define UIM_SCM_ENSURE_TYPE(type, obj) \
UIM_SCM_ENSURE_OBJ(uim_scm_##type##p(obj), #type " required but got", (obj))
/* evaluations */
uim_lisp uim_scm_symbol_value (const char *symbol_str);
uim_bool uim_scm_symbol_value_bool(const char *symbol_str);
long uim_scm_symbol_value_int (const char *symbol_str);
char *uim_scm_symbol_value_str (const char *symbol_str);
uim_lisp uim_scm_eval(uim_lisp obj);
uim_lisp uim_scm_eval_c_string(const char *str);
uim_lisp uim_scm_call(uim_lisp proc, uim_lisp args);
uim_lisp uim_scm_call_with_guard(uim_lisp failed,
uim_lisp proc, uim_lisp args);
uim_lisp uim_scm_callf(const char *proc, const char *args_fmt, ...);
uim_lisp uim_scm_callf_with_guard(uim_lisp failed,
const char *proc, const char *args_fmt, ...);
uim_bool uim_scm_load_file(const char *fn);
uim_bool uim_scm_require_file(const char *fn);
/* type conversions */
long uim_scm_c_bool(uim_lisp val);
uim_lisp uim_scm_make_bool(long val);
long uim_scm_c_int(uim_lisp integer);
uim_lisp uim_scm_make_int(long integer);
long uim_scm_c_char(uim_lisp ch);
uim_lisp uim_scm_make_char(long ch);
char *uim_scm_c_str(uim_lisp str);
const char *uim_scm_refer_c_str(uim_lisp str);
uim_lisp uim_scm_make_str(const char *str);
uim_lisp uim_scm_make_str_directly(char *str);
char *uim_scm_c_symbol(uim_lisp str);
uim_lisp uim_scm_make_symbol(const char *str);
void *uim_scm_c_ptr(uim_lisp ptr);
void uim_scm_nullify_c_ptr(uim_lisp ptr);
uim_lisp uim_scm_make_ptr(void *ptr);
uim_func_ptr uim_scm_c_func_ptr(uim_lisp func_ptr);
uim_lisp uim_scm_make_func_ptr(uim_func_ptr func_ptr);
/* C array <-> Scheme list converters */
uim_lisp uim_scm_array2list(void **ary, size_t len, uim_lisp (*conv)(void *));
void **uim_scm_list2array(uim_lisp lst, size_t *len, void *(*conv)(uim_lisp));
/* C array <-> Scheme vector converters */
uim_lisp uim_scm_array2vector(void **ary, size_t len, uim_lisp (*conv)(void *));
void **uim_scm_vector2array(uim_lisp vec, size_t *len, void *(*conv)(uim_lisp));
/* procedure initializers */
void uim_scm_init_proc0(const char *name, uim_lisp (*func)(void));
void uim_scm_init_proc1(const char *name, uim_lisp (*func)(uim_lisp));
void uim_scm_init_proc2(const char *name,
uim_lisp (*func)(uim_lisp, uim_lisp));
void uim_scm_init_proc3(const char *name,
uim_lisp (*func)(uim_lisp, uim_lisp, uim_lisp));
void uim_scm_init_proc4(const char *name,
uim_lisp (*func)(uim_lisp, uim_lisp, uim_lisp,
uim_lisp));
void uim_scm_init_proc5(const char *name,
uim_lisp (*func)(uim_lisp, uim_lisp, uim_lisp,
uim_lisp, uim_lisp));
/* predicates */
uim_bool uim_scm_truep(uim_lisp obj); /* (if obj #t #f) */
uim_bool uim_scm_falsep(uim_lisp obj);
uim_bool uim_scm_nullp(uim_lisp obj);
uim_bool uim_scm_consp(uim_lisp obj);
uim_bool uim_scm_listp(uim_lisp obj); /* does not detect circular list */
uim_bool uim_scm_intp(uim_lisp obj);
uim_bool uim_scm_charp(uim_lisp obj);
uim_bool uim_scm_vectorp(uim_lisp obj);
uim_bool uim_scm_strp(uim_lisp obj);
uim_bool uim_scm_symbolp(uim_lisp obj);
uim_bool uim_scm_ptrp(uim_lisp obj);
uim_bool uim_scm_func_ptrp(uim_lisp obj);
uim_bool uim_scm_eq(uim_lisp a, uim_lisp b);
/* constants */
uim_lisp uim_scm_t(void);
uim_lisp uim_scm_f(void);
uim_lisp uim_scm_null(void);
uim_lisp uim_scm_eof(void);
/* list constructors */
uim_lisp uim_scm_quote(uim_lisp obj);
uim_lisp uim_scm_list1(uim_lisp elm1);
uim_lisp uim_scm_list2(uim_lisp elm1, uim_lisp elm2);
uim_lisp uim_scm_list3(uim_lisp elm1, uim_lisp elm2, uim_lisp elm3);
uim_lisp uim_scm_list4(uim_lisp elm1, uim_lisp elm2, uim_lisp elm3,
uim_lisp elm4);
uim_lisp uim_scm_list5(uim_lisp elm1, uim_lisp elm2, uim_lisp elm3,
uim_lisp elm4, uim_lisp elm5);
/* list operations */
uim_lisp uim_scm_cons(uim_lisp car, uim_lisp cdr);
uim_lisp uim_scm_car(uim_lisp pair);
uim_lisp uim_scm_cdr(uim_lisp pair);
void uim_scm_set_car(uim_lisp pair, uim_lisp car);
void uim_scm_set_cdr(uim_lisp pair, uim_lisp cdr);
long uim_scm_length(uim_lisp lst);
/* vector operations */
uim_lisp uim_scm_vector_ref(uim_lisp vec, long i);
void uim_scm_vector_set(uim_lisp vec, long i, uim_lisp elm);
long uim_scm_vector_length(uim_lisp vec);
#if UIM_SCM_USE_DEPRECATED_API
/* deprecated: replace with uim_scm_falsep() and uim_scm_truep(), or
* FALSEP() and TRUEP() in uim-scm-abbrev.h */
#define UIM_SCM_FALSEP(x) (uim_scm_falsep(x))
#define UIM_SCM_NFALSEP(x) (uim_scm_truep(x))
#define uim_scm_integerp uim_scm_intp
#define uim_scm_stringp uim_scm_strp
#define uim_scm_null_list uim_scm_null
#define uim_scm_init_subr_0 uim_scm_init_proc0
#define uim_scm_init_subr_1 uim_scm_init_proc1
#define uim_scm_init_subr_2 uim_scm_init_proc2
#define uim_scm_init_subr_3 uim_scm_init_proc3
#define uim_scm_init_subr_4 uim_scm_init_proc4
#define uim_scm_init_subr_5 uim_scm_init_proc5
#endif /* UIM_SCM_USE_DEPRECATED_API */
#ifdef __cplusplus
}
#endif
#endif
|