cmod, lass: switch/port/gate glibc functions for windows#84
Open
passyur wants to merge 19 commits into
Open
Conversation
LASS does not use any POSIX functions from unistd.h. Replace with <cstdlib> so the few exit() callers (Filter.h, examples/samplexml1.cpp) have an explicit, portable source. piece-experimental.cpp was leaning on the transitive include for chdir(); add an explicit unistd.h there to keep the build green until that call is replaced with std::filesystem. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
The XmlReader buffered-tag parser was the last C stdio user in LASS. Move the file handle to std::ifstream and provide a small readLineInto helper that preserves the exact fgets() semantics the parser relied on (returns false only on EOF with zero bytes read; otherwise null- terminates whatever was read up to the next newline or buffer limit). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
PieceHelper::getDirectoryList was using opendir/readdir/closedir. Switch to std::filesystem and surface OS errors through std::error_code instead of errno. As a side effect the result list no longer contains "." and ".." entries (the POSIX loop pushed them in unfiltered, which forced every caller to ignore them). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Replaces system("mkdir ...") and system("rm -f .../ScoreFiles/*.fms")
with std::filesystem::create_directory and a directory_iterator-based
sweep of .fms files. create_directory is idempotent, so the previous
"list directory, look for an exact match, then mkdir" sequence
collapses into a single call. Errors now surface as std::error_code
instead of silently failing in a forked shell.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Removes the last unistd.h dependency in piece-experimental.cpp. Failures (e.g. nonexistent path) now log instead of being silently swallowed by the POSIX call. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Avoids spawning a shell for the per-render PDF move into ScoreFiles/ and surfaces failures (e.g. cross-device rename) instead of dropping the system() return value on the floor. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…system::remove Utilities was the last CMOD site mixing C stdio with std::string and spawning a shell to clean up a temp file. Use std::ofstream for the write and std::filesystem::remove for cleanup; the temp file is no longer at the mercy of /bin/rm being on PATH. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Nothing in SignalHandlers.{h,cpp} touches POSIX-specific I/O.
execinfo.h and csignal stay since their backtrace/raise calls have no
portable C++20 replacement.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
The remaining live system() call (lilypond) is the only one with no portable replacement, so split the path: keep std::system() on POSIX and use CreateProcessA on Windows so we avoid spinning up cmd.exe just to parse the command line. Win32 failure now surfaces GetLastError() instead of silently disappearing into a shell exit code. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
cross platform
should definitely be a constexpr in some random header file and not a macro
incomplete changes but enough to run on win11
we now only link lassie with lass. really, we don't need to link it with lass either, but I am supremely lazy right now
SIZE is defined in tables.h, NOGDI and NOMINMAX are necessary for <windows.h> to compile successfully here
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #81.