static void setupAntiAlias(void) { if (textAlphaBits == 0 && graphicAlphaBits == 0) antiAlias = make_message(" "); else if (textAlphaBits == 0) antiAlias = make_message("-dGraphicsAlphaBits=%d ", graphicAlphaBits); else if (graphicAlphaBits == 0) antiAlias = make_message("-dTextAlphaBits=%d ", textAlphaBits); else antiAlias = make_message("-dTextAlphaBits=%d -dGraphicsAlphaBits=%d ", textAlphaBits, graphicAlphaBits); }
bool PlugInInfoStore::supportsMIMEType(WebCore::String const& mimetype) { logm(MODULE_FACILITIES, mimetype.deprecatedString().ascii()); if (mimetype == "application/x-origyn-mediaplayer") { logm(MODULE_FACILITIES, make_message("mime-type '%s' is supported", mimetype.deprecatedString().ascii())); return true; } else { logm(MODULE_FACILITIES, make_message("mime-type '%s' is not supported", mimetype.deprecatedString().ascii())); return false; } }
static char * lookup_symbol (state_t *state, process_t *process, uint64_t address, gboolean kernel) { const char *sym; g_assert (process); if (kernel) { sym = lookup_kernel_symbol (address); } else { const map_t *map = process_locate_map (process, address); if (!map) { sym = make_message (state, "No map [%s]", process->comm); } else { bin_file_t *bin_file = state_get_bin_file (state, map->filename); const bin_symbol_t *bin_sym; address -= map->start; address += map->offset; if (map->inode && !bin_file_check_inode (bin_file, map->inode)) { /* If the inodes don't match, it's probably because the * file has changed since the process was started. */ sym = make_message (state, "%s: inode mismatch", map->filename); } else { bin_sym = bin_file_lookup_symbol (bin_file, address); sym = bin_symbol_get_name (bin_file, bin_sym); } } } if (sym) return unique_dup (state->unique_symbols, sym); else return NULL; }
int main(int argc, const char * argv[]) { int tcpflag = 1; printf("Usage: lo_bndlsend [u] (u means use UDP)\n"); if (argc == 2) { tcpflag = (strchr(argv[1], 'u') == NULL); } printf("tcpflag %d\n", tcpflag); sleep(2); // allow some time for server to start client = lo_address_new_with_proto(tcpflag ? LO_TCP : LO_UDP, "localhost", "8100"); printf("client: %p\n", client); char s[128]; lo_timetag now; lo_timetag_now(&now); lo_timetag timetag; for (int i = 9; i >= 5; i--) { // make the bundle timetag_add(&timetag, now, 2 + i * 0.1); lo_bundle bndl = lo_bundle_new(timetag); // make first message sprintf(s, "an arbitrary string at 2.%d", i); lo_message msg1 = make_message(1000 + i, s); // add the message to the bundle lo_bundle_add_message(bndl, "/xyz/msg1", msg1); // make second message sprintf(s, "another arbitrary string at 2.%d", i); lo_message msg2 = make_message(2000 + i, s); // add the message to the bundle lo_bundle_add_message(bndl, "/abcdefg/msg2", msg2); // send it lo_send_bundle(client, bndl); } send_nested(now, 3.0, 0.0, 3000); send_nested(now, 3.1, 3.2, 4000); sleep(1); // make sure messages go out lo_address_free(client); sleep(1); // time to clean up socketsa printf("OSCSEND DONE\n"); return 0; }
void delayed_send(Duration rel_time, strong_actor_ptr from, strong_actor_ptr to, message_id mid, message data) { timer_->enqueue(nullptr, invalid_message_id, make_message(duration{rel_time}, std::move(from), std::move(to), mid, std::move(data)), nullptr); }
response_handle_type timed_sync_send(message_priority prio, const actor& dest, const duration& rtime, Ts&&... what) { static_assert(sizeof...(Ts) > 0, "no message to send"); return timed_sync_send_tuple(prio, dest, rtime, make_message(std::forward<Ts>(what)...)); }
typename detail::deduce_output_type< detail::type_list<Sigs...>, detail::type_list< typename detail::implicit_conversions< typename std::decay<Ts>::type >::type... > >::delegated_type delegate(message_priority mp, const typed_actor<Sigs...>& dest, Ts&&... xs) { static_assert(sizeof...(Ts) > 0, "no message to send"); using token = detail::type_list< typename detail::implicit_conversions< typename std::decay<Ts>::type >::type...>; token tk; check_typed_input(dest, tk); if (! dest) return {}; auto mid = current_element_->mid; current_element_->mid = mp == message_priority::high ? mid.with_high_priority() : mid.with_normal_priority(); current_element_->msg = make_message(std::forward<Ts>(xs)...); dest->enqueue(std::move(current_element_), host()); return {}; }
PendingCall StubBase::send_request(const char* method_name, std::function<void(DBusMessageIter&)>&& f, bool is_oneway) { message_ptr_t msg = make_message(dbus_message_new_method_call(busname().c_str(), objectpath(), iface(), method_name)); DBusPendingCall* pending = nullptr; DBusMessageIter iter; dbus_message_iter_init_append(msg.get(), &iter); f(iter); if (!is_oneway) { int timeout = disp().request_timeout(); if (detail::request_specific_timeout.count() > 0) timeout = detail::request_specific_timeout.count(); dbus_connection_send_with_reply(disp().conn_, msg.get(), &pending, timeout); } else { // otherwise server would stop reading requests after a while dbus_message_set_no_reply(msg.get(), TRUE); dbus_connection_send(disp().conn_, msg.get(), nullptr); dbus_connection_flush(disp().conn_); } detail::request_specific_timeout = std::chrono::milliseconds(0); return PendingCall(dbus_message_get_serial(msg.get()), pending); }
void StubBase::set_property(const char* name, std::function<void(DBusMessageIter&)>&& f) { message_ptr_t msg = make_message(dbus_message_new_method_call(busname().c_str(), objectpath(), "org.freedesktop.DBus.Properties", "Set")); DBusMessageIter iter; dbus_message_iter_init_append(msg.get(), &iter); encode(iter, iface(), name); f(iter); // and now serialize the variant DBusError err; dbus_error_init(&err); DBusMessage* reply = dbus_connection_send_with_reply_and_block(disp().conn_, msg.get(), DBUS_TIMEOUT_USE_DEFAULT, &err); // drop original message msg.reset(reply); // check for reponse if (dbus_error_is_set(&err)) { // TODO make static function to throw from DBusError Error ex(err.name, err.message); dbus_error_free(&err); throw ex; } }
int s_snprintf(char *str, size_t size, const char *format, ...) { va_list ap; char *formatted = NULL; int formatted_len; errno = 0; va_start(ap, format); formatted = make_message(&formatted_len, format, ap); va_end(ap); if (NULL == formatted) { return (-1); } s_strcpy(str, formatted, size); free(formatted); formatted = NULL; if (formatted_len >= size) { errno = EINVAL; } return (formatted_len); }
/// Anonymously sends `to` an exit message. inline void anon_send_exit(const actor_addr& to, uint32_t reason) { if (! to){ return; } auto ptr = actor_cast<actor>(to); ptr->enqueue(invalid_actor_addr, message_id{}.with_high_priority(), make_message(exit_msg{invalid_actor_addr, reason}), nullptr); }
void send(const typed_actor<Rs...>& whom, Ts... what) { check_typed_input(whom, detail::type_list<typename detail::implicit_conversions< typename detail::rm_const_and_ref<Ts>::type >::type...>{}); send_tuple(message_priority::normal, actor{whom.m_ptr.get()}, make_message(std::forward<Ts>(what)...)); }
void delayed_send(Duration rel_time, actor_addr from, channel to, message_id mid, message data) { m_timer->enqueue(invalid_actor_addr, message_id::invalid, make_message(atom("_Send"), duration{rel_time}, std::move(from), std::move(to), mid, std::move(data)), nullptr); }
void set_error(struct context *context, const char *format, va_list list) { if (!context) return; null_check(format); const char *message = make_message(format, list); context->error = variable_new_err(context, message); }
void sync_request_bouncer::operator()(const strong_actor_ptr& sender, const message_id& mid) const { if (sender && mid.is_request()) sender->enqueue(nullptr, mid.response_id(), make_message(make_error(sec::request_receiver_down)), // TODO: this breaks out of the execution unit nullptr); }
void throw_runtime_error(const char *tag, const char *func, const char *msg) { auto what = make_message(tag, func); what += ": "; what += msg; throw std::runtime_error(what); }
int make_message_var(IvyBuffer* buffer, const char *fmt, ... ) { va_list ap; int len; va_start (ap, fmt ); len = make_message (buffer, fmt, ap ); va_end (ap ); return len; }
Font::Font() :m_fontList(0), m_letterSpacing(0), m_wordSpacing(0), d(new FontPrivate()) { if (!d->init()) exit(2); if (m_fontMap[12] == 0) m_fontMap[12] = d->open("/usr/share/fonts/owb.ttf", 12, 0); d->m_ttfFont = m_fontMap[12]; if (d->m_ttfFont == NULL) logml(MODULE_FONTS, LEVEL_EMERGENCY, make_message("Couldn't init FreeType engine")); }
message_ptr_t StubBase::send_request_and_block(const char* method_name, std::function<void(DBusMessageIter&)>&& f, bool is_oneway) { message_ptr_t msg = make_message(dbus_message_new_method_call(busname().c_str(), objectpath(), iface(), method_name)); DBusPendingCall* pending = nullptr; message_ptr_t rc(nullptr, &dbus_message_unref); DBusMessageIter iter; dbus_message_iter_init_append(msg.get(), &iter); f(iter); if (!is_oneway) { int timeout = disp().request_timeout(); if (detail::request_specific_timeout.count() > 0) timeout = detail::request_specific_timeout.count(); dbus_connection_send_with_reply(disp().conn_, msg.get(), &pending, timeout); detail::request_specific_timeout = std::chrono::milliseconds(0); dbus_pending_call_block(pending); rc = make_message(dbus_pending_call_steal_reply(pending)); dbus_pending_call_unref(pending); CallState cs(*rc); if (!cs) cs.throw_exception(); } else { // otherwise server would stop reading requests after a while dbus_message_set_no_reply(msg.get(), TRUE); dbus_connection_send(disp().conn_, msg.get(), nullptr); dbus_connection_flush(disp().conn_); } return rc; }
void remote_actor_proxy::forward_msg(const actor_addr& sender, message_id mid, message msg) { CAF_LOG_TRACE(CAF_ARG(id()) << ", " << CAF_TSARG(sender) << ", " << CAF_MARG(mid, integer_value) << ", " << CAF_TSARG(msg)); m_parent->enqueue( invalid_actor_addr, invalid_message_id, make_message(atom("_Dispatch"), sender, address(), mid, std::move(msg)), nullptr); }
void send_as(const actor& from, message_priority prio, const channel& to, Ts&&... xs) { if (! to) { return; } message_id mid; to->enqueue(from.address(), prio == message_priority::high ? mid.with_high_priority() : mid, make_message(std::forward<Ts>(xs)...), nullptr); }
void BCObserverService::notifyObserver(const String& topic, const String& data) { logml(MODULE_FACILITIES, LEVEL_INFO, make_message("notify data %s for topic %s", data.deprecatedString().ascii(), topic.deprecatedString().ascii())); Vector<BIObserver*> listObserver = m_topic.get(topic); Vector<BIObserver*>::iterator it; for (it = listObserver.begin(); it != listObserver.end(); it++) { (*it)->observe(topic, data); } }
void forwarding_actor_proxy::forward_msg(const actor_addr& sender, message_id mid, message msg) { BOOST_ACTOR_LOG_TRACE(BOOST_ACTOR_ARG(id()) << ", " << BOOST_ACTOR_TSARG(sender) << ", " << BOOST_ACTOR_MARG(mid, integer_value) << ", " << BOOST_ACTOR_TSARG(msg)); shared_lock<detail::shared_spinlock> guard_(manager_mtx_); if (manager_) manager_->enqueue(invalid_actor_addr, invalid_message_id, make_message(forward_atom::value, sender, address(), mid, std::move(msg)), nullptr); }
void delegate(message_priority mp, const actor& dest, Ts&&... xs) { static_assert(sizeof...(Ts) > 0, "no message to send"); if (! dest) return; auto mid = current_element_->mid; current_element_->mid = mp == message_priority::high ? mid.with_high_priority() : mid.with_normal_priority(); current_element_->msg = make_message(std::forward<Ts>(xs)...); dest->enqueue(std::move(current_element_), host()); }
void sync_request_bouncer::operator()(const actor_addr& sender, const message_id& mid) const { BOOST_ACTOR_REQUIRE(rsn != exit_reason::not_exited); if (sender && mid.is_request()) { auto ptr = detail::raw_access::get(sender); ptr->enqueue({invalid_actor_addr, ptr, mid.response_id()}, make_message(sync_exited_msg{sender, rsn}), // TODO: this breaks out of the execution unit nullptr); } }
void forwarding_actor_proxy::forward_msg(const actor_addr& sender, message_id mid, message msg) { CAF_LOG_TRACE(CAF_ARG(id()) << ", " << CAF_TSARG(sender) << ", " << CAF_MARG(mid, integer_value) << ", " << CAF_TSARG(msg)); shared_lock<detail::shared_spinlock> m_guard(m_manager_mtx); m_manager->enqueue(invalid_actor_addr, invalid_message_id, make_message(atom("_Dispatch"), sender, address(), mid, std::move(msg)), nullptr); }
void delayed_send(const typed_actor<Sigs...>& dest, const duration& rtime, Ts&&... xs) { using token = detail::type_list< typename detail::implicit_conversions< typename std::decay<Ts>::type >::type...>; token tk; check_typed_input(dest, tk); delayed_send_impl(message_id::make(), actor_cast<abstract_channel*>(dest), rtime, make_message(std::forward<Ts>(xs)...)); }
/* * open_dict_file -- Open the dictionary file * * Inputs: * * dict_file_name The dictionary file name, or NULL for default. * * Returns: * * The file descriptor of the dictionary file. */ static FILE * open_dict_file(const char *dict_file_name) { char *fn; FILE *fp; #ifdef __CYGWIN__ char fnbuf[MAXLINE]; int fnbuf_siz; int i; #endif if (dict_file_name[0] == '\0') { /* Dictionary file not specified */ #ifdef __CYGWIN__ if ((fnbuf_siz=GetModuleFileName(GetModuleHandle(0), fnbuf, MAXLINE)) == 0) { err_msg("ERROR: Call to GetModuleFileName failed"); } for (i=fnbuf_siz-1; i>=0 && fnbuf[i] != '/' && fnbuf[i] != '\\'; i--) ; if (i >= 0) { fnbuf[i] = '\0'; } fn = make_message("%s\\%s", fnbuf, DICT_FILE); #else fn = make_message("%s/%s", IKEDATADIR, DICT_FILE); #endif } else { /* Dictionary filename was specified */ fn = make_message("%s", dict_file_name); } if ((strcmp(fn, "-")) == 0) { /* Filename "-" means stdin */ fp = stdin; } else { if ((fp = fopen(fn, "r")) == NULL) { err_sys("error opening dictionary file %s", fn); } } free(fn); return fp; }
bool forwarding_actor_proxy::link_impl(linking_operation op, abstract_actor* other) { switch (op) { case establish_link_op: if (establish_link_impl(other)) { // causes remote actor to link to (proxy of) other // receiving peer will call: this->local_link_to(other) forward_msg(ctrl(), invalid_message_id, make_message(link_atom::value, other->address())); return true; } break; case remove_link_op: if (remove_link_impl(other)) { // causes remote actor to unlink from (proxy of) other forward_msg(ctrl(), invalid_message_id, make_message(unlink_atom::value, other->address())); return true; } break; case establish_backlink_op: if (establish_backlink_impl(other)) { // causes remote actor to unlink from (proxy of) other forward_msg(ctrl(), invalid_message_id, make_message(link_atom::value, other->address())); return true; } break; case remove_backlink_op: if (remove_backlink_impl(other)) { // causes remote actor to unlink from (proxy of) other forward_msg(ctrl(), invalid_message_id, make_message(unlink_atom::value, other->address())); return true; } break; } return false; }
bool remote_actor_proxy::link_impl(linking_operation op, const actor_addr& other) { switch (op) { case establish_link_op: if (establish_link_impl(other)) { // causes remote actor to link to (proxy of) other // receiving peer will call: this->local_link_to(other) forward_msg(address(), invalid_message_id, make_message(atom("_Link"), other)); return true; } return false; case remove_link_op: if (remove_link_impl(other)) { // causes remote actor to unlink from (proxy of) other forward_msg(address(), invalid_message_id, make_message(atom("_Unlink"), other)); return true; } return false; case establish_backlink_op: if (establish_backlink_impl(other)) { // causes remote actor to unlink from (proxy of) other forward_msg(address(), invalid_message_id, make_message(atom("_Link"), other)); return true; } return false; case remove_backlink_op: if (remove_backlink_impl(other)) { // causes remote actor to unlink from (proxy of) other forward_msg(address(), invalid_message_id, make_message(atom("_Unlink"), other)); return true; } return false; } return false; }