Skip to content

Commit b735109

Browse files
SunrisepeakSunrisepeak
andauthored
openlifa.openmui 0.3.0: the openmui specification (OpenLifa), its C ABI and C++ module (#604)
Signed-off-by: Sunrisepeak <speakshen@outlook.com> Co-authored-by: Sunrisepeak <speakshen@outlook.com>
1 parent b6236cf commit b735109

5 files changed

Lines changed: 84 additions & 0 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@
99

1010
### Added
1111

12+
- **openlifa.openmui 0.3.0。** OpenLifa 标准 openmui 的规范:registry、C ABI(`include/openmui.h`,
13+
在使用者的包含路径上)和声明其值类型的 C++ 模块 `openmui.spec`(语义树节点及其一致性检查、actor、
14+
信封、Core 组件契约)。actor、效果、授权与信封采用 openas 0.2。只依赖标准库(头文件为 C99);代码
15+
Apache-2.0,规范文本 CC BY-SA 4.0。GLOBAL 为 GitHub 标签归档。新增测试成员 `tests/examples/openlifa.openmui`。
1216
- **openlifa.openas 0.2.0。** OpenLifa 标准 openas 的规范与声明它的 C++ 模块(`openas`、
1317
`openas.conformance`):actor 及其委托链的文本形式、动词的效果等级、系统上限之下的授权与单个请求的决定、
1418
运行信封的记录种类、退出码与错误码,以及动词描述、actor 与授权的一致性检查。只依赖标准库;代码 Apache-2.0,

‎mcpp.toml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,7 @@ members = [
236236
"tests/examples/openkal-tools",
237237
"tests/examples/openkal-bind",
238238
"tests/examples/openlifa.openas",
239+
"tests/examples/openlifa.openmui",
239240
"tests/examples/os",
240241
]
241242

‎pkgs/o/openlifa.openmui.lua‎

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
-- openlifa.openmui --- the openmui specification, an OpenLifa standard: its
2+
-- registry, the C ABI (include/openmui.h, on the include path of a consumer),
3+
-- and the C++ module that declares its value types.
4+
--
5+
-- A user interface as one semantic tree, of which pixels, accessibility,
6+
-- agents and tests are renderings. The module is `openmui.spec`, named for the
7+
-- specification rather than the organization that publishes it.
8+
--
9+
-- No `deps`. Standard library only (C99 for the header).
10+
package = {
11+
spec = "1",
12+
namespace = "openlifa",
13+
name = "openmui",
14+
description = "openmui: a user interface as one semantic tree --- an OpenLifa specification, its C ABI and its C++ module",
15+
licenses = {"Apache-2.0", "CC-BY-SA-4.0"},
16+
repo = "https://github.com/openlifa/openmui",
17+
type = "package",
18+
19+
extensions = {
20+
autoupdate = {
21+
tag = "${version}",
22+
url = "https://github.com/openlifa/openmui/archive/refs/tags/${tag}.tar.gz",
23+
},
24+
},
25+
26+
xpm = {
27+
linux = {
28+
["0.3.0"] = {
29+
url = "https://github.com/openlifa/openmui/archive/refs/tags/0.3.0.tar.gz",
30+
sha256 = "6986ca5d04e170fc8f8be279c30ffffd248b0e62df2f52e64d570f351d122588",
31+
},
32+
},
33+
macosx = {
34+
["0.3.0"] = {
35+
url = "https://github.com/openlifa/openmui/archive/refs/tags/0.3.0.tar.gz",
36+
sha256 = "6986ca5d04e170fc8f8be279c30ffffd248b0e62df2f52e64d570f351d122588",
37+
},
38+
},
39+
windows = {
40+
["0.3.0"] = {
41+
url = "https://github.com/openlifa/openmui/archive/refs/tags/0.3.0.tar.gz",
42+
sha256 = "6986ca5d04e170fc8f8be279c30ffffd248b0e62df2f52e64d570f351d122588",
43+
},
44+
},
45+
},
46+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# openlifa.openmui test project: the specification's value types — an actor
2+
# in openas's text form, a node and its conformance, a Core contract, an
3+
# envelope.
4+
[package]
5+
name = "openlifa-openmui-tests"
6+
version = "0.1.0"
7+
8+
[dependencies]
9+
openlifa.openmui = "0.3.0"
10+
11+
[indices]
12+
openlifa = { path = "../../.." }
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import std;
2+
import openmui.spec;
3+
4+
namespace spec = omui::spec;
5+
6+
int main() {
7+
const auto actor = spec::Actor::parse("agent:reader;via=person:alice,agent:planner");
8+
if (!actor || actor->via.size() != 2 || actor->text() != "agent:reader;via=person:alice,agent:planner") return 1;
9+
spec::SemanticNode n;
10+
n.id = "notes/delete";
11+
n.role = spec::Role::button;
12+
n.name = "Delete";
13+
n.actions.push_back({.name = "activate", .effect = spec::Effect::irreversible, .verb = "note.delete", .answer = "yes"});
14+
if (!spec::check(n).empty()) return 2;
15+
if (spec::catalog::find("slider") == nullptr) return 3;
16+
spec::Envelope e;
17+
e.error(spec::error_code::needs_answer, "confirm").result(spec::exit_code::needs_answer);
18+
if (e.exit_code() != 2) return 4;
19+
std::println("{}", e.ndjson());
20+
return 0;
21+
}

0 commit comments

Comments
 (0)