Last active
June 4, 2016 12:28
-
-
Save ng420/aff44b75bc67119c33502fb8c640e3a0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* ---------------------------------------------------------------------------- | |
* This file was automatically generated by SWIG (http://www.swig.org). | |
* Version 3.0.9 | |
* | |
* This file is not intended to be easily readable and contains a number of | |
* coding conventions designed to improve portability and efficiency. Do not make | |
* changes to this file unless you know what you are doing--modify the SWIG | |
* interface file instead. | |
* ----------------------------------------------------------------------------- */ | |
#ifdef __cplusplus | |
/* SwigValueWrapper is described in swig.swg */ | |
template<typename T> class SwigValueWrapper { | |
struct SwigMovePointer { | |
T *ptr; | |
SwigMovePointer(T *p) : ptr(p) { } | |
~SwigMovePointer() { delete ptr; } | |
SwigMovePointer& operator=(SwigMovePointer& rhs) { T* oldptr = ptr; ptr = 0; delete oldptr; ptr = rhs.ptr; rhs.ptr = 0; return *this; } | |
} pointer; | |
SwigValueWrapper& operator=(const SwigValueWrapper<T>& rhs); | |
SwigValueWrapper(const SwigValueWrapper<T>& rhs); | |
public: | |
SwigValueWrapper() : pointer(0) { } | |
SwigValueWrapper& operator=(const T& t) { SwigMovePointer tmp(new T(t)); pointer = tmp; return *this; } | |
operator T&() const { return *pointer.ptr; } | |
T *operator&() { return pointer.ptr; } | |
}; | |
template <typename T> T SwigValueInit() { | |
return T(); | |
} | |
#endif | |
/* ----------------------------------------------------------------------------- | |
* This section contains generic SWIG labels for method/variable | |
* declarations/attributes, and other compiler dependent labels. | |
* ----------------------------------------------------------------------------- */ | |
/* template workaround for compilers that cannot correctly implement the C++ standard */ | |
#ifndef SWIGTEMPLATEDISAMBIGUATOR | |
# if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560) | |
# define SWIGTEMPLATEDISAMBIGUATOR template | |
# elif defined(__HP_aCC) | |
/* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */ | |
/* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */ | |
# define SWIGTEMPLATEDISAMBIGUATOR template | |
# else | |
# define SWIGTEMPLATEDISAMBIGUATOR | |
# endif | |
#endif | |
/* inline attribute */ | |
#ifndef SWIGINLINE | |
# if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__)) | |
# define SWIGINLINE inline | |
# else | |
# define SWIGINLINE | |
# endif | |
#endif | |
/* attribute recognised by some compilers to avoid 'unused' warnings */ | |
#ifndef SWIGUNUSED | |
# if defined(__GNUC__) | |
# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) | |
# define SWIGUNUSED __attribute__ ((__unused__)) | |
# else | |
# define SWIGUNUSED | |
# endif | |
# elif defined(__ICC) | |
# define SWIGUNUSED __attribute__ ((__unused__)) | |
# else | |
# define SWIGUNUSED | |
# endif | |
#endif | |
#ifndef SWIG_MSC_UNSUPPRESS_4505 | |
# if defined(_MSC_VER) | |
# pragma warning(disable : 4505) /* unreferenced local function has been removed */ | |
# endif | |
#endif | |
#ifndef SWIGUNUSEDPARM | |
# ifdef __cplusplus | |
# define SWIGUNUSEDPARM(p) | |
# else | |
# define SWIGUNUSEDPARM(p) p SWIGUNUSED | |
# endif | |
#endif | |
/* internal SWIG method */ | |
#ifndef SWIGINTERN | |
# define SWIGINTERN static SWIGUNUSED | |
#endif | |
/* internal inline SWIG method */ | |
#ifndef SWIGINTERNINLINE | |
# define SWIGINTERNINLINE SWIGINTERN SWIGINLINE | |
#endif | |
/* exporting methods */ | |
#if defined(__GNUC__) | |
# if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) | |
# ifndef GCC_HASCLASSVISIBILITY | |
# define GCC_HASCLASSVISIBILITY | |
# endif | |
# endif | |
#endif | |
#ifndef SWIGEXPORT | |
# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) | |
# if defined(STATIC_LINKED) | |
# define SWIGEXPORT | |
# else | |
# define SWIGEXPORT __declspec(dllexport) | |
# endif | |
# else | |
# if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY) | |
# define SWIGEXPORT __attribute__ ((visibility("default"))) | |
# else | |
# define SWIGEXPORT | |
# endif | |
# endif | |
#endif | |
/* calling conventions for Windows */ | |
#ifndef SWIGSTDCALL | |
# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) | |
# define SWIGSTDCALL __stdcall | |
# else | |
# define SWIGSTDCALL | |
# endif | |
#endif | |
/* Deal with Microsoft's attempt at deprecating C standard runtime functions */ | |
#if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE) | |
# define _CRT_SECURE_NO_DEPRECATE | |
#endif | |
/* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */ | |
#if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE) | |
# define _SCL_SECURE_NO_DEPRECATE | |
#endif | |
/* Deal with Apple's deprecated 'AssertMacros.h' from Carbon-framework */ | |
#if defined(__APPLE__) && !defined(__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES) | |
# define __ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES 0 | |
#endif | |
/* Intel's compiler complains if a variable which was never initialised is | |
* cast to void, which is a common idiom which we use to indicate that we | |
* are aware a variable isn't used. So we just silence that warning. | |
* See: https://github.com/swig/swig/issues/192 for more discussion. | |
*/ | |
#ifdef __INTEL_COMPILER | |
# pragma warning disable 592 | |
#endif | |
#include "hphp/runtime/ext/extension.h" | |
#include "hphp/runtime/base/execution-context.h" | |
#include "hphp/runtime/vm/native-data.h" | |
extern int fact(int n); | |
extern int my_mod(int x, int y, char z); | |
extern int my_mod(int x, int y); | |
extern void print_pair(int x, int y); | |
extern void overprint(int x); | |
extern void overprint(int x, int y); | |
namespace HPHP { | |
int64_t _wrap_fact(int64_t targ1) { | |
int arg1 ; | |
int64_t tresult ; | |
int result; | |
arg1 = (int)targ1; | |
result = (int)fact(arg1); | |
tresult = result; | |
return tresult; | |
} | |
int64_t _wrap_my_mod__SWIG_0(int64_t targ1, int64_t targ2, const String& targ3) { | |
int arg1 ; | |
int arg2 ; | |
char arg3 ; | |
int64_t tresult ; | |
int result; | |
arg1 = (int)targ1; | |
arg2 = (int)targ2; | |
{ | |
if (targ3.length() != 1) { | |
throw std::runtime_error("Expecting a string of length 1.\n"); | |
} | |
arg3 = targ3[0]; | |
} | |
result = (int)my_mod(arg1,arg2,arg3); | |
tresult = result; | |
return tresult; | |
} | |
int64_t _wrap_my_mod__SWIG_1(int64_t targ1, int64_t targ2) { | |
int arg1 ; | |
int arg2 ; | |
int64_t tresult ; | |
int result; | |
arg1 = (int)targ1; | |
arg2 = (int)targ2; | |
result = (int)my_mod(arg1,arg2); | |
tresult = result; | |
return tresult; | |
} | |
void _wrap_print_pair(int64_t targ1, int64_t targ2) { | |
int arg1 ; | |
int arg2 ; | |
arg1 = (int)targ1; | |
arg2 = (int)targ2; | |
print_pair(arg1,arg2); | |
} | |
void _wrap_overprint__SWIG_0(int64_t targ1) { | |
int arg1 ; | |
arg1 = (int)targ1; | |
overprint(arg1); | |
} | |
void _wrap_overprint__SWIG_1(int64_t targ1, int64_t targ2) { | |
int arg1 ; | |
int arg2 ; | |
arg1 = (int)targ1; | |
arg2 = (int)targ2; | |
overprint(arg1,arg2); | |
} | |
int64_t HHVM_FUNCTION(fact, int64_t arg1) { | |
return _wrap_fact(arg1); | |
} | |
Variant HHVM_FUNCTION(my_mod, const Array& argv) { | |
int argc; | |
Variant result; | |
argc = argv.size(); | |
if (argc == 2) { | |
bool _v; | |
int64_t targ0; | |
_v = argv[0].isInteger(); | |
if (_v) targ0 = argv[0].toInt64Val(); | |
if (_v) { | |
int64_t targ1; | |
_v = argv[1].isInteger(); | |
if (_v) targ1 = argv[1].toInt64Val(); | |
if (_v) { | |
return _wrap_my_mod__SWIG_1(targ0, targ1); | |
} | |
} | |
} | |
if (argc == 3) { | |
bool _v; | |
int64_t targ0; | |
_v = argv[0].isInteger(); | |
if (_v) targ0 = argv[0].toInt64Val(); | |
if (_v) { | |
int64_t targ1; | |
_v = argv[1].isInteger(); | |
if (_v) targ1 = argv[1].toInt64Val(); | |
if (_v) { | |
String targ2; | |
_v = (argv[2].isString() && argv[2].toString().length() == 1); | |
if (_v) targ2 = argv[2].toString(); | |
if (_v) { | |
return _wrap_my_mod__SWIG_0(targ0, targ1, targ2); | |
} | |
} | |
} | |
} | |
throw "No matching function for overloaded 'my_mod'"; | |
} | |
void HHVM_FUNCTION(print_pair, int64_t arg1, int64_t arg2) { | |
_wrap_print_pair(arg1, arg2); | |
} | |
Variant HHVM_FUNCTION(overprint, const Array& argv) { | |
int argc; | |
Variant result; | |
argc = argv.size(); | |
if (argc == 1) { | |
bool _v; | |
int64_t targ0; | |
_v = argv[0].isInteger(); | |
if (_v) targ0 = argv[0].toInt64Val(); | |
if (_v) { | |
_wrap_overprint__SWIG_0(targ0); | |
} | |
} | |
if (argc == 2) { | |
bool _v; | |
int64_t targ0; | |
_v = argv[0].isInteger(); | |
if (_v) targ0 = argv[0].toInt64Val(); | |
if (_v) { | |
int64_t targ1; | |
_v = argv[1].isInteger(); | |
if (_v) targ1 = argv[1].toInt64Val(); | |
if (_v) { | |
_wrap_overprint__SWIG_1(targ0, targ1); | |
} | |
} | |
} | |
throw "No matching function for overloaded 'overprint'"; | |
} | |
class EXAMPLEExtension : public Extension { | |
public: | |
EXAMPLEExtension(): Extension("example", "1.0") {} | |
void moduleInit() override { | |
HHVM_FE(fact); | |
HHVM_FE(my_mod); | |
HHVM_FE(print_pair); | |
HHVM_FE(overprint); | |
loadSystemlib(); | |
} | |
} s_example_extension; | |
HHVM_GET_MODULE(example); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment