void CFGPrinterOutput::print_state(BlockBegin* block) { print_begin("states"); InstructionPrinter ip(true, output()); ValueStack* state = block->state(); int index; Value value; for_each_state(state) { print_begin("locals"); print("size %d", state->locals_size()); print("method \"%s\"", method_name(state->scope()->method())); for_each_local_value(state, index, value) { ip.print_phi(index, value, block); print_operand(value); output()->cr(); } print_end("locals"); if (state->stack_size() > 0) { print_begin("stack"); print("size %d", state->stack_size()); print("method \"%s\"", method_name(state->scope()->method())); for_each_stack_value(state, index, value) { ip.print_phi(index, value, block); print_operand(value); output()->cr(); }
/** \brief Launch the http_sclient_t */ upnp_err_t upnp_call_t::launch_http_sclient() throw() { // sanity check - http_sclient_t MUST be NULL DBG_ASSERT( !http_sclient ); // build the data2post datum_t data2post; data2post = build_soap_req(service_name(), method_name(), strvar_db()).to_datum(); // build the http_reqhd_t to use for the http_sclient_t http_reqhd_t http_reqhd; http_reqhd = build_soap_reqhd(control_uri(), service_name(), method_name(), data2post); // log to debug KLOG_DBG("http_reqhd=" << http_reqhd); KLOG_DBG("data2post=" << data2post.to_stdstring()); // start the http_sclient_t http_err_t http_err; http_sclient = nipmem_new http_sclient_t(); http_err = http_sclient->start(http_reqhd, this, NULL, data2post); if( http_err.failed() ) return upnp_err_from_http(http_err); // return no error return upnp_err_t::OK; }
void CFGPrinterOutput::print_compilation() { print_begin("compilation"); print("name \"%s\"", method_name(_compilation->method(), true)); print("method \"%s\"", method_name(_compilation->method())); print("date "INT64_FORMAT, os::javaTimeMillis()); print_end("compilation"); }
static int work(lms_t *lms, int method, int verbose, const char *path) { struct stat st; int r; if (verbose) { lms_set_progress_callback(lms, progress, "CHECK", NULL); printf("CHECK at \"%s\" using %s method.\n", path, method_name(method)); } else lms_set_progress_callback(lms, NULL, NULL, NULL); if (method == 1) r = lms_check_single_process(lms, path); else if (method == 2) r = lms_check(lms, path); else r = -1; if (r != 0) { if (verbose) printf("CHECK FAILED at \"%s\".\n", path); return r; } if (stat(path, &st) != 0) { printf("PROCESS skipped for '%s': doesn't exist.\n", path); return 0; } if (verbose) { lms_set_progress_callback(lms, progress, "PROGRESS", NULL); printf("PROCESS at \"%s\" using %s method.\n", path, method_name(method)); } else lms_set_progress_callback(lms, NULL, NULL, NULL); if (method == 1) r = lms_process_single_process(lms, path); else if (method == 2) r = lms_process(lms, path); if (r != 0) { if (verbose) printf("PROCESS FAILED at \"%s\".\n", path); return r; } return 0; }
// ----------- methods v8::Handle<v8::Value> Invoke(const v8::Arguments& args) { v8::HandleScope scope; if (args.Length() < 3) { ThrowException(v8::Exception::TypeError(v8::String::New("Wrong number of arguments"))); return scope.Close(v8::Undefined()); } if (!args[0]->IsString() || !args[1]->IsString() || !args[2]->IsArray ()) { ThrowException(v8::Exception::TypeError(v8::String::New("Wrong arguments"))); return scope.Close(v8::Undefined()); } v8::String::AsciiValue element_name(args[0]->ToString()); v8::String::AsciiValue method_name(args[1]->ToString()); v8::Local<v8::Object> obj_arguments = args[2]->ToObject(); v8::Local<v8::Array> arguments = obj_arguments->GetPropertyNames(); std::vector<std::string> vector_arg; for(unsigned int i = 0; i < arguments->Length(); i++) { v8::String::AsciiValue val(obj_arguments->Get(i)->ToString()); vector_arg.push_back(std::string(*val)); } std::string *return_value; switcher_container[0]->invoke (std::string(*element_name), std::string(*method_name), &return_value, vector_arg); v8::Handle<v8::String> res = v8::String::New((*return_value).c_str ()); return scope.Close(res); }
static VALUE full_name(VALUE klass, ID mid) { VALUE result = klass_name(klass); rb_str_cat2(result, "#"); rb_str_append(result, method_name(mid)); return result; }
int tLuaCOMEnumerator::call_method(lua_State *L) { /// positions of parameters // self param (not used, but explicited to ensure // consistency) const int self_param = 1; // first user param const int user_first_param = 2; // last user param const int user_last_param = lua_gettop(L); // upvalues const int enumerator_param = lua_upvalueindex(1); const int method_param = lua_upvalueindex(2); int num_params = 0; if(user_last_param < user_first_param) num_params = 0; else num_params = user_last_param - user_first_param + 1; // gets the enumerator tLuaCOMEnumerator* enumerator = (tLuaCOMEnumerator*)*(void **)lua_touserdata(L, enumerator_param); // gets the method name tStringBuffer method_name(lua_tostring(L, method_param)); // call method int retval = 0; try { retval = enumerator->callCOMmethod(L, method_name, user_first_param, num_params); } catch(class tLuaCOMException& e) { luacom_error(L, e.getMessage()); return 0; } return retval; }
static inline int write_request_line(HTTP_ReqLine* line, int connection) { if(write_ref(method_name(line->method), connection)) return 1; if(write_ref(es_temp(" "), connection)) return 1; if(line->domain.size) { if(write_ref(es_temp("http://"), connection)) return 1; if(write_ref(es_ref(&line->domain), connection)) return 1; } if(write_str(es_printf("/%.*s HTTP/1.%c\r\n", ES_STRINGPRINT(&line->path), line->http_version), connection)) return 1; return 0; }
v8::Handle<v8::Value> GetMethodDescriptionByClass(const v8::Arguments& args) { v8::HandleScope scope; if (args.Length() != 2) { ThrowException(v8::Exception::TypeError(v8::String::New("Wrong number of arguments"))); return scope.Close(v8::Undefined()); } if (!args[0]->IsString() || !args[1]->IsString()) { ThrowException(v8::Exception::TypeError(v8::String::New("Wrong arguments"))); return scope.Close(v8::Undefined()); } v8::String::AsciiValue class_name(args[0]->ToString()); v8::String::AsciiValue method_name(args[1]->ToString()); v8::Handle<v8::String> res = v8::String::New(switcher_container[0]->get_method_description_by_class(std::string(*class_name), std::string(*method_name)).c_str()); return scope.Close(res); }
void shade::Component::compile(Formatter& fmt, const FileAccumulator& acc, ShaderEnvironment env, formatter::Constants::Primitive primitive_type) { // Setup shader environment fmt.setup(m_objects.get_next_index(), primitive_type); fmt.insert_sources(m_sources); // Output class methods and properties IterateAttributes instance_var_output(bind(&Component::output_attribute, boost::cref(*this), boost::ref(fmt), _1), bind(&Component::get_type_state, boost::ref(*this), _1) ); instance_var_output(get_pointer(m_shader)); std::for_each(m_classbins.begin(), m_classbins.end(), SelfArgumentOutput(fmt, env, m_objects)); std::for_each(m_classbins.begin(), m_classbins.end(), MethodOutput(fmt, env, m_objects)); std::for_each(m_classbins.begin(), m_classbins.end(), PropertyOutput(bind(&Component::output_property_dispatcher, boost::cref(*this), boost::ref(fmt), _1), fmt, m_objects)); // Write initializer in (if possible) correct order fmt.begin_initialize("shade_initialize"); InitializerOutput initializer_output(fmt, env, m_objects, bind(&Component::get_type_state, this, _1)); initializer_output(&*m_shader); fmt.end_initialize(); if (env == geometry_shader) { fmt.begin_initialize("shade_initialize_post", false); InitializerOutput initializer_output(fmt, post_geometry_shader, m_objects, bind(&Component::get_type_state, this, _1)); initializer_output(&*m_shader); fmt.end_initialize(); } // Finally write main entry function shade::shaders::Enterable* entry = dynamic_cast<shade::shaders::Enterable*>(get_pointer(m_shader)); if (entry) { std::string class_name(entry->shade::shaders::Enterable::get_class_name()); std::string method_name(entry->get_entry_name(env)); fmt.invoke(class_name, method_name); } m_requires_compilation = false; }
/** \brief Parse a soap reply in case of a success */ upnp_err_t upnp_call_t::parse_soap_rep_success(const datum_t &xml_datum, xml_parse_t &xml_parse , strvar_db_t &strvar_db) const throw() { // log to debug KLOG_DBG("enter in " << xml_datum.to_stdstring()); // parse all the variables contained in the Response try { xml_parse.goto_firstsib(method_name() + "Response"); // if the response MAY not have any children is there are no variable returned bool has_variable = xml_parse.has_children(); // if there are variable, goto_children() where the variable are if( has_variable ) xml_parse.goto_children(); // go thru all the sibling at this level - which reprensent the variable while( has_variable ){ // log to debug KLOG_DBG("nodename=" << xml_parse.node_name()); KLOG_DBG("nodecontent=" << xml_parse.node_content()); // if this node_name is NOT "text", insert it in the strvar_db_t // - NOTE: "text" is the nodename used by the xml parser for the \r\n inserted // between the xml node. so they are to skip if( xml_parse.node_name() != "text" ){ strvar_db.append(xml_parse.node_name(), xml_parse.node_content()); } // if there are nomore sibling, leave the loop if( !xml_parse.has_nextsib() ) break; // goto the next sibling xml_parse.goto_nextsib(); }; }catch(xml_except_t &e){ KLOG_ERR("unable to parse the xml 'response variable' due to " << e.what() << " in " << xml_datum.to_stdstring()); return upnp_err_t(upnp_err_t::ERROR, "unable to parse the xml 'response varialble' due to " + e.what()); } // return no error return upnp_err_t::OK; }
void test_classify(T t, const char* type) { std::cout << "Testing type " << type << std::endl; typedef typename boost::math::detail::fp_traits<T>::type traits; typedef typename traits::method method; std::cout << "Evaluation method = " << method_name(method()) << std::endl; t = 2; T u = 2; BOOST_CHECK_EQUAL((::boost::math::fpclassify)(t), (int)FP_NORMAL); BOOST_CHECK_EQUAL((::boost::math::fpclassify)(-t), (int)FP_NORMAL); BOOST_CHECK_EQUAL((::boost::math::isfinite)(t), true); BOOST_CHECK_EQUAL((::boost::math::isfinite)(-t), true); BOOST_CHECK_EQUAL((::boost::math::isinf)(t), false); BOOST_CHECK_EQUAL((::boost::math::isinf)(-t), false); BOOST_CHECK_EQUAL((::boost::math::isnan)(t), false); BOOST_CHECK_EQUAL((::boost::math::isnan)(-t), false); BOOST_CHECK_EQUAL((::boost::math::isnormal)(t), true); BOOST_CHECK_EQUAL((::boost::math::isnormal)(-t), true); if(std::numeric_limits<T>::is_specialized) { t = (std::numeric_limits<T>::max)(); BOOST_CHECK_EQUAL((::boost::math::fpclassify)(t), (int)FP_NORMAL); BOOST_CHECK_EQUAL((::boost::math::fpclassify)(-t), (int)FP_NORMAL); BOOST_CHECK_EQUAL((::boost::math::isfinite)(t), true); BOOST_CHECK_EQUAL((::boost::math::isfinite)(-t), true); BOOST_CHECK_EQUAL((::boost::math::isinf)(t), false); BOOST_CHECK_EQUAL((::boost::math::isinf)(-t), false); BOOST_CHECK_EQUAL((::boost::math::isnan)(t), false); BOOST_CHECK_EQUAL((::boost::math::isnan)(-t), false); BOOST_CHECK_EQUAL((::boost::math::isnormal)(t), true); BOOST_CHECK_EQUAL((::boost::math::isnormal)(-t), true); t = (std::numeric_limits<T>::min)(); if(t != 0) { BOOST_CHECK_EQUAL((::boost::math::fpclassify)(t), (int)FP_NORMAL); BOOST_CHECK_EQUAL((::boost::math::fpclassify)(-t), (int)FP_NORMAL); BOOST_CHECK_EQUAL((::boost::math::isfinite)(t), true); BOOST_CHECK_EQUAL((::boost::math::isfinite)(-t), true); BOOST_CHECK_EQUAL((::boost::math::isinf)(t), false); BOOST_CHECK_EQUAL((::boost::math::isinf)(-t), false); BOOST_CHECK_EQUAL((::boost::math::isnan)(t), false); BOOST_CHECK_EQUAL((::boost::math::isnan)(-t), false); BOOST_CHECK_EQUAL((::boost::math::isnormal)(t), true); BOOST_CHECK_EQUAL((::boost::math::isnormal)(-t), true); } } if(std::numeric_limits<T>::has_denorm) { t = (std::numeric_limits<T>::min)(); t /= 2; if(t != 0) { BOOST_CHECK_EQUAL((::boost::math::fpclassify)(t), (int)FP_SUBNORMAL); BOOST_CHECK_EQUAL((::boost::math::fpclassify)(-t), (int)FP_SUBNORMAL); BOOST_CHECK_EQUAL((::boost::math::isfinite)(t), true); BOOST_CHECK_EQUAL((::boost::math::isfinite)(-t), true); BOOST_CHECK_EQUAL((::boost::math::isinf)(t), false); BOOST_CHECK_EQUAL((::boost::math::isinf)(-t), false); BOOST_CHECK_EQUAL((::boost::math::isnan)(t), false); BOOST_CHECK_EQUAL((::boost::math::isnan)(-t), false); BOOST_CHECK_EQUAL((::boost::math::isnormal)(t), false); BOOST_CHECK_EQUAL((::boost::math::isnormal)(-t), false); } t = std::numeric_limits<T>::denorm_min(); if((t != 0) && (t < (std::numeric_limits<T>::min)())) { BOOST_CHECK_EQUAL((::boost::math::fpclassify)(t), (int)FP_SUBNORMAL); BOOST_CHECK_EQUAL((::boost::math::fpclassify)(-t), (int)FP_SUBNORMAL); BOOST_CHECK_EQUAL((::boost::math::isfinite)(t), true); BOOST_CHECK_EQUAL((::boost::math::isfinite)(-t), true); BOOST_CHECK_EQUAL((::boost::math::isinf)(t), false); BOOST_CHECK_EQUAL((::boost::math::isinf)(-t), false); BOOST_CHECK_EQUAL((::boost::math::isnan)(t), false); BOOST_CHECK_EQUAL((::boost::math::isnan)(-t), false); BOOST_CHECK_EQUAL((::boost::math::isnormal)(t), false); BOOST_CHECK_EQUAL((::boost::math::isnormal)(-t), false); } } else { std::cout << "Denormalised forms not tested" << std::endl; } t = 0; BOOST_CHECK_EQUAL((::boost::math::fpclassify)(t), (int)FP_ZERO); BOOST_CHECK_EQUAL((::boost::math::fpclassify)(-t), (int)FP_ZERO); BOOST_CHECK_EQUAL((::boost::math::isfinite)(t), true); BOOST_CHECK_EQUAL((::boost::math::isfinite)(-t), true); BOOST_CHECK_EQUAL((::boost::math::isinf)(t), false); BOOST_CHECK_EQUAL((::boost::math::isinf)(-t), false); BOOST_CHECK_EQUAL((::boost::math::isnan)(t), false); BOOST_CHECK_EQUAL((::boost::math::isnan)(-t), false); BOOST_CHECK_EQUAL((::boost::math::isnormal)(t), false); BOOST_CHECK_EQUAL((::boost::math::isnormal)(-t), false); t /= -u; // create minus zero if it exists BOOST_CHECK_EQUAL((::boost::math::fpclassify)(t), (int)FP_ZERO); BOOST_CHECK_EQUAL((::boost::math::fpclassify)(-t), (int)FP_ZERO); BOOST_CHECK_EQUAL((::boost::math::isfinite)(t), true); BOOST_CHECK_EQUAL((::boost::math::isfinite)(-t), true); BOOST_CHECK_EQUAL((::boost::math::isinf)(t), false); BOOST_CHECK_EQUAL((::boost::math::isinf)(-t), false); BOOST_CHECK_EQUAL((::boost::math::isnan)(t), false); BOOST_CHECK_EQUAL((::boost::math::isnan)(-t), false); BOOST_CHECK_EQUAL((::boost::math::isnormal)(t), false); BOOST_CHECK_EQUAL((::boost::math::isnormal)(-t), false); // infinity: if(std::numeric_limits<T>::has_infinity) { // At least one std::numeric_limits<T>::infinity)() returns zero // (Compaq true64 cxx), hence the check. t = (std::numeric_limits<T>::infinity)(); BOOST_CHECK_EQUAL((::boost::math::fpclassify)(t), (int)FP_INFINITE); BOOST_CHECK_EQUAL((::boost::math::fpclassify)(-t), (int)FP_INFINITE); BOOST_CHECK_EQUAL((::boost::math::isfinite)(t), false); BOOST_CHECK_EQUAL((::boost::math::isfinite)(-t), false); BOOST_CHECK_EQUAL((::boost::math::isinf)(t), true); BOOST_CHECK_EQUAL((::boost::math::isinf)(-t), true); BOOST_CHECK_EQUAL((::boost::math::isnan)(t), false); BOOST_CHECK_EQUAL((::boost::math::isnan)(-t), false); BOOST_CHECK_EQUAL((::boost::math::isnormal)(t), false); BOOST_CHECK_EQUAL((::boost::math::isnormal)(-t), false); #if !defined(__BORLANDC__) && !(defined(__DECCXX) && !defined(_IEEE_FP)) // divide by zero on Borland triggers a C++ exception :-( // divide by zero on Compaq CXX triggers a C style signal :-( t = 2; u = 0; t /= u; BOOST_CHECK_EQUAL((::boost::math::fpclassify)(t), (int)FP_INFINITE); BOOST_CHECK_EQUAL((::boost::math::fpclassify)(-t), (int)FP_INFINITE); BOOST_CHECK_EQUAL((::boost::math::isfinite)(t), false); BOOST_CHECK_EQUAL((::boost::math::isfinite)(-t), false); BOOST_CHECK_EQUAL((::boost::math::isinf)(t), true); BOOST_CHECK_EQUAL((::boost::math::isinf)(-t), true); BOOST_CHECK_EQUAL((::boost::math::isnan)(t), false); BOOST_CHECK_EQUAL((::boost::math::isnan)(-t), false); BOOST_CHECK_EQUAL((::boost::math::isnormal)(t), false); BOOST_CHECK_EQUAL((::boost::math::isnormal)(-t), false); t = -2; t /= u; BOOST_CHECK_EQUAL((::boost::math::fpclassify)(t), (int)FP_INFINITE); BOOST_CHECK_EQUAL((::boost::math::fpclassify)(-t), (int)FP_INFINITE); BOOST_CHECK_EQUAL((::boost::math::isfinite)(t), false); BOOST_CHECK_EQUAL((::boost::math::isfinite)(-t), false); BOOST_CHECK_EQUAL((::boost::math::isinf)(t), true); BOOST_CHECK_EQUAL((::boost::math::isinf)(-t), true); BOOST_CHECK_EQUAL((::boost::math::isnan)(t), false); BOOST_CHECK_EQUAL((::boost::math::isnan)(-t), false); BOOST_CHECK_EQUAL((::boost::math::isnormal)(t), false); BOOST_CHECK_EQUAL((::boost::math::isnormal)(-t), false); #else std::cout << "Infinities from divide by zero not tested" << std::endl; #endif } else { std::cout << "Infinity not tested" << std::endl; } #ifndef __BORLANDC__ // NaN's: // Note that Borland throws an exception if we even try to obtain a Nan // by calling std::numeric_limits<T>::quiet_NaN() !!!!!!! if(std::numeric_limits<T>::has_quiet_NaN) { t = std::numeric_limits<T>::quiet_NaN(); BOOST_CHECK_EQUAL((::boost::math::fpclassify)(t), (int)FP_NAN); BOOST_CHECK_EQUAL((::boost::math::fpclassify)(-t), (int)FP_NAN); BOOST_CHECK_EQUAL((::boost::math::isfinite)(t), false); BOOST_CHECK_EQUAL((::boost::math::isfinite)(-t), false); BOOST_CHECK_EQUAL((::boost::math::isinf)(t), false); BOOST_CHECK_EQUAL((::boost::math::isinf)(-t), false); BOOST_CHECK_EQUAL((::boost::math::isnan)(t), true); BOOST_CHECK_EQUAL((::boost::math::isnan)(-t), true); BOOST_CHECK_EQUAL((::boost::math::isnormal)(t), false); BOOST_CHECK_EQUAL((::boost::math::isnormal)(-t), false); } else { std::cout << "Quiet NaN's not tested" << std::endl; } if(std::numeric_limits<T>::has_signaling_NaN) { t = std::numeric_limits<T>::signaling_NaN(); BOOST_CHECK_EQUAL((::boost::math::fpclassify)(t), (int)FP_NAN); BOOST_CHECK_EQUAL((::boost::math::fpclassify)(-t), (int)FP_NAN); BOOST_CHECK_EQUAL((::boost::math::isfinite)(t), false); BOOST_CHECK_EQUAL((::boost::math::isfinite)(-t), false); BOOST_CHECK_EQUAL((::boost::math::isinf)(t), false); BOOST_CHECK_EQUAL((::boost::math::isinf)(-t), false); BOOST_CHECK_EQUAL((::boost::math::isnan)(t), true); BOOST_CHECK_EQUAL((::boost::math::isnan)(-t), true); BOOST_CHECK_EQUAL((::boost::math::isnormal)(t), false); BOOST_CHECK_EQUAL((::boost::math::isnormal)(-t), false); } else { std::cout << "Signaling NaN's not tested" << std::endl; } #endif }