void CLogger::OnLoggingEvent(class CLoggingEvent& evt) { // Remove newspace at end wxString bufferline = evt.Message().Strip(wxString::trailing); // Create the timestamp wxString stamp = wxDateTime::Now().FormatISODate() + wxT(" ") + wxDateTime::Now().FormatISOTime() #ifdef CLIENT_GUI + wxT(" (remote-GUI): "); #else + wxT(": "); #endif // critical lines get a ! prepended, ordinary lines a blank // logfile-only lines get a . to prevent transmission on EC wxString prefix = !evt.ToGUI() ? wxT(".") : (evt.IsCritical() ? wxT("!") : wxT(" ")); if ( bufferline.IsEmpty() ) { // If it's empty we just write a blank line with no timestamp. DoLine(wxT(" \n"), evt.ToStdout(), evt.ToGUI()); } else { // Split multi-line messages into individual lines wxStringTokenizer tokens( bufferline, wxT("\n") ); while ( tokens.HasMoreTokens() ) { wxString fullline = prefix + stamp + tokens.GetNextToken() + wxT("\n"); DoLine(fullline, evt.ToStdout(), evt.ToGUI()); } } }
bool Life::FindMore(LifeCell *cells[], size_t *ncells) { LifeCellBox *c; *cells = m_cells; m_ncells = 0; if (m_changed) { for ( ; m_y <= m_y1; m_y += 8, m_x = m_x0) for ( ; m_x <= m_x1; m_x += 8) { if ((c = LinkBox(m_x, m_y, false)) == NULL) continue; // check whether there is enough space left in the array if (m_ncells > (CELLSARRAYSIZE - 64)) { *ncells = m_ncells; return false; } DoLine(m_x, m_y , c->m_live1, c->m_old1 ); DoLine(m_x, m_y + 1, c->m_live1 >> 8, c->m_old1 >> 8 ); DoLine(m_x, m_y + 2, c->m_live1 >> 16, c->m_old1 >> 16); DoLine(m_x, m_y + 3, c->m_live1 >> 24, c->m_old1 >> 24); DoLine(m_x, m_y + 4, c->m_live2, c->m_old2 ); DoLine(m_x, m_y + 5, c->m_live2 >> 8, c->m_old2 >> 8 ); DoLine(m_x, m_y + 6, c->m_live2 >> 16, c->m_old2 >> 16); DoLine(m_x, m_y + 7, c->m_live2 >> 24, c->m_old2 >> 24); } } else { for ( ; m_y <= m_y1; m_y += 8, m_x = m_x0)
//---------------------------------------------- // callback function for mouse press events //---------------------------------------------- // void QFunctionEditor:: mousePressEvent( QMouseEvent *m) { int point_x = m->x(); int point_y = m->y(); point_x -= m_nBorder_x; point_y -= m_nBorder_y; if((m->buttons() & Qt::LeftButton) != 0) { // LEFT MOUSE BUTTON PRESSED if((point_x >= 0) && (point_x <= 255)) { m_bIsDragValid = true; m_nStart_x = point_x; m_nStart_y = point_y; } } else if (((m->buttons() & Qt::MidButton) != 0) || ((m->buttons() & Qt::RightButton) != 0)) { // MIDDLE MOUSE BUTTON PRESSED if((m_bIsDragValid)) { DoLine(m_nStart_x, m_nStart_y, point_x, point_y); m_nStart_x = point_x; m_nStart_y = point_y; repaint(); } } }
int main(int argc, char *argv[]) { int len, i; char* tagline = NULL; File* phile; FILE *f; char buf[1024]; int abi = #ifndef ARRAYPERSTR X_DEFAULT_ABI; #else X_ARRAYPER_ABI; #endif f = stdin; if (argc > 1) { for (i = 1; i < argc; i++) { if (strcmp (argv[i], "-f") == 0) { if (++i < argc) f = fopen (argv[i], "r"); else return 1; } if (strcmp (argv[i], "-sparcabi") == 0) abi = X_SPARC_ABI; if (strcmp (argv[i], "-intelabi") == 0) abi = X_INTEL_ABI; if (strcmp (argv[i], "-functionabi") == 0) abi = X_FUNCTION_ABI; if (strcmp (argv[i], "-earlyR6bc") == 0 && abi == X_INTEL_ABI) abi = X_INTEL_ABI_BC; if (strcmp (argv[i], "-arrayperabi") == 0) abi = X_ARRAYPER_ABI; #ifdef ARRAYPERSTR if (strcmp (argv[i], "-defaultabi") == 0) abi = X_DEFAULT_ABI; #endif } } if (f == NULL) return 1; while (fgets(buf, sizeof buf, f)) { if (!buf[0] || buf[0] == '\n') continue; if (buf[0] == '!') { if (tagline) continue; tagline = DoComment (buf); continue; } if (buf[(len = strlen (buf) - 1)] == '\n') buf[len] = '\0'; DoLine(buf); } for (phile = file; phile; phile = phile->next) { if (abi != X_ARRAYPER_ABI) IndexEntries (phile, abi); WriteHeader (tagline, phile, abi); } WriteSource(tagline, abi); return 0; }
//---------------------------------------------- // reset the color table to linear ramp //---------------------------------------------- // void QFunctionEditor:: resetTable( bool bSelected) { int start_X = 0, start_Y = 255, end_X = 255, end_Y = 0; if(bSelected) { DoLine(start_X, start_Y, end_X, end_Y); } else { QFunctionEditor::EditMode nMode = m_nMode; m_nMode = (QFunctionEditor::EditMode) 0xFF; DoLine(start_X, start_Y, end_X, end_Y); m_nMode = nMode; } update(); }
void FlattenCurve( POINT P0, POINT P1, POINT P2, POINT P3 ) { UINT32 dx,dy ; dx = abs(P1.x*3 - P0.x*2 - P3.x) ; dy = abs(P1.y*3 - P0.y*2 - P3.y) ; if ( (dx>=dy ? 3*dx+dy : dx+3*dy) > Flatness ) FlattenSplit(P0,P1,P2,P3) ; else { dx = abs(P2.x*3 - P0.x - P3.x*2) ; dy = abs(P2.y*3 - P0.y - P3.y*2) ; if ( (dx>=dy ? 3*dx+dy : dx+3*dy) > Flatness ) FlattenSplit(P0,P1,P2,P3) ; else DoLine(P3) ; } }
BOOL GWinding( PPOINT pPoints, PBYTE Types, INT32 Length, UINT32 pFlatness, UINT32 &pBottomLeftOffset, POINT &pBottomLeft ) { Flatness = pFlatness*27/2 ; StartPoint = Points = pPoints ; BottomLeft = PrevPoint = LastPoint = *Points++ ; Types++ ; --Length ; BottomLeftOffset = 0 ; Flags = 03 ; while ( Length>0 ) { if ( (*Types & PT_MOVETO)==PT_LINETO ) { DoLine( Points[0] ) ; Points++ ; Types++ ; --Length ; } else /* Curve */ { FlattenCurve( Points[-1],Points[0],Points[1],Points[2] ) ; Points+=3 ; Types+=3 ; Length-=3 ; } } if ( BottomLeft.x!=LastPoint.x || BottomLeft.y!=LastPoint.y ) PrevPoint = LastPoint ; if ( Flags & 01 ) Prev_Point = PrevPoint ; else if ( Flags & 02 ) Next_Point = *StartPoint ; pBottomLeftOffset = BottomLeftOffset ; pBottomLeft = BottomLeft ; INT32 Sgn = GWSgnMulSubMul( Next_Point.x-BottomLeft.x, Prev_Point.y-BottomLeft.y, Prev_Point.x-BottomLeft.x, Next_Point.y-BottomLeft.y ) ; if ( Sgn ) return Sgn<0 ; Sgn = Next_Point.x-Prev_Point.x ; if ( Sgn ) return Sgn<0 ; Sgn = Prev_Point.y-Next_Point.y ; return Sgn<0 ; }
//---------------------------------------------------- // callback function for mouse move events //---------------------------------------------------- // void QFunctionEditor:: mouseMoveEvent(QMouseEvent *m) { if((m_nBorder_x < 0) || (m_nBorder_y < 0)) { return; } int x,w; int point_x = m->x(); int point_y = m->y(); point_x -= m_nBorder_x; point_y -= m_nBorder_y; if((point_x < 0) || (point_x > 255)) { return; } if(point_y > 255) { point_y = 255; } else if(point_y < 0) { point_y = 0; } if((m_bIsDragValid) && (m->buttons() & Qt::LeftButton)) { DoLine(m_nStart_x, m_nStart_y, point_x, point_y); w = point_x - m_nStart_x; if(w > 0) { x = m_nStart_x; } else { w = -w; x = point_x; } m_nStart_x = point_x; m_nStart_y = point_y; repaint(m_nBorder_x + x - 15, 0, w+30, height()); } }