def run(args): this_command = os.environ["LIBTBX_DISPATCHER_NAME"] if (len(args) != 1): print "usage: %s module_name > error.h" % this_command return write_this_is_auto_generated(f=sys.stdout, file_name_generator=this_command) sys.stdout.write(as_string(module_name=args[0]))
def write_define_wrappers(f, namespace, defines, i_fragment): write_this_is_auto_generated(f, this) print >> f, """\ #include <boost/python/def.hpp> #include <boost/python/scope.hpp> #include <gltbx/include_opengl.h> namespace gltbx { namespace %s { namespace boost_python { void wrap_defines_%02d(boost::python::scope scope) {""" % (namespace, i_fragment) for define in defines: write_one(f, define) if (namespace == "gl"): for i in xrange(4): write_one(f, "GL_AUX%d" % i) for i in xrange(8): write_one(f, "GL_LIGHT%d" % i) for i in xrange(32): write_one(f, "GL_TEXTURE%d" % i) print >> f, """\ } }}} // gltbx::%s::boost_python""" % namespace
def run(args): this_command = os.environ["LIBTBX_DISPATCHER_NAME"] if (len(args) != 1): print("usage: %s module_name > error.h" % this_command) return write_this_is_auto_generated(f=sys.stdout, file_name_generator=this_command) sys.stdout.write(as_string(module_name=args[0]))
def write_function_wrappers(f, namespace, signatures, i_fragment): write_this_is_auto_generated(f, this) print("""\ #include <gltbx/special_wrapper_support.h> #include <gltbx/pointer_args_bpl.h> #include <gltbx/error.h> """, file=f) if (namespace == "glu"): print("#if defined(__GNUC__) && __GNUC__ == 2 \\", file=f) print(" && __GNUC_MINOR__ == 96 && __GNUC_PATCHLEVEL__ == 0", file=f) print("#define GLTBX_NO_OPAQUE_POINTERS", file=f) print("#else", file=f) print("#include <boost/python/return_value_policy.hpp>", file=f) print("#include <boost/python/return_opaque_pointer.hpp>", file=f) for opaque_pointer in opaque_pointers: print("BOOST_PYTHON_OPAQUE_SPECIALIZED_TYPE_ID(%s)" % (opaque_pointer[:-1]), file=f) print("#endif", file=f) print(file=f) print("""\ namespace gltbx { namespace %s { namespace { """ % namespace, file=f) for signature in signatures: signature.write_wrapper(f=f) print("""\ } // namespace <anonymous> namespace boost_python { void wrap_functions_%02d() { using namespace boost::python;""" % i_fragment, file=f) for signature in signatures: signature.write_def(f=f) print("""\ } }}} // namespace gltbx::%s::boost_python""" % namespace, file=f)
def write_function_wrappers(f, namespace, signatures, i_fragment): write_this_is_auto_generated(f, this) print >> f, """\ #include <gltbx/special_wrapper_support.h> #include <gltbx/pointer_args_bpl.h> #include <gltbx/error.h> """ if (namespace == "glu"): print >> f, "#if defined(__GNUC__) && __GNUC__ == 2 \\" print >> f, " && __GNUC_MINOR__ == 96 && __GNUC_PATCHLEVEL__ == 0" print >> f, "#define GLTBX_NO_OPAQUE_POINTERS" print >> f, "#else" print >> f, "#include <boost/python/return_value_policy.hpp>" print >> f, "#include <boost/python/return_opaque_pointer.hpp>" for opaque_pointer in opaque_pointers: print >> f, "BOOST_PYTHON_OPAQUE_SPECIALIZED_TYPE_ID(%s)" % ( opaque_pointer[:-1]) print >> f, "#endif" print >> f print >> f, """\ namespace gltbx { namespace %s { namespace { """ % namespace for signature in signatures: signature.write_wrapper(f=f) print >> f, """\ } // namespace <anonymous> namespace boost_python { void wrap_functions_%02d() { using namespace boost::python;""" % i_fragment for signature in signatures: signature.write_def(f=f) print >> f, """\ } }}} // namespace gltbx::%s::boost_python""" % namespace