本文整理汇总了C++中create_context函数的典型用法代码示例。如果您正苦于以下问题:C++ create_context函数的具体用法?C++ create_context怎么用?C++ create_context使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了create_context函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: gpbridge_export_start
void gpbridge_export_start(PG_FUNCTION_ARGS)
{
gphadoop_context* context = create_context(fcinfo);
parse_gphd_uri(context, false, fcinfo);
/* get rest servers list and choose one */
Relation rel = EXTPROTOCOL_GET_RELATION(fcinfo);
PxfServer* rest_server = get_pxf_server(context->gphd_uri, rel);
if (!rest_server)
ereport(ERROR,
(errcode(ERRCODE_CONNECTION_FAILURE),
errmsg("No REST servers were found (by accessing PXF URI %s)",
context->gphd_uri->uri)));
elog(DEBUG2, "chosen pxf rest_server = %s:%d", rest_server->host, rest_server->port);
build_file_name_for_write(context);
build_uri_for_write(context, rest_server);
free_datanode_rest_server(rest_server);
context->churl_headers = churl_headers_init();
add_querydata_to_http_header(context, fcinfo);
context->churl_handle = churl_init_upload(context->uri.data,
context->churl_headers);
}
开发者ID:sansanichfb,项目名称:incubator-hawq,代码行数:28,代码来源:gpbridgeapi.c
示例2: create_context
void BlockEnvironment::call(STATE, Task* task, Message& msg) {
Object* val;
if(msg.args() > 0) {
Tuple* tup = Tuple::create(state, msg.args());
for(int i = msg.args() - 1; i >= 0; i--) {
tup->put(state, i, msg.get_argument(i));
}
val = tup;
} else {
val = Qnil;
}
BlockContext* ctx = create_context(state, task->active());
if(task->profiler) {
profiler::Method* prof_meth = task->profiler->enter_method(
as<Symbol>(home_->name()), home_->module()->name(), profiler::kBlock);
if(!prof_meth->file()) {
prof_meth->set_position(method_->file(), method_->start_line(state));
}
}
// HACK: manually clear the stack used as args.
task->active()->clear_stack(msg.stack);
task->make_active(ctx);
task->push(val);
}
开发者ID:marnen,项目名称:rubinius,代码行数:28,代码来源:block_environment.cpp
示例3: create_uim_agent_context
uim_agent_context *
create_uim_agent_context(const char *encoding)
{
uim_agent_context *ret;
const char *im;
debug_printf(DEBUG_NOTE, "create_uim_agent_context\n");
ret = uim_malloc(sizeof(uim_agent_context));
if (encoding) {
ret->encoding = uim_strdup(encoding);
} else {
if (debug_level > 0)
ret->encoding = uim_strdup("EUC-JP");
else
ret->encoding = uim_strdup("UTF-8");
}
ret->context = create_context(ret->encoding, ret);
if ((im = uim_get_default_im_name(setlocale(LC_CTYPE, NULL))))
ret->im = uim_strdup(im);
else
ret->im = NULL;
ret->pe = create_preedit();
ret->cand = create_candidate();
ret->prop = create_prop();
ret->comstr = (char *)NULL;
return ret;
}
开发者ID:DirtYiCE,项目名称:uim,代码行数:35,代码来源:context.c
示例4: malloc
int S9xOpenGLDisplayDriver::init ()
{
initialized = false;
if (!create_context ())
{
return -1;
}
if (!opengl_defaults ())
{
return -1;
}
buffer[0] = malloc (image_padded_size);
buffer[1] = malloc (scaled_padded_size);
clear_buffers ();
padded_buffer[0] = (void *) (((uint8 *) buffer[0]) + image_padded_offset);
padded_buffer[1] = (void *) (((uint8 *) buffer[1]) + scaled_padded_offset);
GFX.Screen = (uint16 *) padded_buffer[0];
GFX.Pitch = image_width * image_bpp;
context->swap_interval (config->sync_to_vblank);
initialized = true;
return 0;
}
开发者ID:snes9xgit,项目名称:snes9x,代码行数:31,代码来源:gtk_display_driver_opengl.cpp
示例5: set_exec_context
/* Build a context from the domain_context and category fields of the data_t
* structure.
* Use the resultant context as the execution context (setexeccon) for the
* next call to exec.
*/
static bool
set_exec_context (data_t* data)
{
char mcs_str [9] = { 0, }, *context = NULL;
int p_ret = 0;
p_ret = snprintf (mcs_str, sizeof (mcs_str), "s0:c%d", data->category);
if (p_ret < 0 || p_ret > 9) {
syslog (LOG_CRIT, "insufficient buffer size");
return false;
}
context = create_context (data->domain_context, mcs_str);
if (context == NULL) {
syslog (LOG_CRIT, "error creating context from %s and %s",
data->domain_context, mcs_str);
return false;
}
syslog (LOG_INFO, "Setting execution context to %s", context);
if (setexeccon(context) == -1) {
syslog (LOG_CRIT, "setexeccon: %s", strerror (errno));
return false;
}
free (context);
return true;
}
开发者ID:cjp256,项目名称:xenclient-oe,代码行数:30,代码来源:svirt-interpose.c
示例6: create_context
void CCryptKey::DecryptData(const std::vector<unsigned char>& encrypted, std::vector<unsigned char>& data)
{
ies_ctx_t *ctx;
char error[1024] = "Unknown error";
cryptogram_t *cryptogram;
size_t length;
unsigned char *decrypted;
ctx = create_context(pkey);
if (!EC_KEY_get0_private_key(ctx->user_key))
throw key_error("Given EC key is not private key");
size_t key_length = ctx->stored_key_length;
size_t mac_length = EVP_MD_size(ctx->md);
cryptogram = cryptogram_alloc(key_length, mac_length, encrypted.size() - key_length - mac_length);
memcpy(cryptogram_key_data(cryptogram), &encrypted[0], encrypted.size());
decrypted = ecies_decrypt(ctx, cryptogram, &length, error);
cryptogram_free(cryptogram);
free(ctx);
if (decrypted == NULL) {
throw key_error(std::string("Error in decryption: %s") + error);
}
data.resize(length);
memcpy(&data[0], decrypted, length);
free(decrypted);
}
开发者ID:CryptoDJ,项目名称:DarkSilk-Release-Candidate,代码行数:30,代码来源:cryptkey.cpp
示例7: operator
cairo_surface_ptr operator()(marker_svg const & marker) const
{
box2d<double> bbox(marker.bounding_box());
agg::trans_affine tr(transform(bbox));
double width = std::max(1.0, std::round(bbox.width()));
double height = std::max(1.0, std::round(bbox.height()));
cairo_rectangle_t extent { 0, 0, width, height };
cairo_surface_ptr surface(
cairo_recording_surface_create(
CAIRO_CONTENT_COLOR_ALPHA, &extent),
cairo_surface_closer());
cairo_ptr cairo = create_context(surface);
cairo_context context(cairo);
svg_storage_type & svg = *marker.get_data();
svg_attribute_type const& svg_attributes = svg.attributes();
svg::vertex_stl_adapter<svg::svg_path_storage> stl_storage(
svg.source());
svg::svg_path_adapter svg_path(stl_storage);
render_vector_marker(context, svg_path, svg_attributes,
bbox, tr, opacity_);
return surface;
}
开发者ID:haroldzmli,项目名称:mapnik,代码行数:27,代码来源:render_polygon_pattern.hpp
示例8: main
int main(int argc , const char ** argv) {
enkf_main_install_SIGNALS();
const char * config_file = argv[1];
const char * config_file_iterations = argv[2];
const char * job_file_create_case = argv[3];
const char * job_file_init_case_job = argv[4];
const char * job_file_load_results = argv[5];
const char * job_file_load_results_iter = argv[6];
const char * job_file_observation_ranking = argv[7];
const char * job_file_data_ranking = argv[8];
const char * job_file_ranking_export = argv[9];
const char * job_file_init_misfit_table = argv[10];
const char * job_file_export_runpath = argv[11];
ert_test_context_type * test_context = create_context( config_file, "enkf_workflow_job_test" );
{
test_create_case_job(test_context, "JOB1" , job_file_create_case);
test_init_case_job(test_context, "JOB2", job_file_init_case_job);
test_load_results_job(test_context, "JOB3" , job_file_load_results);
test_load_results_iter_job( test_context, "JOB4" , job_file_load_results_iter );
test_init_misfit_table(test_context, "JOB5" , job_file_init_misfit_table);
test_rank_realizations_on_observations_job(test_context, "JOB6" , job_file_observation_ranking);
test_rank_realizations_on_data_job(test_context , "JOB7" , job_file_data_ranking);
test_export_ranking(test_context, "JOB8" , job_file_ranking_export);
}
ert_test_context_free( test_context );
test_export_runpath_files(config_file, config_file_iterations, job_file_export_runpath);
exit(0);
}
开发者ID:atgeirr,项目名称:ResInsight,代码行数:33,代码来源:enkf_workflow_job_test.c
示例9: runtarget
smbresultlist* runtarget(char *target, int maxdepth) {
SMBCCTX *context;
char buf[256];
smbresultlist *res = NULL;
//Try to create a context, if it's null that means we failed, so let the user know.
if((context = create_context()) == NULL) {
smbresult *tmp = createSMBResultEmpty();
parse_smburl(target, &tmp->host, &tmp->share, &tmp->object);
tmp->statuscode = errno;
smbresultlist_push(&res, tmp);
return res;
}
//Check to see if the target has smb:// in front, if not add it.
if(strncmp("smb://", target, 6) != 0) {
snprintf(buf, sizeof(buf), "smb://%s", target);
} else {
strncpy(buf, target, strlen(target) + 1);
}
//Browse to our file and get the goods
res = browse(context, buf, maxdepth, 0);
//Delete our context, so there's less segfaults.
delete_context(context);
return res;
}
开发者ID:CroweCybersecurity,项目名称:shareenum,代码行数:28,代码来源:smb.c
示例10: new_module
struct module* new_module(char* filename) {
void* handle = dlopen(filename, RTLD_LAZY);
if (!handle) {
fprintf(stderr, "%s\n", dlerror());
return NULL;
}
mod_match_function* matcher = dlsym(handle, "matchData");
if (!matcher) {
fprintf(stderr, "%s\n", dlerror());
dlclose(handle);
return NULL;
}
struct module* module = malloc(sizeof(struct module));
memset(module, 0, sizeof(struct module));
module->handle = handle;
module->matcher = matcher;
mod_create_context* create_context = dlsym(handle, "createContext");
if (create_context) {
module->context = create_context();
mod_free_context* free_context = dlsym(handle, "freeContext");
if (!free_context)
fprintf(stderr, "WARNING, you seem to have a createContext() function but no freeContext() function, you're possibly leaking memory.\n");
}
return module;
};
开发者ID:Marlinc,项目名称:multiproto,代码行数:25,代码来源:module.c
示例11: halide_acquire_cuda_context
// The default implementation of halide_acquire_cl_context uses the global
// pointers above, and serializes access with a spin lock.
// Overriding implementations of acquire/release must implement the following
// behavior:
// - halide_acquire_cl_context should always store a valid context/command
// queue in ctx/q, or return an error code.
// - A call to halide_acquire_cl_context is followed by a matching call to
// halide_release_cl_context. halide_acquire_cl_context should block while a
// previous call (if any) has not yet been released via halide_release_cl_context.
WEAK int halide_acquire_cuda_context(void *user_context, CUcontext *ctx) {
// TODO: Should we use a more "assertive" assert? these asserts do
// not block execution on failure.
halide_assert(user_context, ctx != NULL);
if (cuda_ctx_ptr == NULL) {
cuda_ctx_ptr = &weak_cuda_ctx;
cuda_lock_ptr = &weak_cuda_lock;
}
halide_assert(user_context, cuda_lock_ptr != NULL);
while (__sync_lock_test_and_set(cuda_lock_ptr, 1)) { }
// If the context has not been initialized, initialize it now.
halide_assert(user_context, cuda_ctx_ptr != NULL);
if (*cuda_ctx_ptr == NULL) {
CUresult error = create_context(user_context, cuda_ctx_ptr);
if (error != CUDA_SUCCESS) {
__sync_lock_release(cuda_lock_ptr);
return error;
}
}
*ctx = *cuda_ctx_ptr;
return 0;
}
开发者ID:bnascimento,项目名称:Halide,代码行数:35,代码来源:cuda.cpp
示例12: test_register
static void test_register(gconstpointer data)
{
struct context *context = create_context(data);
const struct test_pdu *pdu;
ssize_t len;
bool ret;
context->hfp = hfp_gw_new(context->fd_client);
g_assert(context->hfp);
pdu = &context->data->pdu_list[context->pdu_offset++];
ret = hfp_gw_set_close_on_unref(context->hfp, true);
g_assert(ret);
if (context->data->result_func) {
ret = hfp_gw_register(context->hfp, context->data->result_func,
(char *)pdu->data, context, NULL);
g_assert(ret);
}
pdu = &context->data->pdu_list[context->pdu_offset++];
len = write(context->fd_server, pdu->data, pdu->size);
g_assert_cmpint(len, ==, pdu->size);
execute_context(context);
}
开发者ID:CarbonDevXperia,项目名称:android_external_bluetooth_bluez,代码行数:28,代码来源:test-hfp.c
示例13: main
int main( int argc, char **argv )
{
// etape 1 : creer la fenetre
Window window= create_window(1024, 640);
if(window == NULL)
return 1; // erreur lors de la creation de la fenetre ou de l'init de sdl2
// etape 2 : creer un contexte opengl pour pouvoir dessiner
Context context= create_context(window);
if(context == NULL)
return 1; // erreur lors de la creation du contexte opengl
// etape 3 : creation des objets
if(init() < 0)
{
printf("[error] init failed.\n");
return 1;
}
// etape 4 : affichage de l'application, tant que la fenetre n'est pas fermee. ou que draw() ne renvoie pas 0
run(window, draw);
// etape 5 : nettoyage
quit();
release_context(context);
release_window(window);
return 0;
}
开发者ID:PierreCAMILLI,项目名称:mif23-projet,代码行数:28,代码来源:tuto4.cpp
示例14: halide_acquire_cl_context
// The default implementation of halide_acquire_cl_context uses the global
// pointers above, and serializes access with a spin lock.
// Overriding implementations of acquire/release must implement the following
// behavior:
// - halide_acquire_cl_context should always store a valid context/command
// queue in ctx/q, or return an error code.
// - A call to halide_acquire_cl_context is followed by a matching call to
// halide_release_cl_context. halide_acquire_cl_context should block while a
// previous call (if any) has not yet been released via halide_release_cl_context.
WEAK int halide_acquire_cl_context(void *user_context, cl_context *ctx, cl_command_queue *q) {
// TODO: Should we use a more "assertive" assert? These asserts do
// not block execution on failure.
halide_assert(user_context, ctx != NULL);
halide_assert(user_context, q != NULL);
// If the context pointers aren't hooked up, use our weak globals.
if (cl_ctx_ptr == NULL) {
cl_ctx_ptr = &weak_cl_ctx;
cl_q_ptr = &weak_cl_q;
cl_lock_ptr = &weak_cl_lock;
}
halide_assert(user_context, cl_lock_ptr != NULL);
while (__sync_lock_test_and_set(cl_lock_ptr, 1)) { }
// If the context has not been initialized, initialize it now.
halide_assert(user_context, cl_ctx_ptr != NULL);
halide_assert(user_context, cl_q_ptr != NULL);
if (!(*cl_ctx_ptr)) {
cl_int error = create_context(user_context, cl_ctx_ptr, cl_q_ptr);
if (error != CL_SUCCESS) {
__sync_lock_release(cl_lock_ptr);
return error;
}
}
*ctx = *cl_ctx_ptr;
*q = *cl_q_ptr;
return 0;
}
开发者ID:netaz,项目名称:Halide,代码行数:40,代码来源:opencl.cpp
示例15: perfmon_init
void perfmon_init(void)
{
size_t i;
long nr;
if (cpu_type == CPU_TIMER_INT)
return;
if (!no_xen) {
xen_ctx = xmalloc(sizeof(struct child));
xen_ctx->pid = getpid();
xen_ctx->up_pipe[0] = -1;
xen_ctx->up_pipe[1] = -1;
xen_ctx->sigusr1 = 0;
xen_ctx->sigusr2 = 0;
xen_ctx->sigterm = 0;
create_context(xen_ctx);
write_pmu(xen_ctx);
load_context(xen_ctx);
return;
}
nr = sysconf(_SC_NPROCESSORS_ONLN);
if (nr == -1) {
fprintf(stderr, "Couldn't determine number of CPUs.\n");
exit(EXIT_FAILURE);
}
nr_cpus = nr;
children = xmalloc(sizeof(struct child) * nr_cpus);
bzero(children, sizeof(struct child) * nr_cpus);
for (i = 0; i < nr_cpus; ++i) {
int ret;
if (pipe(children[i].up_pipe)) {
perror("Couldn't create child pipe");
exit(EXIT_FAILURE);
}
ret = fork();
if (ret == -1) {
perror("Couldn't fork perfmon child");
exit(EXIT_FAILURE);
} else if (ret == 0) {
close(children[i].up_pipe[0]);
run_child(i);
} else {
children[i].pid = ret;
close(children[i].up_pipe[1]);
printf("Waiting on CPU%d\n", (int)i);
wait_for_child(&children[i]);
}
}
}
开发者ID:0omega,项目名称:platform_external_oprofile,代码行数:60,代码来源:opd_perfmon.c
示例16: main
int main( int argc, char **argv )
{
if(argc == 1)
{
printf("usage: %s shader.glsl [mesh.obj] [texture0.png [texture1.png]]\n", argv[0]);
return 0;
}
Window window= create_window(1024, 640);
if(window == NULL)
return 1;
Context context= create_context(window);
if(context == NULL)
return 1;
// creation des objets opengl
std::vector<const char *> options(argv + 1, argv + argc);
if(init(options) < 0)
{
printf("[error] init failed.\n");
return 1;
}
// affichage de l'application
run(window, draw);
// nettoyage
quit();
release_context(context);
release_window(window);
return 0;
}
开发者ID:PierreCAMILLI,项目名称:mif23-projet,代码行数:33,代码来源:shader_kit.cpp
示例17: run_child
static void run_child(size_t cpu)
{
struct child * self = &children[cpu];
self->pid = getpid();
self->sigusr1 = 0;
self->sigusr2 = 0;
self->sigterm = 0;
inner_child = self;
if (atexit(close_pipe)){
close_pipe();
exit(EXIT_FAILURE);
}
umask(0);
/* Change directory to allow directory to be removed */
if (chdir("/") < 0) {
perror("Unable to chdir to \"/\"");
exit(EXIT_FAILURE);
}
setup_signals();
set_affinity(cpu);
create_context(self);
write_pmu(self);
load_context(self);
notify_parent(self, cpu);
/* Redirect standard files to /dev/null */
freopen( "/dev/null", "r", stdin);
freopen( "/dev/null", "w", stdout);
freopen( "/dev/null", "w", stderr);
for (;;) {
sigset_t sigmask;
sigfillset(&sigmask);
sigdelset(&sigmask, SIGUSR1);
sigdelset(&sigmask, SIGUSR2);
sigdelset(&sigmask, SIGTERM);
if (self->sigusr1) {
perfmon_start_child(self->ctx_fd);
self->sigusr1 = 0;
}
if (self->sigusr2) {
perfmon_stop_child(self->ctx_fd);
self->sigusr2 = 0;
}
sigsuspend(&sigmask);
}
}
开发者ID:0omega,项目名称:platform_external_oprofile,代码行数:59,代码来源:opd_perfmon.c
示例18: glXCreateContextWithConfigSGIX
extern GLXContext glXCreateContextWithConfigSGIX (Display *dpy, GLXFBConfigSGIX config, int renderType, GLXContext shareList, Bool direct)
{
GLXContext ctx;
GH_GET_PTR_GL(glXCreateContextWithConfigSGIX);
ctx=GH_glXCreateContextWithConfigSGIX(dpy, config, renderType, shareList, direct);
create_context(ctx);
return ctx;
}
开发者ID:derhass,项目名称:glx_hook,代码行数:9,代码来源:glx_hook.c
示例19: glXImportContextEXT
extern GLXContext glXImportContextEXT (Display *dpy, GLXContextID id)
{
GLXContext ctx;
GH_GET_PTR_GL(glXImportContextEXT);
ctx=GH_glXImportContextEXT(dpy, id);
create_context(ctx);
return ctx;
}
开发者ID:derhass,项目名称:glx_hook,代码行数:9,代码来源:glx_hook.c
示例20: glXCreateContext
extern GLXContext glXCreateContext(Display *dpy, XVisualInfo *vis, GLXContext shareList, Bool direct )
{
GLXContext ctx;
GH_GET_PTR_GL(glXCreateContext);
ctx=GH_glXCreateContext(dpy, vis, shareList, direct);
create_context(ctx);
return ctx;
}
开发者ID:derhass,项目名称:glx_hook,代码行数:9,代码来源:glx_hook.c
注:本文中的create_context函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论