/* End glyph definition. */ static void glyphEnd(abfGlyphCallbacks *cb) { ufwCtx h = cb->direct_ctx; if (h->err.code != 0) return; else if (h->path.state < 2) { /* Call sequence error */ h->err.code = ufwErrBadCall; return; } if (h->path.state >= 3) /* have seen a move to. */ writeContour(h); if (h->path.state < 3) /* have NOT seen a move to, hence have never emitted an <outline> tag. */ writeLine(h, "\t<outline>"); writeLine(h, "\t</outline>"); writeLine(h, "</glyph>"); h->path.state = 0; flushBuf(h); /* Close dst stream */ h->cb.stm.close(&h->cb.stm, h->stm.dst); return; }
//------------------------------------------------------------------------------------------------- inline void_t Console::pause( culong_t &a_timeoutMsec ) const { #if xENV_WIN xTEST_DIFF(_wnd, xWND_NATIVE_HANDLE_NULL); xTEST_EQ(_stdIn.isValid(), true); xTEST_EQ(_stdOut.isValid(), true); #endif std::tstring_t msg; if (a_timeoutMsec == xTIMEOUT_INFINITE) { msg = xT("Pause, press [ENTER] to continue..."); writeLine(msg); std::cin.clear(); std::cin.ignore(); } else { msg = String::format(xT("Pause, wait for %lu msec to continue..."), a_timeoutMsec); writeLine(msg); Thread::currentSleep(a_timeoutMsec); } }
int MSXrpt_write() { INT4 magic = 0; int j; int recordsize = sizeof(INT4); // --- check that results are available if ( MSX.Nperiods < 1 ) return 0; if ( MSX.OutFile.file == NULL ) return ERR_OPEN_OUT_FILE; fseek(MSX.OutFile.file, -recordsize, SEEK_END); fread(&magic, sizeof(INT4), 1, MSX.OutFile.file); if ( magic != MAGICNUMBER ) return ERR_IO_OUT_FILE; // --- write program logo & project title PageNum = 1; LineNum = 1; newPage(); for (j=0; j<=5; j++) writeLine(Logo[j]); writeLine(""); writeLine(MSX.Title); // --- generate the appropriate type of table if ( MSX.Statflag == SERIES ) createSeriesTables(); else createStatsTables(); writeLine(""); return 0; }
void Logfile::writeCollapsibleSection(const UnicodeString& title, const Vector<UnicodeString>& contents, OutputType type, bool writeLineNumbers) { // Collapsible sections are done with an <a> tag that toggles the display style on a div holding the contents of the // section. The toggleDivVisibility() JavaScript function used here is defined in Logfile::LogfileHeader. static auto nextSectionID = 0U; auto divID = String() + "collapsible-section-" + nextSectionID++; m->writeRaw(UnicodeString() + "<div class='info'>[" + FileSystem::getShortDateTime() + "] " + "<a href='javascript:;' onmousedown='toggleDivVisibility(\"" + divID + "\");'>" + title + "</a></div>" + "<div id='" + divID + "' style='display: none; padding-left: 5em; padding-top: 1em; padding-bottom: 1em;'>"); for (auto i = 0U; i < contents.size(); i++) { if (writeLineNumbers) writeLine(String::Empty, (UnicodeString(i + 1) + ":").padToLength(10) + contents[i], type, false); else writeLine(String::Empty, contents[i], type, false); } m->writeRaw(String("</div>")); }
bool NetscapePluginModule::scanPlugin(const String& pluginPath) { RawPluginMetaData metaData; { // Don't allow the plugin to pollute the standard output. StdoutDevNullRedirector stdOutRedirector; // We are loading the plugin here since it does not seem to be a standardized way to // get the needed informations from a UNIX plugin without loading it. RefPtr<NetscapePluginModule> pluginModule = NetscapePluginModule::getOrCreate(pluginPath); if (!pluginModule) return false; pluginModule->incrementLoadCount(); bool success = pluginModule->getPluginInfoForLoadedPlugin(metaData); pluginModule->decrementLoadCount(); if (!success) return false; } // Write data to standard output for the UI process. writeLine(metaData.name); writeLine(metaData.description); writeLine(metaData.mimeDescription); fflush(stdout); return true; }
bool MyClient::sendFiles( const QStringList & files, bool addToPlaylist) { QString line; writeLine("open_files_start\r\n"); line = readLine(); if (!line.startsWith("OK")) return false; for (int n=0; n < files.count(); n++) { writeLine("open_files " + files[n] + "\r\n"); line = readLine(); if (!line.startsWith("OK")) return false; } if (!addToPlaylist) writeLine("open_files_end\r\n"); else writeLine("add_files_end\r\n"); writeLine("quit\r\n"); do { line = readLine(); } while (!line.isNull()); /* socket->disconnectFromHost(); socket->waitForDisconnected( timeout ); */ return true; }
void ASFont::write(Surface* surface, const std::string& text, int x, int y, HAlign halign, VAlign valign) { if (text.find("\n", 0) != std::string::npos) { std::vector<std::string> textArr; split(textArr, text, "\n"); writeLine(surface, textArr, x, y, halign, valign); } else writeLine(surface, text, x, y, halign, valign); }
// do something... void dispatchCommand() { int commandNumber = atoi(commandBuffer); if (DEBUG) { Serial.print("command buffer is: "); Serial.println(commandBuffer); Serial.println("accumulated data:"); Serial.println(dataBuffer); } int dataAsInt; switch (commandNumber) { case CLEAR: clearLineHistory(); lcd.clear(); break; case ROW_ONE_TEXT: writeLine(1, dataBuffer); break; case ROW_TWO_TEXT: writeLine(2, dataBuffer); break; case PLACE_STRING: writeString(dataBuffer); break; case WRITE_ASCII: writeAscii(dataBuffer); break; case SCROLL_LEFT: dataAsInt = atoi(dataBuffer); dataAsInt > 0 ? dataAsInt : DEFAULT_SCROLL_DELAY; lcd.leftScroll(LINE_SIZE, dataAsInt > 0 ? dataAsInt : DEFAULT_SCROLL_DELAY); lcd.clear(); // should i or not? break; case SCROLL_UP: writeLine(1, lineHistory[2]); writeLine(2, dataBuffer); break; case MAKE_CHAR: recvCharData(); break; case SET_GAUGE: setGauge(); break; case SEND_CMD: lcd.commandWrite(atoi(dataBuffer)); break; case PRINT: lcd.print(atoi(dataBuffer)); break; case RESET: clearLineHistory(); resetGauges(); lcd.clear(); break; default: lcd.clear(); lcd.printIn("Undef'd Command"); } }
void IOHelper::writeWelcome() { clearScreen(); writeLine("-------------------------------------------------------------"); writeLine("| Welcome to Dungeons & Dragons |"); writeLine("| |"); writeLine("| Made by Wouter Aarts & Ben van Doormalen |"); writeLine("-------------------------------------------------------------"); }
void luConsoleEdit::runCmd(const wxString& cmd, bool prompt, bool echo) { if (echo) writeLine(cmd + "\n"); if (prompt) writeLine(m_prompt); if (m_script) { m_script->call(WX2GK(cmd), "console"); } }
void newPage() { char s[MAXLINE+1]; LineNum = 1; sprintf(s, "\nPage %-3d EPANET-MSX 1.1", //1.1.00 PageNum); writeLine(s); writeLine(""); if ( PageNum > 1 ) writeTableHdr(); PageNum++; }
static void writeGlyphFinalCurve(ufwCtx h, float *coords) { writeStr(h, "\t\t\t<point x=\""); writeReal(h, coords[0]); writeStr(h, "\" y=\""); writeReal(h, coords[1]); writeLine(h, "\" />"); writeStr(h, "\t\t\t<point x=\""); writeReal(h, coords[2]); writeStr(h, "\" y=\""); writeReal(h, coords[3]); writeLine(h, "\" />"); }
int main(int argc, char **argv) { cudaError_t err = cudaSuccess; int deviceCount = 0; size_t totalDevMem, freeDevMem; size_t lastLineLength = 0; // MUST be initialized to zero signal(SIGTERM, signalHandler); signal(SIGQUIT, signalHandler); signal(SIGINT, signalHandler); signal(SIGHUP, signalHandler); writeLine(lastLineLength, "Preparing..."); err = cudaGetDeviceCount(&deviceCount); if (err != cudaSuccess) { std::cerr << "ERROR: " << cudaGetErrorString(err) << std::endl; } while (err == cudaSuccess && gRun) { std::ostringstream stream; for (int i=0; i < deviceCount; ++i) { if (err == cudaSuccess) { err = cudaSetDevice(i); if (err == cudaSuccess) { cudaMemGetInfo(&freeDevMem, &totalDevMem); if (i != 0) stream << " : "; stream << "Dev " << i << " (" << (freeDevMem/1024) << " KB of " << (totalDevMem/1048576) << " MB free)"; } } } if (err == cudaSuccess) { writeLine(lastLineLength, stream.str()); } sleep(5); // TODO - make the cycle time an optional command line flag... } cudaThreadExit(); std::cout << std::endl; return 0; }
void QAtChat::performWakeup() { d->wakeupInProgress = true; writeLine( d->wakeupCommand ); d->lastSendTime.restart(); QTimer::singleShot( 1000, this, SLOT(wakeupFinished()) ); }
void TInterior::draw() // modified for scroller { ushort color = getColor(0x0301); for( int i = 0; i < size.y; i++ ) // for each line: { TDrawBuffer b; b.moveChar( 0, ' ', color, size.x ); // fill line buffer with spaces int j = delta.y + i; // delta is scroller offset if( j < lineCount && lines[j] != 0 ) { char s[maxLineLength]; if( delta.x > strlen(lines[j] ) ) s[0] = EOS; else { strncpy( s, lines[j]+delta.x, size.x ); s[size.x] = EOS; } b.moveCStr( 0, s, color ); } writeLine( 0, i, size.x, 1, b); } }
bool ASTPrinter::visit(Identifier const& _node) { writeLine(string("Identifier ") + _node.getName()); printType(_node); printSourcePart(_node); return goDeeper(); }
bool ASTPrinter::visit(ElementaryTypeNameExpression const& _node) { writeLine(string("ElementaryTypeNameExpression ") + Token::toString(_node.getTypeToken())); printType(_node); printSourcePart(_node); return goDeeper(); }
void ExtPlaneConnection::setUpdateInterval(double newInterval) { updateInterval = newInterval; if(server_ok & (updateInterval > 0)) { QString line = "extplane-set update_interval " + QString::number(newInterval); writeLine(line); } }
bool ASTPrinter::visit(IndexAccess const& _node) { writeLine("IndexAccess"); printType(_node); printSourcePart(_node); return goDeeper(); }
bool ASTPrinter::visit(FunctionCall const& _node) { writeLine("FunctionCall"); printType(_node); printSourcePart(_node); return goDeeper(); }
bool ASTPrinter::visit(NewExpression const& _node) { writeLine("NewExpression"); printType(_node); printSourcePart(_node); return goDeeper(); }
bool ASTPrinter::visit(Assignment const& _node) { writeLine(string("Assignment using operator ") + Token::toString(_node.getAssignmentOperator())); printType(_node); printSourcePart(_node); return goDeeper(); }
bool ASTPrinter::visit(BinaryOperation const& _node) { writeLine(string("BinaryOperation using operator ") + Token::toString(_node.getOperator())); printType(_node); printSourcePart(_node); return goDeeper(); }
void TProgressBar::draw() { char string[4]; sprintf(string,"%d",curPercent); string[3] = '\0'; if(curPercent<10) { string[2] = string[0]; string[1] = string[0] = ' '; } else if(curPercent<100 && curPercent>9) { string[2] = string[1]; string[1] = string[0]; string[0] = ' '; } TDrawBuffer nbuf; uchar colorNormal, colorHiLite; colorNormal = getColor(1); uchar fore = colorNormal >>4; // >>4 is same as /16 colorHiLite = fore+((colorNormal-(fore<<4))<<4); // <<4 is same as *16 nbuf.moveChar(0,backChar,colorNormal,size.x); nbuf.moveStr(numOffset,string,colorNormal); nbuf.moveStr(numOffset+3," %",colorNormal); unsigned i; for(i=0;i<curWidth;i++) nbuf.putAttribute(i,colorHiLite); writeLine(0, 0, size.x, 1, nbuf); }
void LoggerWithFiltering::performWriteLine(std::string message, rang::fg color) { if (message.find(textToFilter) != std::string::npos) { writeLine(message, color); } }
void ExtPlaneConnection::unsubscribeDataRef(ClientDataRef *ref) { DEBUG << ref << ref->name() << ref->subscribers(); ref->setSubscribers(ref->subscribers() - 1); if(ref->subscribers() > 0) return; DEBUG << "Ref not subscribed by anyone anymore"; dataRefs.remove(ref->name()); bool isSimulated = false; foreach(SimulatedDataRef *simRef, simulatedRefs) { if(simRef->clientRef()==ref) { simRef->deleteLater(); simulatedRefs.removeOne(simRef); isSimulated = true; } } disconnect(ref, 0, this, 0); if(!isSimulated) { if(server_ok) writeLine("unsub " + ref->name()); DEBUG << "Deleting ref " << ref->name() << ref; ref->deleteLater(); } foreach(ClientDataRef *ref, dataRefs) { DEBUG << "refs now:" << ref->name(); } }
void TPuzzleView::draw() { char tmp[8]; char color[2], colorBack; TDrawBuffer buf; color[0] = color[1] = colorBack = getColor(1); if (!solved) color[1] = getColor(2); /* SS: little change */ short i; for (i = 0; i <= 3; i++) //for(short i = 0; i <= 3; i++) { buf.moveChar(0, ' ', colorBack, 18); if (i == 1) buf.moveStr(13, "Move", colorBack); if (i == 2) { sprintf(tmp, "%d", moves); buf.moveStr(14, tmp, colorBack); } for (short j = 0; j <= 3; j++) { strcpy(tmp, " "); tmp[1] = board[i][j]; if (board[i][j] == ' ') buf.moveStr((short) (j * 3), tmp, color[0]); else buf.moveStr((short) (j * 3), tmp, color[(int) map[board[i][j] - 'A']]); } writeLine(0, i, 18, 1, buf); } }
bool ASTPrinter::visit(MemberAccess const& _node) { writeLine("MemberAccess to member " + _node.getMemberName()); printType(_node); printSourcePart(_node); return goDeeper(); }
void TOutlineViewer::draw() { ushort nrmColor = getColor(0x0401); firstThat(drawTree); dBuf.moveChar(0, ' ', nrmColor, size.x); writeLine(0, auxPos + 1, size.x, size.y - (auxPos - delta.y), dBuf); }
void LC_MakerCamSVG::writeEntity(RS_Entity* entity) { RS_DEBUG->print("RS_MakerCamSVG::writeEntity: Found entity ..."); switch (entity->rtti()) { case RS2::EntityInsert: writeInsert((RS_Insert*)entity); break; case RS2::EntityPoint: writePoint((RS_Point*)entity); break; case RS2::EntityLine: writeLine((RS_Line*)entity); break; case RS2::EntityPolyline: writePolyline((RS_Polyline*)entity); break; case RS2::EntityCircle: writeCircle((RS_Circle*)entity); break; case RS2::EntityArc: writeArc((RS_Arc*)entity); break; case RS2::EntityEllipse: writeEllipse((RS_Ellipse*)entity); break; default: RS_DEBUG->print("RS_MakerCamSVG::writeEntity: Entity with type '%d' not yet implemented", (int)entity->rtti()); break; } }