Skip to content

Commit 9b5b17e

Browse files
authored
0.3.0 --- the keystrokes the host keeps for itself are a position now (#3)
1 parent 9110ed8 commit 9b5b17e

4 files changed

Lines changed: 58 additions & 16 deletions

File tree

‎.github/workflows/ci.yml‎

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ env:
4040
# `em++`'s C compiler is `emcc` and not `em` (a C translation unit in the
4141
# conformance suite does not compile without that), and the wasm target rows
4242
# resolve the emsdk payload.
43-
MCPP_VERSION: 2026.9.12.2
43+
MCPP_VERSION: 2026.9.18.3
4444
XLINGS_VERSION: v2026.8.17.2
4545
XLINGS_NON_INTERACTIVE: '1'
4646

@@ -189,24 +189,32 @@ jobs:
189189
work="$RUNNER_TEMP/absent"
190190
rm -rf "$work"; mkdir -p "$work/src"
191191
impl="$(pwd)"
192-
# BOTH DEPENDENCIES NAMED THE SAME WAY, and this step therefore runs
193-
# BEFORE the manifest is pointed at the specification's working tree.
194-
# mcpp refuses a graph in which one package reaches `openkal` by path
195-
# and another by version -- measured:
192+
# BOTH DEPENDENCIES NAMED THE SAME WAY. mcpp refuses a graph in
193+
# which one package reaches `openkal` by path and another by version
194+
# -- measured:
196195
#
197196
# error: dependency 'mcpplibs.openkal' is requested as both a path
198197
# dep (by 'absent') and a version dep (by
199198
# 'mcpplibs.openkal-emscripten@path'). Pick one.
200199
#
201-
# so the consumer uses the version this implementation's committed
202-
# manifest names, which is the arrangement an ordinary consumer has.
200+
# AND BOTH NAME THE WORKING TREE RATHER THAN A PUBLISHED VERSION.
201+
# They named the version this implementation's manifest asks for,
202+
# which is the arrangement an ordinary consumer has --- and which
203+
# made this step unrunnable during the release it is part of: a
204+
# branch that raises the version asks the index for one that is not
205+
# registered yet, and the step then reports "the build did not fail
206+
# naming kal_process_spawn" for a build that never started. What this
207+
# step asserts is a property of the two trees, so it takes the trees.
208+
sed 's|^openkal = .*$|openkal = { path = "'"$impl"'/.spec" }|' \
209+
"$impl/mcpp.toml" > "$impl/mcpp.toml.next"
210+
mv "$impl/mcpp.toml.next" "$impl/mcpp.toml"
203211
cat > "$work/mcpp.toml" << TOML
204212
[package]
205213
name = "absent"
206214
version = "0.1.0"
207215
208216
[dependencies]
209-
openkal = "$(grep -oP '^openkal = "\K[0-9.]+' "$impl/mcpp.toml")"
217+
openkal = { path = "$impl/.spec" }
210218
openkal-emscripten = { path = "$impl" }
211219
TOML
212220
cat > "$work/src/main.cpp" << 'CPP'

‎README.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ So the interface is carried by a feature:
6161

6262
```toml
6363
[dependencies]
64-
openkal-emscripten = { version = "0.2.0", features = ["threads"] }
64+
openkal-emscripten = { version = "0.3.0", features = ["threads"] }
6565
```
6666

6767
Without it, `src/threads/task.cpp` compiles to nothing, the eight `kal_task_*`
@@ -143,10 +143,10 @@ implementation in its source:
143143

144144
```toml
145145
[dependencies]
146-
openkal = "0.13.0"
146+
openkal = "0.14.0"
147147

148148
[target.'cfg(os = "emscripten")'.dependencies]
149-
openkal-emscripten = "0.2.0"
149+
openkal-emscripten = "0.3.0"
150150
```
151151

152152
## Licence

‎mcpp.toml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
namespace = "mcpplibs"
33
name = "openkal-emscripten"
4-
version = "0.2.0"
4+
version = "0.3.0"
55
description = "An implementation of openkal for Emscripten, written ABOVE a C library rather than beneath one, because on this platform there is no kernel to issue calls to."
66
license = "Apache-2.0"
77

@@ -18,7 +18,7 @@ authors = ["mcpplibs"]
1818
repo = "https://github.com/mcpplibs/openkal-emscripten"
1919

2020
[dependencies]
21-
openkal = "0.13.0"
21+
openkal = "0.14.0"
2222

2323
[build]
2424
# THE DIALECT FLAGS ARE THE SAME AS EVERY OTHER IMPLEMENTATION'S AND THE REASON

‎src/terminal.cpp‎

Lines changed: 37 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,15 @@ int kal_terminal_get_mode(kal_stream s, kal_uintptr* mode) {
2929
kal_uintptr m = 0;
3030
if ((t.c_lflag & ICANON) != 0) m |= KAL_TERM_LINE_EDIT;
3131
if ((t.c_lflag & ECHO) != 0) m |= KAL_TERM_ECHO;
32+
// KAL_TERM_PASS_CONTROL IS READ FROM THREE FLAGS AND NOT FROM ISIG. The
33+
// position states that the environment reserves NO keystroke, so it is set
34+
// only where every mechanism by which this environment reserves one is off:
35+
// ISIG for the interrupt and its neighbours, IXON for the pair that stops
36+
// and starts output, IEXTEN for the one that takes the next keystroke
37+
// literally. Under node these are the host's own; in a browser there is no
38+
// terminal and the property word says so before any of this is reached.
39+
if ((t.c_lflag & (ISIG | IEXTEN)) == 0 &&
40+
(t.c_iflag & IXON) == 0) m |= KAL_TERM_PASS_CONTROL;
3241
*mode = m;
3342
return kal_ok;
3443
}
@@ -37,12 +46,37 @@ int kal_terminal_set_mode(kal_stream s, kal_uintptr mode) {
3746
struct termios t{};
3847
const int fd = static_cast<int>(s.h);
3948
if (::tcgetattr(fd, &t) != 0) return oke::last();
40-
// READ, MODIFY, WRITE, AND ONLY THE TWO BITS openkal NAMES. A mode
49+
const bool reserved_none = (t.c_lflag & (ISIG | IEXTEN)) == 0 &&
50+
(t.c_iflag & IXON) == 0;
51+
// READ, MODIFY, WRITE, AND ONLY THE POSITIONS openkal NAMES. A mode
4152
// composed from scratch would silently reset every other attribute of the
42-
// terminal -- flow control, the special characters, the baud rate -- none
43-
// of which this interface claims to own.
53+
// terminal -- the special characters, the baud rate -- none of which this
54+
// interface claims to own.
4455
if (mode & KAL_TERM_LINE_EDIT) t.c_lflag |= ICANON; else t.c_lflag &= ~ICANON;
4556
if (mode & KAL_TERM_ECHO) t.c_lflag |= ECHO; else t.c_lflag &= ~ECHO;
57+
58+
// A POSITION WHOSE REQUESTED VALUE IS THE ONE IN EFFECT IS NOT WRITTEN.
59+
// This one stands for three flags, so establishing it again would settle
60+
// two mechanisms the caller never asked about.
61+
if (((mode & KAL_TERM_PASS_CONTROL) != 0) != reserved_none) {
62+
if (mode & KAL_TERM_PASS_CONTROL) {
63+
t.c_lflag &= ~(ISIG | IEXTEN);
64+
t.c_iflag &= ~IXON;
65+
} else {
66+
t.c_lflag |= (ISIG | IEXTEN);
67+
t.c_iflag |= IXON;
68+
}
69+
}
70+
71+
// AND A MODE IS NOT A WAY TO END THE INPUT. With line assembly off, how
72+
// long a read waits is decided by VMIN and VTIME, and a terminal left at
73+
// VMIN=0 makes `kal_stream_read' report zero --- which clause 7.4 says
74+
// denotes the end of the input. A caller that wants a read which gives up
75+
// asks `kal_timeout_read' for one.
76+
if ((mode & KAL_TERM_LINE_EDIT) == 0) {
77+
t.c_cc[VMIN] = 1;
78+
t.c_cc[VTIME] = 0;
79+
}
4680
// TCSANOW and not TCSADRAIN: openkal's caller has just been told what the
4781
// mode is and is entitled to have it take effect before its next read.
4882
if (::tcsetattr(fd, TCSANOW, &t) != 0) return oke::last();

0 commit comments

Comments
 (0)