void LogLine( const char *str ) { int len; if( LogHndl == NIL_HANDLE ) return; len = strlen( str ); if( WriteText( LogHndl, str, len ) != len ) { LogFini(); } }
void WriteStringArray(const SC_StringArray& strings) { WriteInt(strings.Size()); WriteInt(strings.GetStringLen()); WriteLine(); for (int i = 0; i < strings.Size(); i++ ) { WriteText(strings[i]); } }
void DPO_TransformTable::WriteToFile() { const int objMajVer = 0; const int objMinVer = 0; WriteObjectHeader(objMajVer, objMinVer); WriteFuncObjRef(inputTableObjRef); WriteBool(columnDescAreVarID); WriteInt(int(outputTableData)); WriteLine(); for (int i = 0; i < maxTransform; i++) { WriteBool(transformDesc[i].doTransform); WriteLine(); WriteText(transformDesc[i].transformID); WriteText(transformDesc[i].transformDesc); } WriteLine(); }
//////////////////////////////////////////////////////////////////////////////// // BeginElement // bool XmlWriter::BeginElement( const char *psElementName ) { if (CloseCurrentElement() && WriteIndent() && WriteText( "<", 1 ) && WriteName( psElementName )) { mnState = kStateElement; mbSimpleElement = true; mnIndentLevel++; return true; } return false; }
void LayerStaticSupport::WriteGeoLayer(const GeologyLayer& outLayer) { WriteText(outLayer.intervalID); WriteUnitReal(outLayer.topDepth); WriteUnitReal(outLayer.topElevation); WriteInt(outLayer.nintervalNodes); WriteLine(); WriteBool(outLayer.layerHasSkin); WriteBool(outLayer.layerIsIsotropic); WriteInt(outLayer.parIndex); WriteLine(); }
void CmyWord::WriteNewLineText(CString szText, int nLineCount /**//* = 1 */) { int i; if (nLineCount <= 0) { nLineCount = 0; } for (i = 0; i < nLineCount; i++) { m_wdSel.TypeParagraph(); } WriteText(szText); }
BOOL __fastcall DetourWeTriggerEditorEditboxCopy(const char *source) { if (source) { try { return WriteText(base::u2w(source)); } catch (...) { } } return base::fast_call<BOOL>(pgTrueWeTriggerEditorEditboxCopy, source); }
bool CreateProcess(char* fileName) { cursorIndex++; CStringA message = "Loading '"; message.Add(fileName); message.Add("'..."); WriteText(message._ptr(), (cursorIndex / 24) * 40, cursorIndex % 24, 0xA); dword smid = 0; bool loaded = true; dword fileSize = GetFileSize(fileName); if (fileSize != 0) { smid = KeAllocSharedMem(fileSize); ReadFile(smid, fileName); } else { loaded = false; } if (loaded) { byte* drvImage = KeMapSharedMem(smid); if (!KeCreateProcess(drvImage, fileSize, fileName)) loaded = false; KeReleaseSharedMem(smid); } if (loaded) WriteText("OK", message.Len() + (cursorIndex / 24) * 40, cursorIndex % 24, 0xA); else WriteText("Fail", message.Len() + (cursorIndex / 24) * 40, cursorIndex % 24, 0xC); return loaded; }
void DPO_ReadLabelArray::WriteToFile() { const int objMajVer = 0; const int objMinVer = 0; WriteObjectHeader(objMajVer, objMinVer); WriteText(labelsFname); WriteInt(int(labelFileFormat)); WriteLine(); WriteLine(); }
/*テキスト通常描画*/ void TextClass::NormalWrite(UserClass &User){ //インスタンス取得 KeyClass* Key = KeyClass::GetInstance(); MouseClass* Mouse = MouseClass::GetInstance(); //テキスト描画 WriteText(User); //名前描画 WriteName(); //ゲームカウント更新 //User.SetSaveData(SceneCount,TextCount,SerifCount); }
task datalog() { Delete(IRFileName, IRIoResult); // delete any preexisting file OpenWrite( IRFileHandle, IRIoResult, IRFileName, IRFileSize); // create and open a new file while(!LogData){EndTimeSlice();} // wait until we are instructed to start gathering data while(LogData) // add samples to the file { StringFormat(sString, "%4d", step); // autonomous program step number WriteText(IRFileHandle, IRIoResult, sString); StringFormat(sString, "%7d", IR_Bearing); //our calculated bearing IR one WriteText(IRFileHandle, IRIoResult, sString); StringFormat(sString, "%7d", bearingAC); // IR calculated bearing IR one WriteText(IRFileHandle, IRIoResult, sString); StringFormat(sString, "%7d", IR_Bearing2); // our calculated bearing IR two WriteText(IRFileHandle, IRIoResult, sString); StringFormat(sString, "%7d", bearingAC2); // IR calculated bearing IR two strcat(sString,CRLF); WriteText(IRFileHandle, IRIoResult, sString); wait1Msec(50); // sample frequency } Close(IRFileHandle, IRIoResult); // close the file once we are told to stop wait10Msec(20); }
void MyFrame::onThreadMsg(wxCommandEvent& evt){ ThreadMsg *msg =static_cast<ThreadMsg*>(evt.GetClientData()); wxString str (wxDateTime::Now().Format(wxT("[%F %H-%M-%S]"))); str << wxString::Format(wxT(" (TID#%ld) "), msg->pthSpeaker);//->GetId()); str << msg->sName; WriteText(str, wxTextAttr(*wxBLUE)); switch(msg->action){ case ThreadMsg::TEXT_OUT: WriteText(msg->GetStr()+wxT("\n")); break; case ThreadMsg::ERROR_OUT: WriteText(msg->GetStr()+wxT("\n"),wxTextAttr(*wxRED) ); break; case ThreadMsg::TERMINATED: WriteText(wxT(" Terminated by user\n"),wxTextAttr(*wxRED) ); break; default: WriteText(wxT(" ERROR\n"), wxTextAttr(*wxRED)); } delete msg; }
void LayerStaticSupport::WriteWellBoreZone(const WellBoreZone& outWBZ) { WriteText(outWBZ.intervalID); WriteUnitReal(outWBZ.topDepth); WriteUnitReal(outWBZ.topElevation); WriteInt(outWBZ.nintervalNodes); WriteLine(); WriteBool(outWBZ.zoneIsPacker); WriteUnitReal(outWBZ.deltaVolume); WriteUnitReal(outWBZ.tzComp); WriteInt(outWBZ.seqIndex); WriteLine(); }
// Write the text void CtrlBox2::SetTxt( const wxString &txt, bool redraw ) { if( this->txt != txt ) { this->txt = txt; Clear(); WriteText(txt); /* if( redraw ) { Refresh(true); Update(); } */ } }
void WriteEndFullTag(void) { char *etag = NULL; if ((etag = CurrFull->find(CurrDepth)) == NULL) return; long etype = GetCurrEtype(etag); // if pending text, strip trailing space until after end tag if (PendingText) PendingText = WriteTextWithoutTrailingSpace(PendingText); if (DoFull && DoPara) { // if ending block, and in wrapped text, close the p if ((etype == 1) && WrappedText) { WriteCode("</p>"); WrappedText = false; } } bool skiptag = false; if (DoMin && DoPara) { if (SkippedPTag && !stricmp(etag, "p")) { skiptag = true; SkippedPTag = false; } } if (!skiptag) { WriteChar('<'); WriteChar('/'); WriteText(etag); WriteChar('>'); } if (((etag = CurrShort->find(CurrDepth)) != NULL) && !stricmp(etag, CurrElems->find(CurrDepth))) { CurrElems->remove(CurrDepth); CurrEtypes->remove(CurrDepth); } CurrFull->remove(CurrDepth); CurrShortEnd->remove(CurrDepth); CurrShort->remove(CurrDepth); LastFullEndDepth = --CurrDepth; }
void DPO_ReadGridData::WriteToFile() { const int objMajVer = 3; // added decimate // const int objMajVer = 2; // added surfer // const int objMajVer = 1; // added options // const int objMajVer = 0; const int objMinVer = 0; WriteObjectHeader(objMajVer, objMinVer); WriteText(gridDataFname); WriteText(setXID); WriteText(setYID); WriteBool(setXLog); WriteBool(setYLog); WriteInt(int(gridFileFormat)); WriteInt(decimationModulus); WriteLine(); }
void DPO_ExecuteProcess::WriteToFile() { const int objMajVer = 4; // added ignoreGlobalDoNotExecute // const int objMajVer = 3; // added MPI node support // const int objMajVer = 2; // added hide window // const int objMajVer = 1; // added execute on apply and exe par0 // const int objMajVer = 0; const int objMinVer = 0; WriteObjectHeader(objMajVer, objMinVer); WriteText(processToExecute); WriteText(processCmdLine); WriteText(processExeDirectory); WriteBool(useUpstreamTrigger); WriteBool(upstreamMustBeOK); WriteBool(executeOnApply); // added v1 WriteBool(ignoreGlobalDoNotExecute); // added v4 WriteBool(hideConsoleWindow); // added v2 WriteBool(useSpecificEXE); WriteBool(useCommandLine); WriteBool(addExePar0); // added v1 WriteBool(setExeDirectory); // added v3 WriteLine(); WriteBool(addMPINodeNumber); WriteBool(mpiFiles[0].nodeBasedFile); WriteBool(mpiFiles[1].nodeBasedFile); WriteBool(mpiFiles[2].nodeBasedFile); WriteLine(); WriteFuncObjRef(upstreamTriggerObjRef); }
static inline void WriteRegexTexts(const gzFile& f, CListBox& list) { int size; gzwrite(f, &(size = list.GetCount()), sizeof(int)); // 长度 CString strBuf; for (int i = 0; i < size; i++) { list.GetText(i, strBuf); BOOL isRegex = strBuf.Left(REGEX_PREFIX_LENGTH) == IS_REGEX_PREFIX; int intBuf; gzwrite(f, &(intBuf = isRegex ? 1 : 0), sizeof(int)); // 是正则 strBuf = strBuf.Right(strBuf.GetLength() - REGEX_PREFIX_LENGTH); WriteText(f, strBuf); } }
void DPO_ReadXY::WriteToFile() { const int objMajVer = 2; // added date based reading // const int objMajVer = 1; // added MPI node support // const int objMajVer = 0; const int objMinVer = 0; WriteObjectHeader(objMajVer, objMinVer); WriteText(xyFname); WriteInt(int(xyFileFormat)); WriteBool(readColumnID); WriteInt(tableXcol); WriteInt(tableYcol); WriteLine(); WriteInt(int(dateSpec.timeSpecUnits)); WriteInt(int(dateSpec.timeSpecType)); WriteInt(dateSpec.calendarYearStart); WriteLine(); WriteText(dataID); WriteNodeFileArray(mpiFiles); }
//============================================================================ // remove old file, open new one and write the header // int open_flight_record(const string sFileName) { TFileIOResult nIoResult; int nFileSize = 15 * 1024; ClearTimer(T4); Delete(sFileName, nIoResult); OpenWrite(flightDatFH, nIoResult, sFileName, nFileSize); if (nIoResult != 0) { wait10Msec(50); StopAllTasks(); } WriteText(flightDatFH, nIoResult, "int flight[][X]={\n"); //X=MotorNumber+ 1 wait10Msec(5); return(0); }
//////////////////////////////////////////////////////////////////////////////// // WriteName // // The XML standard specifies: // [4] NameChar ::= Letter | Digit | '.' | '-' | '_' | ':' | CombiningChar | Extender // [5] Name ::= (Letter | '_' | ':') (NameChar)* // [6] Names ::= Name (#x20 Name)* // [7] Nmtoken ::= (NameChar)+ // [8] Nmtokens ::= Nmtoken (#x20 Nmtoken)* // bool XmlWriter::WriteName( const char *psName ) { #if (defined(EA_TRACE_ENABLED) && EA_TRACE_ENABLED) || defined(EA_ASSERT_ENABLED) // If the EATrace or EAAssert packages are configured to enable assertions... const size_t length = strlen(psName); EA_ASSERT_FORMATTED((length > 0) && (length < 256), ("XmlWriter: Invalid element/tag name length: %u", (unsigned)length)); // We may want to extend this invalid char list, but the ones here are the primary bad chars const size_t pos = strcspn(psName, " <>\"\'&\t\r\n"); EA_ASSERT_FORMATTED(pos == length, ("XmlWriter: Invalid xml element/tag name: %s", psName)); // As can be seen above, actually only letters, '_', and ':' may begin a name. EA_ASSERT_FORMATTED((length == 0) || !isdigit(psName[0]), ("XmlWriter: Invalid xml element/tag name first char: %s", psName)); #endif return WriteText(psName, kSizeTypeNull); }
/* * Changes the window's size incrementally * PARAMS: * iters: number of times to resize the window * step: the size the window's x & y will change each iteration * delay: the time between iterations * * Note: The window's current width + (iters * step) will be the final width * and the same for current height */ void GradualResize(int iters, int step, int delay) { int x, y; SDL_GetWindowSize(window, &x, &y); x = x + step; y = y + step; int cnt; for(cnt = 0; cnt < iters; cnt++, x=x+step, y=y+step) { WriteText("Wooooah", GREEN); SDL_PumpEvents(); SDL_SetWindowSize(window, x, y); SDL_Delay(delay); } EndDemo(); }
void XmlWriter::WriteElement(const Element& rElement) { WriteIndent(); m_rStream << "<" << rElement.GetPrefixName(); // write namespaces for (const Namespace* pNamespace = rElement.GetFirstNamespace(); pNamespace; pNamespace = pNamespace->GetNextSibling()) { WriteNamespace(*pNamespace); } // write attributes for (const Attribute* pAttribute = rElement.GetFirstAttribute(); pAttribute; pAttribute = pAttribute->GetNextSibling()) { WriteAttribute(*pAttribute); } if (rElement.IsEmpty()) { // end element m_rStream << "/>"; } else { m_rStream << ">"; if (rElement.IsLeaf()) { WriteText(static_cast<const Text&>(*rElement.GetFirstChild())); } else { // write childs ++m_nIndent; for (const Node* pNode = rElement.GetFirstChild(); pNode; pNode = pNode->GetNextSibling()) { WriteNode(*pNode); } --m_nIndent; WriteIndent(); } m_rStream << "</" << rElement.GetPrefixName() << ">"; } }
void WriteAttr(char *name, char *val) { WriteText(" "); WriteText(name); WriteText("="); char *quote = strchr(val, '"') ? "'" : "\""; WriteText(quote); WriteText(val); WriteText(quote); }
//////////////////////////////////////////////////////////////////////////////// // WriteWhitespace // bool XmlWriter::WriteWhitespace( size_t nChars ) { const size_t kSpacesCount = 32; const char kSpaces[kSpacesCount + 1] = " "; // Since nIndent may be > than kSpacesCount, we allow for writing the indent in pieces. while (nChars > 0) { const size_t nCharsToWrite = ((nChars < kSpacesCount) ? nChars : kSpacesCount); if (!WriteText( kSpaces, nCharsToWrite )) return false; nChars -= nCharsToWrite; } return true; }
static VOID DoSaveFile(VOID) { HANDLE hFile; LPTSTR pTemp; DWORD size; hFile = CreateFile(Globals.szFileName, GENERIC_WRITE, FILE_SHARE_WRITE, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); if(hFile == INVALID_HANDLE_VALUE) { ShowLastError(); return; } size = GetWindowTextLength(Globals.hEdit) + 1; pTemp = HeapAlloc(GetProcessHeap(), 0, size * sizeof(*pTemp)); if (!pTemp) { CloseHandle(hFile); ShowLastError(); return; } size = GetWindowText(Globals.hEdit, pTemp, size); #ifndef UNICODE pTemp = (LPTSTR)ConvertToUNICODE(pTemp, &size); if (!pTemp) { /* original "pTemp" already freed */ CloseHandle(hFile); ShowLastError(); return; } #endif if (size) { if (!WriteText(hFile, (LPWSTR)pTemp, size, Globals.iEncoding, Globals.iEoln)) ShowLastError(); else SendMessage(Globals.hEdit, EM_SETMODIFY, FALSE, 0); } CloseHandle(hFile); HeapFree(GetProcessHeap(), 0, pTemp); }
bool CGPGroup::Write(CTextPool **textPool, int depth) { int i; CGPValue *mPair = mPairs; CGPGroup *mSubGroup = mSubGroups; if (depth >= 0) { for(i=0;i<depth;i++) { (*textPool)->AllocText("\t", false, textPool); } WriteText(textPool, mName); (*textPool)->AllocText("\r\n", false, textPool); for(i=0;i<depth;i++) { (*textPool)->AllocText("\t", false, textPool); } (*textPool)->AllocText("{\r\n", false, textPool); } while(mPair) { mPair->Write(textPool, depth+1); mPair = (CGPValue *)mPair->GetNext(); } while(mSubGroup) { mSubGroup->Write(textPool, depth+1); mSubGroup = (CGPGroup *)mSubGroup->GetNext(); } if (depth >= 0) { for(i=0;i<depth;i++) { (*textPool)->AllocText("\t", false, textPool); } (*textPool)->AllocText("}\r\n", false, textPool); } return true; }
void WriteStartTag(char *name, pair **attrs, long attrcnt) { WriteChar('<'); WriteText(name); if (attrs) { pair *attr = NULL; char *aname = NULL; char *aval = NULL; for (long i = 0; i < attrcnt; i++) { attr = attrs[i]; if (!attr) break; aname = (char *) Parser->U32to8Str(attr->name, attr->namelen); aval = (char *) Parser->U32to8Str(attr->val, attr->vallen); WriteAttr(aname, aval); } } }
static BOOL DoSaveFile(VOID) { BOOL bRet = TRUE; HANDLE hFile; LPTSTR pTemp; DWORD size; hFile = CreateFile(Globals.szFileName, GENERIC_WRITE, FILE_SHARE_WRITE, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); if(hFile == INVALID_HANDLE_VALUE) { ShowLastError(); return FALSE; } size = GetWindowTextLength(Globals.hEdit) + 1; pTemp = HeapAlloc(GetProcessHeap(), 0, size * sizeof(*pTemp)); if (!pTemp) { CloseHandle(hFile); ShowLastError(); return FALSE; } size = GetWindowText(Globals.hEdit, pTemp, size); if (size) { if (!WriteText(hFile, (LPWSTR)pTemp, size, Globals.encFile, Globals.iEoln)) { ShowLastError(); bRet = FALSE; } else { SendMessage(Globals.hEdit, EM_SETMODIFY, FALSE, 0); bRet = TRUE; } } CloseHandle(hFile); HeapFree(GetProcessHeap(), 0, pTemp); return bRet; }
void wxTextEntry::DoSetValue(const wxString& value, int flags) { if (value != DoGetValue()) { // Use Remove() rather than SelectAll() to avoid unnecessary clipboard // operations, and prevent triggering an apparent bug in GTK which // causes the subsequent WriteText() to append rather than overwrite. { EventsSuppressor noevents(this); Remove(0, -1); } EventsSuppressor noeventsIf(this, !(flags & SetValue_SendEvent)); WriteText(value); } else if (flags & SetValue_SendEvent) SendTextUpdatedEvent(GetEditableWindow()); SetInsertionPoint(0); }