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