int main(int argc, char **) { if (argc < 2) { fprintf(stderr, "This is an internal helper of Qt Creator. Do not run it manually.\n"); return 1; } uiShutDownWindowMessage = RegisterWindowMessage(L"qtcctrlcstub_shutdown"); uiInterruptMessage = RegisterWindowMessage(L"qtcctrlcstub_interrupt"); WNDCLASSEX wcex = {0}; wcex.cbSize = sizeof(wcex); wcex.lpfnWndProc = WndProc; wcex.hInstance = GetModuleHandle(0); wcex.lpszClassName = szWindowClass; if (!RegisterClassEx(&wcex)) return 1; hwndMain = CreateWindow(szWindowClass, szTitle, WS_DISABLED, 0, 0, 0, 0, NULL, NULL, wcex.hInstance, NULL); if (!hwndMain) return FALSE; // Get the command line and remove the call to this executable. wchar_t *strCommandLine = _wcsdup(GetCommandLine()); const size_t strCommandLineLength = wcslen(strCommandLine); size_t pos = 0; bool quoted = false; while (pos < strCommandLineLength) { if (strCommandLine[pos] == L'"') { quoted = !quoted; } else if (!quoted && isSpaceOrTab(strCommandLine[pos])) { while (isSpaceOrTab(strCommandLine[++pos])); break; } ++pos; } bool bSuccess = startProcess(strCommandLine + pos); free(strCommandLine); if (!bSuccess) return -1; MSG msg; DWORD dwExitCode = -1; while (GetMessage(&msg, NULL, 0, 0)) { if (msg.message == WM_DESTROY) dwExitCode = static_cast<DWORD>(msg.wParam); TranslateMessage(&msg); DispatchMessage(&msg); } return (int)dwExitCode; }
void countSpace () { while ((c = getchar()) !='\n') { if (isSpaceOrTab(c) && !isSpaceOrTab(previousChar) ) { anzahlWörter++; } if(isSpaceOrTab(c)){ anzahlZeichen--; } anzahlZeichen++; previousChar = c; } }
void rstrip(char line[]) { int i; int lengthWithoutNewLine = getLength(line) - 1; for (i = lengthWithoutNewLine; i >= 0; --i) { char currentChar = line[i]; if (isSpaceOrTab(currentChar)) { // printf("the character '%c' is space or tab\n", currentChar); line[i] = '\n'; line[i + 1] = '\0'; } else { // printf("the character '%c' is not space or tab\n", currentChar); break; } } }
void ParseVertexAttrib(const std::string& line, std::vector<Vector3>& positions, std::vector<Vector3>& normals, std::vector<Vector2>& texcoords) { if (line.size() > 1) { const char next = line[1]; if (isSpaceOrTab(next)) // "v ": parse vertex position { const Vector3 position = ParseVector3(line); positions.push_back(position); } else if (next == 'n') // "v ": parse vertex normal { const Vector3 normal = ParseVector3(line); normals.push_back(normal); } else if (next == 't') // "v ": parse vertex texcoord { const Vector2 texcoord = ParseVector2(line); texcoords.push_back(texcoord); } } }
static bool isParameterValueChar(CharacterType chr) { return !isSpaceOrTab(chr) && !isParameterValueEnd(chr); }