Team Fortress 2 Source Code as on 22/4/2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1351 lines
59 KiB

  1. /* -----------------------------------------------------------------------------
  2. * See the LICENSE file for information on copyright, usage and redistribution
  3. * of SWIG, and the README file for authors - http://www.swig.org/release.html.
  4. *
  5. * std_map.i
  6. *
  7. * SWIG typemaps for std::map
  8. * ----------------------------------------------------------------------------- */
  9. %include <std_common.i>
  10. // ------------------------------------------------------------------------
  11. // std::map
  12. //
  13. // The aim of all that follows would be to integrate std::map with
  14. // Guile as much as possible, namely, to allow the user to pass and
  15. // be returned Scheme association lists.
  16. // const declarations are used to guess the intent of the function being
  17. // exported; therefore, the following rationale is applied:
  18. //
  19. // -- f(std::map<T>), f(const std::map<T>&), f(const std::map<T>*):
  20. // the parameter being read-only, either a Scheme alist or a
  21. // previously wrapped std::map<T> can be passed.
  22. // -- f(std::map<T>&), f(std::map<T>*):
  23. // the parameter must be modified; therefore, only a wrapped std::map
  24. // can be passed.
  25. // -- std::map<T> f():
  26. // the map is returned by copy; therefore, a Scheme alist
  27. // is returned which is most easily used in other Scheme functions
  28. // -- std::map<T>& f(), std::map<T>* f(), const std::map<T>& f(),
  29. // const std::map<T>* f():
  30. // the map is returned by reference; therefore, a wrapped std::map
  31. // is returned
  32. // ------------------------------------------------------------------------
  33. %{
  34. #include <map>
  35. #include <algorithm>
  36. #include <stdexcept>
  37. %}
  38. // exported class
  39. namespace std {
  40. template<class K, class T> class map {
  41. %typemap(in) map<K,T> (std::map<K,T>* m) {
  42. if (gh_null_p($input)) {
  43. $1 = std::map<K,T >();
  44. } else if (gh_pair_p($input)) {
  45. $1 = std::map<K,T >();
  46. SCM alist = $input;
  47. while (!gh_null_p(alist)) {
  48. K* k;
  49. T* x;
  50. SCM entry, key, val;
  51. entry = gh_car(alist);
  52. if (!gh_pair_p(entry))
  53. SWIG_exception(SWIG_TypeError,"alist expected");
  54. key = gh_car(entry);
  55. val = gh_cdr(entry);
  56. k = (K*) SWIG_MustGetPtr(key,$descriptor(K *),$argnum, 0);
  57. if (SWIG_ConvertPtr(val,(void**) &x,
  58. $descriptor(T *), 0) != 0) {
  59. if (!gh_pair_p(val))
  60. SWIG_exception(SWIG_TypeError,"alist expected");
  61. val = gh_car(val);
  62. x = (T*) SWIG_MustGetPtr(val,$descriptor(T *),$argnum, 0);
  63. }
  64. (($1_type &)$1)[*k] = *x;
  65. alist = gh_cdr(alist);
  66. }
  67. } else {
  68. $1 = *(($&1_type)
  69. SWIG_MustGetPtr($input,$&1_descriptor,$argnum, 0));
  70. }
  71. }
  72. %typemap(in) const map<K,T>& (std::map<K,T> temp,
  73. std::map<K,T>* m),
  74. const map<K,T>* (std::map<K,T> temp,
  75. std::map<K,T>* m) {
  76. if (gh_null_p($input)) {
  77. temp = std::map<K,T >();
  78. $1 = &temp;
  79. } else if (gh_pair_p($input)) {
  80. temp = std::map<K,T >();
  81. $1 = &temp;
  82. SCM alist = $input;
  83. while (!gh_null_p(alist)) {
  84. K* k;
  85. T* x;
  86. SCM entry, key, val;
  87. entry = gh_car(alist);
  88. if (!gh_pair_p(entry))
  89. SWIG_exception(SWIG_TypeError,"alist expected");
  90. key = gh_car(entry);
  91. val = gh_cdr(entry);
  92. k = (K*) SWIG_MustGetPtr(key,$descriptor(K *),$argnum, 0);
  93. if (SWIG_ConvertPtr(val,(void**) &x,
  94. $descriptor(T *), 0) != 0) {
  95. if (!gh_pair_p(val))
  96. SWIG_exception(SWIG_TypeError,"alist expected");
  97. val = gh_car(val);
  98. x = (T*) SWIG_MustGetPtr(val,$descriptor(T *),$argnum, 0);
  99. }
  100. temp[*k] = *x;
  101. alist = gh_cdr(alist);
  102. }
  103. } else {
  104. $1 = ($1_ltype) SWIG_MustGetPtr($input,$1_descriptor,$argnum, 0);
  105. }
  106. }
  107. %typemap(out) map<K,T> {
  108. SCM alist = SCM_EOL;
  109. for (std::map<K,T >::reverse_iterator i=$1.rbegin();
  110. i!=$1.rend(); ++i) {
  111. K* key = new K(i->first);
  112. T* val = new T(i->second);
  113. SCM k = SWIG_NewPointerObj(key,$descriptor(K *), 1);
  114. SCM x = SWIG_NewPointerObj(val,$descriptor(T *), 1);
  115. SCM entry = gh_cons(k,x);
  116. alist = gh_cons(entry,alist);
  117. }
  118. $result = alist;
  119. }
  120. %typecheck(SWIG_TYPECHECK_MAP) map<K,T> {
  121. /* native sequence? */
  122. if (gh_null_p($input)) {
  123. /* an empty sequence can be of any type */
  124. $1 = 1;
  125. } else if (gh_pair_p($input)) {
  126. /* check the first element only */
  127. K* k;
  128. T* x;
  129. SCM head = gh_car($input);
  130. if (gh_pair_p(head)) {
  131. SCM key = gh_car(head);
  132. SCM val = gh_cdr(head);
  133. if (SWIG_ConvertPtr(key,(void**) &k,
  134. $descriptor(K *), 0) != 0) {
  135. $1 = 0;
  136. } else {
  137. if (SWIG_ConvertPtr(val,(void**) &x,
  138. $descriptor(T *), 0) == 0) {
  139. $1 = 1;
  140. } else if (gh_pair_p(val)) {
  141. val = gh_car(val);
  142. if (SWIG_ConvertPtr(val,(void**) &x,
  143. $descriptor(T *), 0) == 0)
  144. $1 = 1;
  145. else
  146. $1 = 0;
  147. } else {
  148. $1 = 0;
  149. }
  150. }
  151. } else {
  152. $1 = 0;
  153. }
  154. } else {
  155. /* wrapped map? */
  156. std::map<K,T >* m;
  157. if (SWIG_ConvertPtr($input,(void **) &m,
  158. $&1_descriptor, 0) == 0)
  159. $1 = 1;
  160. else
  161. $1 = 0;
  162. }
  163. }
  164. %typecheck(SWIG_TYPECHECK_MAP) const map<K,T>&,
  165. const map<K,T>* {
  166. /* native sequence? */
  167. if (gh_null_p($input)) {
  168. /* an empty sequence can be of any type */
  169. $1 = 1;
  170. } else if (gh_pair_p($input)) {
  171. /* check the first element only */
  172. K* k;
  173. T* x;
  174. SCM head = gh_car($input);
  175. if (gh_pair_p(head)) {
  176. SCM key = gh_car(head);
  177. SCM val = gh_cdr(head);
  178. if (SWIG_ConvertPtr(key,(void**) &k,
  179. $descriptor(K *), 0) != 0) {
  180. $1 = 0;
  181. } else {
  182. if (SWIG_ConvertPtr(val,(void**) &x,
  183. $descriptor(T *), 0) == 0) {
  184. $1 = 1;
  185. } else if (gh_pair_p(val)) {
  186. val = gh_car(val);
  187. if (SWIG_ConvertPtr(val,(void**) &x,
  188. $descriptor(T *), 0) == 0)
  189. $1 = 1;
  190. else
  191. $1 = 0;
  192. } else {
  193. $1 = 0;
  194. }
  195. }
  196. } else {
  197. $1 = 0;
  198. }
  199. } else {
  200. /* wrapped map? */
  201. std::map<K,T >* m;
  202. if (SWIG_ConvertPtr($input,(void **) &m,
  203. $1_descriptor, 0) == 0)
  204. $1 = 1;
  205. else
  206. $1 = 0;
  207. }
  208. }
  209. %rename("length") size;
  210. %rename("null?") empty;
  211. %rename("clear!") clear;
  212. %rename("ref") __getitem__;
  213. %rename("set!") __setitem__;
  214. %rename("delete!") __delitem__;
  215. %rename("has-key?") has_key;
  216. public:
  217. map();
  218. map(const map<K,T> &);
  219. unsigned int size() const;
  220. bool empty() const;
  221. void clear();
  222. %extend {
  223. T& __getitem__(const K& key) throw (std::out_of_range) {
  224. std::map<K,T >::iterator i = self->find(key);
  225. if (i != self->end())
  226. return i->second;
  227. else
  228. throw std::out_of_range("key not found");
  229. }
  230. void __setitem__(const K& key, const T& x) {
  231. (*self)[key] = x;
  232. }
  233. void __delitem__(const K& key) throw (std::out_of_range) {
  234. std::map<K,T >::iterator i = self->find(key);
  235. if (i != self->end())
  236. self->erase(i);
  237. else
  238. throw std::out_of_range("key not found");
  239. }
  240. bool has_key(const K& key) {
  241. std::map<K,T >::iterator i = self->find(key);
  242. return i != self->end();
  243. }
  244. SCM keys() {
  245. SCM result = SCM_EOL;
  246. for (std::map<K,T >::reverse_iterator i=$1.rbegin();
  247. i!=$1.rend(); ++i) {
  248. K* key = new K(i->first);
  249. SCM k = SWIG_NewPointerObj(key,$descriptor(K *), 1);
  250. result = gh_cons(k,result);
  251. }
  252. return result;
  253. }
  254. }
  255. };
  256. // specializations for built-ins
  257. %define specialize_std_map_on_key(K,CHECK,CONVERT_FROM,CONVERT_TO)
  258. template<class T> class map<K,T> {
  259. %typemap(in) map<K,T> (std::map<K,T>* m) {
  260. if (gh_null_p($input)) {
  261. $1 = std::map<K,T >();
  262. } else if (gh_pair_p($input)) {
  263. $1 = std::map<K,T >();
  264. SCM alist = $input;
  265. while (!gh_null_p(alist)) {
  266. T* x;
  267. SCM entry, key, val;
  268. entry = gh_car(alist);
  269. if (!gh_pair_p(entry))
  270. SWIG_exception(SWIG_TypeError,"alist expected");
  271. key = gh_car(entry);
  272. val = gh_cdr(entry);
  273. if (!CHECK(key))
  274. SWIG_exception(SWIG_TypeError,
  275. "map<" #K "," #T "> expected");
  276. if (SWIG_ConvertPtr(val,(void**) &x,
  277. $descriptor(T *), 0) != 0) {
  278. if (!gh_pair_p(val))
  279. SWIG_exception(SWIG_TypeError,"alist expected");
  280. val = gh_car(val);
  281. x = (T*) SWIG_MustGetPtr(val,$descriptor(T *),$argnum, 0);
  282. }
  283. (($1_type &)$1)[CONVERT_FROM(key)] = *x;
  284. alist = gh_cdr(alist);
  285. }
  286. } else {
  287. $1 = *(($&1_type)
  288. SWIG_MustGetPtr($input,$&1_descriptor,$argnum, 0));
  289. }
  290. }
  291. %typemap(in) const map<K,T>& (std::map<K,T> temp,
  292. std::map<K,T>* m),
  293. const map<K,T>* (std::map<K,T> temp,
  294. std::map<K,T>* m) {
  295. if (gh_null_p($input)) {
  296. temp = std::map<K,T >();
  297. $1 = &temp;
  298. } else if (gh_pair_p($input)) {
  299. temp = std::map<K,T >();
  300. $1 = &temp;
  301. SCM alist = $input;
  302. while (!gh_null_p(alist)) {
  303. T* x;
  304. SCM entry, key, val;
  305. entry = gh_car(alist);
  306. if (!gh_pair_p(entry))
  307. SWIG_exception(SWIG_TypeError,"alist expected");
  308. key = gh_car(entry);
  309. val = gh_cdr(entry);
  310. if (!CHECK(key))
  311. SWIG_exception(SWIG_TypeError,
  312. "map<" #K "," #T "> expected");
  313. if (SWIG_ConvertPtr(val,(void**) &x,
  314. $descriptor(T *), 0) != 0) {
  315. if (!gh_pair_p(val))
  316. SWIG_exception(SWIG_TypeError,"alist expected");
  317. val = gh_car(val);
  318. x = (T*) SWIG_MustGetPtr(val,$descriptor(T *),$argnum, 0);
  319. }
  320. temp[CONVERT_FROM(key)] = *x;
  321. alist = gh_cdr(alist);
  322. }
  323. } else {
  324. $1 = ($1_ltype) SWIG_MustGetPtr($input,$1_descriptor,$argnum, 0);
  325. }
  326. }
  327. %typemap(out) map<K,T> {
  328. SCM alist = SCM_EOL;
  329. for (std::map<K,T >::reverse_iterator i=$1.rbegin();
  330. i!=$1.rend(); ++i) {
  331. T* val = new T(i->second);
  332. SCM k = CONVERT_TO(i->first);
  333. SCM x = SWIG_NewPointerObj(val,$descriptor(T *), 1);
  334. SCM entry = gh_cons(k,x);
  335. alist = gh_cons(entry,alist);
  336. }
  337. $result = alist;
  338. }
  339. %typecheck(SWIG_TYPECHECK_MAP) map<K,T> {
  340. // native sequence?
  341. if (gh_null_p($input)) {
  342. /* an empty sequence can be of any type */
  343. $1 = 1;
  344. } else if (gh_pair_p($input)) {
  345. // check the first element only
  346. T* x;
  347. SCM head = gh_car($input);
  348. if (gh_pair_p(head)) {
  349. SCM key = gh_car(head);
  350. SCM val = gh_cdr(head);
  351. if (!CHECK(key)) {
  352. $1 = 0;
  353. } else {
  354. if (SWIG_ConvertPtr(val,(void**) &x,
  355. $descriptor(T *), 0) == 0) {
  356. $1 = 1;
  357. } else if (gh_pair_p(val)) {
  358. val = gh_car(val);
  359. if (SWIG_ConvertPtr(val,(void**) &x,
  360. $descriptor(T *), 0) == 0)
  361. $1 = 1;
  362. else
  363. $1 = 0;
  364. } else {
  365. $1 = 0;
  366. }
  367. }
  368. } else {
  369. $1 = 0;
  370. }
  371. } else {
  372. // wrapped map?
  373. std::map<K,T >* m;
  374. if (SWIG_ConvertPtr($input,(void **) &m,
  375. $&1_descriptor, 0) == 0)
  376. $1 = 1;
  377. else
  378. $1 = 0;
  379. }
  380. }
  381. %typecheck(SWIG_TYPECHECK_MAP) const map<K,T>&,
  382. const map<K,T>* {
  383. // native sequence?
  384. if (gh_null_p($input)) {
  385. /* an empty sequence can be of any type */
  386. $1 = 1;
  387. } else if (gh_pair_p($input)) {
  388. // check the first element only
  389. T* x;
  390. SCM head = gh_car($input);
  391. if (gh_pair_p(head)) {
  392. SCM key = gh_car(head);
  393. SCM val = gh_cdr(head);
  394. if (!CHECK(key)) {
  395. $1 = 0;
  396. } else {
  397. if (SWIG_ConvertPtr(val,(void**) &x,
  398. $descriptor(T *), 0) == 0) {
  399. $1 = 1;
  400. } else if (gh_pair_p(val)) {
  401. val = gh_car(val);
  402. if (SWIG_ConvertPtr(val,(void**) &x,
  403. $descriptor(T *), 0) == 0)
  404. $1 = 1;
  405. else
  406. $1 = 0;
  407. } else {
  408. $1 = 0;
  409. }
  410. }
  411. } else {
  412. $1 = 0;
  413. }
  414. } else {
  415. // wrapped map?
  416. std::map<K,T >* m;
  417. if (SWIG_ConvertPtr($input,(void **) &m,
  418. $1_descriptor, 0) == 0)
  419. $1 = 1;
  420. else
  421. $1 = 0;
  422. }
  423. }
  424. %rename("length") size;
  425. %rename("null?") empty;
  426. %rename("clear!") clear;
  427. %rename("ref") __getitem__;
  428. %rename("set!") __setitem__;
  429. %rename("delete!") __delitem__;
  430. %rename("has-key?") has_key;
  431. public:
  432. map();
  433. map(const map<K,T> &);
  434. unsigned int size() const;
  435. bool empty() const;
  436. void clear();
  437. %extend {
  438. T& __getitem__(K key) throw (std::out_of_range) {
  439. std::map<K,T >::iterator i = self->find(key);
  440. if (i != self->end())
  441. return i->second;
  442. else
  443. throw std::out_of_range("key not found");
  444. }
  445. void __setitem__(K key, const T& x) {
  446. (*self)[key] = x;
  447. }
  448. void __delitem__(K key) throw (std::out_of_range) {
  449. std::map<K,T >::iterator i = self->find(key);
  450. if (i != self->end())
  451. self->erase(i);
  452. else
  453. throw std::out_of_range("key not found");
  454. }
  455. bool has_key(K key) {
  456. std::map<K,T >::iterator i = self->find(key);
  457. return i != self->end();
  458. }
  459. SCM keys() {
  460. SCM result = SCM_EOL;
  461. for (std::map<K,T >::reverse_iterator i=$1.rbegin();
  462. i!=$1.rend(); ++i) {
  463. SCM k = CONVERT_TO(i->first);
  464. result = gh_cons(k,result);
  465. }
  466. return result;
  467. }
  468. }
  469. };
  470. %enddef
  471. %define specialize_std_map_on_value(T,CHECK,CONVERT_FROM,CONVERT_TO)
  472. template<class K> class map<K,T> {
  473. %typemap(in) map<K,T> (std::map<K,T>* m) {
  474. if (gh_null_p($input)) {
  475. $1 = std::map<K,T >();
  476. } else if (gh_pair_p($input)) {
  477. $1 = std::map<K,T >();
  478. SCM alist = $input;
  479. while (!gh_null_p(alist)) {
  480. K* k;
  481. SCM entry, key, val;
  482. entry = gh_car(alist);
  483. if (!gh_pair_p(entry))
  484. SWIG_exception(SWIG_TypeError,"alist expected");
  485. key = gh_car(entry);
  486. val = gh_cdr(entry);
  487. k = (K*) SWIG_MustGetPtr(key,$descriptor(K *),$argnum, 0);
  488. if (!CHECK(val)) {
  489. if (!gh_pair_p(val))
  490. SWIG_exception(SWIG_TypeError,"alist expected");
  491. val = gh_car(val);
  492. if (!CHECK(val))
  493. SWIG_exception(SWIG_TypeError,
  494. "map<" #K "," #T "> expected");
  495. }
  496. (($1_type &)$1)[*k] = CONVERT_FROM(val);
  497. alist = gh_cdr(alist);
  498. }
  499. } else {
  500. $1 = *(($&1_type)
  501. SWIG_MustGetPtr($input,$&1_descriptor,$argnum, 0));
  502. }
  503. }
  504. %typemap(in) const map<K,T>& (std::map<K,T> temp,
  505. std::map<K,T>* m),
  506. const map<K,T>* (std::map<K,T> temp,
  507. std::map<K,T>* m) {
  508. if (gh_null_p($input)) {
  509. temp = std::map<K,T >();
  510. $1 = &temp;
  511. } else if (gh_pair_p($input)) {
  512. temp = std::map<K,T >();
  513. $1 = &temp;
  514. SCM alist = $input;
  515. while (!gh_null_p(alist)) {
  516. K* k;
  517. SCM entry, key, val;
  518. entry = gh_car(alist);
  519. if (!gh_pair_p(entry))
  520. SWIG_exception(SWIG_TypeError,"alist expected");
  521. key = gh_car(entry);
  522. val = gh_cdr(entry);
  523. k = (K*) SWIG_MustGetPtr(key,$descriptor(K *),$argnum, 0);
  524. if (!CHECK(val)) {
  525. if (!gh_pair_p(val))
  526. SWIG_exception(SWIG_TypeError,"alist expected");
  527. val = gh_car(val);
  528. if (!CHECK(val))
  529. SWIG_exception(SWIG_TypeError,
  530. "map<" #K "," #T "> expected");
  531. }
  532. temp[*k] = CONVERT_FROM(val);
  533. alist = gh_cdr(alist);
  534. }
  535. } else {
  536. $1 = ($1_ltype) SWIG_MustGetPtr($input,$1_descriptor,$argnum, 0);
  537. }
  538. }
  539. %typemap(out) map<K,T> {
  540. SCM alist = SCM_EOL;
  541. for (std::map<K,T >::reverse_iterator i=$1.rbegin();
  542. i!=$1.rend(); ++i) {
  543. K* key = new K(i->first);
  544. SCM k = SWIG_NewPointerObj(key,$descriptor(K *), 1);
  545. SCM x = CONVERT_TO(i->second);
  546. SCM entry = gh_cons(k,x);
  547. alist = gh_cons(entry,alist);
  548. }
  549. $result = alist;
  550. }
  551. %typecheck(SWIG_TYPECHECK_MAP) map<K,T> {
  552. // native sequence?
  553. if (gh_null_p($input)) {
  554. /* an empty sequence can be of any type */
  555. $1 = 1;
  556. } else if (gh_pair_p($input)) {
  557. // check the first element only
  558. K* k;
  559. SCM head = gh_car($input);
  560. if (gh_pair_p(head)) {
  561. SCM key = gh_car(head);
  562. SCM val = gh_cdr(head);
  563. if (SWIG_ConvertPtr(val,(void **) &k,
  564. $descriptor(K *), 0) != 0) {
  565. $1 = 0;
  566. } else {
  567. if (CHECK(val)) {
  568. $1 = 1;
  569. } else if (gh_pair_p(val)) {
  570. val = gh_car(val);
  571. if (CHECK(val))
  572. $1 = 1;
  573. else
  574. $1 = 0;
  575. } else {
  576. $1 = 0;
  577. }
  578. }
  579. } else {
  580. $1 = 0;
  581. }
  582. } else {
  583. // wrapped map?
  584. std::map<K,T >* m;
  585. if (SWIG_ConvertPtr($input,(void **) &m,
  586. $&1_descriptor, 0) == 0)
  587. $1 = 1;
  588. else
  589. $1 = 0;
  590. }
  591. }
  592. %typecheck(SWIG_TYPECHECK_MAP) const map<K,T>&,
  593. const map<K,T>* {
  594. // native sequence?
  595. if (gh_null_p($input)) {
  596. /* an empty sequence can be of any type */
  597. $1 = 1;
  598. } else if (gh_pair_p($input)) {
  599. // check the first element only
  600. K* k;
  601. SCM head = gh_car($input);
  602. if (gh_pair_p(head)) {
  603. SCM key = gh_car(head);
  604. SCM val = gh_cdr(head);
  605. if (SWIG_ConvertPtr(val,(void **) &k,
  606. $descriptor(K *), 0) != 0) {
  607. $1 = 0;
  608. } else {
  609. if (CHECK(val)) {
  610. $1 = 1;
  611. } else if (gh_pair_p(val)) {
  612. val = gh_car(val);
  613. if (CHECK(val))
  614. $1 = 1;
  615. else
  616. $1 = 0;
  617. } else {
  618. $1 = 0;
  619. }
  620. }
  621. } else {
  622. $1 = 0;
  623. }
  624. } else {
  625. // wrapped map?
  626. std::map<K,T >* m;
  627. if (SWIG_ConvertPtr($input,(void **) &m,
  628. $1_descriptor, 0) == 0)
  629. $1 = 1;
  630. else
  631. $1 = 0;
  632. }
  633. }
  634. %rename("length") size;
  635. %rename("null?") empty;
  636. %rename("clear!") clear;
  637. %rename("ref") __getitem__;
  638. %rename("set!") __setitem__;
  639. %rename("delete!") __delitem__;
  640. %rename("has-key?") has_key;
  641. public:
  642. map();
  643. map(const map<K,T> &);
  644. unsigned int size() const;
  645. bool empty() const;
  646. void clear();
  647. %extend {
  648. T __getitem__(const K& key) throw (std::out_of_range) {
  649. std::map<K,T >::iterator i = self->find(key);
  650. if (i != self->end())
  651. return i->second;
  652. else
  653. throw std::out_of_range("key not found");
  654. }
  655. void __setitem__(const K& key, T x) {
  656. (*self)[key] = x;
  657. }
  658. void __delitem__(const K& key) throw (std::out_of_range) {
  659. std::map<K,T >::iterator i = self->find(key);
  660. if (i != self->end())
  661. self->erase(i);
  662. else
  663. throw std::out_of_range("key not found");
  664. }
  665. bool has_key(const K& key) {
  666. std::map<K,T >::iterator i = self->find(key);
  667. return i != self->end();
  668. }
  669. SCM keys() {
  670. SCM result = SCM_EOL;
  671. for (std::map<K,T >::reverse_iterator i=$1.rbegin();
  672. i!=$1.rend(); ++i) {
  673. K* key = new K(i->first);
  674. SCM k = SWIG_NewPointerObj(key,$descriptor(K *), 1);
  675. result = gh_cons(k,result);
  676. }
  677. return result;
  678. }
  679. }
  680. };
  681. %enddef
  682. %define specialize_std_map_on_both(K,CHECK_K,CONVERT_K_FROM,CONVERT_K_TO,
  683. T,CHECK_T,CONVERT_T_FROM,CONVERT_T_TO)
  684. template<> class map<K,T> {
  685. %typemap(in) map<K,T> (std::map<K,T>* m) {
  686. if (gh_null_p($input)) {
  687. $1 = std::map<K,T >();
  688. } else if (gh_pair_p($input)) {
  689. $1 = std::map<K,T >();
  690. SCM alist = $input;
  691. while (!gh_null_p(alist)) {
  692. SCM entry, key, val;
  693. entry = gh_car(alist);
  694. if (!gh_pair_p(entry))
  695. SWIG_exception(SWIG_TypeError,"alist expected");
  696. key = gh_car(entry);
  697. val = gh_cdr(entry);
  698. if (!CHECK_K(key))
  699. SWIG_exception(SWIG_TypeError,
  700. "map<" #K "," #T "> expected");
  701. if (!CHECK_T(val)) {
  702. if (!gh_pair_p(val))
  703. SWIG_exception(SWIG_TypeError,"alist expected");
  704. val = gh_car(val);
  705. if (!CHECK_T(val))
  706. SWIG_exception(SWIG_TypeError,
  707. "map<" #K "," #T "> expected");
  708. }
  709. (($1_type &)$1)[CONVERT_K_FROM(key)] =
  710. CONVERT_T_FROM(val);
  711. alist = gh_cdr(alist);
  712. }
  713. } else {
  714. $1 = *(($&1_type)
  715. SWIG_MustGetPtr($input,$&1_descriptor,$argnum, 0));
  716. }
  717. }
  718. %typemap(in) const map<K,T>& (std::map<K,T> temp,
  719. std::map<K,T>* m),
  720. const map<K,T>* (std::map<K,T> temp,
  721. std::map<K,T>* m) {
  722. if (gh_null_p($input)) {
  723. temp = std::map<K,T >();
  724. $1 = &temp;
  725. } else if (gh_pair_p($input)) {
  726. temp = std::map<K,T >();
  727. $1 = &temp;
  728. SCM alist = $input;
  729. while (!gh_null_p(alist)) {
  730. SCM entry, key, val;
  731. entry = gh_car(alist);
  732. if (!gh_pair_p(entry))
  733. SWIG_exception(SWIG_TypeError,"alist expected");
  734. key = gh_car(entry);
  735. val = gh_cdr(entry);
  736. if (!CHECK_K(key))
  737. SWIG_exception(SWIG_TypeError,
  738. "map<" #K "," #T "> expected");
  739. if (!CHECK_T(val)) {
  740. if (!gh_pair_p(val))
  741. SWIG_exception(SWIG_TypeError,"alist expected");
  742. val = gh_car(val);
  743. if (!CHECK_T(val))
  744. SWIG_exception(SWIG_TypeError,
  745. "map<" #K "," #T "> expected");
  746. }
  747. temp[CONVERT_K_FROM(key)] = CONVERT_T_FROM(val);
  748. alist = gh_cdr(alist);
  749. }
  750. } else {
  751. $1 = ($1_ltype) SWIG_MustGetPtr($input,$1_descriptor,$argnum, 0);
  752. }
  753. }
  754. %typemap(out) map<K,T> {
  755. SCM alist = SCM_EOL;
  756. for (std::map<K,T >::reverse_iterator i=$1.rbegin();
  757. i!=$1.rend(); ++i) {
  758. SCM k = CONVERT_K_TO(i->first);
  759. SCM x = CONVERT_T_TO(i->second);
  760. SCM entry = gh_cons(k,x);
  761. alist = gh_cons(entry,alist);
  762. }
  763. $result = alist;
  764. }
  765. %typecheck(SWIG_TYPECHECK_MAP) map<K,T> {
  766. // native sequence?
  767. if (gh_null_p($input)) {
  768. /* an empty sequence can be of any type */
  769. $1 = 1;
  770. } else if (gh_pair_p($input)) {
  771. // check the first element only
  772. SCM head = gh_car($input);
  773. if (gh_pair_p(head)) {
  774. SCM key = gh_car(head);
  775. SCM val = gh_cdr(head);
  776. if (!CHECK_K(key)) {
  777. $1 = 0;
  778. } else {
  779. if (CHECK_T(val)) {
  780. $1 = 1;
  781. } else if (gh_pair_p(val)) {
  782. val = gh_car(val);
  783. if (CHECK_T(val))
  784. $1 = 1;
  785. else
  786. $1 = 0;
  787. } else {
  788. $1 = 0;
  789. }
  790. }
  791. } else {
  792. $1 = 0;
  793. }
  794. } else {
  795. // wrapped map?
  796. std::map<K,T >* m;
  797. if (SWIG_ConvertPtr($input,(void **) &m,
  798. $&1_descriptor, 0) == 0)
  799. $1 = 1;
  800. else
  801. $1 = 0;
  802. }
  803. }
  804. %typecheck(SWIG_TYPECHECK_MAP) const map<K,T>&,
  805. const map<K,T>* {
  806. // native sequence?
  807. if (gh_null_p($input)) {
  808. /* an empty sequence can be of any type */
  809. $1 = 1;
  810. } else if (gh_pair_p($input)) {
  811. // check the first element only
  812. SCM head = gh_car($input);
  813. if (gh_pair_p(head)) {
  814. SCM key = gh_car(head);
  815. SCM val = gh_cdr(head);
  816. if (!CHECK_K(key)) {
  817. $1 = 0;
  818. } else {
  819. if (CHECK_T(val)) {
  820. $1 = 1;
  821. } else if (gh_pair_p(val)) {
  822. val = gh_car(val);
  823. if (CHECK_T(val))
  824. $1 = 1;
  825. else
  826. $1 = 0;
  827. } else {
  828. $1 = 0;
  829. }
  830. }
  831. } else {
  832. $1 = 0;
  833. }
  834. } else {
  835. // wrapped map?
  836. std::map<K,T >* m;
  837. if (SWIG_ConvertPtr($input,(void **) &m,
  838. $1_descriptor, 0) == 0)
  839. $1 = 1;
  840. else
  841. $1 = 0;
  842. }
  843. }
  844. %rename("length") size;
  845. %rename("null?") empty;
  846. %rename("clear!") clear;
  847. %rename("ref") __getitem__;
  848. %rename("set!") __setitem__;
  849. %rename("delete!") __delitem__;
  850. %rename("has-key?") has_key;
  851. public:
  852. map();
  853. map(const map<K,T> &);
  854. unsigned int size() const;
  855. bool empty() const;
  856. void clear();
  857. %extend {
  858. T __getitem__(K key) throw (std::out_of_range) {
  859. std::map<K,T >::iterator i = self->find(key);
  860. if (i != self->end())
  861. return i->second;
  862. else
  863. throw std::out_of_range("key not found");
  864. }
  865. void __setitem__(K key, T x) {
  866. (*self)[key] = x;
  867. }
  868. void __delitem__(K key) throw (std::out_of_range) {
  869. std::map<K,T >::iterator i = self->find(key);
  870. if (i != self->end())
  871. self->erase(i);
  872. else
  873. throw std::out_of_range("key not found");
  874. }
  875. bool has_key(K key) {
  876. std::map<K,T >::iterator i = self->find(key);
  877. return i != self->end();
  878. }
  879. SCM keys() {
  880. SCM result = SCM_EOL;
  881. for (std::map<K,T >::reverse_iterator i=$1.rbegin();
  882. i!=$1.rend(); ++i) {
  883. SCM k = CONVERT_K_TO(i->first);
  884. result = gh_cons(k,result);
  885. }
  886. return result;
  887. }
  888. }
  889. };
  890. %enddef
  891. specialize_std_map_on_key(bool,gh_boolean_p,
  892. gh_scm2bool,SWIG_bool2scm);
  893. specialize_std_map_on_key(int,gh_number_p,
  894. gh_scm2long,gh_long2scm);
  895. specialize_std_map_on_key(short,gh_number_p,
  896. gh_scm2long,gh_long2scm);
  897. specialize_std_map_on_key(long,gh_number_p,
  898. gh_scm2long,gh_long2scm);
  899. specialize_std_map_on_key(unsigned int,gh_number_p,
  900. gh_scm2ulong,gh_ulong2scm);
  901. specialize_std_map_on_key(unsigned short,gh_number_p,
  902. gh_scm2ulong,gh_ulong2scm);
  903. specialize_std_map_on_key(unsigned long,gh_number_p,
  904. gh_scm2ulong,gh_ulong2scm);
  905. specialize_std_map_on_key(double,gh_number_p,
  906. gh_scm2double,gh_double2scm);
  907. specialize_std_map_on_key(float,gh_number_p,
  908. gh_scm2double,gh_double2scm);
  909. specialize_std_map_on_key(std::string,gh_string_p,
  910. SWIG_scm2string,SWIG_string2scm);
  911. specialize_std_map_on_value(bool,gh_boolean_p,
  912. gh_scm2bool,SWIG_bool2scm);
  913. specialize_std_map_on_value(int,gh_number_p,
  914. gh_scm2long,gh_long2scm);
  915. specialize_std_map_on_value(short,gh_number_p,
  916. gh_scm2long,gh_long2scm);
  917. specialize_std_map_on_value(long,gh_number_p,
  918. gh_scm2long,gh_long2scm);
  919. specialize_std_map_on_value(unsigned int,gh_number_p,
  920. gh_scm2ulong,gh_ulong2scm);
  921. specialize_std_map_on_value(unsigned short,gh_number_p,
  922. gh_scm2ulong,gh_ulong2scm);
  923. specialize_std_map_on_value(unsigned long,gh_number_p,
  924. gh_scm2ulong,gh_ulong2scm);
  925. specialize_std_map_on_value(double,gh_number_p,
  926. gh_scm2double,gh_double2scm);
  927. specialize_std_map_on_value(float,gh_number_p,
  928. gh_scm2double,gh_double2scm);
  929. specialize_std_map_on_value(std::string,gh_string_p,
  930. SWIG_scm2string,SWIG_string2scm);
  931. specialize_std_map_on_both(bool,gh_boolean_p,
  932. gh_scm2bool,SWIG_bool2scm,
  933. bool,gh_boolean_p,
  934. gh_scm2bool,SWIG_bool2scm);
  935. specialize_std_map_on_both(bool,gh_boolean_p,
  936. gh_scm2bool,SWIG_bool2scm,
  937. int,gh_number_p,
  938. gh_scm2long,gh_long2scm);
  939. specialize_std_map_on_both(bool,gh_boolean_p,
  940. gh_scm2bool,SWIG_bool2scm,
  941. short,gh_number_p,
  942. gh_scm2long,gh_long2scm);
  943. specialize_std_map_on_both(bool,gh_boolean_p,
  944. gh_scm2bool,SWIG_bool2scm,
  945. long,gh_number_p,
  946. gh_scm2long,gh_long2scm);
  947. specialize_std_map_on_both(bool,gh_boolean_p,
  948. gh_scm2bool,SWIG_bool2scm,
  949. unsigned int,gh_number_p,
  950. gh_scm2ulong,gh_ulong2scm);
  951. specialize_std_map_on_both(bool,gh_boolean_p,
  952. gh_scm2bool,SWIG_bool2scm,
  953. unsigned short,gh_number_p,
  954. gh_scm2ulong,gh_ulong2scm);
  955. specialize_std_map_on_both(bool,gh_boolean_p,
  956. gh_scm2bool,SWIG_bool2scm,
  957. unsigned long,gh_number_p,
  958. gh_scm2ulong,gh_ulong2scm);
  959. specialize_std_map_on_both(bool,gh_boolean_p,
  960. gh_scm2bool,SWIG_bool2scm,
  961. double,gh_number_p,
  962. gh_scm2double,gh_double2scm);
  963. specialize_std_map_on_both(bool,gh_boolean_p,
  964. gh_scm2bool,SWIG_bool2scm,
  965. float,gh_number_p,
  966. gh_scm2double,gh_double2scm);
  967. specialize_std_map_on_both(bool,gh_boolean_p,
  968. gh_scm2bool,SWIG_bool2scm,
  969. std::string,gh_string_p,
  970. SWIG_scm2string,SWIG_string2scm);
  971. specialize_std_map_on_both(int,gh_number_p,
  972. gh_scm2long,gh_long2scm,
  973. bool,gh_boolean_p,
  974. gh_scm2bool,SWIG_bool2scm);
  975. specialize_std_map_on_both(int,gh_number_p,
  976. gh_scm2long,gh_long2scm,
  977. int,gh_number_p,
  978. gh_scm2long,gh_long2scm);
  979. specialize_std_map_on_both(int,gh_number_p,
  980. gh_scm2long,gh_long2scm,
  981. short,gh_number_p,
  982. gh_scm2long,gh_long2scm);
  983. specialize_std_map_on_both(int,gh_number_p,
  984. gh_scm2long,gh_long2scm,
  985. long,gh_number_p,
  986. gh_scm2long,gh_long2scm);
  987. specialize_std_map_on_both(int,gh_number_p,
  988. gh_scm2long,gh_long2scm,
  989. unsigned int,gh_number_p,
  990. gh_scm2ulong,gh_ulong2scm);
  991. specialize_std_map_on_both(int,gh_number_p,
  992. gh_scm2long,gh_long2scm,
  993. unsigned short,gh_number_p,
  994. gh_scm2ulong,gh_ulong2scm);
  995. specialize_std_map_on_both(int,gh_number_p,
  996. gh_scm2long,gh_long2scm,
  997. unsigned long,gh_number_p,
  998. gh_scm2ulong,gh_ulong2scm);
  999. specialize_std_map_on_both(int,gh_number_p,
  1000. gh_scm2long,gh_long2scm,
  1001. double,gh_number_p,
  1002. gh_scm2double,gh_double2scm);
  1003. specialize_std_map_on_both(int,gh_number_p,
  1004. gh_scm2long,gh_long2scm,
  1005. float,gh_number_p,
  1006. gh_scm2double,gh_double2scm);
  1007. specialize_std_map_on_both(int,gh_number_p,
  1008. gh_scm2long,gh_long2scm,
  1009. std::string,gh_string_p,
  1010. SWIG_scm2string,SWIG_string2scm);
  1011. specialize_std_map_on_both(short,gh_number_p,
  1012. gh_scm2long,gh_long2scm,
  1013. bool,gh_boolean_p,
  1014. gh_scm2bool,SWIG_bool2scm);
  1015. specialize_std_map_on_both(short,gh_number_p,
  1016. gh_scm2long,gh_long2scm,
  1017. int,gh_number_p,
  1018. gh_scm2long,gh_long2scm);
  1019. specialize_std_map_on_both(short,gh_number_p,
  1020. gh_scm2long,gh_long2scm,
  1021. short,gh_number_p,
  1022. gh_scm2long,gh_long2scm);
  1023. specialize_std_map_on_both(short,gh_number_p,
  1024. gh_scm2long,gh_long2scm,
  1025. long,gh_number_p,
  1026. gh_scm2long,gh_long2scm);
  1027. specialize_std_map_on_both(short,gh_number_p,
  1028. gh_scm2long,gh_long2scm,
  1029. unsigned int,gh_number_p,
  1030. gh_scm2ulong,gh_ulong2scm);
  1031. specialize_std_map_on_both(short,gh_number_p,
  1032. gh_scm2long,gh_long2scm,
  1033. unsigned short,gh_number_p,
  1034. gh_scm2ulong,gh_ulong2scm);
  1035. specialize_std_map_on_both(short,gh_number_p,
  1036. gh_scm2long,gh_long2scm,
  1037. unsigned long,gh_number_p,
  1038. gh_scm2ulong,gh_ulong2scm);
  1039. specialize_std_map_on_both(short,gh_number_p,
  1040. gh_scm2long,gh_long2scm,
  1041. double,gh_number_p,
  1042. gh_scm2double,gh_double2scm);
  1043. specialize_std_map_on_both(short,gh_number_p,
  1044. gh_scm2long,gh_long2scm,
  1045. float,gh_number_p,
  1046. gh_scm2double,gh_double2scm);
  1047. specialize_std_map_on_both(short,gh_number_p,
  1048. gh_scm2long,gh_long2scm,
  1049. std::string,gh_string_p,
  1050. SWIG_scm2string,SWIG_string2scm);
  1051. specialize_std_map_on_both(long,gh_number_p,
  1052. gh_scm2long,gh_long2scm,
  1053. bool,gh_boolean_p,
  1054. gh_scm2bool,SWIG_bool2scm);
  1055. specialize_std_map_on_both(long,gh_number_p,
  1056. gh_scm2long,gh_long2scm,
  1057. int,gh_number_p,
  1058. gh_scm2long,gh_long2scm);
  1059. specialize_std_map_on_both(long,gh_number_p,
  1060. gh_scm2long,gh_long2scm,
  1061. short,gh_number_p,
  1062. gh_scm2long,gh_long2scm);
  1063. specialize_std_map_on_both(long,gh_number_p,
  1064. gh_scm2long,gh_long2scm,
  1065. long,gh_number_p,
  1066. gh_scm2long,gh_long2scm);
  1067. specialize_std_map_on_both(long,gh_number_p,
  1068. gh_scm2long,gh_long2scm,
  1069. unsigned int,gh_number_p,
  1070. gh_scm2ulong,gh_ulong2scm);
  1071. specialize_std_map_on_both(long,gh_number_p,
  1072. gh_scm2long,gh_long2scm,
  1073. unsigned short,gh_number_p,
  1074. gh_scm2ulong,gh_ulong2scm);
  1075. specialize_std_map_on_both(long,gh_number_p,
  1076. gh_scm2long,gh_long2scm,
  1077. unsigned long,gh_number_p,
  1078. gh_scm2ulong,gh_ulong2scm);
  1079. specialize_std_map_on_both(long,gh_number_p,
  1080. gh_scm2long,gh_long2scm,
  1081. double,gh_number_p,
  1082. gh_scm2double,gh_double2scm);
  1083. specialize_std_map_on_both(long,gh_number_p,
  1084. gh_scm2long,gh_long2scm,
  1085. float,gh_number_p,
  1086. gh_scm2double,gh_double2scm);
  1087. specialize_std_map_on_both(long,gh_number_p,
  1088. gh_scm2long,gh_long2scm,
  1089. std::string,gh_string_p,
  1090. SWIG_scm2string,SWIG_string2scm);
  1091. specialize_std_map_on_both(unsigned int,gh_number_p,
  1092. gh_scm2ulong,gh_ulong2scm,
  1093. bool,gh_boolean_p,
  1094. gh_scm2bool,SWIG_bool2scm);
  1095. specialize_std_map_on_both(unsigned int,gh_number_p,
  1096. gh_scm2ulong,gh_ulong2scm,
  1097. int,gh_number_p,
  1098. gh_scm2long,gh_long2scm);
  1099. specialize_std_map_on_both(unsigned int,gh_number_p,
  1100. gh_scm2ulong,gh_ulong2scm,
  1101. short,gh_number_p,
  1102. gh_scm2long,gh_long2scm);
  1103. specialize_std_map_on_both(unsigned int,gh_number_p,
  1104. gh_scm2ulong,gh_ulong2scm,
  1105. long,gh_number_p,
  1106. gh_scm2long,gh_long2scm);
  1107. specialize_std_map_on_both(unsigned int,gh_number_p,
  1108. gh_scm2ulong,gh_ulong2scm,
  1109. unsigned int,gh_number_p,
  1110. gh_scm2ulong,gh_ulong2scm);
  1111. specialize_std_map_on_both(unsigned int,gh_number_p,
  1112. gh_scm2ulong,gh_ulong2scm,
  1113. unsigned short,gh_number_p,
  1114. gh_scm2ulong,gh_ulong2scm);
  1115. specialize_std_map_on_both(unsigned int,gh_number_p,
  1116. gh_scm2ulong,gh_ulong2scm,
  1117. unsigned long,gh_number_p,
  1118. gh_scm2ulong,gh_ulong2scm);
  1119. specialize_std_map_on_both(unsigned int,gh_number_p,
  1120. gh_scm2ulong,gh_ulong2scm,
  1121. double,gh_number_p,
  1122. gh_scm2double,gh_double2scm);
  1123. specialize_std_map_on_both(unsigned int,gh_number_p,
  1124. gh_scm2ulong,gh_ulong2scm,
  1125. float,gh_number_p,
  1126. gh_scm2double,gh_double2scm);
  1127. specialize_std_map_on_both(unsigned int,gh_number_p,
  1128. gh_scm2ulong,gh_ulong2scm,
  1129. std::string,gh_string_p,
  1130. SWIG_scm2string,SWIG_string2scm);
  1131. specialize_std_map_on_both(unsigned short,gh_number_p,
  1132. gh_scm2ulong,gh_ulong2scm,
  1133. bool,gh_boolean_p,
  1134. gh_scm2bool,SWIG_bool2scm);
  1135. specialize_std_map_on_both(unsigned short,gh_number_p,
  1136. gh_scm2ulong,gh_ulong2scm,
  1137. int,gh_number_p,
  1138. gh_scm2long,gh_long2scm);
  1139. specialize_std_map_on_both(unsigned short,gh_number_p,
  1140. gh_scm2ulong,gh_ulong2scm,
  1141. short,gh_number_p,
  1142. gh_scm2long,gh_long2scm);
  1143. specialize_std_map_on_both(unsigned short,gh_number_p,
  1144. gh_scm2ulong,gh_ulong2scm,
  1145. long,gh_number_p,
  1146. gh_scm2long,gh_long2scm);
  1147. specialize_std_map_on_both(unsigned short,gh_number_p,
  1148. gh_scm2ulong,gh_ulong2scm,
  1149. unsigned int,gh_number_p,
  1150. gh_scm2ulong,gh_ulong2scm);
  1151. specialize_std_map_on_both(unsigned short,gh_number_p,
  1152. gh_scm2ulong,gh_ulong2scm,
  1153. unsigned short,gh_number_p,
  1154. gh_scm2ulong,gh_ulong2scm);
  1155. specialize_std_map_on_both(unsigned short,gh_number_p,
  1156. gh_scm2ulong,gh_ulong2scm,
  1157. unsigned long,gh_number_p,
  1158. gh_scm2ulong,gh_ulong2scm);
  1159. specialize_std_map_on_both(unsigned short,gh_number_p,
  1160. gh_scm2ulong,gh_ulong2scm,
  1161. double,gh_number_p,
  1162. gh_scm2double,gh_double2scm);
  1163. specialize_std_map_on_both(unsigned short,gh_number_p,
  1164. gh_scm2ulong,gh_ulong2scm,
  1165. float,gh_number_p,
  1166. gh_scm2double,gh_double2scm);
  1167. specialize_std_map_on_both(unsigned short,gh_number_p,
  1168. gh_scm2ulong,gh_ulong2scm,
  1169. std::string,gh_string_p,
  1170. SWIG_scm2string,SWIG_string2scm);
  1171. specialize_std_map_on_both(unsigned long,gh_number_p,
  1172. gh_scm2ulong,gh_ulong2scm,
  1173. bool,gh_boolean_p,
  1174. gh_scm2bool,SWIG_bool2scm);
  1175. specialize_std_map_on_both(unsigned long,gh_number_p,
  1176. gh_scm2ulong,gh_ulong2scm,
  1177. int,gh_number_p,
  1178. gh_scm2long,gh_long2scm);
  1179. specialize_std_map_on_both(unsigned long,gh_number_p,
  1180. gh_scm2ulong,gh_ulong2scm,
  1181. short,gh_number_p,
  1182. gh_scm2long,gh_long2scm);
  1183. specialize_std_map_on_both(unsigned long,gh_number_p,
  1184. gh_scm2ulong,gh_ulong2scm,
  1185. long,gh_number_p,
  1186. gh_scm2long,gh_long2scm);
  1187. specialize_std_map_on_both(unsigned long,gh_number_p,
  1188. gh_scm2ulong,gh_ulong2scm,
  1189. unsigned int,gh_number_p,
  1190. gh_scm2ulong,gh_ulong2scm);
  1191. specialize_std_map_on_both(unsigned long,gh_number_p,
  1192. gh_scm2ulong,gh_ulong2scm,
  1193. unsigned short,gh_number_p,
  1194. gh_scm2ulong,gh_ulong2scm);
  1195. specialize_std_map_on_both(unsigned long,gh_number_p,
  1196. gh_scm2ulong,gh_ulong2scm,
  1197. unsigned long,gh_number_p,
  1198. gh_scm2ulong,gh_ulong2scm);
  1199. specialize_std_map_on_both(unsigned long,gh_number_p,
  1200. gh_scm2ulong,gh_ulong2scm,
  1201. double,gh_number_p,
  1202. gh_scm2double,gh_double2scm);
  1203. specialize_std_map_on_both(unsigned long,gh_number_p,
  1204. gh_scm2ulong,gh_ulong2scm,
  1205. float,gh_number_p,
  1206. gh_scm2double,gh_double2scm);
  1207. specialize_std_map_on_both(unsigned long,gh_number_p,
  1208. gh_scm2ulong,gh_ulong2scm,
  1209. std::string,gh_string_p,
  1210. SWIG_scm2string,SWIG_string2scm);
  1211. specialize_std_map_on_both(double,gh_number_p,
  1212. gh_scm2double,gh_double2scm,
  1213. bool,gh_boolean_p,
  1214. gh_scm2bool,SWIG_bool2scm);
  1215. specialize_std_map_on_both(double,gh_number_p,
  1216. gh_scm2double,gh_double2scm,
  1217. int,gh_number_p,
  1218. gh_scm2long,gh_long2scm);
  1219. specialize_std_map_on_both(double,gh_number_p,
  1220. gh_scm2double,gh_double2scm,
  1221. short,gh_number_p,
  1222. gh_scm2long,gh_long2scm);
  1223. specialize_std_map_on_both(double,gh_number_p,
  1224. gh_scm2double,gh_double2scm,
  1225. long,gh_number_p,
  1226. gh_scm2long,gh_long2scm);
  1227. specialize_std_map_on_both(double,gh_number_p,
  1228. gh_scm2double,gh_double2scm,
  1229. unsigned int,gh_number_p,
  1230. gh_scm2ulong,gh_ulong2scm);
  1231. specialize_std_map_on_both(double,gh_number_p,
  1232. gh_scm2double,gh_double2scm,
  1233. unsigned short,gh_number_p,
  1234. gh_scm2ulong,gh_ulong2scm);
  1235. specialize_std_map_on_both(double,gh_number_p,
  1236. gh_scm2double,gh_double2scm,
  1237. unsigned long,gh_number_p,
  1238. gh_scm2ulong,gh_ulong2scm);
  1239. specialize_std_map_on_both(double,gh_number_p,
  1240. gh_scm2double,gh_double2scm,
  1241. double,gh_number_p,
  1242. gh_scm2double,gh_double2scm);
  1243. specialize_std_map_on_both(double,gh_number_p,
  1244. gh_scm2double,gh_double2scm,
  1245. float,gh_number_p,
  1246. gh_scm2double,gh_double2scm);
  1247. specialize_std_map_on_both(double,gh_number_p,
  1248. gh_scm2double,gh_double2scm,
  1249. std::string,gh_string_p,
  1250. SWIG_scm2string,SWIG_string2scm);
  1251. specialize_std_map_on_both(float,gh_number_p,
  1252. gh_scm2double,gh_double2scm,
  1253. bool,gh_boolean_p,
  1254. gh_scm2bool,SWIG_bool2scm);
  1255. specialize_std_map_on_both(float,gh_number_p,
  1256. gh_scm2double,gh_double2scm,
  1257. int,gh_number_p,
  1258. gh_scm2long,gh_long2scm);
  1259. specialize_std_map_on_both(float,gh_number_p,
  1260. gh_scm2double,gh_double2scm,
  1261. short,gh_number_p,
  1262. gh_scm2long,gh_long2scm);
  1263. specialize_std_map_on_both(float,gh_number_p,
  1264. gh_scm2double,gh_double2scm,
  1265. long,gh_number_p,
  1266. gh_scm2long,gh_long2scm);
  1267. specialize_std_map_on_both(float,gh_number_p,
  1268. gh_scm2double,gh_double2scm,
  1269. unsigned int,gh_number_p,
  1270. gh_scm2ulong,gh_ulong2scm);
  1271. specialize_std_map_on_both(float,gh_number_p,
  1272. gh_scm2double,gh_double2scm,
  1273. unsigned short,gh_number_p,
  1274. gh_scm2ulong,gh_ulong2scm);
  1275. specialize_std_map_on_both(float,gh_number_p,
  1276. gh_scm2double,gh_double2scm,
  1277. unsigned long,gh_number_p,
  1278. gh_scm2ulong,gh_ulong2scm);
  1279. specialize_std_map_on_both(float,gh_number_p,
  1280. gh_scm2double,gh_double2scm,
  1281. double,gh_number_p,
  1282. gh_scm2double,gh_double2scm);
  1283. specialize_std_map_on_both(float,gh_number_p,
  1284. gh_scm2double,gh_double2scm,
  1285. float,gh_number_p,
  1286. gh_scm2double,gh_double2scm);
  1287. specialize_std_map_on_both(float,gh_number_p,
  1288. gh_scm2double,gh_double2scm,
  1289. std::string,gh_string_p,
  1290. SWIG_scm2string,SWIG_string2scm);
  1291. specialize_std_map_on_both(std::string,gh_string_p,
  1292. SWIG_scm2string,SWIG_string2scm,
  1293. bool,gh_boolean_p,
  1294. gh_scm2bool,SWIG_bool2scm);
  1295. specialize_std_map_on_both(std::string,gh_string_p,
  1296. SWIG_scm2string,SWIG_string2scm,
  1297. int,gh_number_p,
  1298. gh_scm2long,gh_long2scm);
  1299. specialize_std_map_on_both(std::string,gh_string_p,
  1300. SWIG_scm2string,SWIG_string2scm,
  1301. short,gh_number_p,
  1302. gh_scm2long,gh_long2scm);
  1303. specialize_std_map_on_both(std::string,gh_string_p,
  1304. SWIG_scm2string,SWIG_string2scm,
  1305. long,gh_number_p,
  1306. gh_scm2long,gh_long2scm);
  1307. specialize_std_map_on_both(std::string,gh_string_p,
  1308. SWIG_scm2string,SWIG_string2scm,
  1309. unsigned int,gh_number_p,
  1310. gh_scm2ulong,gh_ulong2scm);
  1311. specialize_std_map_on_both(std::string,gh_string_p,
  1312. SWIG_scm2string,SWIG_string2scm,
  1313. unsigned short,gh_number_p,
  1314. gh_scm2ulong,gh_ulong2scm);
  1315. specialize_std_map_on_both(std::string,gh_string_p,
  1316. SWIG_scm2string,SWIG_string2scm,
  1317. unsigned long,gh_number_p,
  1318. gh_scm2ulong,gh_ulong2scm);
  1319. specialize_std_map_on_both(std::string,gh_string_p,
  1320. SWIG_scm2string,SWIG_string2scm,
  1321. double,gh_number_p,
  1322. gh_scm2double,gh_double2scm);
  1323. specialize_std_map_on_both(std::string,gh_string_p,
  1324. SWIG_scm2string,SWIG_string2scm,
  1325. float,gh_number_p,
  1326. gh_scm2double,gh_double2scm);
  1327. specialize_std_map_on_both(std::string,gh_string_p,
  1328. SWIG_scm2string,SWIG_string2scm,
  1329. std::string,gh_string_p,
  1330. SWIG_scm2string,SWIG_string2scm);
  1331. }