Home | History | Annotate | Download | only in guile
      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 // Guile 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 (scm_is_null($input)) {
     46                 $1 = std::map<K,T >();
     47             } else if (scm_is_pair($input)) {
     48                 $1 = std::map<K,T >();
     49                 SCM alist = $input;
     50                 while (!scm_is_null(alist)) {
     51                     K* k;
     52                     T* x;
     53                     SCM entry, key, val;
     54                     entry = SCM_CAR(alist);
     55                     if (!scm_is_pair(entry))
     56                         SWIG_exception(SWIG_TypeError,"alist expected");
     57                     key = SCM_CAR(entry);
     58                     val = SCM_CDR(entry);
     59                     k = (K*) SWIG_MustGetPtr(key,$descriptor(K *),$argnum, 0);
     60                     if (SWIG_ConvertPtr(val,(void**) &x,
     61                                     $descriptor(T *), 0) != 0) {
     62                         if (!scm_is_pair(val))
     63                             SWIG_exception(SWIG_TypeError,"alist expected");
     64                         val = SCM_CAR(val);
     65                         x = (T*) SWIG_MustGetPtr(val,$descriptor(T *),$argnum, 0);
     66                     }
     67                     (($1_type &)$1)[*k] = *x;
     68                     alist = SCM_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 (scm_is_null($input)) {
     80                 temp = std::map<K,T >();
     81                 $1 = &temp;
     82             } else if (scm_is_pair($input)) {
     83                 temp = std::map<K,T >();
     84                 $1 = &temp;
     85                 SCM alist = $input;
     86                 while (!scm_is_null(alist)) {
     87                     K* k;
     88                     T* x;
     89                     SCM entry, key, val;
     90                     entry = SCM_CAR(alist);
     91                     if (!scm_is_pair(entry))
     92                         SWIG_exception(SWIG_TypeError,"alist expected");
     93                     key = SCM_CAR(entry);
     94                     val = SCM_CDR(entry);
     95                     k = (K*) SWIG_MustGetPtr(key,$descriptor(K *),$argnum, 0);
     96                     if (SWIG_ConvertPtr(val,(void**) &x,
     97                                     $descriptor(T *), 0) != 0) {
     98                         if (!scm_is_pair(val))
     99                             SWIG_exception(SWIG_TypeError,"alist expected");
    100                         val = SCM_CAR(val);
    101                         x = (T*) SWIG_MustGetPtr(val,$descriptor(T *),$argnum, 0);
    102                     }
    103                     temp[*k] = *x;
    104                     alist = SCM_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             SCM alist = SCM_EOL;
    112             for (std::map<K,T >::reverse_iterator i=$i.rbegin();
    113                                                   i!=$i.rend(); ++i) {
    114                 K* key = new K(i->first);
    115                 T* val = new T(i->second);
    116                 SCM k = SWIG_NewPointerObj(key,$descriptor(K *), 1);
    117                 SCM x = SWIG_NewPointerObj(val,$descriptor(T *), 1);
    118                 SCM entry = scm_cons(k,x);
    119                 alist = scm_cons(entry,alist);
    120             }
    121             $result = alist;
    122         }
    123         %typecheck(SWIG_TYPECHECK_MAP) map<K,T> {
    124             /* native sequence? */
    125             if (scm_is_null($input)) {
    126                 /* an empty sequence can be of any type */
    127                 $1 = 1;
    128             } else if (scm_is_pair($input)) {
    129                 /* check the first element only */
    130                 K* k;
    131                 T* x;
    132                 SCM head = SCM_CAR($input);
    133                 if (scm_is_pair(head)) {
    134                     SCM key = SCM_CAR(head);
    135                     SCM val = SCM_CDR(head);
    136                     if (SWIG_ConvertPtr(key,(void**) &k,
    137                                     $descriptor(K *), 0) != 0) {
    138                         $1 = 0;
    139                     } else {
    140                         if (SWIG_ConvertPtr(val,(void**) &x,
    141                                         $descriptor(T *), 0) == 0) {
    142                             $1 = 1;
    143                         } else if (scm_is_pair(val)) {
    144                             val = SCM_CAR(val);
    145                             if (SWIG_ConvertPtr(val,(void**) &x,
    146                                             $descriptor(T *), 0) == 0)
    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) == 0)
    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 (scm_is_null($input)) {
    171                 /* an empty sequence can be of any type */
    172                 $1 = 1;
    173             } else if (scm_is_pair($input)) {
    174                 /* check the first element only */
    175                 K* k;
    176                 T* x;
    177                 SCM head = SCM_CAR($input);
    178                 if (scm_is_pair(head)) {
    179                     SCM key = SCM_CAR(head);
    180                     SCM val = SCM_CDR(head);
    181                     if (SWIG_ConvertPtr(key,(void**) &k,
    182                                     $descriptor(K *), 0) != 0) {
    183                         $1 = 0;
    184                     } else {
    185                         if (SWIG_ConvertPtr(val,(void**) &x,
    186                                         $descriptor(T *), 0) == 0) {
    187                             $1 = 1;
    188                         } else if (scm_is_pair(val)) {
    189                             val = SCM_CAR(val);
    190                             if (SWIG_ConvertPtr(val,(void**) &x,
    191                                             $descriptor(T *), 0) == 0)
    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) == 0)
    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             const 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             SCM keys() {
    253                 SCM result = SCM_EOL;
    254                 for (std::map<K,T >::reverse_iterator i=self->rbegin();
    255                                                       i!=self->rend(); ++i) {
    256                     K* key = new K(i->first);
    257                     SCM k = SWIG_NewPointerObj(key,$descriptor(K *), 1);
    258                     result = scm_cons(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 (scm_is_null($input)) {
    273                 $1 = std::map<K,T >();
    274             } else if (scm_is_pair($input)) {
    275                 $1 = std::map<K,T >();
    276                 SCM alist = $input;
    277                 while (!scm_is_null(alist)) {
    278                     T* x;
    279                     SCM entry, key, val;
    280                     entry = SCM_CAR(alist);
    281                     if (!scm_is_pair(entry))
    282                         SWIG_exception(SWIG_TypeError,"alist expected");
    283                     key = SCM_CAR(entry);
    284                     val = SCM_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) != 0) {
    290                         if (!scm_is_pair(val))
    291                             SWIG_exception(SWIG_TypeError,"alist expected");
    292                         val = SCM_CAR(val);
    293                         x = (T*) SWIG_MustGetPtr(val,$descriptor(T *),$argnum, 0);
    294                     }
    295                     (($1_type &)$1)[CONVERT_FROM(key)] = *x;
    296                     alist = SCM_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 (scm_is_null($input)) {
    308                 temp = std::map<K,T >();
    309                 $1 = &temp;
    310             } else if (scm_is_pair($input)) {
    311                 temp = std::map<K,T >();
    312                 $1 = &temp;
    313                 SCM alist = $input;
    314                 while (!scm_is_null(alist)) {
    315                     T* x;
    316                     SCM entry, key, val;
    317                     entry = SCM_CAR(alist);
    318                     if (!scm_is_pair(entry))
    319                         SWIG_exception(SWIG_TypeError,"alist expected");
    320                     key = SCM_CAR(entry);
    321                     val = SCM_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) != 0) {
    327                         if (!scm_is_pair(val))
    328                             SWIG_exception(SWIG_TypeError,"alist expected");
    329                         val = SCM_CAR(val);
    330                         x = (T*) SWIG_MustGetPtr(val,$descriptor(T *),$argnum, 0);
    331                     }
    332                     temp[CONVERT_FROM(key)] = *x;
    333                     alist = SCM_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             SCM alist = SCM_EOL;
    341             for (std::map<K,T >::reverse_iterator i=$1.rbegin();
    342                                                   i!=$1.rend(); ++i) {
    343                 T* val = new T(i->second);
    344                 SCM k = CONVERT_TO(i->first);
    345                 SCM x = SWIG_NewPointerObj(val,$descriptor(T *), 1);
    346                 SCM entry = scm_cons(k,x);
    347                 alist = scm_cons(entry,alist);
    348             }
    349             $result = alist;
    350         }
    351         %typecheck(SWIG_TYPECHECK_MAP) map<K,T> {
    352             // native sequence?
    353             if (scm_is_null($input)) {
    354                 /* an empty sequence can be of any type */
    355                 $1 = 1;
    356             } else if (scm_is_pair($input)) {
    357                 // check the first element only
    358                 T* x;
    359                 SCM head = SCM_CAR($input);
    360                 if (scm_is_pair(head)) {
    361                     SCM key = SCM_CAR(head);
    362                     SCM val = SCM_CDR(head);
    363                     if (!CHECK(key)) {
    364                         $1 = 0;
    365                     } else {
    366                         if (SWIG_ConvertPtr(val,(void**) &x,
    367                                         $descriptor(T *), 0) == 0) {
    368                             $1 = 1;
    369                         } else if (scm_is_pair(val)) {
    370                             val = SCM_CAR(val);
    371                             if (SWIG_ConvertPtr(val,(void**) &x,
    372                                             $descriptor(T *), 0) == 0)
    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) == 0)
    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 (scm_is_null($input)) {
    397                 /* an empty sequence can be of any type */
    398                 $1 = 1;
    399             } else if (scm_is_pair($input)) {
    400                 // check the first element only
    401                 T* x;
    402                 SCM head = SCM_CAR($input);
    403                 if (scm_is_pair(head)) {
    404                     SCM key = SCM_CAR(head);
    405                     SCM val = SCM_CDR(head);
    406                     if (!CHECK(key)) {
    407                         $1 = 0;
    408                     } else {
    409                         if (SWIG_ConvertPtr(val,(void**) &x,
    410                                         $descriptor(T *), 0) == 0) {
    411                             $1 = 1;
    412                         } else if (scm_is_pair(val)) {
    413                             val = SCM_CAR(val);
    414                             if (SWIG_ConvertPtr(val,(void**) &x,
    415                                             $descriptor(T *), 0) == 0)
    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) == 0)
    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             SCM keys() {
    473                 SCM result = SCM_EOL;
    474                 for (std::map<K,T >::reverse_iterator i=self->rbegin();
    475                                                       i!=self->rend(); ++i) {
    476                     SCM k = CONVERT_TO(i->first);
    477                     result = scm_cons(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 (scm_is_null($input)) {
    489                 $1 = std::map<K,T >();
    490             } else if (scm_is_pair($input)) {
    491                 $1 = std::map<K,T >();
    492                 SCM alist = $input;
    493                 while (!scm_is_null(alist)) {
    494                     K* k;
    495                     SCM entry, key, val;
    496                     entry = SCM_CAR(alist);
    497                     if (!scm_is_pair(entry))
    498                         SWIG_exception(SWIG_TypeError,"alist expected");
    499                     key = SCM_CAR(entry);
    500                     val = SCM_CDR(entry);
    501                     k = (K*) SWIG_MustGetPtr(key,$descriptor(K *),$argnum, 0);
    502                     if (!CHECK(val)) {
    503                         if (!scm_is_pair(val))
    504                             SWIG_exception(SWIG_TypeError,"alist expected");
    505                         val = SCM_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 = SCM_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 (scm_is_null($input)) {
    523                 temp = std::map<K,T >();
    524                 $1 = &temp;
    525             } else if (scm_is_pair($input)) {
    526                 temp = std::map<K,T >();
    527                 $1 = &temp;
    528                 SCM alist = $input;
    529                 while (!scm_is_null(alist)) {
    530                     K* k;
    531                     SCM entry, key, val;
    532                     entry = SCM_CAR(alist);
    533                     if (!scm_is_pair(entry))
    534                         SWIG_exception(SWIG_TypeError,"alist expected");
    535                     key = SCM_CAR(entry);
    536                     val = SCM_CDR(entry);
    537                     k = (K*) SWIG_MustGetPtr(key,$descriptor(K *),$argnum, 0);
    538                     if (!CHECK(val)) {
    539                         if (!scm_is_pair(val))
    540                             SWIG_exception(SWIG_TypeError,"alist expected");
    541                         val = SCM_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 = SCM_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             SCM alist = SCM_EOL;
    555             for (std::map<K,T >::reverse_iterator i=$1.rbegin();
    556                                                   i!=$1.rend(); ++i) {
    557                 K* key = new K(i->first);
    558                 SCM k = SWIG_NewPointerObj(key,$descriptor(K *), 1);
    559                 SCM x = CONVERT_TO(i->second);
    560                 SCM entry = scm_cons(k,x);
    561                 alist = scm_cons(entry,alist);
    562             }
    563             $result = alist;
    564         }
    565         %typecheck(SWIG_TYPECHECK_MAP) map<K,T> {
    566             // native sequence?
    567             if (scm_is_null($input)) {
    568                 /* an empty sequence can be of any type */
    569                 $1 = 1;
    570             } else if (scm_is_pair($input)) {
    571                 // check the first element only
    572                 K* k;
    573                 SCM head = SCM_CAR($input);
    574                 if (scm_is_pair(head)) {
    575                     SCM key = SCM_CAR(head);
    576                     SCM val = SCM_CDR(head);
    577                     if (SWIG_ConvertPtr(val,(void **) &k,
    578                                     $descriptor(K *), 0) != 0) {
    579                         $1 = 0;
    580                     } else {
    581                         if (CHECK(val)) {
    582                             $1 = 1;
    583                         } else if (scm_is_pair(val)) {
    584                             val = SCM_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) == 0)
    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 (scm_is_null($input)) {
    610                 /* an empty sequence can be of any type */
    611                 $1 = 1;
    612             } else if (scm_is_pair($input)) {
    613                 // check the first element only
    614                 K* k;
    615                 SCM head = SCM_CAR($input);
    616                 if (scm_is_pair(head)) {
    617                     SCM key = SCM_CAR(head);
    618                     SCM val = SCM_CDR(head);
    619                     if (SWIG_ConvertPtr(val,(void **) &k,
    620                                     $descriptor(K *), 0) != 0) {
    621                         $1 = 0;
    622                     } else {
    623                         if (CHECK(val)) {
    624                             $1 = 1;
    625                         } else if (scm_is_pair(val)) {
    626                             val = SCM_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) == 0)
    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             SCM keys() {
    685                 SCM result = SCM_EOL;
    686                 for (std::map<K,T >::reverse_iterator i=self->rbegin();
    687                                                       i!=self->rend(); ++i) {
    688                     K* key = new K(i->first);
    689                     SCM k = SWIG_NewPointerObj(key,$descriptor(K *), 1);
    690                     result = scm_cons(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 (scm_is_null($input)) {
    703                 $1 = std::map<K,T >();
    704             } else if (scm_is_pair($input)) {
    705                 $1 = std::map<K,T >();
    706                 SCM alist = $input;
    707                 while (!scm_is_null(alist)) {
    708                     SCM entry, key, val;
    709                     entry = SCM_CAR(alist);
    710                     if (!scm_is_pair(entry))
    711                         SWIG_exception(SWIG_TypeError,"alist expected");
    712                     key = SCM_CAR(entry);
    713                     val = SCM_CDR(entry);
    714                     if (!CHECK_K(key))
    715                         SWIG_exception(SWIG_TypeError,
    716                                            "map<" #K "," #T "> expected");
    717                     if (!CHECK_T(val)) {
    718                         if (!scm_is_pair(val))
    719                             SWIG_exception(SWIG_TypeError,"alist expected");
    720                         val = SCM_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 = SCM_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 (scm_is_null($input)) {
    739                 temp = std::map<K,T >();
    740                 $1 = &temp;
    741             } else if (scm_is_pair($input)) {
    742                 temp = std::map<K,T >();
    743                 $1 = &temp;
    744                 SCM alist = $input;
    745                 while (!scm_is_null(alist)) {
    746                     SCM entry, key, val;
    747                     entry = SCM_CAR(alist);
    748                     if (!scm_is_pair(entry))
    749                         SWIG_exception(SWIG_TypeError,"alist expected");
    750                     key = SCM_CAR(entry);
    751                     val = SCM_CDR(entry);
    752                     if (!CHECK_K(key))
    753                         SWIG_exception(SWIG_TypeError,
    754                                            "map<" #K "," #T "> expected");
    755                     if (!CHECK_T(val)) {
    756                         if (!scm_is_pair(val))
    757                             SWIG_exception(SWIG_TypeError,"alist expected");
    758                         val = SCM_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 = SCM_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             SCM alist = SCM_EOL;
    772             for (std::map<K,T >::reverse_iterator i=$1.rbegin();
    773                                                   i!=$1.rend(); ++i) {
    774                 SCM k = CONVERT_K_TO(i->first);
    775                 SCM x = CONVERT_T_TO(i->second);
    776                 SCM entry = scm_cons(k,x);
    777                 alist = scm_cons(entry,alist);
    778             }
    779             $result = alist;
    780         }
    781         %typecheck(SWIG_TYPECHECK_MAP) map<K,T> {
    782             // native sequence?
    783             if (scm_is_null($input)) {
    784                 /* an empty sequence can be of any type */
    785                 $1 = 1;
    786             } else if (scm_is_pair($input)) {
    787                 // check the first element only
    788                 SCM head = SCM_CAR($input);
    789                 if (scm_is_pair(head)) {
    790                     SCM key = SCM_CAR(head);
    791                     SCM val = SCM_CDR(head);
    792                     if (!CHECK_K(key)) {
    793                         $1 = 0;
    794                     } else {
    795                         if (CHECK_T(val)) {
    796                             $1 = 1;
    797                         } else if (scm_is_pair(val)) {
    798                             val = SCM_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) == 0)
    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 (scm_is_null($input)) {
    824                 /* an empty sequence can be of any type */
    825                 $1 = 1;
    826             } else if (scm_is_pair($input)) {
    827                 // check the first element only
    828                 SCM head = SCM_CAR($input);
    829                 if (scm_is_pair(head)) {
    830                     SCM key = SCM_CAR(head);
    831                     SCM val = SCM_CDR(head);
    832                     if (!CHECK_K(key)) {
    833                         $1 = 0;
    834                     } else {
    835                         if (CHECK_T(val)) {
    836                             $1 = 1;
    837                         } else if (scm_is_pair(val)) {
    838                             val = SCM_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) == 0)
    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             SCM keys() {
    897                 SCM result = SCM_EOL;
    898                 for (std::map<K,T >::reverse_iterator i=self->rbegin();
    899                                                       i!=self->rend(); ++i) {
    900                     SCM k = CONVERT_K_TO(i->first);
    901                     result = scm_cons(k,result);
    902                 }
    903                 return result;
    904             }
    905         }
    906     };
    907     %enddef
    908 
    909 
    910     specialize_std_map_on_key(bool,scm_is_bool,
    911                               scm_is_true,SWIG_bool2scm);
    912     specialize_std_map_on_key(int,scm_is_number,
    913                               scm_to_long,scm_from_long);
    914     specialize_std_map_on_key(short,scm_is_number,
    915                               scm_to_long,scm_from_long);
    916     specialize_std_map_on_key(long,scm_is_number,
    917                               scm_to_long,scm_from_long);
    918     specialize_std_map_on_key(unsigned int,scm_is_number,
    919                               scm_to_ulong,scm_from_ulong);
    920     specialize_std_map_on_key(unsigned short,scm_is_number,
    921                               scm_to_ulong,scm_from_ulong);
    922     specialize_std_map_on_key(unsigned long,scm_is_number,
    923                               scm_to_ulong,scm_from_ulong);
    924     specialize_std_map_on_key(double,scm_is_number,
    925                               scm_to_double,scm_from_double);
    926     specialize_std_map_on_key(float,scm_is_number,
    927                               scm_to_double,scm_from_double);
    928     specialize_std_map_on_key(std::string,scm_is_string,
    929                               SWIG_scm2string,SWIG_string2scm);
    930 
    931     specialize_std_map_on_value(bool,scm_is_bool,
    932                                 scm_is_true,SWIG_bool2scm);
    933     specialize_std_map_on_value(int,scm_is_number,
    934                                 scm_to_long,scm_from_long);
    935     specialize_std_map_on_value(short,scm_is_number,
    936                                 scm_to_long,scm_from_long);
    937     specialize_std_map_on_value(long,scm_is_number,
    938                                 scm_to_long,scm_from_long);
    939     specialize_std_map_on_value(unsigned int,scm_is_number,
    940                                 scm_to_ulong,scm_from_ulong);
    941     specialize_std_map_on_value(unsigned short,scm_is_number,
    942                                 scm_to_ulong,scm_from_ulong);
    943     specialize_std_map_on_value(unsigned long,scm_is_number,
    944                                 scm_to_ulong,scm_from_ulong);
    945     specialize_std_map_on_value(double,scm_is_number,
    946                                 scm_to_double,scm_from_double);
    947     specialize_std_map_on_value(float,scm_is_number,
    948                                 scm_to_double,scm_from_double);
    949     specialize_std_map_on_value(std::string,scm_is_string,
    950                                 SWIG_scm2string,SWIG_string2scm);
    951 
    952     specialize_std_map_on_both(bool,scm_is_bool,
    953                                scm_is_true,SWIG_bool2scm,
    954                                bool,scm_is_bool,
    955                                scm_is_true,SWIG_bool2scm);
    956     specialize_std_map_on_both(bool,scm_is_bool,
    957                                scm_is_true,SWIG_bool2scm,
    958                                int,scm_is_number,
    959                                scm_to_long,scm_from_long);
    960     specialize_std_map_on_both(bool,scm_is_bool,
    961                                scm_is_true,SWIG_bool2scm,
    962                                short,scm_is_number,
    963                                scm_to_long,scm_from_long);
    964     specialize_std_map_on_both(bool,scm_is_bool,
    965                                scm_is_true,SWIG_bool2scm,
    966                                long,scm_is_number,
    967                                scm_to_long,scm_from_long);
    968     specialize_std_map_on_both(bool,scm_is_bool,
    969                                scm_is_true,SWIG_bool2scm,
    970                                unsigned int,scm_is_number,
    971                                scm_to_ulong,scm_from_ulong);
    972     specialize_std_map_on_both(bool,scm_is_bool,
    973                                scm_is_true,SWIG_bool2scm,
    974                                unsigned short,scm_is_number,
    975                                scm_to_ulong,scm_from_ulong);
    976     specialize_std_map_on_both(bool,scm_is_bool,
    977                                scm_is_true,SWIG_bool2scm,
    978                                unsigned long,scm_is_number,
    979                                scm_to_ulong,scm_from_ulong);
    980     specialize_std_map_on_both(bool,scm_is_bool,
    981                                scm_is_true,SWIG_bool2scm,
    982                                double,scm_is_number,
    983                                scm_to_double,scm_from_double);
    984     specialize_std_map_on_both(bool,scm_is_bool,
    985                                scm_is_true,SWIG_bool2scm,
    986                                float,scm_is_number,
    987                                scm_to_double,scm_from_double);
    988     specialize_std_map_on_both(bool,scm_is_bool,
    989                                scm_is_true,SWIG_bool2scm,
    990                                std::string,scm_is_string,
    991                                SWIG_scm2string,SWIG_string2scm);
    992     specialize_std_map_on_both(int,scm_is_number,
    993                                scm_to_long,scm_from_long,
    994                                bool,scm_is_bool,
    995                                scm_is_true,SWIG_bool2scm);
    996     specialize_std_map_on_both(int,scm_is_number,
    997                                scm_to_long,scm_from_long,
    998                                int,scm_is_number,
    999                                scm_to_long,scm_from_long);
   1000     specialize_std_map_on_both(int,scm_is_number,
   1001                                scm_to_long,scm_from_long,
   1002                                short,scm_is_number,
   1003                                scm_to_long,scm_from_long);
   1004     specialize_std_map_on_both(int,scm_is_number,
   1005                                scm_to_long,scm_from_long,
   1006                                long,scm_is_number,
   1007                                scm_to_long,scm_from_long);
   1008     specialize_std_map_on_both(int,scm_is_number,
   1009                                scm_to_long,scm_from_long,
   1010                                unsigned int,scm_is_number,
   1011                                scm_to_ulong,scm_from_ulong);
   1012     specialize_std_map_on_both(int,scm_is_number,
   1013                                scm_to_long,scm_from_long,
   1014                                unsigned short,scm_is_number,
   1015                                scm_to_ulong,scm_from_ulong);
   1016     specialize_std_map_on_both(int,scm_is_number,
   1017                                scm_to_long,scm_from_long,
   1018                                unsigned long,scm_is_number,
   1019                                scm_to_ulong,scm_from_ulong);
   1020     specialize_std_map_on_both(int,scm_is_number,
   1021                                scm_to_long,scm_from_long,
   1022                                double,scm_is_number,
   1023                                scm_to_double,scm_from_double);
   1024     specialize_std_map_on_both(int,scm_is_number,
   1025                                scm_to_long,scm_from_long,
   1026                                float,scm_is_number,
   1027                                scm_to_double,scm_from_double);
   1028     specialize_std_map_on_both(int,scm_is_number,
   1029                                scm_to_long,scm_from_long,
   1030                                std::string,scm_is_string,
   1031                                SWIG_scm2string,SWIG_string2scm);
   1032     specialize_std_map_on_both(short,scm_is_number,
   1033                                scm_to_long,scm_from_long,
   1034                                bool,scm_is_bool,
   1035                                scm_is_true,SWIG_bool2scm);
   1036     specialize_std_map_on_both(short,scm_is_number,
   1037                                scm_to_long,scm_from_long,
   1038                                int,scm_is_number,
   1039                                scm_to_long,scm_from_long);
   1040     specialize_std_map_on_both(short,scm_is_number,
   1041                                scm_to_long,scm_from_long,
   1042                                short,scm_is_number,
   1043                                scm_to_long,scm_from_long);
   1044     specialize_std_map_on_both(short,scm_is_number,
   1045                                scm_to_long,scm_from_long,
   1046                                long,scm_is_number,
   1047                                scm_to_long,scm_from_long);
   1048     specialize_std_map_on_both(short,scm_is_number,
   1049                                scm_to_long,scm_from_long,
   1050                                unsigned int,scm_is_number,
   1051                                scm_to_ulong,scm_from_ulong);
   1052     specialize_std_map_on_both(short,scm_is_number,
   1053                                scm_to_long,scm_from_long,
   1054                                unsigned short,scm_is_number,
   1055                                scm_to_ulong,scm_from_ulong);
   1056     specialize_std_map_on_both(short,scm_is_number,
   1057                                scm_to_long,scm_from_long,
   1058                                unsigned long,scm_is_number,
   1059                                scm_to_ulong,scm_from_ulong);
   1060     specialize_std_map_on_both(short,scm_is_number,
   1061                                scm_to_long,scm_from_long,
   1062                                double,scm_is_number,
   1063                                scm_to_double,scm_from_double);
   1064     specialize_std_map_on_both(short,scm_is_number,
   1065                                scm_to_long,scm_from_long,
   1066                                float,scm_is_number,
   1067                                scm_to_double,scm_from_double);
   1068     specialize_std_map_on_both(short,scm_is_number,
   1069                                scm_to_long,scm_from_long,
   1070                                std::string,scm_is_string,
   1071                                SWIG_scm2string,SWIG_string2scm);
   1072     specialize_std_map_on_both(long,scm_is_number,
   1073                                scm_to_long,scm_from_long,
   1074                                bool,scm_is_bool,
   1075                                scm_is_true,SWIG_bool2scm);
   1076     specialize_std_map_on_both(long,scm_is_number,
   1077                                scm_to_long,scm_from_long,
   1078                                int,scm_is_number,
   1079                                scm_to_long,scm_from_long);
   1080     specialize_std_map_on_both(long,scm_is_number,
   1081                                scm_to_long,scm_from_long,
   1082                                short,scm_is_number,
   1083                                scm_to_long,scm_from_long);
   1084     specialize_std_map_on_both(long,scm_is_number,
   1085                                scm_to_long,scm_from_long,
   1086                                long,scm_is_number,
   1087                                scm_to_long,scm_from_long);
   1088     specialize_std_map_on_both(long,scm_is_number,
   1089                                scm_to_long,scm_from_long,
   1090                                unsigned int,scm_is_number,
   1091                                scm_to_ulong,scm_from_ulong);
   1092     specialize_std_map_on_both(long,scm_is_number,
   1093                                scm_to_long,scm_from_long,
   1094                                unsigned short,scm_is_number,
   1095                                scm_to_ulong,scm_from_ulong);
   1096     specialize_std_map_on_both(long,scm_is_number,
   1097                                scm_to_long,scm_from_long,
   1098                                unsigned long,scm_is_number,
   1099                                scm_to_ulong,scm_from_ulong);
   1100     specialize_std_map_on_both(long,scm_is_number,
   1101                                scm_to_long,scm_from_long,
   1102                                double,scm_is_number,
   1103                                scm_to_double,scm_from_double);
   1104     specialize_std_map_on_both(long,scm_is_number,
   1105                                scm_to_long,scm_from_long,
   1106                                float,scm_is_number,
   1107                                scm_to_double,scm_from_double);
   1108     specialize_std_map_on_both(long,scm_is_number,
   1109                                scm_to_long,scm_from_long,
   1110                                std::string,scm_is_string,
   1111                                SWIG_scm2string,SWIG_string2scm);
   1112     specialize_std_map_on_both(unsigned int,scm_is_number,
   1113                                scm_to_ulong,scm_from_ulong,
   1114                                bool,scm_is_bool,
   1115                                scm_is_true,SWIG_bool2scm);
   1116     specialize_std_map_on_both(unsigned int,scm_is_number,
   1117                                scm_to_ulong,scm_from_ulong,
   1118                                int,scm_is_number,
   1119                                scm_to_long,scm_from_long);
   1120     specialize_std_map_on_both(unsigned int,scm_is_number,
   1121                                scm_to_ulong,scm_from_ulong,
   1122                                short,scm_is_number,
   1123                                scm_to_long,scm_from_long);
   1124     specialize_std_map_on_both(unsigned int,scm_is_number,
   1125                                scm_to_ulong,scm_from_ulong,
   1126                                long,scm_is_number,
   1127                                scm_to_long,scm_from_long);
   1128     specialize_std_map_on_both(unsigned int,scm_is_number,
   1129                                scm_to_ulong,scm_from_ulong,
   1130                                unsigned int,scm_is_number,
   1131                                scm_to_ulong,scm_from_ulong);
   1132     specialize_std_map_on_both(unsigned int,scm_is_number,
   1133                                scm_to_ulong,scm_from_ulong,
   1134                                unsigned short,scm_is_number,
   1135                                scm_to_ulong,scm_from_ulong);
   1136     specialize_std_map_on_both(unsigned int,scm_is_number,
   1137                                scm_to_ulong,scm_from_ulong,
   1138                                unsigned long,scm_is_number,
   1139                                scm_to_ulong,scm_from_ulong);
   1140     specialize_std_map_on_both(unsigned int,scm_is_number,
   1141                                scm_to_ulong,scm_from_ulong,
   1142                                double,scm_is_number,
   1143                                scm_to_double,scm_from_double);
   1144     specialize_std_map_on_both(unsigned int,scm_is_number,
   1145                                scm_to_ulong,scm_from_ulong,
   1146                                float,scm_is_number,
   1147                                scm_to_double,scm_from_double);
   1148     specialize_std_map_on_both(unsigned int,scm_is_number,
   1149                                scm_to_ulong,scm_from_ulong,
   1150                                std::string,scm_is_string,
   1151                                SWIG_scm2string,SWIG_string2scm);
   1152     specialize_std_map_on_both(unsigned short,scm_is_number,
   1153                                scm_to_ulong,scm_from_ulong,
   1154                                bool,scm_is_bool,
   1155                                scm_is_true,SWIG_bool2scm);
   1156     specialize_std_map_on_both(unsigned short,scm_is_number,
   1157                                scm_to_ulong,scm_from_ulong,
   1158                                int,scm_is_number,
   1159                                scm_to_long,scm_from_long);
   1160     specialize_std_map_on_both(unsigned short,scm_is_number,
   1161                                scm_to_ulong,scm_from_ulong,
   1162                                short,scm_is_number,
   1163                                scm_to_long,scm_from_long);
   1164     specialize_std_map_on_both(unsigned short,scm_is_number,
   1165                                scm_to_ulong,scm_from_ulong,
   1166                                long,scm_is_number,
   1167                                scm_to_long,scm_from_long);
   1168     specialize_std_map_on_both(unsigned short,scm_is_number,
   1169                                scm_to_ulong,scm_from_ulong,
   1170                                unsigned int,scm_is_number,
   1171                                scm_to_ulong,scm_from_ulong);
   1172     specialize_std_map_on_both(unsigned short,scm_is_number,
   1173                                scm_to_ulong,scm_from_ulong,
   1174                                unsigned short,scm_is_number,
   1175                                scm_to_ulong,scm_from_ulong);
   1176     specialize_std_map_on_both(unsigned short,scm_is_number,
   1177                                scm_to_ulong,scm_from_ulong,
   1178                                unsigned long,scm_is_number,
   1179                                scm_to_ulong,scm_from_ulong);
   1180     specialize_std_map_on_both(unsigned short,scm_is_number,
   1181                                scm_to_ulong,scm_from_ulong,
   1182                                double,scm_is_number,
   1183                                scm_to_double,scm_from_double);
   1184     specialize_std_map_on_both(unsigned short,scm_is_number,
   1185                                scm_to_ulong,scm_from_ulong,
   1186                                float,scm_is_number,
   1187                                scm_to_double,scm_from_double);
   1188     specialize_std_map_on_both(unsigned short,scm_is_number,
   1189                                scm_to_ulong,scm_from_ulong,
   1190                                std::string,scm_is_string,
   1191                                SWIG_scm2string,SWIG_string2scm);
   1192     specialize_std_map_on_both(unsigned long,scm_is_number,
   1193                                scm_to_ulong,scm_from_ulong,
   1194                                bool,scm_is_bool,
   1195                                scm_is_true,SWIG_bool2scm);
   1196     specialize_std_map_on_both(unsigned long,scm_is_number,
   1197                                scm_to_ulong,scm_from_ulong,
   1198                                int,scm_is_number,
   1199                                scm_to_long,scm_from_long);
   1200     specialize_std_map_on_both(unsigned long,scm_is_number,
   1201                                scm_to_ulong,scm_from_ulong,
   1202                                short,scm_is_number,
   1203                                scm_to_long,scm_from_long);
   1204     specialize_std_map_on_both(unsigned long,scm_is_number,
   1205                                scm_to_ulong,scm_from_ulong,
   1206                                long,scm_is_number,
   1207                                scm_to_long,scm_from_long);
   1208     specialize_std_map_on_both(unsigned long,scm_is_number,
   1209                                scm_to_ulong,scm_from_ulong,
   1210                                unsigned int,scm_is_number,
   1211                                scm_to_ulong,scm_from_ulong);
   1212     specialize_std_map_on_both(unsigned long,scm_is_number,
   1213                                scm_to_ulong,scm_from_ulong,
   1214                                unsigned short,scm_is_number,
   1215                                scm_to_ulong,scm_from_ulong);
   1216     specialize_std_map_on_both(unsigned long,scm_is_number,
   1217                                scm_to_ulong,scm_from_ulong,
   1218                                unsigned long,scm_is_number,
   1219                                scm_to_ulong,scm_from_ulong);
   1220     specialize_std_map_on_both(unsigned long,scm_is_number,
   1221                                scm_to_ulong,scm_from_ulong,
   1222                                double,scm_is_number,
   1223                                scm_to_double,scm_from_double);
   1224     specialize_std_map_on_both(unsigned long,scm_is_number,
   1225                                scm_to_ulong,scm_from_ulong,
   1226                                float,scm_is_number,
   1227                                scm_to_double,scm_from_double);
   1228     specialize_std_map_on_both(unsigned long,scm_is_number,
   1229                                scm_to_ulong,scm_from_ulong,
   1230                                std::string,scm_is_string,
   1231                                SWIG_scm2string,SWIG_string2scm);
   1232     specialize_std_map_on_both(double,scm_is_number,
   1233                                scm_to_double,scm_from_double,
   1234                                bool,scm_is_bool,
   1235                                scm_is_true,SWIG_bool2scm);
   1236     specialize_std_map_on_both(double,scm_is_number,
   1237                                scm_to_double,scm_from_double,
   1238                                int,scm_is_number,
   1239                                scm_to_long,scm_from_long);
   1240     specialize_std_map_on_both(double,scm_is_number,
   1241                                scm_to_double,scm_from_double,
   1242                                short,scm_is_number,
   1243                                scm_to_long,scm_from_long);
   1244     specialize_std_map_on_both(double,scm_is_number,
   1245                                scm_to_double,scm_from_double,
   1246                                long,scm_is_number,
   1247                                scm_to_long,scm_from_long);
   1248     specialize_std_map_on_both(double,scm_is_number,
   1249                                scm_to_double,scm_from_double,
   1250                                unsigned int,scm_is_number,
   1251                                scm_to_ulong,scm_from_ulong);
   1252     specialize_std_map_on_both(double,scm_is_number,
   1253                                scm_to_double,scm_from_double,
   1254                                unsigned short,scm_is_number,
   1255                                scm_to_ulong,scm_from_ulong);
   1256     specialize_std_map_on_both(double,scm_is_number,
   1257                                scm_to_double,scm_from_double,
   1258                                unsigned long,scm_is_number,
   1259                                scm_to_ulong,scm_from_ulong);
   1260     specialize_std_map_on_both(double,scm_is_number,
   1261                                scm_to_double,scm_from_double,
   1262                                double,scm_is_number,
   1263                                scm_to_double,scm_from_double);
   1264     specialize_std_map_on_both(double,scm_is_number,
   1265                                scm_to_double,scm_from_double,
   1266                                float,scm_is_number,
   1267                                scm_to_double,scm_from_double);
   1268     specialize_std_map_on_both(double,scm_is_number,
   1269                                scm_to_double,scm_from_double,
   1270                                std::string,scm_is_string,
   1271                                SWIG_scm2string,SWIG_string2scm);
   1272     specialize_std_map_on_both(float,scm_is_number,
   1273                                scm_to_double,scm_from_double,
   1274                                bool,scm_is_bool,
   1275                                scm_is_true,SWIG_bool2scm);
   1276     specialize_std_map_on_both(float,scm_is_number,
   1277                                scm_to_double,scm_from_double,
   1278                                int,scm_is_number,
   1279                                scm_to_long,scm_from_long);
   1280     specialize_std_map_on_both(float,scm_is_number,
   1281                                scm_to_double,scm_from_double,
   1282                                short,scm_is_number,
   1283                                scm_to_long,scm_from_long);
   1284     specialize_std_map_on_both(float,scm_is_number,
   1285                                scm_to_double,scm_from_double,
   1286                                long,scm_is_number,
   1287                                scm_to_long,scm_from_long);
   1288     specialize_std_map_on_both(float,scm_is_number,
   1289                                scm_to_double,scm_from_double,
   1290                                unsigned int,scm_is_number,
   1291                                scm_to_ulong,scm_from_ulong);
   1292     specialize_std_map_on_both(float,scm_is_number,
   1293                                scm_to_double,scm_from_double,
   1294                                unsigned short,scm_is_number,
   1295                                scm_to_ulong,scm_from_ulong);
   1296     specialize_std_map_on_both(float,scm_is_number,
   1297                                scm_to_double,scm_from_double,
   1298                                unsigned long,scm_is_number,
   1299                                scm_to_ulong,scm_from_ulong);
   1300     specialize_std_map_on_both(float,scm_is_number,
   1301                                scm_to_double,scm_from_double,
   1302                                double,scm_is_number,
   1303                                scm_to_double,scm_from_double);
   1304     specialize_std_map_on_both(float,scm_is_number,
   1305                                scm_to_double,scm_from_double,
   1306                                float,scm_is_number,
   1307                                scm_to_double,scm_from_double);
   1308     specialize_std_map_on_both(float,scm_is_number,
   1309                                scm_to_double,scm_from_double,
   1310                                std::string,scm_is_string,
   1311                                SWIG_scm2string,SWIG_string2scm);
   1312     specialize_std_map_on_both(std::string,scm_is_string,
   1313                                SWIG_scm2string,SWIG_string2scm,
   1314                                bool,scm_is_bool,
   1315                                scm_is_true,SWIG_bool2scm);
   1316     specialize_std_map_on_both(std::string,scm_is_string,
   1317                                SWIG_scm2string,SWIG_string2scm,
   1318                                int,scm_is_number,
   1319                                scm_to_long,scm_from_long);
   1320     specialize_std_map_on_both(std::string,scm_is_string,
   1321                                SWIG_scm2string,SWIG_string2scm,
   1322                                short,scm_is_number,
   1323                                scm_to_long,scm_from_long);
   1324     specialize_std_map_on_both(std::string,scm_is_string,
   1325                                SWIG_scm2string,SWIG_string2scm,
   1326                                long,scm_is_number,
   1327                                scm_to_long,scm_from_long);
   1328     specialize_std_map_on_both(std::string,scm_is_string,
   1329                                SWIG_scm2string,SWIG_string2scm,
   1330                                unsigned int,scm_is_number,
   1331                                scm_to_ulong,scm_from_ulong);
   1332     specialize_std_map_on_both(std::string,scm_is_string,
   1333                                SWIG_scm2string,SWIG_string2scm,
   1334                                unsigned short,scm_is_number,
   1335                                scm_to_ulong,scm_from_ulong);
   1336     specialize_std_map_on_both(std::string,scm_is_string,
   1337                                SWIG_scm2string,SWIG_string2scm,
   1338                                unsigned long,scm_is_number,
   1339                                scm_to_ulong,scm_from_ulong);
   1340     specialize_std_map_on_both(std::string,scm_is_string,
   1341                                SWIG_scm2string,SWIG_string2scm,
   1342                                double,scm_is_number,
   1343                                scm_to_double,scm_from_double);
   1344     specialize_std_map_on_both(std::string,scm_is_string,
   1345                                SWIG_scm2string,SWIG_string2scm,
   1346                                float,scm_is_number,
   1347                                scm_to_double,scm_from_double);
   1348     specialize_std_map_on_both(std::string,scm_is_string,
   1349                                SWIG_scm2string,SWIG_string2scm,
   1350                                std::string,scm_is_string,
   1351                                SWIG_scm2string,SWIG_string2scm);
   1352 }
   1353