Skip to content

Commit bc01ecb

Browse files
committed
0.2.0: the package exports no module
Version 0.1 provided openkal.stream, openkal.memory and openkal.abort, each re-exporting a declaration module from the specification package. That placed the names a consumer imports under this package's control, which is not an implementation's role. The package now contributes definitions and nothing else. It imports the same interface a consumer imports, because it needs the declarations it is defining. Requires openkal 0.2.0.
1 parent 294ab2d commit bc01ecb

12 files changed

Lines changed: 30 additions & 52 deletions

File tree

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ jobs:
4545
4646
- name: The exported surface matches the specification
4747
env:
48-
OPENKAL_VERSION: 0.1.0
48+
OPENKAL_VERSION: 0.2.0
4949
run: |
5050
# Clause 9.3. The list is fetched from the specification repository at
5151
# the version this implementation is written against, so that the

README.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,27 +12,28 @@ that other implementations follow.
1212
| `openkal.stream` | descriptors 0, 1 and 2; writes are completed or reported |
1313
| `openkal.memory` | built upon the C library allocator, as clause 7.3 requires |
1414

15-
Vectored writes are not provided. The absence is expressed by declaring nothing,
16-
and `kal::has_write_vectored<kal::stream>` is correspondingly false.
15+
The package declares no module. The interface belongs to the specification
16+
package, which this package imports in order to define what it declares.
1717

1818
## Use
1919

2020
```toml
2121
[dependencies]
22-
openkal = "0.1.0"
22+
openkal = "0.2.0"
2323

2424
[target.'cfg(os = "linux")'.dependencies]
25-
openkal-linux = "0.1.0"
25+
openkal-linux = "0.2.0"
2626
```
2727

2828
## Points of interest for other implementations
2929

3030
The implementation is short, and the following aspects of it are the ones the
3131
specification expects to be reproduced.
3232

33-
**The interface module adds nothing.** `src/stream.cppm` consists of an export
34-
and a re-export. An implementation may add only the overloads the specification
35-
lists as optional capabilities of the interface, and this one adds none.
33+
**The package exports no module.** An implementation contributes definitions.
34+
The interface is the specification's, and an implementation that exported one
35+
would place a name the consumer relies upon outside the specification's
36+
control.
3637

3738
**Interruption is retried, not reported.** A caller cannot distinguish an
3839
interrupted call from a genuine failure without knowledge of the platform. An

examples/hello/mcpp.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@ name = "hello"
55
version = "0.1.0"
66

77
[dependencies]
8-
openkal = "0.1.0"
8+
openkal = { path = "../../../openkal" }
99
openkal-linux = { path = "../.." }

examples/hello/src/main.cpp

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,9 @@ int main() {
1212
kal::write(kal::out(), report, n);
1313
kal::free(region, 64, 8);
1414

15-
// A capability the implementation does not provide is detected at compile
16-
// time, so the program selects an alternative without a run-time test.
17-
if constexpr (kal::has_write_vectored<kal::stream>) {
18-
const char v[] = "openkal: vectored writes available\n";
19-
kal::write(kal::out(), v, sizeof(v) - 1);
20-
} else {
21-
const char v[] = "openkal: vectored writes unavailable\n";
22-
kal::write(kal::out(), v, sizeof(v) - 1);
23-
}
15+
// The program imports openkal and names no implementation. Which
16+
// implementation supplies the definitions is decided in the manifest.
17+
const char done[] = "openkal: the program named no implementation\n";
18+
kal::write(kal::out(), done, sizeof(done) - 1);
2419
return 0;
2520
}

mcpp.toml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,18 @@
11
[package]
22
namespace = "mcpplibs"
33
name = "openkal-linux"
4-
version = "0.1.0"
4+
version = "0.2.0"
55
description = "The reference implementation of openkal for Linux. It is both a usable backend and the worked example other implementations follow."
66
license = "Apache-2.0"
77
authors = ["mcpplibs"]
88
repo = "https://github.com/mcpplibs/openkal-linux"
99

1010
[dependencies]
11-
openkal = "0.1.0"
11+
openkal = "0.2.0"
12+
13+
# The package contributes definitions and no modules. The interface it
14+
# implements is declared by the specification package, which this package
15+
# imports and does not re-export.
16+
[targets.openkal-linux]
17+
kind = "lib"
18+
sources = ["src/**/*.cpp"]

src/abort.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#include <unistd.h>
22
#include <stdlib.h>
3-
import openkal.decl.abort;
4-
import openkal.decl.types;
3+
import openkal.abort;
54

65
extern "C" {
76

src/abort.cppm

Lines changed: 0 additions & 2 deletions
This file was deleted.

src/memory.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#include <stdlib.h>
22
#include <stddef.h>
3-
import openkal.decl.memory;
4-
import openkal.decl.types;
3+
import openkal.memory;
54

65
extern "C" {
76

src/memory.cppm

Lines changed: 0 additions & 2 deletions
This file was deleted.

src/stream.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#include <unistd.h>
22
#include <errno.h>
3-
import openkal.decl.stream;
4-
import openkal.decl.types;
3+
import openkal.stream;
54

65
namespace {
76

0 commit comments

Comments
 (0)