/tags/rel-1.3.32/Lib/allegrocl/allegrocl.swg

# · Unknown · 543 lines · 465 code · 78 blank · 0 comment · 0 complexity · 2b00eb55372f17421c3bd4183ceb5453 MD5 · raw file

  1. /* Define a C preprocessor symbol that can be used in interface files
  2. to distinguish between the SWIG language modules. */
  3. #define SWIG_ALLEGRO_CL
  4. #define %ffargs(...) %feature("ffargs", "1", ##__VA_ARGS__)
  5. %ffargs(strings_convert="t");
  6. /* typemaps for argument and result type conversions. */
  7. %typemap(lin,numinputs=1) SWIGTYPE "(cl::let (($out $in))\n $body)";
  8. %typemap(lout) bool, char, unsigned char, signed char,
  9. short, signed short, unsigned short,
  10. int, signed int, unsigned int,
  11. long, signed long, unsigned long,
  12. float, double, long double, char *, void *,
  13. enum SWIGTYPE "(cl::setq ACL_ffresult $body)";
  14. %typemap(lout) void "$body";
  15. %typemap(lout) SWIGTYPE[ANY], SWIGTYPE *,
  16. SWIGTYPE &
  17. %{ (cl:let* ((address $body)
  18. (new-inst (cl:make-instance '$lclass :foreign-address address)))
  19. (cl:when (cl:and $owner (cl:not (cl:zerop address)))
  20. (excl:schedule-finalization new-inst #'$ldestructor))
  21. (cl:setq ACL_ffresult new-inst)) %}
  22. %typemap(lout) SWIGTYPE "(cl::let* ((address $body)\n (new-inst (cl::make-instance '$lclass :foreign-address address)))\n (cl::unless (cl::zerop address)\n (excl:schedule-finalization new-inst #'$ldestructor))\n (cl::setq ACL_ffresult new-inst))";
  23. %typemap(lisptype) bool "cl:boolean";
  24. %typemap(lisptype) char "cl:character";
  25. %typemap(lisptype) unsigned char "cl:integer";
  26. %typemap(lisptype) signed char "cl:integer";
  27. %typemap(ffitype) bool ":int";
  28. %typemap(ffitype) char ":char";
  29. %typemap(ffitype) unsigned char ":unsigned-char";
  30. %typemap(ffitype) signed char ":char";
  31. %typemap(ffitype) short, signed short ":short";
  32. %typemap(ffitype) unsigned short ":unsigned-short";
  33. %typemap(ffitype) int, signed int ":int";
  34. %typemap(ffitype) unsigned int ":unsigned-int";
  35. %typemap(ffitype) long, signed long ":long";
  36. %typemap(ffitype) unsigned long ":unsigned-long";
  37. %typemap(ffitype) float ":float";
  38. %typemap(ffitype) double ":double";
  39. %typemap(ffitype) char * "(* :char)";
  40. %typemap(ffitype) void * "(* :void)";
  41. %typemap(ffitype) void ":void";
  42. %typemap(ffitype) enum SWIGTYPE ":int";
  43. %typemap(ffitype) SWIGTYPE & "(* :void)";
  44. %typemap(ctype) bool "int";
  45. %typemap(ctype) char, unsigned char, signed char,
  46. short, signed short, unsigned short,
  47. int, signed int, unsigned int,
  48. long, signed long, unsigned long,
  49. float, double, long double, char *, void *, void,
  50. enum SWIGTYPE, SWIGTYPE *,
  51. SWIGTYPE[ANY], SWIGTYPE & "$1_ltype";
  52. %typemap(ctype) SWIGTYPE "$&1_type";
  53. %typemap(in) bool "$1 = (bool)$input;";
  54. %typemap(in) char, unsigned char, signed char,
  55. short, signed short, unsigned short,
  56. int, signed int, unsigned int,
  57. long, signed long, unsigned long,
  58. float, double, long double, char *, void *, void,
  59. enum SWIGTYPE, SWIGTYPE *,
  60. SWIGTYPE[ANY], SWIGTYPE & "$1 = $input;";
  61. %typemap(in) SWIGTYPE "$1 = *$input;";
  62. /* We don't need to do any actual C-side typechecking, but need to
  63. use the precedence values to choose which overloaded function
  64. interfaces to generate when conflicts arise. */
  65. /* predefined precedence values
  66. Symbolic Name Precedence Value
  67. ------------------------------ ------------------
  68. SWIG_TYPECHECK_POINTER 0
  69. SWIG_TYPECHECK_VOIDPTR 10
  70. SWIG_TYPECHECK_BOOL 15
  71. SWIG_TYPECHECK_UINT8 20
  72. SWIG_TYPECHECK_INT8 25
  73. SWIG_TYPECHECK_UINT16 30
  74. SWIG_TYPECHECK_INT16 35
  75. SWIG_TYPECHECK_UINT32 40
  76. SWIG_TYPECHECK_INT32 45
  77. SWIG_TYPECHECK_UINT64 50
  78. SWIG_TYPECHECK_INT64 55
  79. SWIG_TYPECHECK_UINT128 60
  80. SWIG_TYPECHECK_INT128 65
  81. SWIG_TYPECHECK_INTEGER 70
  82. SWIG_TYPECHECK_FLOAT 80
  83. SWIG_TYPECHECK_DOUBLE 90
  84. SWIG_TYPECHECK_COMPLEX 100
  85. SWIG_TYPECHECK_UNICHAR 110
  86. SWIG_TYPECHECK_UNISTRING 120
  87. SWIG_TYPECHECK_CHAR 130
  88. SWIG_TYPECHECK_STRING 140
  89. SWIG_TYPECHECK_BOOL_ARRAY 1015
  90. SWIG_TYPECHECK_INT8_ARRAY 1025
  91. SWIG_TYPECHECK_INT16_ARRAY 1035
  92. SWIG_TYPECHECK_INT32_ARRAY 1045
  93. SWIG_TYPECHECK_INT64_ARRAY 1055
  94. SWIG_TYPECHECK_INT128_ARRAY 1065
  95. SWIG_TYPECHECK_FLOAT_ARRAY 1080
  96. SWIG_TYPECHECK_DOUBLE_ARRAY 1090
  97. SWIG_TYPECHECK_CHAR_ARRAY 1130
  98. SWIG_TYPECHECK_STRING_ARRAY 1140
  99. */
  100. %typecheck(SWIG_TYPECHECK_BOOL) bool { $1 = 1; };
  101. %typecheck(SWIG_TYPECHECK_CHAR) char { $1 = 1; };
  102. %typecheck(SWIG_TYPECHECK_FLOAT) float { $1 = 1; };
  103. %typecheck(SWIG_TYPECHECK_DOUBLE) double { $1 = 1; };
  104. %typecheck(SWIG_TYPECHECK_STRING) char * { $1 = 1; };
  105. %typecheck(SWIG_TYPECHECK_INTEGER)
  106. unsigned char, signed char,
  107. short, signed short, unsigned short,
  108. int, signed int, unsigned int,
  109. long, signed long, unsigned long,
  110. enum SWIGTYPE { $1 = 1; };
  111. %typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE *, SWIGTYPE &,
  112. SWIGTYPE[ANY], SWIGTYPE { $1 = 1; };
  113. /* This maps C/C++ types to Lisp classes for overload dispatch */
  114. %typemap(lispclass) bool "t";
  115. %typemap(lispclass) char "cl:character";
  116. %typemap(lispclass) unsigned char, signed char,
  117. short, signed short, unsigned short,
  118. int, signed int, unsigned int,
  119. long, signed long, unsigned long,
  120. enum SWIGTYPE "cl:integer";
  121. %typemap(lispclass) float "cl:single-float";
  122. %typemap(lispclass) double "cl:double-float";
  123. %typemap(lispclass) char * "cl:string";
  124. %typemap(out) bool "$result = (int)$1;";
  125. %typemap(out) char, unsigned char, signed char,
  126. short, signed short, unsigned short,
  127. int, signed int, unsigned int,
  128. long, signed long, unsigned long,
  129. float, double, long double, char *, void *, void,
  130. enum SWIGTYPE, SWIGTYPE *,
  131. SWIGTYPE[ANY], SWIGTYPE & "$result = $1;";
  132. #ifdef __cplusplus
  133. %typemap(out) SWIGTYPE "$result = new $1_type($1);";
  134. #else
  135. %typemap(out) SWIGTYPE {
  136. $result = ($&1_ltype) malloc(sizeof($1_type));
  137. memmove($result, &$1, sizeof($1_type));
  138. }
  139. #endif
  140. //////////////////////////////////////////////////////////////
  141. // UCS-2 string conversion
  142. // should this be SWIG_TYPECHECK_CHAR?
  143. %typecheck(SWIG_TYPECHECK_UNICHAR) wchar_t { $1 = 1; };
  144. %typemap(in) wchar_t "$1 = $input;";
  145. %typemap(lin,numinputs=1) wchar_t "(cl::let (($out (cl:char-code $in)))\n $body)";
  146. %typemap(lin,numinputs=1) wchar_t* "(excl:with-native-string ($out $in
  147. :external-format #+little-endian :fat-le #-little-endian :fat)\n
  148. $body)"
  149. %typemap(out) wchar_t "$result = $1;";
  150. %typemap(lout) wchar_t "(cl::setq ACL_ffresult (cl::code-char $body))";
  151. %typemap(lout) wchar_t* "(cl::setq ACL_ffresult (excl:native-to-string $body
  152. :external-format #+little-endian :fat-le #-little-endian :fat))";
  153. %typemap(ffitype) wchar_t ":unsigned-short";
  154. %typemap(lisptype) wchar_t "";
  155. %typemap(ctype) wchar_t "wchar_t";
  156. %typemap(lispclass) wchar_t "cl:character";
  157. %typemap(lispclass) wchar_t* "cl:string";
  158. //////////////////////////////////////////////////////////////
  159. /* name conversion for overloaded operators. */
  160. #ifdef __cplusplus
  161. %rename(__add__) *::operator+;
  162. %rename(__pos__) *::operator+();
  163. %rename(__pos__) *::operator+() const;
  164. %rename(__sub__) *::operator-;
  165. %rename(__neg__) *::operator-() const;
  166. %rename(__neg__) *::operator-();
  167. %rename(__mul__) *::operator*;
  168. %rename(__deref__) *::operator*();
  169. %rename(__deref__) *::operator*() const;
  170. %rename(__div__) *::operator/;
  171. %rename(__mod__) *::operator%;
  172. %rename(__logxor__) *::operator^;
  173. %rename(__logand__) *::operator&;
  174. %rename(__logior__) *::operator|;
  175. %rename(__lognot__) *::operator~();
  176. %rename(__lognot__) *::operator~() const;
  177. %rename(__not__) *::operator!();
  178. %rename(__not__) *::operator!() const;
  179. %rename(__assign__) *::operator=;
  180. %rename(__add_assign__) *::operator+=;
  181. %rename(__sub_assign__) *::operator-=;
  182. %rename(__mul_assign__) *::operator*=;
  183. %rename(__div_assign__) *::operator/=;
  184. %rename(__mod_assign__) *::operator%=;
  185. %rename(__logxor_assign__) *::operator^=;
  186. %rename(__logand_assign__) *::operator&=;
  187. %rename(__logior_assign__) *::operator|=;
  188. %rename(__lshift__) *::operator<<;
  189. %rename(__lshift_assign__) *::operator<<=;
  190. %rename(__rshift__) *::operator>>;
  191. %rename(__rshift_assign__) *::operator>>=;
  192. %rename(__eq__) *::operator==;
  193. %rename(__ne__) *::operator!=;
  194. %rename(__lt__) *::operator<;
  195. %rename(__gt__) *::operator>;
  196. %rename(__lte__) *::operator<=;
  197. %rename(__gte__) *::operator>=;
  198. %rename(__and__) *::operator&&;
  199. %rename(__or__) *::operator||;
  200. %rename(__preincr__) *::operator++();
  201. %rename(__postincr__) *::operator++(int);
  202. %rename(__predecr__) *::operator--();
  203. %rename(__postdecr__) *::operator--(int);
  204. %rename(__comma__) *::operator,();
  205. %rename(__comma__) *::operator,() const;
  206. %rename(__member_ref__) *::operator->;
  207. %rename(__member_func_ref__) *::operator->*;
  208. %rename(__funcall__) *::operator();
  209. %rename(__aref__) *::operator[];
  210. #endif
  211. %insert("lisphead") %{
  212. ;; $Id: allegrocl.swg 9901 2007-08-16 18:39:50Z mutandiz $
  213. (eval-when (compile load eval)
  214. ;; avoid compiling ef-templates at runtime
  215. (excl:find-external-format :fat)
  216. (excl:find-external-format :fat-le)
  217. ;;; You can define your own identifier converter if you want.
  218. ;;; Use the -identifier-converter command line argument to
  219. ;;; specify its name.
  220. (eval-when (:compile-toplevel :load-toplevel :execute)
  221. (cl::defparameter *swig-export-list* nil))
  222. (cl::defconstant *void* :..void..)
  223. ;; parsers to aid in finding SWIG definitions in files.
  224. (cl::defun scm-p1 (form)
  225. (let* ((info (cl::second form))
  226. (id (car info))
  227. (id-args (if (eq (cl::car form) 'swig-dispatcher)
  228. (cl::cdr info)
  229. (cl::cddr info))))
  230. (cl::apply *swig-identifier-converter* id
  231. (cl::progn (cl::when (cl::eq (cl::car form) 'swig-dispatcher)
  232. (cl::remf id-args :arities))
  233. id-args))))
  234. (cl::defmacro defswig1 (name (&rest args) &body body)
  235. `(cl::progn (cl::defmacro ,name ,args
  236. ,@body)
  237. (excl::define-simple-parser ,name scm-p1)) )
  238. (cl::defmacro defswig2 (name (&rest args) &body body)
  239. `(cl::progn (cl::defmacro ,name ,args
  240. ,@body)
  241. (excl::define-simple-parser ,name second)))
  242. (defun read-symbol-from-string (string)
  243. (cl::multiple-value-bind (result position)
  244. (cl::read-from-string string nil "eof" :preserve-whitespace t)
  245. (cl::if (cl::and (cl::symbolp result)
  246. (cl::eql position (cl::length string)))
  247. result
  248. (cl::multiple-value-bind (sym)
  249. (cl::intern string)
  250. sym))))
  251. (cl::defun full-name (id type arity class)
  252. (cl::case type
  253. (:getter (cl::format nil "~@[~A_~]~A" class id))
  254. (:constructor (cl::format nil "new_~A~@[~A~]" id arity))
  255. (:destructor (cl::format nil "delete_~A" id))
  256. (:type (cl::format nil "ff_~A" id))
  257. (:slot id)
  258. (:ff-operator (cl::format nil "ffi_~A" id))
  259. (otherwise (cl::format nil "~@[~A_~]~A~@[~A~]"
  260. class id arity))))
  261. (cl::defun identifier-convert-null (id &key type class arity)
  262. (cl::if (cl::eq type :setter)
  263. `(cl::setf ,(identifier-convert-null
  264. id :type :getter :class class :arity arity))
  265. (read-symbol-from-string (full-name id type arity class))))
  266. (cl::defun identifier-convert-lispify (cname &key type class arity)
  267. (cl::assert (cl::stringp cname))
  268. (cl::when (cl::eq type :setter)
  269. (cl::return-from identifier-convert-lispify
  270. `(cl::setf ,(identifier-convert-lispify
  271. cname :type :getter :class class :arity arity))))
  272. (cl::setq cname (full-name cname type arity class))
  273. (cl::if (cl::eq type :constant)
  274. (cl::setf cname (cl::format nil "*~A*" cname)))
  275. (cl::setf cname (excl::replace-regexp cname "_" "-"))
  276. (cl::let ((lastcase :other)
  277. newcase char res)
  278. (cl::dotimes (n (cl::length cname))
  279. (cl::setf char (cl::schar cname n))
  280. (excl::if* (cl::alpha-char-p char)
  281. then
  282. (cl::setf newcase (cl::if (cl::upper-case-p char) :upper :lower))
  283. (cl::when (cl::or (cl::and (cl::eq lastcase :upper)
  284. (cl::eq newcase :lower))
  285. (cl::and (cl::eq lastcase :lower)
  286. (cl::eq newcase :upper)))
  287. ;; case change... add a dash
  288. (cl::push #\- res)
  289. (cl::setf newcase :other))
  290. (cl::push (cl::char-downcase char) res)
  291. (cl::setf lastcase newcase)
  292. else
  293. (cl::push char res)
  294. (cl::setf lastcase :other)))
  295. (read-symbol-from-string (cl::coerce (cl::nreverse res) 'string))))
  296. (cl::defun id-convert-and-export (name &rest kwargs)
  297. (cl::multiple-value-bind (symbol package)
  298. (cl::apply *swig-identifier-converter* name kwargs)
  299. (cl::let ((args (cl::list (cl::if (cl::consp symbol)
  300. (cl::cadr symbol) symbol)
  301. (cl::or package cl::*package*))))
  302. (cl::apply #'cl::export args)
  303. (cl::pushnew args *swig-export-list*))
  304. symbol))
  305. (cl::defmacro swig-insert-id (name namespace &key (type :type) class)
  306. `(cl::let ((cl::*package* (cl::find-package ,(package-name-for-namespace namespace))))
  307. (id-convert-and-export ,name :type ,type :class ,class)))
  308. (defswig2 swig-defconstant (string value)
  309. (cl::let ((symbol (id-convert-and-export string :type :constant)))
  310. `(cl::eval-when (compile load eval)
  311. (cl::defconstant ,symbol ,value))))
  312. (cl::defun maybe-reorder-args (funcname arglist)
  313. ;; in the foreign setter function the new value will be the last argument
  314. ;; in Lisp it needs to be the first
  315. (cl::if (cl::consp funcname)
  316. (cl::append (cl::last arglist) (cl::butlast arglist))
  317. arglist))
  318. (cl::defun maybe-return-value (funcname arglist)
  319. ;; setf functions should return the new value
  320. (cl::when (cl::consp funcname)
  321. `(,(cl::if (cl::consp (cl::car arglist))
  322. (cl::caar arglist)
  323. (cl::car arglist)))))
  324. (cl::defun swig-anyvarargs-p (arglist)
  325. (cl::member :SWIG__varargs_ arglist))
  326. (defswig1 swig-defun ((name &optional (mangled-name name)
  327. &key (type :operator) class arity)
  328. arglist kwargs
  329. &body body)
  330. (cl::let* ((symbol (id-convert-and-export name :type type
  331. :arity arity :class class))
  332. (mangle (excl::if* (cl::string-equal name mangled-name)
  333. then (id-convert-and-export
  334. (cl::cond
  335. ((cl::eq type :setter) (cl::format nil "~A-set" name))
  336. ((cl::eq type :getter) (cl::format nil "~A-get" name))
  337. (t name))
  338. :type :ff-operator :arity arity :class class)
  339. else (cl::intern mangled-name)))
  340. (defun-args (maybe-reorder-args
  341. symbol
  342. (cl::mapcar #'cl::car (cl::and (cl::not (cl::equal arglist '(:void)))
  343. (cl::loop as i in arglist
  344. when (cl::eq (cl::car i) :p+)
  345. collect (cl::cdr i))))))
  346. (ffargs (cl::if (cl::equal arglist '(:void))
  347. arglist
  348. (cl::mapcar #'cl::cdr arglist)))
  349. )
  350. (cl::when (swig-anyvarargs-p ffargs)
  351. (cl::setq ffargs '()))
  352. `(cl::eval-when (compile load eval)
  353. (excl::compiler-let ((*record-xref-info* nil))
  354. (ff:def-foreign-call (,mangle ,mangled-name) ,ffargs ,@kwargs))
  355. (cl::macrolet ((swig-ff-call (&rest args)
  356. (cl::cons ',mangle args)))
  357. (cl::defun ,symbol ,defun-args
  358. ,@body
  359. ,@(maybe-return-value symbol defun-args))))))
  360. (defswig1 swig-defmethod ((name &optional (mangled-name name)
  361. &key (type :operator) class arity)
  362. ffargs kwargs
  363. &body body)
  364. (cl::let* ((symbol (id-convert-and-export name :type type
  365. :arity arity :class class))
  366. (mangle (cl::intern mangled-name))
  367. (defmethod-args (maybe-reorder-args
  368. symbol
  369. (cl::unless (cl::equal ffargs '(:void))
  370. (cl::loop for (lisparg name dispatch) in ffargs
  371. when (eq lisparg :p+)
  372. collect `(,name ,dispatch)))))
  373. (ffargs (cl::if (cl::equal ffargs '(:void))
  374. ffargs
  375. (cl::loop for (nil name nil . ffi) in ffargs
  376. collect `(,name ,@ffi)))))
  377. `(cl::eval-when (compile load eval)
  378. (excl::compiler-let ((*record-xref-info* nil))
  379. (ff:def-foreign-call (,mangle ,mangled-name) ,ffargs ,@kwargs))
  380. (cl::macrolet ((swig-ff-call (&rest args)
  381. (cl::cons ',mangle args)))
  382. (cl::defmethod ,symbol ,defmethod-args
  383. ,@body
  384. ,@(maybe-return-value symbol defmethod-args))))))
  385. (defswig1 swig-dispatcher ((name &key (type :operator) class arities))
  386. (cl::let ((symbol (id-convert-and-export name
  387. :type type :class class)))
  388. `(cl::eval-when (compile load eval)
  389. (cl::defun ,symbol (&rest args)
  390. (cl::case (cl::length args)
  391. ,@(cl::loop for arity in arities
  392. for symbol-n = (id-convert-and-export name
  393. :type type :class class :arity arity)
  394. collect `(,arity (cl::apply #',symbol-n args)))
  395. (t (cl::error "No applicable wrapper-methods for foreign call ~a with args ~a of classes ~a" ',symbol args (cl::mapcar #'(cl::lambda (x) (cl::class-name (cl::class-of x))) args)))
  396. )))))
  397. (defswig2 swig-def-foreign-stub (name)
  398. (cl::let ((lsymbol (id-convert-and-export name :type :class))
  399. (symbol (id-convert-and-export name :type :type)))
  400. `(cl::eval-when (compile load eval)
  401. (ff:def-foreign-type ,symbol (:class ))
  402. (cl::defclass ,lsymbol (ff:foreign-pointer) ()))))
  403. (defswig2 swig-def-foreign-class (name supers &rest rest)
  404. (cl::let ((lsymbol (id-convert-and-export name :type :class))
  405. (symbol (id-convert-and-export name :type :type)))
  406. `(cl::eval-when (compile load eval)
  407. (ff:def-foreign-type ,symbol ,@rest)
  408. (cl::defclass ,lsymbol ,supers
  409. ((foreign-type :initform ',symbol :initarg :foreign-type
  410. :accessor foreign-pointer-type))))))
  411. (defswig2 swig-def-foreign-type (name &rest rest)
  412. (cl::let ((symbol (id-convert-and-export name :type :type)))
  413. `(cl::eval-when (compile load eval)
  414. (ff:def-foreign-type ,symbol ,@rest))))
  415. (defswig2 swig-def-synonym-type (synonym of ff-synonym)
  416. `(cl::eval-when (compile load eval)
  417. (cl::setf (cl::find-class ',synonym) (cl::find-class ',of))
  418. (ff:def-foreign-type ,ff-synonym (:struct ))))
  419. (cl::defun package-name-for-namespace (namespace)
  420. (excl::list-to-delimited-string
  421. (cl::cons *swig-module-name*
  422. (cl::mapcar #'(cl::lambda (name)
  423. (cl::string
  424. (cl::funcall *swig-identifier-converter*
  425. name
  426. :type :namespace)))
  427. namespace))
  428. "."))
  429. (cl::defmacro swig-defpackage (namespace)
  430. (cl::let* ((parent-namespaces (cl::maplist #'cl::reverse (cl::cdr (cl::reverse namespace))))
  431. (parent-strings (cl::mapcar #'package-name-for-namespace
  432. parent-namespaces))
  433. (string (package-name-for-namespace namespace)))
  434. `(cl::eval-when (compile load eval)
  435. (cl::defpackage ,string
  436. (:use :swig :ff #+ignore '(:common-lisp :ff :excl)
  437. ,@parent-strings ,*swig-module-name*)
  438. (:import-from :cl :* :nil :t)))))
  439. (cl::defmacro swig-in-package (namespace)
  440. `(cl::eval-when (compile load eval)
  441. (cl::in-package ,(package-name-for-namespace namespace))))
  442. (defswig2 swig-defvar (name mangled-name &key type (ftype :unsigned-natural))
  443. (cl::let ((symbol (id-convert-and-export name :type type)))
  444. `(cl::eval-when (compile load eval)
  445. (ff:def-foreign-variable (,symbol ,mangled-name) :type ,ftype))))
  446. ) ;; eval-when
  447. (cl::eval-when (compile eval)
  448. (cl::flet ((starts-with-p (str prefix)
  449. (cl::and (cl::>= (cl::length str) (cl::length prefix))
  450. (cl::string= str prefix :end1 (cl::length prefix)))))
  451. (cl::export (cl::loop for sym being each present-symbol of cl::*package*
  452. when (cl::or (starts-with-p (cl::symbol-name sym) (cl::symbol-name :swig-))
  453. (starts-with-p (cl::symbol-name sym) (cl::symbol-name :identifier-convert-)))
  454. collect sym))))
  455. %}
  456. %{
  457. #ifdef __cplusplus
  458. # define EXTERN extern "C"
  459. #else
  460. # define EXTERN extern
  461. #endif
  462. #define EXPORT EXTERN SWIGEXPORT
  463. #include <string.h>
  464. #include <stdlib.h>
  465. %}