/** * Return the path to a directory where temporary files should be * created. */ const char *get_temp_directory() { static const char *temp_directory = NULL; char *tmp; if (temp_directory != NULL) return temp_directory; temp_directory = getenv("PROOT_TMP_DIR"); if (temp_directory == NULL) { temp_directory = P_tmpdir; return temp_directory; } tmp = realpath(temp_directory, NULL); if (tmp == NULL) { note(NULL, WARNING, SYSTEM, "can't canonicalize %s, using %s instead of PROOT_TMP_DIR", temp_directory, P_tmpdir); temp_directory = P_tmpdir; return temp_directory; } temp_directory = talloc_strdup(talloc_autofree_context(), tmp); if (temp_directory == NULL) temp_directory = tmp; else free(tmp); return temp_directory; }
void do_packet(struct interface_info *interface, struct dhcp_packet *packet, int len, unsigned int from_port, struct iaddr from, struct hardware *hfrom) { struct packet tp; int i; if (packet->hlen > sizeof(packet->chaddr)) { note("Discarding packet with invalid hlen."); return; } memset(&tp, 0, sizeof(tp)); tp.raw = packet; tp.packet_length = len; tp.client_port = from_port; tp.client_addr = from; tp.interface = interface; tp.haddr = hfrom; parse_options(&tp); if (tp.options_valid && tp.options[DHO_DHCP_MESSAGE_TYPE].data) tp.packet_type = tp.options[DHO_DHCP_MESSAGE_TYPE].data[0]; if (tp.packet_type) dhcp(&tp); else bootp(&tp); /* Free the data associated with the options. */ for (i = 0; i < 256; i++) if (tp.options[i].len && tp.options[i].data) free(tp.options[i].data); }
static int Fork1(EXEC *ep) { int pid; int fds[2]; if (pipe(fds) == -1) { note("Failed to create pipe for child process (%s).\n", PERROR); errno = EAGAIN ; return(-1); } ep->md = mconnect((char *)0, fds[0], fds[1]); switch (pid = fork()) { case -1: mdisconnect(ep->md); close(fds[0]); close(fds[1]); ep->md = 0; return (-1); case 0: ChildMd = mconnect(NULL, fds[1], fds[1]); return (0); default: mlistenadd(ep->md, POLLIN); return (pid); } }
void pattern::ensureBeatNotes() { // make sure, that all step-note exist for( int i = 0; i < m_steps; ++i ) { bool found = false; for( NoteVector::Iterator it = m_notes.begin(); it != m_notes.end(); ++it ) { if( ( *it )->pos() == i * MidiTime::ticksPerTact() / MidiTime::stepsPerTact() && ( *it )->length() <= 0 ) { found = true; break; } } if( found == false ) { addNote( note( MidiTime( 0 ), MidiTime( i * MidiTime::ticksPerTact() / MidiTime::stepsPerTact() ) ), false ); } } }
QString NotesModel::setCategory(const QString &path, const QString &category) { Note note(path); qDebug() << "NotesModel2::setCategory" << path; QString newPath(note.setCategory(category)); this->refresh(true); return newPath; }
// ---------------------------------------------------------------------------- bool CVcfReader::xAssignVariationAlleles( const CVcfData& data, unsigned int index, CRef<CSeq_feat> pFeature ) // ---------------------------------------------------------------------------- { if (data.IsSnv(index)) { return xAssignVariantSnv(data, index, pFeature); } if (data.IsDel(index)) { return xAssignVariantDel(data, index, pFeature); } if (data.IsIns(index)) { return xAssignVariantIns(data, index, pFeature); } if (data.IsDelins(index)) { return xAssignVariantDelins(data, index, pFeature); } CVariation_ref::TData::TSet::TVariations& variants = pFeature->SetData().SetVariation().SetData().SetSet().SetVariations(); CRef<CVariation_ref> pVariant(new CVariation_ref); string note("Warning: Could not place variation for record \"" + NStr::Replace(data.m_strLine.substr(0, 40), "\t", " ")); if (data.m_strLine.size() > 40) { note += "..."; } note += "\". Offending values: ref=\"" + data.m_strRef + "\", alt=\"" + data.m_Alt[index] + "\""; pVariant->SetData().SetNote(note); variants.push_back(pVariant); return true; }
void HelmVoiceHandler::init() { // Create modulation and pitch wheels. mod_wheel_amount_ = new SmoothValue(0); pitch_wheel_amount_ = new SmoothValue(0); mod_sources_["pitch_wheel"] = pitch_wheel_amount_->output(); mod_sources_["mod_wheel"] = mod_wheel_amount_->output(); // Create all synthesizer voice components. createArticulation(note(), velocity(), voice_event()); createOscillators(current_frequency_->output(), amplitude_envelope_->output(Envelope::kFinished)); createModulators(amplitude_envelope_->output(Envelope::kFinished)); createFilter(osc_feedback_->output(0), note_from_center_->output(), amplitude_envelope_->output(Envelope::kFinished), voice_event()); Value* aftertouch_value = new Value(); aftertouch_value->plug(aftertouch()); addProcessor(aftertouch_value); mod_sources_["aftertouch"] = aftertouch_value->output(); output_->plug(formant_container_, 0); output_->plug(amplitude_, 1); addProcessor(output_); addGlobalProcessor(pitch_wheel_amount_); addGlobalProcessor(mod_wheel_amount_); setVoiceKiller(amplitude_envelope_->output(Envelope::kValue)); HelmModule::init(); }
boost::shared_ptr<XMLNode> MIDIEvent<Time>::to_xml() const { XMLNode *result = 0; switch (type()) { case MIDI_CMD_CONTROL: result = new XMLNode("ControlChange"); result->add_property("Channel", long(channel())); result->add_property("Control", long(cc_number())); result->add_property("Value", long(cc_value())); break; case MIDI_CMD_PGM_CHANGE: result = new XMLNode("ProgramChange"); result->add_property("Channel", long(channel())); result->add_property("Number", long(pgm_number())); break; case MIDI_CMD_NOTE_ON: result = new XMLNode("NoteOn"); result->add_property("Channel", long(channel())); result->add_property("Note", long(note())); result->add_property("Velocity", long(velocity())); break; case MIDI_CMD_NOTE_OFF: result = new XMLNode("NoteOff"); result->add_property("Channel", long(channel())); result->add_property("Note", long(note())); result->add_property("Velocity", long(velocity())); break; case MIDI_CMD_BENDER: result = new XMLNode("PitchBendChange"); result->add_property("Channel", long(channel())); result->add_property("Value", long(pitch_bender_value())); break; default: // The implementation is continued as needed result = new XMLNode("NotImplemented"); break; } return boost::shared_ptr<XMLNode>(result); }
std::vector<std::string> Base::getVarname( std::string &s) { // There might be a varname specification or not. // no varname found: return true std::vector<std::string> names; std::string list; std::vector<std::string> tokens; tokens.push_back( ":v=" ) ; tokens.push_back( ":varname=" ) ; tokens.push_back( ":vname=" ) ; tokens.push_back( ":variable" ) ; bool isEmpty=true; size_t pos0=0; for( size_t i=0 ; i < tokens.size() ; ++i ) { if( (pos0 = s.find( tokens[i] ) ) < std::string::npos ) // e.g.: s: "...:vname=...:..." and tokens: ":vname=..." isEmpty=false; else if( s.substr(0,tokens[i].size()-1) == tokens[i].substr(1) ) // e.g.: s: "vname=..." and tokens: "vname=..." isEmpty=false; } if( isEmpty ) return names; // the assignment sign size_t pos1=s.find("=",pos0); if( pos1 == std::string::npos ) { std::ostringstream ostr(std::ios::app); ostr << "Base::getVarname(): invalid assignment"; exceptionError( ostr.str() ); std::string note("E8: no rules for finding a variable name."); finally(8, note); } else ++pos1 ; // the end of the assignment size_t pos2=s.find(":",pos1); if( pos2 == std::string::npos ) // the end of the string pos2=s.size(); list=s.substr(pos1, pos2-pos1); // expand the list Split spl(list, ","); for( size_t i=0 ; i < spl.size() ; ++i) names.push_back( spl[i] ) ; return names; }
/* * Signal handler. */ static void killer (int sig) { note (N_FATAL, "Caught signal %d, un-registering and exiting.", sig); pmap_unset (SM_PROG, SM_VERS); exit (0); }
TopMenuCore::TopMenuCore(HMODULE _hModule) : m_hModule(_hModule) , m_hStopEvent(NULL) , m_pTopEntry(NULL) { note(""); // clear from any prior run m_hStopEvent = createStopEvent(); }
plString pyVaultTextNoteNode::Note_GetTitle() const { if (fNode) { VaultTextNoteNode note(fNode); return note.GetNoteTitle(); } return ""; }
/*static*/ TscoreTie* TscoreTie::check(TscoreNote* sn) { if (sn && !sn->tie()) { auto next = sn->nextNote(); if (!sn->note()->isRest() && next && !next->note()->isRest() && sn->note()->compareNotes(*next->note())) return new TscoreTie(sn, next); } return nullptr; }
void check_declarations(Context& cxt, Type_decl const& d1, Type_decl const& d2) { Type const& t1 = d1.type(); Type const& t2 = d2.type(); if (is_different(t1, t2)) { // TODO: Get the source location right. error(cxt, "declaration of '{}' as a different kind of type", d1.name()); note("'{}' previously declared as:", d1.name()); // TODO: Don't print the definition. It's not germaine to // the error. If we have source locations, I wonder if we // can just point at the line. note("{}", d1); throw Declaration_error(); } }
inline bool operator==(const Note<Time>& other) { return musical_time_equal (time(), other.time()) && note() == other.note() && musical_time_equal (length(), other.length()) && velocity() == other.velocity() && off_velocity() == other.off_velocity() && channel() == other.channel(); }
/* * Add name,flags to the next map level. */ static void mapadd(register Walk_map_t* wm, register struct name* np, char* name, unsigned long flags) { if (wm->show) note(0, "\"%s\" -> \"%s\"", np->name, name); if (!dictsearch(&wm->prev, name, LOOKUP)) { np = dictsearch(&wm->next, name, INSERT|IGNORECASE|STACK); np->flags = flags; if (dictsearch(&wm->seen, name, CREATE|IGNORECASE|STACK)) { wm->more = 1; } else { np->flags |= GMAP; note(0, "\"%s\": alias loop", name); } } }
void sendNote(int channel, int pitch, int velocity, int noteLength) { if(isThreadRunning()) { midi.sendNoteOn(channel, pitch, velocity); MidiNote note(channel, pitch, noteLength); lock(); frontNotes.push_back(note); unlock(); } }
static int push_module(int fd, char *device, char *module) { int ret = ioctl(fd, I_PUSH, module); if (ret == -1) note("push (%s) on %s failed (%s)\n", module, device, PERROR); return (ret); }
int main(int argc, char **argv) { if (argc == 1) printf("Pas Cool en fait..."); else printf("Note finale : %d\n", note(argv[1]); return 0; }
/// If the top two elements of the stack are digits, convert them to a /// number between 0-99 inclusive. Play the corresponding note. void playNote(MorseToken) { if (1 < symbolStackSize() && isdigit(s(0).toChar()) && isdigit(s(1).toChar())) { size_t note(10 * (s(1).toChar() - '0') + (s(0).toChar() - '0')); playTone(noteHz[note] + 0.5, getDitMicros() * 60); txUnsigned(note); } else { txError(); } }
void loop() { pousserTirer = 1; //velocity of MIDI notes, must be between 0 and 127 //higher velocity usually makes MIDI instruments louder for (uint8_t i=0; i < 15; i++){ note(pousserTirer,i,2*12); } // fin de la boucle for }
void test_build_destination_escaping(void) { h2o_req_t req; h2o_iovec_t dest; int escape = 0; int i, j; struct { char *pathconf; char *dest; char *input; char *output; } tests[] = { {"/abc", "/def", "/abc/xyz?query&m=n/o", "/def/xyz?query&m=n/o"}, {"/abc", "/def", "/%61bc/xyz?query&m=n/o", "/def/xyz?query&m=n/o"}, {"/abc", "/def", "/%61%62c/xyz?query&m=n/o", "/def/xyz?query&m=n/o"}, {"/abc", "/def", "/%61%62%63/xyz?query&m=n/o", "/def/xyz?query&m=n/o"}, {"/abc", "/def", "/./%61%62%63/xyz?query&m=n/o", "/def/xyz?query&m=n/o"}, {"/abc", "/def", "/../%61%62%63/xyz?query&m=n/o", "/def/xyz?query&m=n/o"}, {"/abc", "/def", "/././%61%62%63/xyz?query&m=n/o", "/def/xyz?query&m=n/o"}, {"/abc", "/def", "/./.././%61%62%63/xyz?query&m=n/o", "/def/xyz?query&m=n/o"}, {"/abc", "/def", "/./../blah/../%61%62%63/xyz?query&m=n/o", "/def/xyz?query&m=n/o"}, {"/abc", "/def", "/./../blah/.././%61%62c/xyz?query&m=n/o", "/def/xyz?query&m=n/o"}, {"/abc", "/def", "/./../blah/.././../../%61b%63/xyz?query&m=n/o", "/def/xyz?query&m=n/o"}, {"/abc", "/def", "/abc/xyz/?query&m=n/o", "/def/xyz/?query&m=n/o"}, {"/abc", "/def", "/abc/xyz/.?query&m=n/o", "/def/xyz/.?query&m=n/o"}, {"/abc", "/def", "/abc/xyz/./?query&m=n/o", "/def/xyz/./?query&m=n/o"}, {"/abc", "/def", "/abc/xyz/..?query&m=n/o", "/def/xyz/..?query&m=n/o"}, {"/abc", "/def", "/abc/xyz/../?query&m=n/o", "/def/xyz/../?query&m=n/o"}, {"/abc", "/def", "/abc/xyz/../a?query&m=n/o", "/def/xyz/../a?query&m=n/o"}, {"/abc", "/def", "/abc/%yz/?query&m=n/o", "/def/%yz/?query&m=n/o"}, {"/abc", "/def", "/abc/%78yz/?query&m=n/o", "/def/%78yz/?query&m=n/o"}, {"/", "/", "/xyz/../mno", "/xyz/../mno"}, {"/", "/", "/xyz/../mno/..", "/xyz/../mno/.."}, {"/", "/def", "/xyz/../mno", "/def/xyz/../mno"}, {"/", "/def/", "/xyz/../mno", "/def/xyz/../mno"}, {"/", "/def", "/xyz/../", "/def/xyz/../"}, {"/", "/def/", "/xyz/..", "/def/xyz/.."}, }; h2o_init_request(&req, NULL, NULL); /* 'j' runs the test with a missing leading '/' in the input path */ for (j = 0; j <= 1; j++) { for (i = 0; i < sizeof(tests) / sizeof(tests[0]); i++) { h2o_pathconf_t conf = {NULL, {tests[i].pathconf, strlen(tests[i].pathconf)}}; req.pathconf = &conf; req.path = req.input.path = h2o_iovec_init(tests[i].input + j, strlen(tests[i].input) - j); req.norm_indexes = NULL; req.path_normalized = h2o_url_normalize_path(&req.pool, req.path.base, req.path.len, &req.query_at, &req.norm_indexes); dest = h2o_build_destination(&req, tests[i].dest, strlen(tests[i].dest), escape); note("%s: %d, %sskipping the leading '/'", tests[i].input, i, !j ? "not " : ""); ok(dest.len == strlen(tests[i].output)); ok(h2o_memis(dest.base, dest.len, tests[i].output, strlen(tests[i].output))); } } h2o_mem_clear_pool(&req.pool); }
void CContextContactsDocument::ConstructL() { auto_ptr<CErrorUI> eui(CErrorUI::NewL()); #ifdef __WINS__ RFs fs; User::LeaveIfError(fs.Connect()); fs.Delete(_L("e:\\fill.txt")); fs.Close(); #endif TRAPD(err, MContextDocument::ConstructL(Application(), iDefaultSettings, KCLSettingsTuple, _L("contextcontacts.txt"), _L("contacts"))); //iContext->SetDebugCallstack(ETrue); if (err!=KErrNone) { eui->ShowGlobalErrorNoteL(err); User::Leave(err); } #ifdef __JAIKU__ TBool run_welcome=EFalse; TInt accepted_privacy_stmt_version=0; iContext->Settings().GetSettingL(SETTING_ACCEPTED_PRIVACY_STMT_VERSION, accepted_privacy_stmt_version); TInt text_resource=0; if ( accepted_privacy_stmt_version < KJaikuPrivacyStatementVersion ) { text_resource=R_TXT_PRIVACYSTATEMENT_NOT_ACCEPTED; run_welcome=ETrue; } else { TBool allowed_network_access=EFalse; iContext->Settings().GetSettingL(SETTING_ACCEPTED_NETWORK_ACCESS, allowed_network_access); if (!allowed_network_access) { text_resource=R_TXT_WELCOME_NOT_COMPLETED; run_welcome=ETrue; } } if (run_welcome) { auto_ptr<HBufC> message( StringLoader::LoadL( text_resource ) ); auto_ptr<CAknGlobalNote> note( CAknGlobalNote::NewL() ); note->ShowNoteL(EAknGlobalInformationNote, *message); iContext->CallStackMgr().SetIsExiting(ETrue); ProcessManagement::StartApplicationL( KUidContextWelcome ); User::After(3*1000*1000); // give starter a chance to run User::Leave(KLeaveExit); } #endif #ifdef __WINS__ iContext->SetAppDir(_L("c:\\system\\apps\\contextcontacts\\")); #endif }
void log_init(void) { if (!(run_mode & MODE_LOG_STDERR)) openlog(name_p, LOG_PID | LOG_NDELAY, LOG_DAEMON); mypid = getpid(); note(N_WARNING,"Version %s Starting",version_p); }
void IRBB::dump(Region * ru, bool dump_inner_region) { if (g_tfile == NULL) { return; } note("\n----- BB%d ------", BB_id(this)); if (getLabelList().get_elem_count() > 0) { note("\nLABEL:"); dumpBBLabel(getLabelList(), g_tfile); } //Attributes note("\nATTR:"); if (BB_is_entry(this)) { fprintf(g_tfile, "entry_bb "); } //if (BB_is_exit(this)) { // fprintf(g_tfile, "exit_bb "); //} if (BB_is_fallthrough(this)) { fprintf(g_tfile, "fall_through "); } if (BB_is_target(this)) { fprintf(g_tfile, "branch_target "); } //IR list note("\nSTMT NUM:%d", getNumOfIR()); g_indent += 3; TypeMgr * dm = ru->get_type_mgr(); for (IR * ir = BB_first_ir(this); ir != NULL; ir = BB_irlist(this).get_next()) { ASSERT0(ir->is_single() && ir->get_bb() == this); dump_ir(ir, dm, NULL, true, true, false, dump_inner_region); } g_indent -= 3; fprintf(g_tfile, "\n"); fflush(g_tfile); }
static TInt ShowConfirmationQueryL(TInt aQuery, TInt aBody) { auto_ptr<HBufC> text( StringLoader::LoadL( aBody ) ); TPtrC textP( *text ); auto_ptr<CAknQueryDialog> note( CAknQueryDialog::NewL() ); TInt result = note->ExecuteLD(aQuery, textP); note.release(); return result; }
static TInt ShowMessageDialogL(TInt aQuery, TInt aBody) { auto_ptr<HBufC> text( StringLoader::LoadL( aBody ) ); TPtrC textP( *text ); auto_ptr<CAknMessageQueryDialog> note( CAknMessageQueryDialog::NewL(textP) ); TInt result = note->ExecuteLD( aQuery ); note.release(); return result; }
void NoteView::addClicked() { AddDialog dialog; if( dialog.exec() ) { Note note( dialog.getNoteNameEdit().toStdString(), dialog.getNoteTextEdit().toStdString() ); _controller->addNote( note ); } }
/** * Remove the file @path. This function always returns 0. * * Note: this is a talloc destructor. */ static int remove_temp_file(char *path) { int status; status = unlink(path); if (status < 0) note(NULL, ERROR, SYSTEM, "can't remove '%s'", path); return 0; }
void WayMergeManipulation::addBogusReviewTags(const OsmMapPtr& map) const { assert(isValid(map)); ElementPtr left = map->getWay(_left); ElementPtr right = map->getWay(_right); QString note("The review scores on this way are bogus. See #3242."); ReviewMarker().mark(map, left, right, note, "Bogus", getBogusReviewScore()); }