static VALUE exec_tmpl(VALUE module, VALUE self, VALUE output) { writer_functype writer; struct tmplpro_param* proparam; setup_internal(self); proparam = process_tmplpro_options(self); switch (TYPE(output)) { case T_STRING: writer = &write_chars_to_string; break; case T_FILE: writer = &write_chars_to_file; break; default: rb_warning("bad file descriptor. Use output=stdout\n"); writer = &write_chars_to_file; output = rb_stdout; } tmplpro_set_option_WriterFuncPtr(proparam, writer); tmplpro_set_option_ext_writer_state(proparam, (ABSTRACT_WRITER *)output); int retval = tmplpro_exec_tmpl(proparam); release_tmplpro_options(proparam); return INT2FIX(retval); }
void mggh::EGLHelper::setup(GBMHelper const& gbm) { static const EGLint context_attr[] = { EGL_CONTEXT_CLIENT_VERSION, 2, EGL_NONE }; setup_internal(gbm, true); egl_context = eglCreateContext(egl_display, egl_config, EGL_NO_CONTEXT, context_attr); if (egl_context == EGL_NO_CONTEXT) BOOST_THROW_EXCEPTION(std::runtime_error("Failed to create EGL context")); }
void mggh::EGLHelper::setup(GBMHelper const& gbm, gbm_surface* surface_gbm, EGLContext shared_context) { static const EGLint context_attr[] = { EGL_CONTEXT_CLIENT_VERSION, 2, EGL_NONE }; setup_internal(gbm, false); egl_surface = eglCreateWindowSurface(egl_display, egl_config, surface_gbm, nullptr); if(egl_surface == EGL_NO_SURFACE) BOOST_THROW_EXCEPTION(std::runtime_error("Failed to create EGL window surface")); egl_context = eglCreateContext(egl_display, egl_config, shared_context, context_attr); if (egl_context == EGL_NO_CONTEXT) BOOST_THROW_EXCEPTION(std::runtime_error("Failed to create EGL context")); }