go-libwebp

Experimental translation from libwebp to Go source.
Log | Files | Refs | README | LICENSE

libwebp_go_wrap.c (6542B)


      1 /* ----------------------------------------------------------------------------
      2  * This file was automatically generated by SWIG (http://www.swig.org).
      3  * Version 2.0.10
      4  *
      5  * This file is not intended to be easily readable and contains a number of
      6  * coding conventions designed to improve portability and efficiency. Do not make
      7  * changes to this file unless you know what you are doing--modify the SWIG
      8  * interface file instead.
      9  * ----------------------------------------------------------------------------- */
     10 #define SWIGMODULE libwebp
     11 /* -----------------------------------------------------------------------------
     12  *  This section contains generic SWIG labels for method/variable
     13  *  declarations/attributes, and other compiler dependent labels.
     14  * ----------------------------------------------------------------------------- */
     15 
     16 /* template workaround for compilers that cannot correctly implement the C++ standard */
     17 #ifndef SWIGTEMPLATEDISAMBIGUATOR
     18 # if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560)
     19 #  define SWIGTEMPLATEDISAMBIGUATOR template
     20 # elif defined(__HP_aCC)
     21 /* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */
     22 /* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */
     23 #  define SWIGTEMPLATEDISAMBIGUATOR template
     24 # else
     25 #  define SWIGTEMPLATEDISAMBIGUATOR
     26 # endif
     27 #endif
     28 
     29 /* inline attribute */
     30 #ifndef SWIGINLINE
     31 # if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__))
     32 #   define SWIGINLINE inline
     33 # else
     34 #   define SWIGINLINE
     35 # endif
     36 #endif
     37 
     38 /* attribute recognised by some compilers to avoid 'unused' warnings */
     39 #ifndef SWIGUNUSED
     40 # if defined(__GNUC__)
     41 #   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
     42 #     define SWIGUNUSED __attribute__ ((__unused__))
     43 #   else
     44 #     define SWIGUNUSED
     45 #   endif
     46 # elif defined(__ICC)
     47 #   define SWIGUNUSED __attribute__ ((__unused__))
     48 # else
     49 #   define SWIGUNUSED
     50 # endif
     51 #endif
     52 
     53 #ifndef SWIG_MSC_UNSUPPRESS_4505
     54 # if defined(_MSC_VER)
     55 #   pragma warning(disable : 4505) /* unreferenced local function has been removed */
     56 # endif
     57 #endif
     58 
     59 #ifndef SWIGUNUSEDPARM
     60 # ifdef __cplusplus
     61 #   define SWIGUNUSEDPARM(p)
     62 # else
     63 #   define SWIGUNUSEDPARM(p) p SWIGUNUSED
     64 # endif
     65 #endif
     66 
     67 /* internal SWIG method */
     68 #ifndef SWIGINTERN
     69 # define SWIGINTERN static SWIGUNUSED
     70 #endif
     71 
     72 /* internal inline SWIG method */
     73 #ifndef SWIGINTERNINLINE
     74 # define SWIGINTERNINLINE SWIGINTERN SWIGINLINE
     75 #endif
     76 
     77 /* exporting methods */
     78 #if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
     79 #  ifndef GCC_HASCLASSVISIBILITY
     80 #    define GCC_HASCLASSVISIBILITY
     81 #  endif
     82 #endif
     83 
     84 #ifndef SWIGEXPORT
     85 # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
     86 #   if defined(STATIC_LINKED)
     87 #     define SWIGEXPORT
     88 #   else
     89 #     define SWIGEXPORT __declspec(dllexport)
     90 #   endif
     91 # else
     92 #   if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY)
     93 #     define SWIGEXPORT __attribute__ ((visibility("default")))
     94 #   else
     95 #     define SWIGEXPORT
     96 #   endif
     97 # endif
     98 #endif
     99 
    100 /* calling conventions for Windows */
    101 #ifndef SWIGSTDCALL
    102 # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
    103 #   define SWIGSTDCALL __stdcall
    104 # else
    105 #   define SWIGSTDCALL
    106 # endif
    107 #endif
    108 
    109 /* Deal with Microsoft's attempt at deprecating C standard runtime functions */
    110 #if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE)
    111 # define _CRT_SECURE_NO_DEPRECATE
    112 #endif
    113 
    114 /* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */
    115 #if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE)
    116 # define _SCL_SECURE_NO_DEPRECATE
    117 #endif
    118 
    119 
    120 
    121 #include <stddef.h>
    122 #include <stdio.h>
    123 #include <stdlib.h>
    124 #include <string.h>
    125 #include <sys/types.h>
    126 
    127 
    128 
    129 typedef long long intgo;
    130 typedef unsigned long long uintgo;
    131 
    132 
    133 
    134 typedef struct { char *p; intgo n; } _gostring_;
    135 typedef struct { void* array; intgo len; intgo cap; } _goslice_;
    136 
    137 
    138 
    139 
    140 #define swiggo_size_assert_eq(x, y, name) typedef char name[(x-y)*(x-y)*-2+1];
    141 #define swiggo_size_assert(t, n) swiggo_size_assert_eq(sizeof(t), n, swiggo_sizeof_##t##_is_not_##n)
    142 
    143 swiggo_size_assert(char, 1)
    144 swiggo_size_assert(short, 2)
    145 swiggo_size_assert(int, 4)
    146 typedef long long swiggo_long_long;
    147 swiggo_size_assert(swiggo_long_long, 8)
    148 swiggo_size_assert(float, 4)
    149 swiggo_size_assert(double, 8)
    150 
    151 #ifdef __cplusplus
    152 extern "C" {
    153 #endif
    154 extern void crosscall2(void (*fn)(void *, int), void *, int);
    155 extern void _cgo_allocate(void *, int);
    156 extern void _cgo_panic(void *, int);
    157 #ifdef __cplusplus
    158 }
    159 #endif
    160 
    161 static void *_swig_goallocate(size_t len) {
    162   struct {
    163     size_t len;
    164     void *ret;
    165   } a;
    166   a.len = len;
    167   crosscall2(_cgo_allocate, &a, (int) sizeof a);
    168   return a.ret;
    169 }
    170 
    171 static void _swig_gopanic(const char *p) {
    172   struct {
    173     const char *p;
    174   } a;
    175   a.p = p;
    176   crosscall2(_cgo_panic, &a, (int) sizeof a);
    177 }
    178 
    179 
    180 
    181 
    182 static _gostring_ _swig_makegostring(const char *p, size_t l) {
    183   _gostring_ ret;
    184   ret.p = (char*)_swig_goallocate(l + 1);
    185   memcpy(ret.p, p, l);
    186   ret.n = l;
    187   return ret;
    188 }
    189 
    190 #define SWIG_contract_assert(expr, msg) \
    191   if (!(expr)) { _swig_gopanic(msg); } else
    192 
    193 
    194 #define SWIG_exception(code, msg) _swig_gopanic(msg)
    195 
    196 
    197 #include "webp/decode.h"
    198 #include "webp/encode.h"
    199 #include "webp/types.h"
    200 
    201 #ifdef __cplusplus
    202 extern "C" {
    203 #endif
    204 
    205 void
    206 _wrap_WebPGetDecoderVersion(void *swig_v)
    207 {
    208   int result;
    209 
    210   struct swigargs {
    211     long : 0;
    212     intgo result;
    213   } *swig_a = (struct swigargs *) swig_v;
    214 
    215 
    216   result = (int)WebPGetDecoderVersion();
    217   swig_a->result = result;
    218 }
    219 
    220 
    221 void
    222 _wrap_wrapped_WebPGetInfo(void *swig_v)
    223 {
    224   uint8_t *arg1 = (uint8_t *) 0 ;
    225   size_t arg2 ;
    226   int *arg3 = (int *) 0 ;
    227   int *arg4 = (int *) 0 ;
    228   int temp3 ;
    229   int temp4 ;
    230   int result;
    231 
    232   struct swigargs {
    233     _gostring_ arg1;
    234     _goslice_ arg3;
    235     _goslice_ arg4;
    236     long : 0;
    237     intgo result;
    238   } *swig_a = (struct swigargs *) swig_v;
    239 
    240 
    241   arg1 = (uint8_t *)swig_a->arg1.p;
    242   arg2 = (size_t)swig_a->arg1.n;
    243 
    244   {
    245     if (swig_a->arg3.len == 0) {
    246       _swig_gopanic("array must contain at least 1 element");
    247     }
    248     arg3 = &temp3;
    249   }
    250   {
    251     if (swig_a->arg4.len == 0) {
    252       _swig_gopanic("array must contain at least 1 element");
    253     }
    254     arg4 = &temp4;
    255   }
    256 
    257   result = (int)WebPGetInfo((uint8_t const *)arg1,arg2,arg3,arg4);
    258   swig_a->result = result;
    259   {
    260     int* a = (int *) swig_a->arg3.array;
    261     a[0] = temp3;
    262   }
    263   {
    264     int* a = (int *) swig_a->arg4.array;
    265     a[0] = temp4;
    266   }
    267 
    268 
    269 }
    270 
    271 
    272 #ifdef __cplusplus
    273 }
    274 #endif
    275