Skip to content

cmod, lass: switch/port/gate glibc functions for windows#84

Open
passyur wants to merge 19 commits into
mainfrom
claude/recursing-jepsen-7d3b13
Open

cmod, lass: switch/port/gate glibc functions for windows#84
passyur wants to merge 19 commits into
mainfrom
claude/recursing-jepsen-7d3b13

Conversation

@passyur

@passyur passyur commented May 24, 2026

Copy link
Copy Markdown
Member

Closes #81.

passyur and others added 9 commits May 22, 2026 23:12
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>
@passyur passyur added this to the windows-compat milestone May 24, 2026
passyur and others added 10 commits May 24, 2026 16:29
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

cmod, lass: replace posix/unix functions for Windows development

1 participant