void udfFinalMarks::UpdateMarks() { Enter(); int nRow = 0; for(nRow = 0; nRow < m_gridMarks->GetNumberRows(); ++nRow) { int nCol = 0; for(nCol = 0; nCol < m_gridMarks->GetNumberCols(); ++nCol) { unsigned int id = -1; CChampionshipJudgesMarkTable::tDATA data = {0}; data.tourId = m_tourId; data.teamId = m_row2id[nRow]; data.judgeId = m_col2id[nCol]; long found = CChampionshipJudgesMarkTable(m_pCon).FindId(id, data); __info("Row: %d, Col: %d, tourId: %d, teamId: %d, FOUND: %d == %d", nRow, nCol, data.tourId, data.teamId, found, UDF_E_NOTFOUND); if(UDF_OK == found) { __info("Found! ID: %d. Update it...", id); m_gridMarks->GetCellValue(nRow, nCol).ToULong((unsigned long *)&data.nMark); CChampionshipJudgesMarkTable(m_pCon).UpdateRow(id, data); } else if(found == UDF_E_NOTFOUND) { __info("NOT Found! Insert it..."); m_gridMarks->GetCellValue(nRow, nCol).ToULong((unsigned long *)&data.nMark); CChampionshipJudgesMarkTable(m_pCon).AddRow(data); } } } Leave(); }
static void create_context() { // setenv("EGL_DRIVER", "egl_glx", 0); XSetErrorHandler(_x_error); void* const native_display = XOpenDisplay(nullptr); egl::display const display = egl::api::get_display(native_display); if (display == nullptr) { __fatal() << "Unable to open X display."; throw std::runtime_error("Unable to open X display."); } auto const version = egl::api::initialize(display); __info() << "EGL version: " << version.major << "." << version.minor; __info() << "EGL client-apis: " << egl::api::query_string(display, egl::cst::client_apis); __info() << "EGL extensions: " << egl::api::query_string(display, egl::cst::extensions); __info() << "EGL vendor: " << egl::api::query_string(display, egl::cst::vendor); __info() << "EGL version: " << egl::api::query_string(display, egl::cst::version); egl::attributes const attributes = { egl::attribute { egl::cst::config_caveat, egl::cst::none }, egl::attribute { egl::cst::renderable_type, egl::cst::opengl_bit }, egl::attribute { egl::cst::conformant, egl::cst::opengl_bit }, egl::attribute { egl::cst::surface_type, egl::cst::window_bit | egl::cst::pbuffer_bit | egl::cst::pixmap_bit }, egl::attribute { egl::cst::none, egl::cst::none } }; auto const& configs = egl::api::choose_config(display, attributes); egl::api::bind_api(egl::cst::opengl_api); egl::attributes const context_attributes = { // egl::cst::context_flags_khr, egl::cst::context_opengl_forward_compatible_bit_khr | egl::cst::context_opengl_debug_bit_khr, // egl::cst::context_client_version, 3, // egl::cst::context_minor_version_khr, 3, // egl::cst::context_opengl_profile_mask_khr, egl::cst::context_opengl_core_profile_bit_khr, egl::attribute { egl::cst::none, egl::cst::none } }; egl::context const context = egl::api::create_context(display, configs[0], egl::cst::no_context, context_attributes); // XSync(native_display, false); context_info context_info(display, context, egl::api::create_pbuffer_surface(display, configs[0], { egl::attribute { egl::cst::none, egl::cst::none } }), egl::api::create_pbuffer_surface(display, configs[0], { egl::attribute { egl::cst::none, egl::cst::none } })); if (!context_info.try_acquire()) { __fatal() << "Unable to attach context to default drawable."; throw std::runtime_error("Unable to attach context to default drawable."); } } // _create
static void test() { __trace() << "trace message"; __debug() << "debug message"; __info() << "info message"; __notice() << "notice message"; __warn() << "warn message"; __error() << "error message"; __fatal() << "fatal message"; }
int main(int arg_count, char** arg_values) { corefungi::init(arg_count, arg_values); __trace() << "trace message"; __debug() << "debug message"; __info() << "info message"; __notice() << "notice message"; __warn() << "warn message"; __error() << "error message"; __fatal() << "fatal message"; std::vector< std::string > v = { "this", "is", "a", "vector", "of", "strings" }; __info() << v << v; auto const& t = std::make_tuple("this is ", 1, std::vector< char > {'t','u','p','l','e'}); __warn() << t << " " << t; test_module::test(); return 0; }
bool udfFinalMarks::Validate() { Enter(); bool res = true; do { int col = 0; for(col = 0; col < m_gridMarks->GetNumberCols(); ++col) { int row = 0; for(row = 0; row < m_gridMarks->GetNumberRows(); ++row) { wxString m1 = m_gridMarks->GetCellValue(row, col); int mark = row + 1; for(mark = row + 1; mark < m_gridMarks->GetNumberRows(); ++mark) { wxString m2 = m_gridMarks->GetCellValue(mark, col); if(m1[0] == m2[0]) { __info("INVALID"); m_gridMarks->SetCellBackgroundColour(mark, col, wxColour(255,0,0)); res = false; } } } } }while(0); if(res == false) { m_gridMarks->Refresh(); } Leave(); return res; }
int java_init(euca_opts * args, java_home_t * data) { jint(*hotspot_main) (JavaVM **, JNIEnv **, JavaVMInitArgs *); char *libjvm_path = NULL; if ((libjvm_path = java_library(args, data)) == NULL) __fail("Cannot locate JVM library file"); dso_handle libjvm_handle = NULL; __die((libjvm_handle = dlopen(libjvm_path, RTLD_GLOBAL | RTLD_NOW)) == NULL, "Cannot dynamically link to %s\n%s", libjvm_path, dso_error()); __debug("JVM library %s loaded", libjvm_path); if ((hotspot_main = dlsym(libjvm_handle, "JNI_CreateJavaVM")) == NULL) __fail("Cannot find JVM library entry point"); JavaVMInitArgs arg; arg.ignoreUnrecognized = 0; #if defined(JNI_VERSION_1_4) arg.version = JNI_VERSION_1_4; #else arg.version = JNI_VERSION_1_2; #endif JavaVMOption *opt = NULL; char *java_class_path = java_library_path(args); __debug("Using classpath:\n%s", java_class_path); #define JVM_MAX_OPTS 128 int x = -1, i = 0, encoding_not_defined_flag = 1; opt = (JavaVMOption *) malloc(JVM_MAX_OPTS * sizeof(JavaVMOption)); for (i = 0; i < JVM_MAX_OPTS; i++) opt[i].extraInfo = NULL; i = -1; while (jvm_default_opts[++i] != NULL) JVM_ARG(opt[++x], jvm_default_opts[i], GETARG(args, home)); // setting heap size to half of total memory if it was not set by user char *s, str[16], size_i; long size; str[0] = 0; for (i = 0; i < args->jvm_args_given; i++) { if ((s = strstr(args->jvm_args_arg[i], "mx")) && sscanf(s, "mx%s", str) == 1) { break; } } if (str[0] != 0) { sscanf (str,"%ld%c", &size, &size_i); switch(size_i) { case 'k' : case 'K' : size = size * 1024L; break; case 'm' : case 'M' : size = size * 1024L * 1024L; break; case 'g' : case 'G' : size = size * GIG; break; default: size = size * 1L; } __debug("User defined heap size is %ld bytes", size); if (size < GIG) { __error("User defined heap size of %ld bytes is set too low and system might now work properly", size); } } else { size_t total_memory = getMemoryTotalSize(); double heap_size_gb = 2; if (total_memory <= 32 * GIG && total_memory >= 4 * GIG) heap_size_gb = ceil(total_memory/GIG/2.0); else if (total_memory > 32 * GIG) heap_size_gb = 16.0; __info("User did not set heap size. Setting it automatically to %.0lfGB base on total memory of %zu bytes", heap_size_gb, total_memory); JVM_ARG(opt[++x], "-Xms%.0lfg", heap_size_gb); JVM_ARG(opt[++x], "-Xmx%.0lfg", heap_size_gb); } if (args->exhaustive_flag) { JVM_ARG(opt[++x], "-Deuca.log.exhaustive=TRACE"); JVM_ARG(opt[++x], "-Deuca.log.exhaustive.db=TRACE"); JVM_ARG(opt[++x], "-Deuca.log.exhaustive.user=TRACE"); JVM_ARG(opt[++x], "-Deuca.log.exhaustive.cc=TRACE"); JVM_ARG(opt[++x], "-Deuca.log.exhaustive.external=TRACE"); } else { int exhaust = 0; if (args->exhaustive_db_flag) { JVM_ARG(opt[++x], "-Deuca.log.exhaustive.db=TRACE"); exhaust++; } else { JVM_ARG(opt[++x], "-Deuca.log.exhaustive.db=FATAL"); } if (args->exhaustive_cc_flag) { JVM_ARG(opt[++x], "-Deuca.log.exhaustive.cc=TRACE"); exhaust++; } else { JVM_ARG(opt[++x], "-Deuca.log.exhaustive.cc=FATAL"); } if (args->exhaustive_user_flag) { JVM_ARG(opt[++x], "-Deuca.log.exhaustive.user=TRACE"); exhaust++; } else { JVM_ARG(opt[++x], "-Deuca.log.exhaustive.user=FATAL"); } if (args->exhaustive_external_flag) { JVM_ARG(opt[++x], "-Deuca.log.exhaustive.external=TRACE"); exhaust++; } else { JVM_ARG(opt[++x], "-Deuca.log.exhaustive.external=FATAL"); } if (exhaust) { JVM_ARG(opt[++x], "-Deuca.log.exhaustive=TRACE"); } else { JVM_ARG(opt[++x], "-Deuca.log.exhaustive=FATAL"); } } JVM_ARG(opt[++x], "-Deuca.version=%1$s", ARGUMENTS_VERSION); JVM_ARG(opt[++x], "-Deuca.log.level=%1$s", GETARG(args, log_level)); JVM_ARG(opt[++x], "-Deuca.log.appender=%1$s", GETARG(args, log_appender)); if (strlen(GETARG(args, extra_version)) > 1 && strncmp(GETARG(args, extra_version), "@", 1)) { JVM_ARG(opt[++x], "-Deuca.extra_version=%1$s", GETARG(args, extra_version)); } if (args->initialize_flag) { JVM_ARG(opt[++x], "-Deuca.initialize=true"); JVM_ARG(opt[++x], "-Deuca.remote.dns=true"); } else if (args->upgrade_flag) { JVM_ARG(opt[++x], "-Deuca.upgrade=true"); if (args->upgrade_force_flag) { JVM_ARG(opt[++x], "-Deuca.upgrade.force=true"); } JVM_ARG(opt[++x], "-Deuca.upgrade.old.dir=%1$s", GETARG(args, upgrade_old_dir)); JVM_ARG(opt[++x], "-Deuca.upgrade.old.version=%1$s", GETARG(args, upgrade_old_version)); } else { if (args->remote_dns_flag) { JVM_ARG(opt[++x], "-Deuca.remote.dns=true"); } if (args->disable_iscsi_flag) { JVM_ARG(opt[++x], "-Deuca.disable.iscsi=true"); } } if (args->force_remote_bootstrap_flag || args->disable_cloud_flag) { JVM_ARG(opt[++x], "-Deuca.force.remote.bootstrap=true"); } if (args->debug_noha_flag) { JVM_ARG(opt[++x], "-Deuca.noha.cloud"); } if (args->db_home_given) { JVM_ARG(opt[++x], "-Deuca.db.home=%s", GETARG(args, db_home)); } JVM_ARG(opt[++x], "-XX:+HeapDumpOnOutOfMemoryError"); JVM_ARG(opt[++x], "-XX:HeapDumpPath=%s/var/log/eucalyptus/", GETARG(args, home)); if (args->debug_flag) { JVM_ARG(opt[++x], "-agentlib:jdwp=transport=dt_socket,server=y,suspend=%2$s,address=%1$d", GETARG(args, debug_port), (args->debug_suspend_flag ? "y" : "n")); } if (args->jmx_flag) { JVM_ARG(opt[++x], "-Dcom.sun.management.jmxremote"); //TODO:GRZE:wrapup jmx stuff here. JVM_ARG(opt[++x], "-Dcom.sun.management.jmxremote.port=8772"); JVM_ARG(opt[++x], "-Dcom.sun.management.jmxremote.authenticate=false"); //TODO:GRZE:RELEASE FIXME to use ssl JVM_ARG(opt[++x], "-Dcom.sun.management.jmxremote.ssl=false"); } if (args->verbose_flag) { JVM_ARG(opt[++x], "-verbose:gc"); JVM_ARG(opt[++x], "-XX:+PrintGCTimeStamps"); JVM_ARG(opt[++x], "-XX:+PrintGCDetails"); } if (args->profile_flag && args->agentlib_given) { JVM_ARG(opt[++x], "-agentlib:%s", GETARG(args, agentlib)); } else if (args->profile_flag) { JVM_ARG(opt[++x], "-agentlib:jprofilerti=port=8849"); JVM_ARG(opt[++x], "-Xbootclasspath/a:%1$s/bin/agent.jar", GETARG(args, profiler_home)); } if (args->user_given) { JVM_ARG(opt[++x], "-Deuca.user=%s", GETARG(args, user)); } for (i = 0; i < args->jvm_args_given; i++) JVM_ARG(opt[++x], "-X%s", args->jvm_args_arg[i]); for (i = 0; i < args->define_given; i++) { JVM_ARG(opt[++x], "-D%s", args->define_arg[i]); if (strncmp(args->define_arg[i], "file.encoding", 13) == 0) encoding_not_defined_flag = 0; } for (i = 0; i < args->bootstrap_host_given; i++) JVM_ARG(opt[++x], "-Deuca.bootstrap.host.%d=%s", i, args->bootstrap_host_arg[i]); for (i = 0; i < args->bind_addr_given; i++) JVM_ARG(opt[++x], "-Deuca.bind.addr.%d=%s", i, args->bind_addr_arg[i]); if (args->mcast_addr_given) { JVM_ARG(opt[++x], "-Deuca.mcast.addr=%s", GETARG(args, mcast_addr)); } if (encoding_not_defined_flag) JVM_ARG(opt[++x], "-Dfile.encoding=UTF-8"); opt[++x].optionString = java_class_path; opt[x].extraInfo = NULL; opt[++x].optionString = "abort"; opt[x].extraInfo = java_fail; arg.nOptions = x + 1; arg.options = opt; if (debug) { __debug("+-------------------------------------------------------"); if (strlen(GETARG(args, extra_version)) > 1 && strncmp(GETARG(args, extra_version), "@", 1)) __debug("| Eucalyptus version: %s-%s", ARGUMENTS_VERSION, GETARG(args, extra_version)); else __debug("| Eucalyptus version: %s", ARGUMENTS_VERSION); __debug("| JNI version: %x", arg.version); __debug("| Ignore Unrecognized Arguments: %d", arg.ignoreUnrecognized); __debug("| Extra options: %d", arg.nOptions); for (x = 0; x < arg.nOptions; x++) __debug("| \"%-80.80s\" (0x%p)", opt[x].optionString, opt[x].extraInfo); __debug("+-------------------------------------------------------"); } __debug("Starting JVM."); jint ret = 0; while ((ret = (*hotspot_main) (&jvm, &env, &arg) == EUCA_RET_RELOAD)) ; __die(ret < 0, "Failed to create JVM"); java_load_bootstrapper(); dlclose(libjvm_handle); return 1; }
int main(int argc, char *argv[]) { euca_opts euca_args; euca_opts *args = &euca_args; java_home_t *data = NULL; int status = 0; pid_t pid = 0; uid_t uid = 0; gid_t gid = 0; int i; if (arguments(argc, argv, args) != 0) exit(1); if (args->extra_version_orig != NULL) args->extra_version_arg = args->extra_version_orig; debug = args->debug_flag; set_output(GETARG(args, out), GETARG(args, err)); if (args->kill_flag == 1) return stop_child(args); if (checkuser(GETARG(args, user), &uid, &gid) == 0) return 1; for (i = 0; i < args->java_home_given; ++i) { __debug("Trying user supplied java home: %s", args->java_home_arg[i]); data = get_java_home(args->java_home_arg[i]); if (data != NULL) { break; } } char *java_home_env = getenv("JAVA_HOME"); if (data == NULL && java_home_env != NULL) { __debug("Trying environment JAVA_HOME: %s", java_home_env); data = get_java_home(java_home_env); } if (data == NULL && !args->java_home_given && args->java_home_arg[0] != NULL && CHECK_ISDIR(args->java_home_arg[0])) { __debug("Trying built-in java home: %s", args->java_home_arg[0]); data = get_java_home(args->java_home_arg[0]); } if (data == NULL && CHECK_ISREG("/usr/bin/java")) { char *javapath = (char *)calloc(PATH_MAX, sizeof(char)); javapath = realpath("/usr/bin/java", javapath); if (javapath != NULL) { javapath[strlen(javapath) - strlen("jre/bin/java")] = '\0'; __debug("Trying system java home: %s", javapath); data = get_java_home(javapath); } } if (data == NULL) { __error("Cannot locate Java Home"); return 1; } int x; if (debug == 1) { __debug("+-- DUMPING JAVA HOME STRUCTURE ------------------------"); __debug("| Java Home: \"%s\"", PRINT_NULL(data->path)); __debug("| Found JVMs: %d", data->jnum); for (x = 0; x < data->jnum; x++) { jvm_info_t *jvm = data->jvms[x]; __debug("| JVM Name: \"%s\"", PRINT_NULL(jvm->name)); __debug("| \"%s\"", PRINT_NULL(jvm->libjvm_path)); } __debug("+-------------------------------------------------------"); } if (strcmp(argv[0], "eucalyptus-cloud") != 0) { char *oldpath = getenv("LD_LIBRARY_PATH"), *libf = java_library(args, data); char *old = argv[0], buf[32768], *tmp = NULL, *p1 = NULL, *p2 = NULL; p1 = strdup(libf); tmp = strrchr(p1, '/'); if (tmp != NULL) tmp[0] = '\0'; p2 = strdup(p1); tmp = strrchr(p2, '/'); if (tmp != NULL) tmp[0] = '\0'; if (oldpath == NULL) snprintf(buf, 32768, "%s:%s:%s/bin/linux-x64", p1, p2, GETARG(args, profiler_home)); else snprintf(buf, 32768, "%s:%s:%s:%s/bin/linux-x64", oldpath, p1, p2, GETARG(args, profiler_home)); tmp = strdup(buf); setenv("LD_LIBRARY_PATH", tmp, 1); __debug("Invoking w/ LD_LIBRARY_PATH=%s", getenv("LD_LIBRARY_PATH")); argv[0] = "eucalyptus-cloud"; execve(old, argv, environ); __error("Cannot execute process"); return 1; } __debug("Running w/ LD_LIBRARY_PATH=%s", getenv("LD_LIBRARY_PATH")); if (args->fork_flag) { pid = fork(); __die((pid == -1), "Cannot detach from parent process"); if (pid != 0) return wait_child(args, pid); setsid(); } while ((pid = fork()) != -1) { if (pid == 0) exit(child(args, data, uid, gid)); child_pid = pid; signal(SIGHUP, controller); signal(SIGTERM, controller); signal(SIGINT, controller); while (waitpid(-1, &status, 0) != pid) ; if (WIFEXITED(status)) { status = WEXITSTATUS(status); __debug("Eucalyptus exited with status: %d", status); unlink(GETARG(args, pidfile)); if (status == EUCA_RET_RELOAD) { __info("Reloading service."); continue; } else if (status == 0) { __info("Service shut down cleanly."); return 0; } __error("Service exit with a return value of %d.", status); return 1; } else { perror("Service did not exit cleanly."); __error("Service did not exit cleanly: exit value=%d.", status); return 1; } } __error("Cannot decouple controller/child processes"); return 1; }
int main(int argc, char const* argv[]) { corefungi::init(argc, argv); create_context(); __info() << "vendor: " << gtulu::api::get_string(gtulu::cst::vendor); __info() << "renderer: " << gtulu::api::get_string(gtulu::cst::renderer); __info() << "version: " << gtulu::api::get_string(gtulu::cst::version); __info() << "shading_language_version: " << gtulu::api::get_string(gtulu::cst::shading_language_version); std::vector< int32_t > count; gtulu::api::get(gtulu::cst::max_combined_texture_image_units, count); __debug() << "maximum combined textures: " << count; auto const& messages = gtulu::api::get_debug_message_log(); for (auto const& message : messages) { std::clog << std::get< 4 >(message) << std::endl; } gtulu::api::active_texture(0); gtulu::api::attach_shader(1, 2); std::vector< gtulu::vec3< float > > const uniform_data = { { { 1, 2, 3 } }, { { 2, 3, 4 } }, { { 3, 4, 5 } } }; gtulu::api::uniform(0, uniform_data); gtulu::api::compressed_tex_image(gtulu::cst::texture_1d, 0, gtulu::cst::rgb8, gtulu::vec1< gtulu::size > { { 16 } }, 0, 128, gtulu::buffer_ref(0)); gtulu::vertex_double vdouble1 = 1; gtulu::vertex_double vdouble2 = 1.0f; gtulu::vertex_double vdouble3 = 1.0; gtulu::vertex_attrib attrib1 = 1; gtulu::vertex_attrib attrib2 = 1.0f; gtulu::vertex_attrib attrib3 = 1.0; gtulu::vertex_attrib attrib4 = vdouble2; gtulu::vertex_float float1 = 1; gtulu::vertex_float float2 = 1.0f; gtulu::vertex_float float3 = 1.0; // gtulu::vertex_float float4 = vdouble1; // compile error as expected gtulu::vertex_float float5 = attrib1; gtulu::vertex_integer integer1 = 1; gtulu::vertex_integer integer2 = 1.0f; gtulu::vertex_integer integer3 = 1.0; // gtulu::vertex_integer integer4 = vdouble1; // compile error as expected gtulu::vertex_integer integer5 = attrib1; // gtulu::api::vertex_attrib(vdouble1, gtulu::vec3< int >{1,2,3}); // compile error as expected // gtulu::api::vertex_attrib(vdouble2, gtulu::vec3< float >{1.0f,2.0f,3.0f}); // compile error as expected gtulu::api::vertex_attrib(vdouble3, gtulu::vec3< double > { 1.0, 2.0, 3.0 }); // gtulu::api::vertex_attrib(attrib1, gtulu::vec4< int32_t >{1,2,3,4}); // ambiguous gtulu::api::vertex_attrib(float1, gtulu::vec3< int16_t > { 1, 2, 3 }); gtulu::api::vertex_attrib(float2, gtulu::vec3< float > { 1.0f, 2.0f, 3.0f }); gtulu::api::vertex_attrib(float3, gtulu::vec3< double > { 1.0, 2.0, 3.0 }); gtulu::api::vertex_attrib(integer1, gtulu::vec3< int32_t > { 1, 2, 3 }); // gtulu::api::vertex_attrib(integer2, gtulu::vec3< float >{1.0f,2.0f,3.0f}); // compile error as expected // gtulu::api::vertex_attrib(integer3, gtulu::vec3< double >{1.0,2.0,3.0}); // compile error as expected destroy_context(); return 0; } // main