Skip to content

Commit

Permalink
meta: Update from upstream.
Browse files Browse the repository at this point in the history
  • Loading branch information
sleepy-monax committed Jan 26, 2025
1 parent 46dfc50 commit ad7de38
Show file tree
Hide file tree
Showing 513 changed files with 10,055 additions and 8,103 deletions.
2 changes: 1 addition & 1 deletion meta/plugins/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
python-magic ~= 0.4.27
git+https://github.com/cute-engineering/[email protected].10
git+https://github.com/cute-engineering/[email protected].14
5 changes: 0 additions & 5 deletions meta/plugins/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,11 +134,6 @@ def checkForSymbol(header: str, symbol: str) -> bool:
)


@cli.command(None, "tools", "Manage the development tools")
def _():
pass


@cli.command("n", "tools/nuke", "Nuke the development tools")
@cli.command("s", "tools/setup", "Setup the development environment")
def _():
Expand Down
4 changes: 2 additions & 2 deletions src/apps/hideo-clock/app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ struct Clock : public Ui::View<Clock> {
};

Ui::Child clock(Time time) {
return makeStrong<Clock>(time);
return makeRc<Clock>(time);
}

// MARK: Alarm Page ------------------------------------------------------------
Expand Down Expand Up @@ -181,7 +181,7 @@ Ui::Child app() {
Async::Task<> timerTask(Ui::Child app, Async::Ct ct) {
while (not ct.canceled()) {
Model::event<TimeTick>(*app);
co_trya$(Sys::globalSched().sleepAsync(Sys::now() + TimeSpan::fromSecs(1)));
co_trya$(Sys::globalSched().sleepAsync(Sys::instant() + Duration::fromSecs(1)));
}
co_return Ok();
}
Expand Down
8 changes: 4 additions & 4 deletions src/apps/hideo-fonts/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace Hideo::Fonts {
struct State {
Text::FontBook fontBook;
Opt<String> fontFamily = NONE;
Opt<Strong<Text::Fontface>> fontFace = NONE;
Opt<Rc<Text::Fontface>> fontFace = NONE;

State(Text::FontBook fontBook) : fontBook(fontBook) {}

Expand All @@ -29,7 +29,7 @@ struct SelectFamily {
};

struct SelectFace {
Strong<Text::Fontface> id;
Rc<Text::Fontface> id;
};

using Action = Union<GoBack, SelectFamily, SelectFace>;
Expand Down Expand Up @@ -120,7 +120,7 @@ Ui::Child fontfaceTags(Text::FontAttrs const &attrs) {
return Ui::hflow(4, children);
}

Ui::Child familyItem(State const &, Strong<Text::Fontface> fontface) {
Ui::Child familyItem(State const &, Rc<Text::Fontface> fontface) {
auto attrs = fontface->attrs();

Text::Font font{
Expand Down Expand Up @@ -159,7 +159,7 @@ Ui::Child familyContent(State const &s) {

// MARK: Fontface --------------------------------------------------------------

Ui::Child pangrams(Strong<Text::Fontface> fontface) {
Ui::Child pangrams(Rc<Text::Fontface> fontface) {
f64 size = 12;
Ui::Children children;

Expand Down
4 changes: 2 additions & 2 deletions src/apps/hideo-shell/lock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@

namespace Hideo::Shell {

static Opt<Strong<Text::Fontface>> _blackFontface = NONE;
static Opt<Rc<Text::Fontface>> _blackFontface = NONE;

static Strong<Text::Fontface> blackFontface() {
static Rc<Text::Fontface> blackFontface() {
if (not _blackFontface) {
_blackFontface = Text::loadFontfaceOrFallback("bundle://fonts-inter/fonts/Inter-Bold.ttf"_url).unwrap();
}
Expand Down
24 changes: 12 additions & 12 deletions src/apps/hideo-shell/main/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,18 @@ Async::Task<> entryPointAsync(Sys::Context &ctx) {
.background = co_try$(Image::loadOrFallback("bundle://hideo-shell/wallpapers/winter.qoi"_url)),
.noti = {},
.launchers = {
makeStrong<Hideo::Shell::MockLauncher>(Mdi::INFORMATION_OUTLINE, "About"s, Gfx::BLUE_RAMP),
makeStrong<Hideo::Shell::MockLauncher>(Mdi::CALCULATOR, "Calculator"s, Gfx::ORANGE_RAMP),
makeStrong<Hideo::Shell::MockLauncher>(Mdi::PALETTE_SWATCH, "Color Picker"s, Gfx::RED_RAMP),
makeStrong<Hideo::Shell::MockLauncher>(Mdi::COUNTER, "Counter"s, Gfx::GREEN_RAMP),
makeStrong<Hideo::Shell::MockLauncher>(Mdi::DUCK, "Demos"s, Gfx::YELLOW_RAMP),
makeStrong<Hideo::Shell::MockLauncher>(Mdi::FILE, "Files"s, Gfx::ORANGE_RAMP),
makeStrong<Hideo::Shell::MockLauncher>(Mdi::FORMAT_FONT, "Fonts"s, Gfx::BLUE_RAMP),
makeStrong<Hideo::Shell::MockLauncher>(Mdi::EMOTICON, "Hello World"s, Gfx::RED_RAMP),
makeStrong<Hideo::Shell::MockLauncher>(Mdi::IMAGE, "Icons"s, Gfx::GREEN_RAMP),
makeStrong<Hideo::Shell::MockLauncher>(Mdi::IMAGE, "Image Viewer"s, Gfx::YELLOW_RAMP),
makeStrong<Hideo::Shell::MockLauncher>(Mdi::COG, "Settings"s, Gfx::ZINC_RAMP),
makeStrong<Hideo::Shell::MockLauncher>(Mdi::TABLE, "Spreadsheet"s, Gfx::GREEN_RAMP),
makeRc<Hideo::Shell::MockLauncher>(Mdi::INFORMATION_OUTLINE, "About"s, Gfx::BLUE_RAMP),
makeRc<Hideo::Shell::MockLauncher>(Mdi::CALCULATOR, "Calculator"s, Gfx::ORANGE_RAMP),
makeRc<Hideo::Shell::MockLauncher>(Mdi::PALETTE_SWATCH, "Color Picker"s, Gfx::RED_RAMP),
makeRc<Hideo::Shell::MockLauncher>(Mdi::COUNTER, "Counter"s, Gfx::GREEN_RAMP),
makeRc<Hideo::Shell::MockLauncher>(Mdi::DUCK, "Demos"s, Gfx::YELLOW_RAMP),
makeRc<Hideo::Shell::MockLauncher>(Mdi::FILE, "Files"s, Gfx::ORANGE_RAMP),
makeRc<Hideo::Shell::MockLauncher>(Mdi::FORMAT_FONT, "Fonts"s, Gfx::BLUE_RAMP),
makeRc<Hideo::Shell::MockLauncher>(Mdi::EMOTICON, "Hello World"s, Gfx::RED_RAMP),
makeRc<Hideo::Shell::MockLauncher>(Mdi::IMAGE, "Icons"s, Gfx::GREEN_RAMP),
makeRc<Hideo::Shell::MockLauncher>(Mdi::IMAGE, "Image Viewer"s, Gfx::YELLOW_RAMP),
makeRc<Hideo::Shell::MockLauncher>(Mdi::COG, "Settings"s, Gfx::ZINC_RAMP),
makeRc<Hideo::Shell::MockLauncher>(Mdi::TABLE, "Spreadsheet"s, Gfx::GREEN_RAMP),
},
.instances = {}
};
Expand Down
2 changes: 1 addition & 1 deletion src/apps/hideo-shell/mock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
namespace Hideo::Shell {

void MockLauncher::launch(State &s) {
auto instance = makeStrong<MockInstance>(
auto instance = makeRc<MockInstance>(
icon,
name,
ramp
Expand Down
6 changes: 3 additions & 3 deletions src/apps/hideo-shell/model.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ struct State : Meta::NoCopy {

Image::Picture background;
Vec<Noti> noti;
Vec<Strong<Launcher>> launchers;
Vec<Strong<Instance>> instances;
Vec<Rc<Launcher>> launchers;
Vec<Rc<Instance>> instances;
};

struct ToggleTablet {};
Expand Down Expand Up @@ -98,7 +98,7 @@ struct StartInstance {
};

struct AddInstance {
Strong<Instance> instance;
Rc<Instance> instance;
};

struct MoveInstance {
Expand Down
2 changes: 1 addition & 1 deletion src/apps/hideo-spreadsheet/table.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ struct Table : public Ui::View<Table> {
};

Ui::Child table(State const &s) {
return makeStrong<Table>(s);
return makeRc<Table>(s);
}

} // namespace Hideo::Spreadsheet
8 changes: 4 additions & 4 deletions src/apps/hideo-text/app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ namespace Hideo::Text {
struct State {
Opt<Mime::Url> url;
Opt<Error> error;
Strong<Karm::Text::Model> text;
Rc<Karm::Text::Model> text;
};

struct New {
Expand All @@ -43,7 +43,7 @@ Ui::Task<Action> reduce(State &s, Action a) {
[&](New &) {
s.url = NONE;
s.error = NONE;
s.text = makeStrong<Karm::Text::Model>();
s.text = makeRc<Karm::Text::Model>();
},
[&](Save &) {

Expand All @@ -55,15 +55,15 @@ Ui::Task<Action> reduce(State &s, Action a) {

using Model = Ui::Model<State, Action, reduce>;

Ui::Child editor(Strong<Karm::Text::Model> text) {
Ui::Child editor(Rc<Karm::Text::Model> text) {
return Ui::input(text, [](Ui::Node &n, Action a) {
Model::bubble(n, a);
}) |
Ui::insets(16) | Ui::vscroll() | Ui::grow();
}

Ui::Child app(Opt<Mime::Url> url, Res<String> str) {
auto text = makeStrong<Karm::Text::Model>();
auto text = makeRc<Karm::Text::Model>();
Opt<Error> error = NONE;

if (str) {
Expand Down
2 changes: 1 addition & 1 deletion src/apps/hideo-zoo/page-rich-text.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ static inline Page PAGE_RICHTEXT{
"Rich Text"s,
"An area that displays text with various styles and formatting options.",
[] {
auto prose = makeStrong<Text::Prose>(Ui::TextStyles::bodyMedium());
auto prose = makeRc<Text::Prose>(Ui::TextStyles::bodyMedium());

prose->append("This is a simple text with no formatting.\n"s);

Expand Down
File renamed without changes.
17 changes: 17 additions & 0 deletions src/impls/impl-efi/base/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"$schema": "https://schemas.cute.engineering/stable/cutekit.manifest.component.v1",
"id": "impl-efi.base",
"type": "lib",
"props": {
"cpp-excluded": true
},
"enableIf": {
"sys": [
"efi"
]
},
"requires": [],
"provides": [
"karm-base-impl"
]
}
72 changes: 39 additions & 33 deletions src/impls/impl-efi/sys.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@

namespace Karm::Sys::_Embed {

static TimeStamp fromEfi(Efi::Time time) {
static SystemTime fromEfi(Efi::Time time) {
DateTime dt;
dt.date.year = time.year;
dt.date.month = time.month;
dt.date.day = time.day;
dt.time.hour = time.hour;
dt.time.minute = time.minute;
dt.time.second = time.second;
return dt.toTimeStamp();
return dt.toInstant();
}

struct ConOut : public Fd {
Expand Down Expand Up @@ -68,7 +68,7 @@ struct ConOut : public Fd {
return Ok(0uz);
}

Res<Strong<Fd>> dup() override {
Res<Rc<Fd>> dup() override {
notImplemented();
}

Expand Down Expand Up @@ -159,7 +159,7 @@ struct FileProto : public Fd {
return Ok(0uz);
}

Res<Strong<Fd>> dup() override {
Res<Rc<Fd>> dup() override {
notImplemented();
}

Expand Down Expand Up @@ -201,37 +201,37 @@ struct FileProto : public Fd {
}
};

Res<Strong<Fd>> unpackFd(Io::PackScan &) {
Res<Rc<Fd>> unpackFd(Io::PackScan &) {
notImplemented();
}

Res<Strong<Fd>> createIn() {
return Ok(makeStrong<NullFd>());
Res<Rc<Fd>> createIn() {
return Ok(makeRc<NullFd>());
}

Res<Strong<Fd>> createOut() {
return Ok(makeStrong<ConOut>(Efi::st()->conOut));
Res<Rc<Fd>> createOut() {
return Ok(makeRc<ConOut>(Efi::st()->conOut));
}

Res<Strong<Fd>> createErr() {
return Ok(makeStrong<ConOut>(Efi::st()->stdErr));
Res<Rc<Fd>> createErr() {
return Ok(makeRc<ConOut>(Efi::st()->stdErr));
}

// MARK: Sockets ---------------------------------------------------------------

Res<Strong<Fd>> connectTcp(SocketAddr) {
Res<Rc<Fd>> connectTcp(SocketAddr) {
notImplemented();
}

Res<Strong<Fd>> listenTcp(SocketAddr) {
Res<Rc<Fd>> listenTcp(SocketAddr) {
notImplemented();
}

Res<Strong<Fd>> listenUdp(SocketAddr) {
Res<Rc<Fd>> listenUdp(SocketAddr) {
notImplemented();
}

Res<Strong<Fd>> listenIpc(Mime::Url) {
Res<Rc<Fd>> listenIpc(Mime::Url) {
notImplemented();
}

Expand Down Expand Up @@ -294,7 +294,7 @@ static Res<Mime::Path> resolve(Mime::Url url) {
}
}

Res<Strong<Fd>> openFile(Mime::Url const &url) {
Res<Rc<Fd>> openFile(Mime::Url const &url) {
static Efi::SimpleFileSystemProtocol *fileSystem = nullptr;
if (not fileSystem) {
fileSystem = try$(Efi::openProtocol<Efi::SimpleFileSystemProtocol>(Efi::li()->deviceHandle));
Expand All @@ -321,18 +321,18 @@ Res<Strong<Fd>> openFile(Mime::Url const &url) {
auto utf16str = b.take();

try$(rootDir->open(rootDir, &file, utf16str.buf(), EFI_FILE_MODE_READ, 0));
return Ok(makeStrong<FileProto>(file));
return Ok(makeRc<FileProto>(file));
}

Res<Vec<DirEntry>> readDir(Mime::Url const &) {
return Error::notImplemented();
}

Res<Strong<Fd>> createFile(Mime::Url const &) {
Res<Rc<Fd>> createFile(Mime::Url const &) {
return Error::notImplemented();
}

Res<Strong<Fd>> openOrCreateFile(Mime::Url const &) {
Res<Rc<Fd>> openOrCreateFile(Mime::Url const &) {
return Error::notImplemented();
}

Expand All @@ -350,7 +350,7 @@ Res<MmapResult> memMap(MmapOptions const &options) {
return Ok(MmapResult{vaddr, vaddr, options.size});
}

Res<MmapResult> memMap(MmapOptions const &, Strong<Fd> fd) {
Res<MmapResult> memMap(MmapOptions const &, Rc<Fd> fd) {
usize vaddr = 0;
usize fileSize = try$(Io::size(*fd));

Expand Down Expand Up @@ -383,24 +383,30 @@ Res<Stat> stat(Mime::Url const &) {

// MARK: Time ------------------------------------------------------------------

TimeStamp now() {
SystemTime now() {
Efi::Time t;

Efi::rt()->getTime(&t, nullptr).unwrap();

Date date = {
t.day,
t.month,
t.year,
DateTime dt{
.date = {
.day = t.day,
.month = t.month,
.year = t.year,
},
.time = {
.second = t.second,
.minute = t.minute,
.hour = t.hour,
},
};

Time time = {
t.hour,
t.minute,
t.second,
};
return dt.toInstant() + Duration::fromUSecs(t.nanosecond / 1000);
}

return DateTime{date, time}.toTimeStamp() +
TimeSpan::fromUSecs(t.nanosecond / 1000);
Instant instant() {
// HACK: It's supposed to be a monotonic clock, but we don't have one.
return Instant{now()._value};
}

// MARK: System Informations ---------------------------------------------------
Expand Down Expand Up @@ -437,7 +443,7 @@ Async::Task<> launchAsync(Sys::Intent) {

// MARK: Process Managment -----------------------------------------------------

Res<> sleep(TimeSpan) {
Res<> sleep(Duration) {
return Error::notImplemented();
}

Expand Down
Loading

0 comments on commit ad7de38

Please sign in to comment.