Filter lowpass_make(float cutoff, float sample_freq) { /* float omega_c = tan(cutoff / sample_freq * M_PI); float a = (1 - omega_c) / 2; float as[] = {a, a}; float bs[] = {omega_c}; */ float as[] = {0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1}; float bs[] = {0.0}; return filter_make(as, array_size(as), bs, array_size(bs)); }
// Fetch position from GDB output ANSWER. void PosBuffer::filter (string& answer) { if (answer.length() == 0) return; // Check program state switch (gdb->type()) { case BASH: { if (has_prefix(answer, "Reading ")) started = true; break; } case GDB: { // If GDB prints a "Current function" line, it overrides whatever // came before (e.g. "stopped in"). if (has_prefix(answer, "Current function is ")) already_read= Null; // Check program state if (has_prefix(answer, "Starting program: ")) started = true; if (has_prefix(answer, "The program no longer exists")) terminated = true; if (has_prefix(answer, "Program received signal")) signaled = true; if (has_prefix(answer, "Program terminated with signal")) signaled = terminated = true; if (answer.contains("has changed; re-reading symbols")) recompiled = true; if (has_prefix(answer, "Current language: ")) gdb->program_language(answer); if (has_prefix(answer, "The current source language is ")) gdb->program_language(answer); if (terminated) annotate("exited"); if (signaled) annotate("signalled"); } break; case DBG: { // Check program state if (has_prefix(answer, "Starting program: ")) started = true; } break; case DBX: { if (has_prefix(answer, "Running: ")) started = true; if (answer.contains("has been recompiled")) recompiled = true; if (has_prefix(answer, "signal ")) signaled = true; } break; case MAKE: { if (has_prefix(answer, "Reading makefiles...")) started = true; break; } case PERL: { if (has_prefix(answer, "Loading DB routines from perl5db.pl")) recompiled = true; } break; case XDB: case JDB: case PYDB: break; // Nothing special } // Check for terminated program int i = -1; while ((i = answer.index("rogram", i + 1)) > 0) { int j = i; while (j > 0 && answer[j - 1] != '\n') j--; #if RUNTIME_REGEX static regex rxterminated("([Tt]he )?[Pp]rogram " "(exited|terminated" "|is not being run|no longer exists).*"); #endif if (answer.matches(rxterminated, j)) terminated = true; } if (answer.contains("no active process") || answer.contains("execution completed") || answer.contains("application exited")) terminated = true; // Check for auto command if (app_data.auto_commands) { answer.prepend(auto_cmd_part); auto_cmd_part = ""; string pfx = app_data.auto_command_prefix; if (!auto_cmd_buffer.empty() && !auto_cmd_buffer.contains('\n', -1)) { // Complete pending auto command if (answer.contains('\n')) { auto_cmd_buffer += answer.through('\n'); answer = answer.after('\n'); } else { auto_cmd_buffer += answer; answer = ""; } } int index; while ((index = answer.index(pfx)) >= 0) { string cmd = answer.from(index); if (cmd.contains('\n')) cmd = cmd.through('\n'); answer = answer.before(index) + answer.from(int(index + cmd.length())); cmd = cmd.after(pfx); auto_cmd_buffer += cmd; } if (pfx.contains(answer, 0)) { auto_cmd_part = answer; answer = ""; } } // Fetch and store position info, return remainder switch (already_read) { case PosComplete: if (gdb->type() == GDB) filter_gdb(answer); // Slurp in the source annotation // Nothing more to filter - skip possible line number info filter_line(answer); break; case PosPart: answer.prepend (answer_buffer); answer_buffer = ""; already_read = Null; // FALL THROUGH case Null: { // Now go for the actual position. switch (gdb->type()) { case BASH: filter_bash(answer); break; case DBG: filter_dbg(answer); break; case DBX: filter_dbx(answer); break; case GDB: filter_gdb(answer); break; case JDB: filter_jdb(answer); break; case MAKE: filter_make(answer); break; case PERL: filter_perl(answer); break; case PYDB: filter_pydb(answer); break; case XDB: filter_xdb(answer); break; } filter_line(answer); } break; } }