Home | History | Annotate | Download | only in allegrocl
      1 /* -----------------------------------------------------------------------------
      2  * longlongs.i
      3  *
      4  * Typemap addition for support of 'long long' type and 'unsigned long long
      5  * Makes use of swig-def-foreign-class, so this header should be loaded
      6  * after allegrocl.swg and after any custom user identifier-conversion
      7  * functions have been defined.
      8  * ----------------------------------------------------------------------------- */
      9 
     10 #ifdef Acl64Bit
     11 %typemap(ctype) long long, unsigned long long "$1_ltype";
     12 %typemap(out) long long, unsigned long long "$result = $1;";
     13 
     14 %typemap(ffitype) long long ":nat";
     15 %typemap(ffitype) unsigned long long ":unsigned-nat";
     16 
     17 %typemap(lout) long long, unsigned long long "  #+64bit (cl::setq ACL_ffresult $body)";
     18 
     19 #else
     20 %typemap(out) long long, unsigned long long "$result = &$1;";
     21 %typemap(ffitype) long long "(:struct (l1 :long) (l2 :long))";
     22 
     23 %typemap(ffitype) unsigned long long "(:struct (l1 :unsigned-long) (l2 :unsigned-long))";
     24 
     25 %typemap(lout) long long
     26 "  (cl::setq ACL_ffresult (make-instance '#.(swig-insert-id \"longlong\" () :type :class)
     27                   :foreign-address $body))";
     28 
     29 %typemap(lout) unsigned long long
     30 "  (cl:setq ACL_ffresult (make-instance '#.(swig-insert-id \"ulonglong\" () :type :class)
     31                   :foreign-address $body))";
     32 
     33 #endif
     34 
     35 %typemap(in) long long, unsigned long long "$1 = $input;";
     36 
     37 
     38 %insert("lisphead") %{
     39 
     40 #-64bit
     41 (swig-def-foreign-class "longlong"
     42  (ff:foreign-pointer)
     43  (:struct (l1 :long) (l2 :long)))
     44 
     45 #-64bit
     46 (swig-def-foreign-class "ulonglong"
     47  (ff:foreign-pointer)
     48  (:struct (l1 :unsigned-long) (l2 :unsigned-long)))
     49 %}
     50