// Returns true on success, false on sending timeout or rate-limiting failure bool SparkProtocol::send_event(const char *event_name, const char *data, int ttl, EventType::Enum event_type) { if (updating) { return false; } bool is_system_event = is_system(event_name); if (is_system_event) { static uint16_t lastMinute = 0; static uint8_t eventsThisMinute = 0; uint16_t currentMinute = uint16_t(callbacks.millis()>>16); if (currentMinute==lastMinute) { // == handles millis() overflow if (eventsThisMinute==255) return false; } else { lastMinute = currentMinute; eventsThisMinute = 0; } eventsThisMinute++; } else {
boolean debug_event(int event, Throwable *exception, const Thread *thread, const int method, const int pc, const int method2, const int pc2) { if (!debug) return false; // Check whether the event occured on a system thread. Events on system threads are disabled. if (is_system(thread)) return false; // Inform the debug thread (if any) that there has been a debug event. // return false if no debug thread is waiting. switch (debugEventOptions[event]) { case DBG_EVENT_DISABLE: return false; case DBG_EVENT_IGNORE: return true; default: break; } // Check that we have a debugger attached and that it is ready to go... if (get_monitor_count((&(debug->_super.sync))) != 0 || debugThread->state != CONDVAR_WAITING || (Debug *) debugThread->waitingOn != debug) return false; // Setup the state debug->typ = event; debug->exception = ptr2ref(exception); debug->thread = ptr2ref(thread); debug->pc = pc; debug->method = method; debug->method2 = method2; debug->pc2 = pc2; // Suspend all threads (except current) suspend_thread(null); // Make sure current thread is also suspended if (!is_system(currentThread)) suspend_thread(currentThread); // Allow the debug thread to run debugThread->flags &= ~THREAD_DAEMON; resume_thread(debugThread); monitor_notify_unchecked(&debug->_super, 1); return true; }
std::string IncludeLine::get_preprocessor_line() { if (is_system()) { return std::string("#include <") + _file + std::string(">"); } else { return std::string("#include \"") + _file + std::string("\""); } }
/* Should we display this row. Non-displayed rows don't have rhs, don't * appear on the screen, and aren't saved. They do have rows though, so their * dependencies are tracked. * * We work off sym rather than row so that we can work before the row is fully * built. */ static gboolean row_is_displayable( Symbol *sym ) { if( is_system( sym ) ) return( FALSE ); if( sym->expr && sym->expr->compile && sym->expr->compile->nparam > 0 ) return( FALSE ); if( is_super( sym ) && sym->expr ) { Expr *expr = sym->expr; PElement *root = &expr->root; /* Empty superclass. */ if( PEISELIST( root ) ) return( FALSE ); } return( TRUE ); }
int do_line() { /* Line continuation has already been handled * by read_line() */ char *inlptr = input_line; /* Skip leading whitespace */ while (isspace((int)*inlptr)) inlptr++; if (inlptr != input_line) { /* If there was leading whitespace, copy the actual * command string to the front. use memmove() because * source and target overlap */ memmove(input_line,inlptr,strlen(inlptr)); /* Terminate resulting string */ input_line[strlen(inlptr)] = NUL; } FPRINTF((stderr, "Input line: \"%s\"\n",input_line)); /* also used in load_file */ if (is_system(input_line[0])) { do_system(); if (interactive) /* 3.5 did it unconditionally */ (void) fputs("!\n", stderr); /* why do we need this ? */ return (0); } num_tokens = scanner(&input_line, &input_line_len); c_token = 0; while (c_token < num_tokens) { if (command()) return (1); if (c_token < num_tokens) { /* something after command */ if (equals(c_token, ";")) c_token++; else int_error("';' expected", c_token); } } return (0); }