From c5639ae92c1891a78acfa4f34c79539fee55de83 Mon Sep 17 00:00:00 2001 From: VAN BOSSUYT Nicolas Date: Fri, 12 Apr 2024 11:41:50 +0200 Subject: [PATCH] meta: Prefer MARK: over the old style of separator. --- src/apps/hideo-base/dialogs.cpp | 4 ++-- src/apps/hideo-base/dialogs.h | 4 ++-- src/apps/hideo-files/widgets.cpp | 4 ++-- src/apps/hideo-files/widgets.h | 4 ++-- src/apps/hideo-images/app.h | 4 ++-- src/apps/hideo-settings/app.h | 4 ++-- src/apps/hideo-settings/main.cpp | 4 ++-- src/apps/hideo-shell/main.cpp | 8 ++++---- src/apps/hideo-spreadsheet/app.h | 6 +++--- src/apps/hideo-spreadsheet/table.cpp | 6 +++--- src/impls/impl-efi/sys.cpp | 4 ++-- src/impls/impl-hjert/new-delete.cpp | 4 ++-- src/impls/impl-posix/sys.cpp | 8 ++++---- src/impls/impl-skift/new-delete.cpp | 4 ++-- src/impls/impl-skift/sys.cpp | 12 ++++++------ src/kernel/hal-x86_64/asm.h | 6 +++--- src/kernel/hjert-core/ctx.cpp | 2 +- src/kernel/hjert-core/entry.cpp | 2 +- src/kernel/hjert-core/sched.h | 2 +- src/kernel/hjert-x86_64/arch.cpp | 10 +++++----- src/kernel/loader/menu.cpp | 4 ++-- src/libs/karm-base/async.h | 8 ++++---- src/libs/karm-base/ctype.h | 6 +++--- src/libs/karm-base/ints.h | 6 +++--- src/libs/karm-base/list.h | 14 +++++++------- src/libs/karm-base/macros.h | 8 ++++---- src/libs/karm-base/rc.h | 6 +++--- src/libs/karm-base/rune.h | 18 +++++++++--------- src/libs/karm-base/string.h | 2 +- src/libs/karm-base/time.h | 8 ++++---- src/libs/karm-base/vec.h | 12 ++++++------ src/libs/karm-crypto/base.h | 2 +- src/libs/karm-events/keys.h | 4 ++-- src/libs/karm-gfx/buffer.h | 6 +++--- src/libs/karm-gfx/context.cpp | 18 +++++++++--------- src/libs/karm-gfx/context.h | 20 ++++++++++---------- src/libs/karm-gfx/path.cpp | 10 +++++----- src/libs/karm-gfx/path.h | 10 +++++----- src/libs/karm-gfx/stroke.cpp | 8 ++++---- src/libs/karm-gfx/style.h | 4 ++-- src/libs/karm-io/expr.h | 10 +++++----- src/libs/karm-io/fmt.cpp | 4 ++-- src/libs/karm-io/fmt.h | 22 +++++++++++----------- src/libs/karm-io/funcs.h | 8 ++++---- src/libs/karm-io/pack.h | 12 ++++++------ src/libs/karm-io/tests/test-fmt.cpp | 18 +++++++++--------- src/libs/karm-math/bigint.cpp | 6 +++--- src/libs/karm-math/bigint.h | 6 +++--- src/libs/karm-math/funcs.h | 12 ++++++------ src/libs/karm-media/loader.cpp | 4 ++-- src/libs/karm-media/loader.h | 4 ++-- src/libs/karm-meta/cvrp.h | 8 ++++---- src/libs/karm-meta/signess.h | 4 ++-- src/libs/karm-meta/traits.h | 6 +++--- src/libs/karm-mime/path.cpp | 2 +- src/libs/karm-mime/path.h | 2 +- src/libs/karm-sys/_embed.h | 14 +++++++------- src/libs/karm-sys/async.h | 4 ++-- src/libs/karm-sys/socket.cpp | 6 +++--- src/libs/karm-sys/socket.h | 8 ++++---- src/libs/karm-ui/anim.cpp | 4 ++-- src/libs/karm-ui/anim.h | 4 ++-- src/libs/karm-ui/drag.cpp | 6 +++--- src/libs/karm-ui/drag.h | 8 ++++---- src/libs/karm-ui/funcs.h | 4 ++-- src/libs/karm-ui/input.cpp | 16 ++++++++-------- src/libs/karm-ui/input.h | 18 +++++++++--------- src/libs/karm-ui/layout.cpp | 20 ++++++++++---------- src/libs/karm-ui/layout.h | 22 +++++++++++----------- src/libs/karm-ui/node.h | 8 ++++---- src/libs/karm-ui/reducer.h | 8 ++++---- src/libs/karm-ui/scroll.cpp | 2 +- src/libs/karm-ui/view.cpp | 12 ++++++------ src/libs/karm-ui/view.h | 14 +++++++------- src/specs/bmp/spec.h | 12 ++++++------ src/specs/efi/spec.h | 22 +++++++++++----------- src/specs/jpeg/spec.h | 22 +++++++++++----------- src/specs/sbi/sbi.h | 8 ++++---- src/specs/textbox/model.h | 6 +++--- src/specs/ttf/spec.h | 2 +- src/srvs/grund-device/cmos.cpp | 4 ++-- src/srvs/grund-device/cmos.h | 4 ++-- src/srvs/grund-device/pci.h | 2 +- src/srvs/grund-device/ps2.cpp | 10 +++++----- src/srvs/grund-device/ps2.h | 4 ++-- src/web/web-dom/node.h | 8 ++++---- 86 files changed, 343 insertions(+), 343 deletions(-) diff --git a/src/apps/hideo-base/dialogs.cpp b/src/apps/hideo-base/dialogs.cpp index 5bf09e427c..fabd0871f3 100644 --- a/src/apps/hideo-base/dialogs.cpp +++ b/src/apps/hideo-base/dialogs.cpp @@ -7,7 +7,7 @@ namespace Hideo { -/* --- Dialogs Scaffolding -------------------------------------------------- */ +// MARK: Dialogs Scaffolding --------------------------------------------------- Ui::Child dialogScafold(Layout::Align a, Ui::Child inner) { Ui::BoxStyle const boxStyle = { @@ -45,7 +45,7 @@ Ui::Child dialogCloseButton() { ); } -/* --- Dialogs -------------------------------------------------------------- */ +// MARK: Dialogs --------------------------------------------------------------- Ui::Child versionBadge() { Ui::Children badges = {}; diff --git a/src/apps/hideo-base/dialogs.h b/src/apps/hideo-base/dialogs.h index ed1e8453df..2535635091 100644 --- a/src/apps/hideo-base/dialogs.h +++ b/src/apps/hideo-base/dialogs.h @@ -20,7 +20,7 @@ enum struct DialogButton { FlagsEnum$(DialogButton); -/* --- Dialogs Scaffolding -------------------------------------------------- */ +// MARK: Dialogs Scaffolding --------------------------------------------------- Ui::Child dialogScafold(Layout::Align a, Ui::Child inner); @@ -44,7 +44,7 @@ Ui::Child dialogButtons(DialogButton buttons, DialogButton primary); Ui::Child dialogCloseButton(); -/* --- Dialogs -------------------------------------------------------------- */ +// MARK: Dialogs --------------------------------------------------------------- Ui::Child licenseDialog(); diff --git a/src/apps/hideo-files/widgets.cpp b/src/apps/hideo-files/widgets.cpp index f95a529752..9dbab8c971 100644 --- a/src/apps/hideo-files/widgets.cpp +++ b/src/apps/hideo-files/widgets.cpp @@ -11,7 +11,7 @@ namespace Hideo::Files { -/* --- Common Widgets ------------------------------------------------------- */ +// MARK: Common Widgets -------------------------------------------------------- Ui::Child alert(State const &state, String title, String body) { return Ui::vflow( @@ -203,7 +203,7 @@ Ui::Child toolbar(State const &state) { ); } -/* --- Dialogs ------------------------------------------------------------ */ +// MARK: Dialogs ------------------------------------------------------------- Ui::Child openFileDialog() { return Ui::reducer( diff --git a/src/apps/hideo-files/widgets.h b/src/apps/hideo-files/widgets.h index d6e973725a..3a20d5af0b 100644 --- a/src/apps/hideo-files/widgets.h +++ b/src/apps/hideo-files/widgets.h @@ -7,7 +7,7 @@ namespace Hideo::Files { -/* --- Common Widgets ------------------------------------------------------- */ +// MARK: Common Widgets -------------------------------------------------------- Ui::Child directoryListing(State const &, Sys::Dir const &); @@ -25,7 +25,7 @@ Ui::Child toolbar(State const &); Ui::Child alert(State const &state, String title, String body); -/* --- Dialogs ------------------------------------------------------------ */ +// MARK: Dialogs ------------------------------------------------------------- Ui::Child openFileDialog(); diff --git a/src/apps/hideo-images/app.h b/src/apps/hideo-images/app.h index a1a5850cff..d6e90c1842 100644 --- a/src/apps/hideo-images/app.h +++ b/src/apps/hideo-images/app.h @@ -4,7 +4,7 @@ namespace Hideo::Images { -/* --- Reducer -------------------------------------------------------------- */ +// MARK: Reducer --------------------------------------------------------------- struct State { bool isEditor = false; @@ -37,7 +37,7 @@ void reduce(State &, Action); using Model = Ui::Model; -/* --- Views ---------------------------------------------------------------- */ +// MARK: Views ----------------------------------------------------------------- // Viewer diff --git a/src/apps/hideo-settings/app.h b/src/apps/hideo-settings/app.h index 9b33316b46..5c98b8a8a8 100644 --- a/src/apps/hideo-settings/app.h +++ b/src/apps/hideo-settings/app.h @@ -4,7 +4,7 @@ namespace Hideo::Settings { -/* --- Model ---------------------------------------------------------------- */ +// MARK: Model ----------------------------------------------------------------- enum struct Page { HOME, @@ -49,7 +49,7 @@ void reduce(State &, Action); using Model = Ui::Model; -/* --- Views ---------------------------------------------------------------- */ +// MARK: Views ----------------------------------------------------------------- Ui::Child pageScafold(Ui::Child inner); diff --git a/src/apps/hideo-settings/main.cpp b/src/apps/hideo-settings/main.cpp index 122ed98125..91ec2f5c77 100644 --- a/src/apps/hideo-settings/main.cpp +++ b/src/apps/hideo-settings/main.cpp @@ -30,7 +30,7 @@ Ui::Child sidebar(State const &state) { return Hideo::sidenav(items); } -/* --- Pages ---------------------------------------------------------------- */ +// MARK: Pages ----------------------------------------------------------------- Ui::Child pageContent(State const &state) { switch (state.page()) { @@ -49,7 +49,7 @@ Ui::Child pageContent(State const &state) { } } -/* --- Body ----------------------------------------------------------------- */ +// MARK: Body ------------------------------------------------------------------ Ui::Child app() { return Ui::reducer({}, [](State const &s) { diff --git a/src/apps/hideo-shell/main.cpp b/src/apps/hideo-shell/main.cpp index 6f6c5ffb79..c7928071b7 100644 --- a/src/apps/hideo-shell/main.cpp +++ b/src/apps/hideo-shell/main.cpp @@ -12,7 +12,7 @@ namespace Hideo::Shell { -/* --- Status Bar ----------------------------------------------------------- */ +// MARK: Status Bar ------------------------------------------------------------ Ui::Child indicator(Media::Icon icon) { return Ui::icon(icon) | @@ -47,7 +47,7 @@ Ui::Child statusbarButton(State const &state) { ); } -/* --- Navigation Bar ------------------------------------------------------- */ +// MARK: Navigation Bar -------------------------------------------------------- Ui::Child navbar(State const &) { return Ui::buttonHandle( @@ -56,7 +56,7 @@ Ui::Child navbar(State const &) { Ui::slideIn(Ui::SlideFrom::BOTTOM); } -/* --- Taskbar -------------------------------------------------------------- */ +// MARK: Taskbar --------------------------------------------------------------- Ui::Child taskbar(State const &state) { auto appsButton = Ui::button( @@ -121,7 +121,7 @@ Ui::Child taskbar(State const &state) { ); } -/* --- Shells --------------------------------------------------------------- */ +// MARK: Shells ---------------------------------------------------------------- Ui::Child background(State const &state) { return Ui::image(state.background) | diff --git a/src/apps/hideo-spreadsheet/app.h b/src/apps/hideo-spreadsheet/app.h index ffc4a56fdc..316e106a54 100644 --- a/src/apps/hideo-spreadsheet/app.h +++ b/src/apps/hideo-spreadsheet/app.h @@ -12,7 +12,7 @@ namespace Hideo::Spreadsheet { -/* --- Reducer -------------------------------------------------------------- */ +// MARK: Reducer --------------------------------------------------------------- using Value = Union; @@ -203,7 +203,7 @@ struct State { } }; -/* --- Actions -------------------------------------------------------------- */ +// MARK: Actions --------------------------------------------------------------- struct UpdateSelection { Opt range; @@ -270,7 +270,7 @@ Res<> save(Model const &model, Io::Writer &writer); Res load(Io::Reader &reader); -/* --- Views ---------------------------------------------------------------- */ +// MARK: Views ----------------------------------------------------------------- Ui::Child table(State const &s); diff --git a/src/apps/hideo-spreadsheet/table.cpp b/src/apps/hideo-spreadsheet/table.cpp index 540b0150cd..f63072170b 100644 --- a/src/apps/hideo-spreadsheet/table.cpp +++ b/src/apps/hideo-spreadsheet/table.cpp @@ -21,7 +21,7 @@ struct Table : public Ui::View { return _state->activeSheet(); } - /* --- Geometry --- */ + // MARK: Geometry ---------------------------------------------------------- Math::Recti colHeaderBound(usize col) { return { @@ -50,7 +50,7 @@ struct Table : public Ui::View
{ }; } - /* --- Events --- */ + // MARK: Events ------------------------------------------------------------ void event(Sys::Event &e) override { e.handle([&](Events::MouseEvent const &m) { @@ -80,7 +80,7 @@ struct Table : public Ui::View
{ }); } - /* --- Painting --- */ + // MARK: Painting ---------------------------------------------------------- void paintCell(Gfx::Context &g, Cell const &, Math::Recti bound) { g.rect(bound.cast()); diff --git a/src/impls/impl-efi/sys.cpp b/src/impls/impl-efi/sys.cpp index 1b853310e2..b110457eea 100644 --- a/src/impls/impl-efi/sys.cpp +++ b/src/impls/impl-efi/sys.cpp @@ -192,7 +192,7 @@ Res> createErr() { return Ok(makeStrong(Efi::st()->stdErr)); } -/* --- Sockets -------------------------------------------------------------- */ +// MARK: Sockets --------------------------------------------------------------- Res> connectTcp(SocketAddr) { notImplemented(); @@ -210,7 +210,7 @@ Res> listenIpc(Mime::Url) { notImplemented(); } -/* --- Files ---------------------------------------------------------------- */ +// MARK: Files ----------------------------------------------------------------- static Opt _index = NONE; diff --git a/src/impls/impl-hjert/new-delete.cpp b/src/impls/impl-hjert/new-delete.cpp index 66f9644b45..a2785d233d 100644 --- a/src/impls/impl-hjert/new-delete.cpp +++ b/src/impls/impl-hjert/new-delete.cpp @@ -3,7 +3,7 @@ #include #include -/* --- Kmm Implementation -------------------------------------------------- */ +// MARK: Kmm Implementation --------------------------------------------------- static Lock _heapLock; static Heap _heapImpl = { @@ -25,7 +25,7 @@ static Heap _heapImpl = { }, }; -/* --- New/Delete Implementation -------------------------------------------- */ +// MARK: New/Delete Implementation --------------------------------------------- void *operator new(usize size) { LockScope scope(_heapLock); diff --git a/src/impls/impl-posix/sys.cpp b/src/impls/impl-posix/sys.cpp index d4f71c2ee1..0652188a80 100644 --- a/src/impls/impl-posix/sys.cpp +++ b/src/impls/impl-posix/sys.cpp @@ -176,7 +176,7 @@ Res stat(Mime::Url const &url) { return Ok(Posix::fromStat(buf)); } -/* --- Sockets -------------------------------------------------------------- */ +// MARK: Sockets --------------------------------------------------------------- Res> listenUdp(SocketAddr addr) { int fd = ::socket(AF_INET, SOCK_DGRAM, 0); @@ -244,7 +244,7 @@ Res> listenIpc(Mime::Url url) { return Ok(makeStrong(fd)); } -/* --- Time ----------------------------------------------------------------- */ +// MARK: Time ------------------------------------------------------------------ TimeSpan fromTimeSpec(struct timespec const &ts) { auto usecs = (u64)ts.tv_sec * 1000000 + (u64)ts.tv_nsec / 1000; @@ -263,7 +263,7 @@ TimeSpan uptime() { return fromTimeSpec(ts); } -/* --- Memory Managment ----------------------------------------------------- */ +// MARK: Memory Managment ------------------------------------------------------ isize mmapOptionsToProt(Sys::MmapOptions const &options) { isize prot = 0; @@ -365,7 +365,7 @@ Res<> populate(Vec &infos) { return Ok(); } -/* --- Process Managment ---------------------------------------------------- */ +// MARK: Process Managment ----------------------------------------------------- Res<> sleep(TimeSpan span) { struct timespec ts; diff --git a/src/impls/impl-skift/new-delete.cpp b/src/impls/impl-skift/new-delete.cpp index 61d6df043e..1427c977fb 100644 --- a/src/impls/impl-skift/new-delete.cpp +++ b/src/impls/impl-skift/new-delete.cpp @@ -3,7 +3,7 @@ #include #include -/* --- Heap Implementation -------------------------------------------------- */ +// MARK: Heap Implementation --------------------------------------------------- static constinit Lock _heapLock; static constinit Heap _heapImpl = { @@ -24,7 +24,7 @@ static constinit Heap _heapImpl = { }, }; -/* --- New/Delete Implementation -------------------------------------------- */ +// MARK: New/Delete Implementation --------------------------------------------- void *operator new(usize size) { LockScope scope(_heapLock); diff --git a/src/impls/impl-skift/sys.cpp b/src/impls/impl-skift/sys.cpp index 8d6854e87d..4393152bc5 100644 --- a/src/impls/impl-skift/sys.cpp +++ b/src/impls/impl-skift/sys.cpp @@ -6,7 +6,7 @@ namespace Karm::Sys::_Embed { -/* --- File I/O ------------------------------------------------------------- */ +// MARK: File I/O -------------------------------------------------------------- struct VmoFd : public Sys::Fd { Hj::Vmo _vmo; @@ -98,7 +98,7 @@ Res> readDir(Mime::Url const &) { notImplemented(); } -/* --- Sockets -------------------------------------------------------------- */ +// MARK: Sockets --------------------------------------------------------------- Res> connectTcp(SocketAddr) { notImplemented(); @@ -116,7 +116,7 @@ Res> listenIpc(Mime::Url) { notImplemented(); } -/* --- Time ----------------------------------------------------------------- */ +// MARK: Time ------------------------------------------------------------------ TimeStamp now() { return Hj::now().unwrap(); @@ -126,7 +126,7 @@ TimeSpan uptime() { notImplemented(); } -/* --- Memory Managment ----------------------------------------------------- */ +// MARK: Memory Managment ------------------------------------------------------ Res memMap(Sys::MmapOptions const &) { notImplemented(); @@ -155,7 +155,7 @@ Res<> memFlush(void *, usize) { notImplemented(); } -/* --- System Informations -------------------------------------------------- */ +// MARK: System Informations --------------------------------------------------- Res<> populate(Sys::SysInfo &) { notImplemented(); @@ -177,7 +177,7 @@ Res<> populate(Vec &) { notImplemented(); } -/* --- Process Managment ---------------------------------------------------- */ +// MARK: Process Managment ----------------------------------------------------- Res<> sleep(TimeSpan) { notImplemented(); diff --git a/src/kernel/hal-x86_64/asm.h b/src/kernel/hal-x86_64/asm.h index 6d82c3635c..cf63c9a7f2 100644 --- a/src/kernel/hal-x86_64/asm.h +++ b/src/kernel/hal-x86_64/asm.h @@ -17,7 +17,7 @@ inline void invlpg(usize addr) { : "memory"); } -/* --- CRs ------------------------------------------------------------------ */ +// MARK: CRs ------------------------------------------------------------------- enum Cr0Bit { CR0_PROTECTED_MODE_ENABLE = (1 << 0), @@ -79,7 +79,7 @@ CR(4) #undef CR -/* --- AVX/SSSE ------------------------------------------------------------- */ +// MARK: AVX/SSSE -------------------------------------------------------------- enum Xcr0Bit { XCR0_XSAVE_SAVE_X87 = (1 << 0), @@ -133,7 +133,7 @@ inline void fxrstor(void const *region) { asm volatile("fxrstor (%0)" ::"a"(region)); } -/* --- Msrs ----------------------------------------------------------------- */ +// MARK: Msrs ------------------------------------------------------------------ enum struct Msrs : u64 { APIC = 0x1B, diff --git a/src/kernel/hjert-core/ctx.cpp b/src/kernel/hjert-core/ctx.cpp index 4aa9134ed0..51a0e99b07 100644 --- a/src/kernel/hjert-core/ctx.cpp +++ b/src/kernel/hjert-core/ctx.cpp @@ -6,7 +6,7 @@ namespace Hjert::Core { -/* --- Stack ----------------------------------------------------------------- */ +// MARK: Stack ------------------------------------------------------------------ Res Stack::create() { logInfo("task: creating stack..."); diff --git a/src/kernel/hjert-core/entry.cpp b/src/kernel/hjert-core/entry.cpp index a28c408f9c..621457ee7f 100644 --- a/src/kernel/hjert-core/entry.cpp +++ b/src/kernel/hjert-core/entry.cpp @@ -136,7 +136,7 @@ Res<> init(u64 magic, Handover::Payload &payload) { } // namespace Hjert::Core -/* --- Handover Entry Point ------ ------------------------------------------ */ +// MARK: Handover Entry Point ------ ------------------------------------------- HandoverRequests$( Handover::requestStack(), diff --git a/src/kernel/hjert-core/sched.h b/src/kernel/hjert-core/sched.h index b636f77590..967e500e19 100644 --- a/src/kernel/hjert-core/sched.h +++ b/src/kernel/hjert-core/sched.h @@ -10,7 +10,7 @@ namespace Hjert::Core { struct Task; -/* --- Sched ---------------------------------------------------------------- */ +// MARK: Sched ----------------------------------------------------------------- struct Sched { TimeStamp _stamp{}; diff --git a/src/kernel/hjert-x86_64/arch.cpp b/src/kernel/hjert-x86_64/arch.cpp index ab35ca4e6a..cfc1168dfc 100644 --- a/src/kernel/hjert-x86_64/arch.cpp +++ b/src/kernel/hjert-x86_64/arch.cpp @@ -71,7 +71,7 @@ void stop() { } } -/* --- Cpu ------------------------------------------------------------------ */ +// MARK: Cpu ------------------------------------------------------------------- struct Cpu : public Core::Cpu { void enableInterrupts() override { @@ -93,7 +93,7 @@ Core::Cpu &globalCpu() { return _cpu; } -/* --- Interrupts ----------------------------------------------------------- */ +// MARK: Interrupts ------------------------------------------------------------ static char const *_faultMsg[32] = { "division-by-zero", @@ -214,7 +214,7 @@ void yield() { asm volatile("int $100"); } -/* --- Syscalls ------------------------------------------------------------- */ +// MARK: Syscalls -------------------------------------------------------------- extern "C" usize _sysDispatch(usize sp) { auto *frame = reinterpret_cast(sp); @@ -238,7 +238,7 @@ extern "C" usize _sysDispatch(usize sp) { return (usize)Error::_OK; } -/* --- Vmm ------------------------------------------------------------------ */ +// MARK: Vmm ------------------------------------------------------------------- static x86_64::Pml<4> *_kpml4 = nullptr; static Opt> _vmm = NONE; @@ -287,7 +287,7 @@ Res> createVmm() { return Ok(makeStrong(pml4)); } -/* --- Tasking -------------------------------------------------------------- */ +// MARK: Tasking --------------------------------------------------------------- struct Ctx : public Core::Ctx { usize _ksp; diff --git a/src/kernel/loader/menu.cpp b/src/kernel/loader/menu.cpp index 6e094b11b2..747950831b 100644 --- a/src/kernel/loader/menu.cpp +++ b/src/kernel/loader/menu.cpp @@ -8,7 +8,7 @@ namespace Loader { -/* --- Model ---------------------------------------------------------------- */ +// MARK: Model ----------------------------------------------------------------- struct State { Configs configs; @@ -46,7 +46,7 @@ void reduce(State &s, Action a) { using Model = Ui::Model; -/* --- Views ---------------------------------------------------------------- */ +// MARK: Views ----------------------------------------------------------------- Ui::Child icon(Entry const &e) { return e.icon.visit(Visitor{ diff --git a/src/libs/karm-base/async.h b/src/libs/karm-base/async.h index 17cb9ec3ea..097f1a9e97 100644 --- a/src/libs/karm-base/async.h +++ b/src/libs/karm-base/async.h @@ -9,7 +9,7 @@ namespace Karm::Async { -/* --- Concepts ------------------------------------------------------------- */ +// MARK: Concepts -------------------------------------------------------------- struct Inline {}; static constexpr Inline INLINE; @@ -68,7 +68,7 @@ struct One { template R> using OperationOf = decltype(Meta::declval().connect(Meta::declval())); -/* --- Basics --------------------------------------------------------------- */ +// MARK: Basics ---------------------------------------------------------------- struct Resumable { virtual void resume() = 0; @@ -202,7 +202,7 @@ static inline void detach(S s) { }); } -/* --- Promise -------------------------------------------------------------- */ +// MARK: Promise --------------------------------------------------------------- template struct State { @@ -309,7 +309,7 @@ struct _Promise : public Meta::NoCopy { template using Promise = _Promise>; -/* --- Task ----------------------------------------------------------------- */ +// MARK: Task ------------------------------------------------------------------ enum struct Cfp { INDETERMINATE, diff --git a/src/libs/karm-base/ctype.h b/src/libs/karm-base/ctype.h index 1cdd02a121..9f08c9e352 100644 --- a/src/libs/karm-base/ctype.h +++ b/src/libs/karm-base/ctype.h @@ -9,7 +9,7 @@ concept CType = requires(T c, Rune r) { { c(r) } -> Meta::Same; }; -/* --- Check Identity ------------------------------------------------------- */ +// MARK: Check Identity -------------------------------------------------------- constexpr bool isAscii(Rune rune) { return rune <= 0x7F; @@ -103,7 +103,7 @@ constexpr bool isUnicodeNonCharacter(Rune rune) { ((rune & 0xFFFF) == 0xFFFF)); } -/* --- Rune Conversion ------------------------------------------------------ */ +// MARK: Rune Conversion ------------------------------------------------------- constexpr Rune toAsciiLower(Rune rune) { if (isAsciiUpper(rune)) @@ -119,7 +119,7 @@ constexpr Rune toAsciiUpper(Rune rune) { return rune; } -/* --- Rune Parsing --------------------------------------------------------- */ +// MARK: Rune Parsing ---------------------------------------------------------- constexpr Rune parseAsciiDecDigit(Rune rune) { if (isAsciiDecDigit(rune)) diff --git a/src/libs/karm-base/ints.h b/src/libs/karm-base/ints.h index 0bb231e2c6..ef44eeb8f2 100644 --- a/src/libs/karm-base/ints.h +++ b/src/libs/karm-base/ints.h @@ -10,7 +10,7 @@ namespace Karm { /// A linker symbol. using ExternSym = uint8_t[]; -/* --- Unsigned -------------------------------------------------------- */ +// MARK: Unsigned --------------------------------------------------------- using usize = size_t; @@ -84,7 +84,7 @@ always_inline constexpr auto rotr(auto x, auto n) { return (x >> n) | (x << (sizeof(x) * 8 - n)); } -/* --- Signed ---------------------------------------------------------- */ +// MARK: Signed ----------------------------------------------------------- using isize = ptrdiff_t; @@ -97,7 +97,7 @@ using i64 = int64_t; using i128 = __int128_t; #endif -/* --- Floating point -------------------------------------------------- */ +// MARK: Floating point --------------------------------------------------- using f16 = __fp16; using f32 = float; diff --git a/src/libs/karm-base/list.h b/src/libs/karm-base/list.h index b0414a0597..e9034e4c47 100644 --- a/src/libs/karm-base/list.h +++ b/src/libs/karm-base/list.h @@ -205,7 +205,7 @@ struct List { ~List() { clear(); } - /* --- Indexing --- */ + // MARK: Indexing void insert(usize i, T el) { auto *node = new Item{el}; @@ -253,7 +253,7 @@ struct List { }); } - /* --- Random Access --- */ + // MARK: Random Access T &peek(usize i) { return _ll.peek(i)->value; @@ -271,7 +271,7 @@ struct List { return peek(i); } - /* --- Front Access --- */ + // MARK: Front Access void pushFront(T const &value) { pushFront(T{value}); @@ -301,7 +301,7 @@ struct List { return _ll.head()->value; } - /* --- Back Access --- */ + // MARK: Back Access void pushBack(T const &value) { pushBack(T{value}); @@ -327,13 +327,13 @@ struct List { return _ll.tail()->value; } - /* --- Queue --- */ + // MARK: Queue bool requeue() { return _ll.requeue(); } - /* --- Iteration --- */ + // MARK: Iteration template static auto _iter(Self *self) { @@ -375,7 +375,7 @@ struct List { return _iterRev(this); } - /* --- Len --- */ + // MARK: Len usize len() const { return _ll.len(); diff --git a/src/libs/karm-base/macros.h b/src/libs/karm-base/macros.h index d68b5c9b28..52df59032c 100644 --- a/src/libs/karm-base/macros.h +++ b/src/libs/karm-base/macros.h @@ -20,12 +20,12 @@ namespace Karm { #define _ concat$(__p_, __COUNTER__) -/* --- Count ---------------------------------------------------------------- */ +// MARK: Count ----------------------------------------------------------------- #define __count(_0, _1_, _2_, _3_, _4_, _5_, _6_, _7_, _8_, _9_, _10_, _11_, _12_, _13_, _14_, _15_, _16_, _17_, _18_, _19_, _20_, _21_, _22_, _23_, _24_, _25_, _26_, _27_, _28_, _29_, _30_, _31_, _32_, _33_, _34_, _35_, _36, _37, _38, _39, _40, _41, _42, _43, _44, _45, _46, _47, _48, _49, _50, _51, _52, _53, _54, _55, _56, _57, _58, _59, _60, _61, _62, _63, _64, _65, _66, _67, _68, _69, _70, count, ...) count #define count$(__args...) __count(0, ##__args, 70, 69, 68, 67, 66, 65, 64, 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, 49, 48, 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0) -/* --- Eval ----------------------------------------------------------------- */ +// MARK: Eval ------------------------------------------------------------------ #define __eval0(...) __VA_ARGS__ #define __eval1(...) __eval0(__eval0(__eval0(__VA_ARGS__))) @@ -35,7 +35,7 @@ namespace Karm { #define eval$(...) __eval4(__eval4(__eval4(__VA_ARGS__))) -/* --- Map ------------------------------------------------------------------ */ +// MARK: Map ------------------------------------------------------------------- #define __MAP_END__(...) #define __MAP_OUT__ @@ -65,7 +65,7 @@ namespace Karm { // inserts commas between the results. #define mapList$(f, ...) eval$(__mapList1(f, __VA_ARGS__, ()()(), ()()(), ()()(), 0)) -/* --- Utilities ------------------------------------------------------------ */ +// MARK: Utilities ------------------------------------------------------------- template always_inline static inline T unionCast(U value) diff --git a/src/libs/karm-base/rc.h b/src/libs/karm-base/rc.h index 7e15929db0..8c720a5f32 100644 --- a/src/libs/karm-base/rc.h +++ b/src/libs/karm-base/rc.h @@ -117,7 +117,7 @@ template struct Strong { _Cell *_cell{}; - /* --- Rule of Five ----------------------------------------------------- */ + // MARK: Rule of Five ------------------------------------------------------ constexpr Strong() = delete; @@ -160,7 +160,7 @@ struct Strong { return *this; } - /* --- Operators -------------------------------------------------------- */ + // MARK: Operators --------------------------------------------------------- constexpr T const *operator->() const { return &unwrap(); @@ -178,7 +178,7 @@ struct Strong { return unwrap(); } - /* --- Methods ---------------------------------------------------------- */ + // MARK: Methods ----------------------------------------------------------- constexpr void ensure() const { if (not _cell) { diff --git a/src/libs/karm-base/rune.h b/src/libs/karm-base/rune.h index 85156bbf8a..a58afde345 100644 --- a/src/libs/karm-base/rune.h +++ b/src/libs/karm-base/rune.h @@ -81,7 +81,7 @@ concept DecodeInput = requires(T t, U u) { { t.rem() }; }; -/* --- Utf8 ----------------------------------------------------------------- */ +// MARK: Utf8 ------------------------------------------------------------------ struct Utf8 { using Unit = char; @@ -171,7 +171,7 @@ struct Utf8 { static_assert(StaticEncoding); -/* --- Utf16 ---------------------------------------------------------------- */ +// MARK: Utf16 ----------------------------------------------------------------- struct Utf16 { using Unit = u16; @@ -236,7 +236,7 @@ struct Utf16 { static_assert(StaticEncoding); -/* --- Utf32 ---------------------------------------------------------------- */ +// MARK: Utf32 ----------------------------------------------------------------- struct Utf32 { using Unit = char32_t; @@ -265,7 +265,7 @@ struct Utf32 { static_assert(StaticEncoding); -/* --- Pure ----------------------------------------------------------------- */ +// MARK: Pure ------------------------------------------------------------------ struct Pure { using Unit = Rune; @@ -294,7 +294,7 @@ struct Pure { static_assert(StaticEncoding); -/* --- Ascii ---------------------------------------------------------------- */ +// MARK: Ascii ----------------------------------------------------------------- struct Ascii { using Unit = char; @@ -334,7 +334,7 @@ struct Ascii { static_assert(StaticEncoding); -/* --- Extended Ascii ------------------------------------------------------- */ +// MARK: Extended Ascii -------------------------------------------------------- template struct EAscii { @@ -368,7 +368,7 @@ struct EAscii { } }; -/* --- Ibm437 --------------------------------------------------------------- */ +// MARK: Ibm437 ---------------------------------------------------------------- // clang-format off @@ -419,7 +419,7 @@ using Ibm437 = EAscii; static_assert(StaticEncoding); -/* --- Latin1 --------------------------------------------------------------- */ +// MARK: Latin1 ---------------------------------------------------------------- using Latin1Mapper = decltype([](u8 c) { // HACK: """"Unicode is a "superset" of Latin1""" (please note the quotes) @@ -432,7 +432,7 @@ using Latin1 = EAscii; static_assert(StaticEncoding); -/* --- Utilities ------------------------------------------------------------ */ +// MARK: Utilities ------------------------------------------------------------- template usize transcodeLen(Cursor input) { diff --git a/src/libs/karm-base/string.h b/src/libs/karm-base/string.h index 5d3786fce2..573044b617 100644 --- a/src/libs/karm-base/string.h +++ b/src/libs/karm-base/string.h @@ -264,7 +264,7 @@ struct StrLit { constexpr operator char const *() const { return _buf; } }; -/* --- String Conversion ---------------------------------------------------- */ +// MARK: String Conversion ----------------------------------------------------- template struct _StringBuilder { diff --git a/src/libs/karm-base/time.h b/src/libs/karm-base/time.h index 1d19887578..82bd6752d0 100644 --- a/src/libs/karm-base/time.h +++ b/src/libs/karm-base/time.h @@ -5,7 +5,7 @@ namespace Karm { -/* --- TimeSpan and TimeStamp ----------------------------------------------- */ +// MARK: TimeSpan and TimeStamp ------------------------------------------------ struct TimeSpan { usize _value; // microseconds (us) aka 1/1,000,000th of a second @@ -222,7 +222,7 @@ struct TimeStamp { auto operator<=>(TimeStamp const &) const = default; }; -/* --- Time ----------------------------------------------------------------- */ +// MARK: Time ------------------------------------------------------------------ struct Time { u8 second; @@ -378,7 +378,7 @@ struct Year { auto operator<=>(Year const &) const = default; }; -/* --- Date ----------------------------------------------------------------- */ +// MARK: Date ------------------------------------------------------------------ #define FOREACH_DAY_OF_WEEK(DOW) \ DOW(MONDAY, MON) \ @@ -498,7 +498,7 @@ struct Date { auto operator<=>(Date const &) const = default; }; -/* --- DateTime ------------------------------------------------------------- */ +// MARK: DateTime -------------------------------------------------------------- struct DateTime { Date date; diff --git a/src/libs/karm-base/vec.h b/src/libs/karm-base/vec.h index e1491f16ca..69f491c181 100644 --- a/src/libs/karm-base/vec.h +++ b/src/libs/karm-base/vec.h @@ -22,7 +22,7 @@ struct _Vec { _Vec(S storage) : _buf(storage) {} - /* --- Collection --- */ + // MARK: Collection void add(T const &val) { pushBack(val); @@ -56,7 +56,7 @@ struct _Vec { return changed; } - /* --- Capacity --- */ + // MARK: Capacity void ensure(usize cap) { _buf.ensure(cap); } @@ -70,7 +70,7 @@ struct _Vec { usize cap() const { return _buf.cap(); } - /* --- Random Access --- */ + // MARK: Random Access void insert(usize index, T const &value) { _buf.insert(index, T(value)); } @@ -90,7 +90,7 @@ struct _Vec { void removeRange(usize index, usize count) { _buf.removeRange(index, count); } - /* --- Front Access --- */ + // MARK: Front Access void pushFront(T const &value) { _buf.insert(0, T(value)); } @@ -108,7 +108,7 @@ struct _Vec { T popFront() { return _buf.removeAt(0); } - /* --- Back Access --- */ + // MARK: Back Access void pushBack(T const &value) { insert(len(), value); } @@ -128,7 +128,7 @@ struct _Vec { return removeAt(len() - 1); } - /* --- MutSliceable --- */ + // MARK: MutSliceable constexpr usize len() const { return _buf.len(); } diff --git a/src/libs/karm-crypto/base.h b/src/libs/karm-crypto/base.h index f5a4e347be..7a2ee04732 100644 --- a/src/libs/karm-crypto/base.h +++ b/src/libs/karm-crypto/base.h @@ -24,7 +24,7 @@ using HashSum = decltype(Meta::declval().sum()); template struct Digest : public Array { }; -/* --- Utilities ------------------------------------------------------------ */ +// MARK: Utilities ------------------------------------------------------------- template struct SummerReader : public Io::Reader { diff --git a/src/libs/karm-events/keys.h b/src/libs/karm-events/keys.h index 18c7c438db..dc494afa84 100644 --- a/src/libs/karm-events/keys.h +++ b/src/libs/karm-events/keys.h @@ -5,7 +5,7 @@ namespace Karm::Events { -/* --- Mouse -------------------------------------------- */ +// MARK: Mouse --------------------------------------------- enum struct Button : u8 { NONE = 0, @@ -19,7 +19,7 @@ enum struct Button : u8 { FlagsEnum$(Button); -/* --- Keyboard ----------------------------------------- */ +// MARK: Keyboard ------------------------------------------ enum struct Mod : u8 { NONE = 0, diff --git a/src/libs/karm-gfx/buffer.h b/src/libs/karm-gfx/buffer.h index 3c2d8b5a35..730149e2f0 100644 --- a/src/libs/karm-gfx/buffer.h +++ b/src/libs/karm-gfx/buffer.h @@ -85,7 +85,7 @@ struct _Pixels { return {_buf, _size, _stride, _fmt}; } - /* --- Geometry --------------------------------------------------------- */ + // MARK: Geometry ---------------------------------------------------------- always_inline Math::Recti bound() const { return {0, 0, _size.x, _size.y}; @@ -107,7 +107,7 @@ struct _Pixels { return _stride; } - /* --- Buffer Access ---------------------------------------------------- */ + // MARK: Buffer Access ----------------------------------------------------- always_inline Fmt fmt() const { return _fmt; @@ -167,7 +167,7 @@ struct _Pixels { }; } - /* --- Load/Store ------------------------------------------------------- */ + // MARK: Load/Store -------------------------------------------------------- always_inline Color loadUnsafe(Math::Vec2i pos) const { return _fmt.load(pixelUnsafe(pos)); diff --git a/src/libs/karm-gfx/context.cpp b/src/libs/karm-gfx/context.cpp index cc5ac03e7c..894c4957d4 100644 --- a/src/libs/karm-gfx/context.cpp +++ b/src/libs/karm-gfx/context.cpp @@ -57,7 +57,7 @@ void Context::restore() { _updateTransform(); } -/* --- Origin & Clipping ---------------------------------------------------- */ +// MARK: Origin & Clipping ----------------------------------------------------- Math::Recti Context::clip() const { return current().clip; @@ -92,7 +92,7 @@ void Context::origin(Math::Vec2i pos) { _updateTransform(); } -/* --- Transform ------------------------------------------------------------ */ +// MARK: Transform ------------------------------------------------------------- void Context::transform(Math::Trans2f trans) { auto &t = current().trans; @@ -120,7 +120,7 @@ void Context::identity() { current().trans = Math::Trans2f::identity(); } -/* --- Fill & Stroke -------------------------------------------------------- */ +// MARK: Fill & Stroke --------------------------------------------------------- Paint const &Context::fillStyle() { return current().paint; @@ -149,7 +149,7 @@ Context &Context::textFont(Media::Font font) { return *this; } -/* --- Drawing -------------------------------------------------------------- */ +// MARK: Drawing --------------------------------------------------------------- void Context::clear(Color color) { clear(pixels().bound(), color); } @@ -160,7 +160,7 @@ void Context::clear(Math::Recti rect, Color color) { .clear(color); } -/* --- Blitting ------------------------------------------------------------- */ +// MARK: Blitting -------------------------------------------------------------- [[gnu::flatten]] void Context::_blit( Pixels src, Math::Recti srcRect, auto srcFmt, @@ -211,7 +211,7 @@ void Context::blit(Math::Vec2i dest, Pixels pixels) { blit(pixels.bound(), {dest, pixels.bound().wh}, pixels); } -/* --- Shapes --------------------------------------------------------------- */ +// MARK: Shapes ---------------------------------------------------------------- void Context::stroke(Math::Edgei edge) { begin(); @@ -363,7 +363,7 @@ void Context::fill(Math::Vec2f baseline, Str str) { } } -/* --- Debug ---------------------------------------------------------------- */ +// MARK: Debug ----------------------------------------------------------------- void Context::plot(Math::Vec2i point, Color color) { point = applyOrigin(point); @@ -411,7 +411,7 @@ void Context::plot(Gfx::Color color) { } } -/* --- Paths ---------------------------------------------------------------- */ +// MARK: Paths ----------------------------------------------------------------- [[gnu::flatten]] void Context::_fillImpl(auto paint, auto format, FillRule fillRule) { _rast.fill(clip(), fillRule, [&](Rast::Frag frag) { @@ -525,7 +525,7 @@ void Context::stroke(StrokeStyle style) { _fill(style.paint); } -/* --- Effects -------------------------------------------------------------- */ +// MARK: Effects --------------------------------------------------------------- void Context::apply(Filter filter) { apply(filter, pixels().bound()); diff --git a/src/libs/karm-gfx/context.h b/src/libs/karm-gfx/context.h index d3b3bcf401..d6439f7f5d 100644 --- a/src/libs/karm-gfx/context.h +++ b/src/libs/karm-gfx/context.h @@ -43,7 +43,7 @@ struct Context { LcdLayout _lcdLayout = RGB; bool _useSpaa = false; - /* --- Scope ------------------------------------------------------------ */ + // MARK: Scope ------------------------------------------------------------- // Begin drawing operations on the given pixels. void begin(MutPixels p); @@ -92,7 +92,7 @@ struct Context { blit(offset - origin(), layer.pixels()); } - /* --- Origin & Clipping ------------------------------------------------ */ + // MARK: Origin & Clipping ------------------------------------------------- // Get the current clipping rectangle. Math::Recti clip() const; @@ -118,7 +118,7 @@ struct Context { // Set the current origin. void origin(Math::Vec2i pos); - /* --- Transform -------------------------------------------------------- */ + // MARK: Transform --------------------------------------------------------- void _updateTransform() { _path.transform(current().transWithOrigin()); @@ -142,7 +142,7 @@ struct Context { // Reset the transformation matrix to the identity matrix. void identity(); - /* --- Fill & Stroke ---------------------------------------------------- */ + // MARK: Fill & Stroke ----------------------------------------------------- // Get the current fill style. Paint const &fillStyle(); @@ -162,7 +162,7 @@ struct Context { // Set the current text font. Context &textFont(Media::Font style); - /* --- Drawing ---------------------------------------------------------- */ + // MARK: Drawing ----------------------------------------------------------- // Clear all pixels with respect to the current origin and clip. void clear(Color color = BLACK); @@ -170,7 +170,7 @@ struct Context { // Clear the given rectangle with respect to the current origin and clip. void clear(Math::Recti rect, Color color = BLACK); - /* --- Blitting --------------------------------------------------------- */ + // MARK: Blitting ---------------------------------------------------------- void _blit( Pixels src, @@ -193,7 +193,7 @@ struct Context { // Blit the given pixels to the current pixels at the given position. void blit(Math::Vec2i dest, Pixels pixels); - /* --- Shapes ----------------------------------------------------------- */ + // MARK: Shapes ------------------------------------------------------------ // Stroke a line void stroke(Math::Edgei edge); @@ -240,7 +240,7 @@ struct Context { // Fill a text string void fill(Math::Vec2f baseline, Str str); - /* --- Debug ------------------------------------------------------------ */ + // MARK: Debug ------------------------------------------------------------- // These functions are mostly for debugging purposes. They let you draw // non-antialiased shapes and lines. @@ -256,7 +256,7 @@ struct Context { // Draw the current path as a polygon. void plot(Gfx::Color color); - /* --- Paths ------------------------------------------------------------ */ + // MARK: Paths ------------------------------------------------------------- // (internal) Fill the current shape with the given paint. // NOTE: The shape must be flattened before calling this function. @@ -315,7 +315,7 @@ struct Context { // Stroke the current path with the given style. void stroke(StrokeStyle style); - /* --- Filters ---------------------------------------------------------- */ + // MARK: Filters ----------------------------------------------------------- // Apply the given filter to the current pixels. void apply(Filter filter); diff --git a/src/libs/karm-gfx/path.cpp b/src/libs/karm-gfx/path.cpp index cbf9d7dd9f..d380f83eba 100644 --- a/src/libs/karm-gfx/path.cpp +++ b/src/libs/karm-gfx/path.cpp @@ -4,7 +4,7 @@ namespace Karm::Gfx { -/* --- Flattening ------------------------------------------------------- */ +// MARK: Flattening -------------------------------------------------------- void Path::_flattenClose() { auto end = _verts[last(_segs).end - 1]; @@ -193,7 +193,7 @@ void Path::_flattenCubicToNoTrans(Math::Vec2f a, Math::Vec2f b, Math::Vec2f c, M //_flattenLineTo(point); } -/* --- Operations ------------------------------------------------------- */ +// MARK: Operations -------------------------------------------------------- void Path::evalOp(Op op) { if (_segs.len() > 0 and @@ -268,7 +268,7 @@ void Path::evalOp(Op op) { _lastP = op.p; } -/* --- Primitives ------------------------------------------------------- */ +// MARK: Primitives -------------------------------------------------------- void Path::clear() { evalOp(CLEAR); @@ -314,7 +314,7 @@ void Path::arcTo(Math::Vec2f radius, f64 angle, Math::Vec2f p, Flags flags) { evalOp({ARC_TO, radius, angle, p, flags}); } -/* --- Shapes ----------------------------------------------------------- */ +// MARK: Shapes ------------------------------------------------------------ void Path::line(Math::Edgef edge) { moveTo(edge.start); @@ -387,7 +387,7 @@ void Path::ellipse(Math::Ellipsef ellipse) { close(); } -/* --- Svg -------------------------------------------------------------- */ +// MARK: Svg --------------------------------------------------------------- Opt _nextVec2f(Io::SScan &s) { return Math::Vec2f{ diff --git a/src/libs/karm-gfx/path.h b/src/libs/karm-gfx/path.h index 1256d5597e..c12ceb3da5 100644 --- a/src/libs/karm-gfx/path.h +++ b/src/libs/karm-gfx/path.h @@ -128,7 +128,7 @@ struct Path { }); } - /* --- Flattening ------------------------------------------------------- */ + // MARK: Flattening -------------------------------------------------------- void _flattenClose(); @@ -144,7 +144,7 @@ struct Path { void _flattenArcTo(Math::Vec2f start, Math::Vec2f radius, f64 angle, Flags flags, Math::Vec2f point); - /* --- Transform -------------------------------------------------------- */ + // MARK: Transform --------------------------------------------------------- void transform(Math::Trans2f trans) { _trans = trans; @@ -154,7 +154,7 @@ struct Path { return _trans; } - /* --- Operations ------------------------------------------------------- */ + // MARK: Operations -------------------------------------------------------- void evalOp(Op op); @@ -180,7 +180,7 @@ struct Path { void arcTo(Math::Vec2f radius, f64 angle, Math::Vec2f p, Flags flags = DEFAULT); - /* --- Shapes ----------------------------------------------------------- */ + // MARK: Shapes ------------------------------------------------------------ void line(Math::Edgef edge); @@ -188,7 +188,7 @@ struct Path { void ellipse(Math::Ellipsef ellipse); - /* --- Svg -------------------------------------------------------------- */ + // MARK: Svg --------------------------------------------------------------- Opt _nextVec2f(Io::SScan &scan); diff --git a/src/libs/karm-gfx/stroke.cpp b/src/libs/karm-gfx/stroke.cpp index a6aa404688..472024f9d4 100644 --- a/src/libs/karm-gfx/stroke.cpp +++ b/src/libs/karm-gfx/stroke.cpp @@ -2,7 +2,7 @@ namespace Karm::Gfx { -/* --- Common --------------------------------------------------------------- */ +// MARK: Common ---------------------------------------------------------------- static void _createArc(Shape &shape, Math::Vec2f center, Math::Vec2f start, Math::Vec2f end, f64 startAngle, f64 delta, f64 radius) { isize divs = 32; // FIXME: determine this procedurally @@ -18,7 +18,7 @@ static void _createArc(Shape &shape, Math::Vec2f center, Math::Vec2f start, Math } } -/* --- Line Join ------------------------------------------------------------ */ +// MARK: Line Join ------------------------------------------------------------- static void _createJoinBevel(Shape &shape, Math::Edgef curr, Math::Edgef next) { shape.add({curr.end, next.start}); @@ -90,7 +90,7 @@ static void _createJoin(Shape &shape, StrokeStyle stroke, Math::Edgef curr, Math } } -/* --- Line Cap ------------------------------------------------------------- */ +// MARK: Line Cap -------------------------------------------------------------- struct Cap { Math::Vec2f start; @@ -138,7 +138,7 @@ static void _createCap(Shape &shape, StrokeStyle stroke, Cap cap) { } } -/* --- Public Api ----------------------------------------------------------- */ +// MARK: Public Api ------------------------------------------------------------ [[gnu::flatten]] void createStroke(Shape &shape, Path const &path, StrokeStyle stroke) { f64 outerDist = 0; diff --git a/src/libs/karm-gfx/style.h b/src/libs/karm-gfx/style.h index 43438b2c28..546496f819 100644 --- a/src/libs/karm-gfx/style.h +++ b/src/libs/karm-gfx/style.h @@ -7,7 +7,7 @@ namespace Karm::Gfx { -/* --- Border Style -------------------------------------------------------- */ +// MARK: Border Style --------------------------------------------------------- struct BorderRadius { f64 topLeft{}; @@ -28,7 +28,7 @@ struct BorderRadius { : topLeft(topLeft), topRight(topRight), bottomRight(bottomRight), bottomLeft(bottomLeft) {} }; -/* --- Stroke Style --------------------------------------------------------- */ +// MARK: Stroke Style ---------------------------------------------------------- enum StrokeAlign { CENTER_ALIGN, diff --git a/src/libs/karm-io/expr.h b/src/libs/karm-io/expr.h index ac0c830ae6..7fef985d98 100644 --- a/src/libs/karm-io/expr.h +++ b/src/libs/karm-io/expr.h @@ -24,7 +24,7 @@ Match match(Expr auto expr, _Str input) { : Match::PARTIAL; } -/* --- Combinators ---------------------------------------------------------- */ +// MARK: Combinators ----------------------------------------------------------- /// Returns true if either of the expressions match pass as parameters inline constexpr Expr auto either(Expr auto... exprs) { @@ -96,7 +96,7 @@ inline constexpr Expr auto untilAndConsume(Expr auto expr) { }; } -/* --- Quantifiers ---------------------------------------------------------- */ +// MARK: Quantifiers ----------------------------------------------------------- /// Try to match an expression `atLeast` times and and stops when `atMost` times /// is reached, return true if atLeast is reached otherwise rewind the scanner. @@ -181,7 +181,7 @@ inline Expr auto trap(Expr auto expr, auto cb) { }; } -/* --- Tokens --------------------------------------------------------------- */ +// MARK: Tokens ---------------------------------------------------------------- /// Match nothing and return true. inline constexpr Expr auto nothing() { @@ -245,7 +245,7 @@ inline constexpr Expr auto range(Rune start, Rune end) { }; } -/* --- Posix Classes -------------------------------------------------------- */ +// MARK: Posix Classes --------------------------------------------------------- /// Match an ASCII Character and consume it. inline constexpr Expr auto ascii() { @@ -302,7 +302,7 @@ inline constexpr Expr auto blank() { return ctype(isAsciiBlank); } -/* --- Utils ---------------------------------------------------------------- */ +// MARK: Utils ----------------------------------------------------------------- /// Match a separator and consume it. /// A separator is a expr surrounded by spaces. diff --git a/src/libs/karm-io/fmt.cpp b/src/libs/karm-io/fmt.cpp index e1b9f4df5c..63a183bf9c 100644 --- a/src/libs/karm-io/fmt.cpp +++ b/src/libs/karm-io/fmt.cpp @@ -50,7 +50,7 @@ Res _changeCase(Str str, CaseFn fn) { return Ok(writer.take()); } -/* --- Case functions ------------------------------------------------------- */ +// MARK: Case functions -------------------------------------------------------- // si: string index // wi: word index @@ -161,7 +161,7 @@ Rune _toSpongeCase(Rune rune, usize si, usize) { return toAsciiLower(rune); } -/* --- Public API ----------------------------------------------------------- */ +// MARK: Public API ------------------------------------------------------------ Res toDefaultCase(Str str) { return Ok(str); diff --git a/src/libs/karm-io/fmt.h b/src/libs/karm-io/fmt.h index 38e071dfb4..e64b90ab97 100644 --- a/src/libs/karm-io/fmt.h +++ b/src/libs/karm-io/fmt.h @@ -120,7 +120,7 @@ inline Res toStr(T const &t, Str format = "") { return Ok(writer.take()); } -/* --- Align Formatting ----------------------------------------------------- */ +// MARK: Align Formatting ------------------------------------------------------ enum struct Align { LEFT, @@ -186,7 +186,7 @@ struct Formatter> { } }; -/* --- Case Formatting ------------------------------------------------------ */ +// MARK: Case Formatting ------------------------------------------------------- enum struct Case { DEFAULT, @@ -278,7 +278,7 @@ struct Formatter> { } }; -/* --- Number Formatting ---------------------------------------------------- */ +// MARK: Number Formatting ----------------------------------------------------- struct NumberFormatter { bool prefix = false; @@ -489,7 +489,7 @@ struct Formatter> : public Formatter { } }; -/* --- Format Pointers ------------------------------------------------------ */ +// MARK: Format Pointers ------------------------------------------------------- template struct Formatter { @@ -530,7 +530,7 @@ struct Formatter { } }; -/* --- Format Optionals ----------------------------------------------------- */ +// MARK: Format Optionals ------------------------------------------------------ template <> struct Formatter { @@ -621,7 +621,7 @@ struct Formatter> { } }; -/* --- Format References ---------------------------------------------------- */ +// MARK: Format References ----------------------------------------------------- template struct Formatter> { @@ -660,7 +660,7 @@ struct Formatter> { } }; -/* --- Format Reflectable --------------------------------------------------- */ +// MARK: Format Reflectable ---------------------------------------------------- template struct Formatter { @@ -691,7 +691,7 @@ struct Formatter { } }; -/* --- Format Sliceable ----------------------------------------------------- */ +// MARK: Format Sliceable ------------------------------------------------------ template struct Formatter { @@ -716,7 +716,7 @@ struct Formatter { } }; -/* --- Format String -------------------------------------------------------- */ +// MARK: Format String --------------------------------------------------------- template struct StringFormatter { bool prefix = false; @@ -779,7 +779,7 @@ struct Formatter : public StringFormatter { } }; -/* --- Format Time ---------------------------------------------------------- */ +// MARK: Format Time ----------------------------------------------------------- template <> struct Formatter { @@ -816,7 +816,7 @@ struct Formatter { } }; -/* --- Format Tuple --------------------------------------------------------- */ +// MARK: Format Tuple ---------------------------------------------------------- template struct Formatter> { diff --git a/src/libs/karm-io/funcs.h b/src/libs/karm-io/funcs.h index 20b70b1c36..2679a1fd9a 100644 --- a/src/libs/karm-io/funcs.h +++ b/src/libs/karm-io/funcs.h @@ -9,7 +9,7 @@ namespace Karm::Io { -/* --- Read ----------------------------------------------------------------- */ +// MARK: Read ------------------------------------------------------------------ inline Res pread(Readable auto &reader, MutBytes bytes, Seek seek) { auto result = try$(reader.seek(seek)); @@ -35,7 +35,7 @@ inline Res readAllUtf8(Readable auto &reader) { return Ok(writer.take()); } -/* --- Write ---------------------------------------------------------------- */ +// MARK: Write ----------------------------------------------------------------- inline Res pwrite(Writable auto &writer, Bytes bytes, Seek seek) { auto result = try$(writer.seek(seek)); @@ -46,7 +46,7 @@ inline Res putByte(Writable auto &writer, Byte byte) { return writer.write({&byte, 1}); } -/* --- Seek ----------------------------------------------------------------- */ +// MARK: Seek ------------------------------------------------------------------ inline Res tell(Seekable auto &seeker) { return seeker.seek(Seek::fromCurrent(0)); @@ -68,7 +68,7 @@ inline Res skip(Readable auto &reader, usize n) { return copy(reader, sink, n); } -/* --- Copy ----------------------------------------------------------------- */ +// MARK: Copy ------------------------------------------------------------------ inline Res copy(Readable auto &reader, MutBytes bytes) { usize readed = 0; diff --git a/src/libs/karm-io/pack.h b/src/libs/karm-io/pack.h index 129f106e45..b005c43474 100644 --- a/src/libs/karm-io/pack.h +++ b/src/libs/karm-io/pack.h @@ -20,7 +20,7 @@ static constexpr T unpack(BScan &s) { return Packer::unpack(s); } -/* --- Trivialy Copyable ---------------------------------------------------- */ +// MARK: Trivialy Copyable ----------------------------------------------------- template struct Packer { @@ -35,7 +35,7 @@ struct Packer { } }; -/* --- Optionals ------------------------------------------------------------ */ +// MARK: Optionals ------------------------------------------------------------- template <> struct Packer { @@ -100,7 +100,7 @@ struct Packer> { } }; -/* --- Reflectable --------------------------------------------------------- */ +// MARK: Reflectable ---------------------------------------------------------- template struct Packer { @@ -119,7 +119,7 @@ struct Packer { } }; -/* --- Sliceable -------------------------------------------------------------- */ +// MARK: Sliceable --------------------------------------------------------------- template struct Packer> { @@ -141,7 +141,7 @@ struct Packer> { } }; -/* --- Strings -------------------------------------------------------------- */ +// MARK: Strings --------------------------------------------------------------- template struct Packer<_String> { @@ -159,7 +159,7 @@ struct Packer<_String> { } }; -/* --- Tuple ---------------------------------------------------------------- */ +// MARK: Tuple ----------------------------------------------------------------- template struct Packer> { diff --git a/src/libs/karm-io/tests/test-fmt.cpp b/src/libs/karm-io/tests/test-fmt.cpp index bca5873962..724221805e 100644 --- a/src/libs/karm-io/tests/test-fmt.cpp +++ b/src/libs/karm-io/tests/test-fmt.cpp @@ -27,7 +27,7 @@ Res<> testCase(Str expected, T const &value, Str format = "") { return Ok(); } -/* --- Number Formatting ---------------------------------------------------- */ +// MARK: Number Formatting ----------------------------------------------------- test$(fmtUnsignedNumber) { // Unsigned @@ -81,7 +81,7 @@ test$(fmtSignedNumber) { return Ok(); } -/* --- Boolean Formatting --------------------------------------------------- */ +// MARK: Boolean Formatting ---------------------------------------------------- test$(fmtBool) { try$(testCase("True", true)); @@ -89,7 +89,7 @@ test$(fmtBool) { return Ok(); } -/* --- Format Optionals ----------------------------------------------------- */ +// MARK: Format Optionals ------------------------------------------------------ test$(fmtOptionals) { try$(testCase("None", NONE)); @@ -122,7 +122,7 @@ test$(fmtResult) { return Ok(); } -/* --- Format References ---------------------------------------------------- */ +// MARK: Format References ----------------------------------------------------- test$(fmtReferences) { auto number = makeStrong(123); @@ -140,7 +140,7 @@ test$(fmtReferences) { return Ok(); } -/* --- Format Reflectable --------------------------------------------------- */ +// MARK: Format Reflectable ---------------------------------------------------- test$(fmtReflectable) { auto fooStr = try$(Io::format("{#}", Foo{1, 2})); @@ -152,7 +152,7 @@ test$(fmtReflectable) { return Ok(); } -/* --- Format Sliceable ----------------------------------------------------- */ +// MARK: Format Sliceable ------------------------------------------------------ test$(fmtSliceable) { Array arr{1, 2, 3}; @@ -160,16 +160,16 @@ test$(fmtSliceable) { return Ok(); } -/* --- Format String -------------------------------------------------------- */ +// MARK: Format String --------------------------------------------------------- test$(fmtString) { try$(testCase("test", Str("test"))); return Ok(); } -/* --- Format Time ---------------------------------------------------------- */ +// MARK: Format Time ----------------------------------------------------------- -/* --- Format Tuple --------------------------------------------------------- */ +// MARK: Format Tuple ---------------------------------------------------------- test$(fmtCons) { try$(testCase("{1, 2}", Cons{1, 2})); diff --git a/src/libs/karm-math/bigint.cpp b/src/libs/karm-math/bigint.cpp index ba82d7b0b2..1d7e7f1f89 100644 --- a/src/libs/karm-math/bigint.cpp +++ b/src/libs/karm-math/bigint.cpp @@ -2,7 +2,7 @@ namespace Karm::Math { -/* --- Unsigned Big Integer ------------------------------------------------- */ +// MARK: Unsigned Big Integer -------------------------------------------------- void _add(UBig &lhs, usize rhs) { auto lhsLen = lhs._len(); @@ -250,7 +250,7 @@ void _pow(UBig const &base, UBig const &exp, UBig &res) { } } -/* --- Signed Big Integer --------------------------------------------------- */ +// MARK: Signed Big Integer ---------------------------------------------------- void _add(IBig &lhs, IBig const &rhs) { if (lhs._sign == rhs._sign) { @@ -321,7 +321,7 @@ void _pow(IBig const &base, UBig const &exp, IBig &res) { } } -/* --- Fractional Numbers --------------------------------------------------- */ +// MARK: Fractional Numbers ---------------------------------------------------- void _fromF64(Frac &frac, f64 value) { IBig const TEN = 10_ibig; diff --git a/src/libs/karm-math/bigint.h b/src/libs/karm-math/bigint.h index cbb896718f..8a81058907 100644 --- a/src/libs/karm-math/bigint.h +++ b/src/libs/karm-math/bigint.h @@ -6,7 +6,7 @@ namespace Karm::Math { -/* --- Unsigned Big Integer ------------------------------------------------- */ +// MARK: Unsigned Big Integer -------------------------------------------------- // aka natural number struct UBig; @@ -283,7 +283,7 @@ struct UBig { } }; -/* --- Signed Big Integer --------------------------------------------------- */ +// MARK: Signed Big Integer ---------------------------------------------------- // aka integer number struct IBig; @@ -527,7 +527,7 @@ struct IBig { } }; -/* --- Fractional Number ---------------------------------------------------- */ +// MARK: Fractional Number ----------------------------------------------------- // aka rational number struct Frac; diff --git a/src/libs/karm-math/funcs.h b/src/libs/karm-math/funcs.h index 2295fc44f8..a8beff093f 100644 --- a/src/libs/karm-math/funcs.h +++ b/src/libs/karm-math/funcs.h @@ -6,7 +6,7 @@ namespace Karm::Math { -/* --- Other ---------------------------------------------------------------- */ +// MARK: Other ----------------------------------------------------------------- constexpr auto abs(auto value) { return value < 0 ? -value : value; @@ -21,7 +21,7 @@ constexpr bool epsilonEq(T lhs, T rhs, T epsilon) { return abs(lhs - rhs) < epsilon; } -/* --- Floats --------------------------------------------------------------- */ +// MARK: Floats ---------------------------------------------------------------- static constexpr bool isNan(f64 x) { return __builtin_isnan(x); @@ -35,7 +35,7 @@ static constexpr bool isNegInf(f64 x) { return __builtin_isinf_sign(x) < 0; } -/* --- Rounding + Remainder ------------------------------------------------- */ +// MARK: Rounding + Remainder -------------------------------------------------- template constexpr T floor(T x) { @@ -57,7 +57,7 @@ constexpr isize round(f64 x) { return (isize)(x + 0.5); } -/* --- Trigonometry --------------------------------------------------------- */ +// MARK: Trigonometry ---------------------------------------------------------- enum Precision { PRECISE, @@ -118,7 +118,7 @@ constexpr T cot(T x) noexcept { return T(1.) / tan(x); } -/* --- Exponentials --------------------------------------------------------- */ +// MARK: Exponentials ---------------------------------------------------------- template T exp(T x) { @@ -149,7 +149,7 @@ T exp(T x) { return (result); } -/* --- Power ---------------------------------------------------------------- */ +// MARK: Power ----------------------------------------------------------------- template constexpr T pow2(T x) { diff --git a/src/libs/karm-media/loader.cpp b/src/libs/karm-media/loader.cpp index 9cf1067495..9c21214e18 100644 --- a/src/libs/karm-media/loader.cpp +++ b/src/libs/karm-media/loader.cpp @@ -12,7 +12,7 @@ namespace Karm::Media { -/* --- Font loading --------------------------------------------------------- */ +// MARK: Font loading ---------------------------------------------------------- Res> loadFontface(Sys::Mmap &&map) { return Ok(try$(TtfFontface::load(std::move(map)))); @@ -48,7 +48,7 @@ Res loadFontOrFallback(f64 size, Mime::Url url) { return Ok(Font::fallback()); } -/* --- Image loading -------------------------------------------------------- */ +// MARK: Image loading --------------------------------------------------------- static Res loadBmp(Bytes bytes) { auto bmp = try$(Bmp::Image::load(bytes)); diff --git a/src/libs/karm-media/loader.h b/src/libs/karm-media/loader.h index 5c2cada359..d5a1b755e3 100644 --- a/src/libs/karm-media/loader.h +++ b/src/libs/karm-media/loader.h @@ -7,7 +7,7 @@ namespace Karm::Media { -/* --- Font loading --------------------------------------------------------- */ +// MARK: Font loading ---------------------------------------------------------- Res> loadFontface(Sys::Mmap &&map); @@ -19,7 +19,7 @@ Res loadFont(f64 size, Mime::Url url); Res loadFontOrFallback(f64 size, Mime::Url url); -/* --- Image loading -------------------------------------------------------- */ +// MARK: Image loading --------------------------------------------------------- Res loadImage(Sys::Mmap &&map); diff --git a/src/libs/karm-meta/cvrp.h b/src/libs/karm-meta/cvrp.h index 1cab3923e3..907f5361d9 100644 --- a/src/libs/karm-meta/cvrp.h +++ b/src/libs/karm-meta/cvrp.h @@ -4,7 +4,7 @@ namespace Karm::Meta { -/* --- Const ---------------------------------------------------------------- */ +// MARK: Const ----------------------------------------------------------------- template inline constexpr bool _Const = false; @@ -31,7 +31,7 @@ using RemoveConst = typename _RemoveConst::Type; template using CopyConst = Cond, Dest const, RemoveConst>; -/* --- Volatile ------------------------------------------------------------- */ +// MARK: Volatile -------------------------------------------------------------- template inline constexpr bool _Volatile = false; @@ -61,7 +61,7 @@ using CopyVolatile = Cond, Dest volatile, RemoveVolatile>; template using RemoveConstVolatile = RemoveConst>; -/* --- Ref -------------------------------------------------------------------*/ +// MARK: Ref -------------------------------------------------------------------*/ template inline constexpr bool _LvalueRef = false; @@ -105,7 +105,7 @@ using RemoveRef = typename _RemoveRef::Type; template using RemoveConstVolatileRef = RemoveConstVolatile>; -/* --- Pointer -------------------------------------------------------------- */ +// MARK: Pointer --------------------------------------------------------------- template inline constexpr bool _Ptr = false; diff --git a/src/libs/karm-meta/signess.h b/src/libs/karm-meta/signess.h index b00bd63c80..32acc0c4c2 100644 --- a/src/libs/karm-meta/signess.h +++ b/src/libs/karm-meta/signess.h @@ -2,7 +2,7 @@ namespace Karm::Meta { -/* --- Signed --------------------------------------------------------------- */ +// MARK: Signed ---------------------------------------------------------------- template struct _MakeSigned { @@ -62,7 +62,7 @@ struct _MakeSigned { template using MakeSigned = typename _MakeSigned::Type; -/* ---- Unsigned ------------------------------------------------------------ */ +// MARK:- Unsigned ------------------------------------------------------------- template struct _MakeUnsigned { diff --git a/src/libs/karm-meta/traits.h b/src/libs/karm-meta/traits.h index 34ab70ec34..88681ff531 100644 --- a/src/libs/karm-meta/traits.h +++ b/src/libs/karm-meta/traits.h @@ -8,7 +8,7 @@ struct Bool; namespace Karm::Meta { -/* --- Primary type categories ---------------------------------------------- */ +// MARK: Primary type categories ----------------------------------------------- template concept Void = __is_void(T); @@ -52,7 +52,7 @@ concept Struct = __is_class(T); template concept Integral = __is_integral(T); -/* --- Type properties ------------------------------------------------------ */ +// MARK: Type properties ------------------------------------------------------- template concept Trivial = __is_trivial(T); @@ -81,7 +81,7 @@ concept UnsignedIntegral = Integral and Unsigned; template using UnderlyingType = __underlying_type(T); -/* --- Type relationships --------------------------------------------------- */ +// MARK: Type relationships ---------------------------------------------------- template concept Derive = __is_base_of(Base, Derived); diff --git a/src/libs/karm-mime/path.cpp b/src/libs/karm-mime/path.cpp index 5efeb4fad9..859440dfbe 100644 --- a/src/libs/karm-mime/path.cpp +++ b/src/libs/karm-mime/path.cpp @@ -4,7 +4,7 @@ namespace Karm::Mime { -/* --- Path ----------------------------------------------------------------- */ +// MARK: Path ------------------------------------------------------------------ Path Path::parse(Io::SScan &s, bool inUrl, bool stopAtWhitespace) { Path path; diff --git a/src/libs/karm-mime/path.h b/src/libs/karm-mime/path.h index ab263f04ef..9cb297a97c 100644 --- a/src/libs/karm-mime/path.h +++ b/src/libs/karm-mime/path.h @@ -10,7 +10,7 @@ namespace Karm::Mime { -/* --- Path ----------------------------------------------------------------- */ +// MARK: Path ------------------------------------------------------------------ static inline Str suffixOf(Str str) { auto dotIndex = lastIndexOf(str, '.'); diff --git a/src/libs/karm-sys/_embed.h b/src/libs/karm-sys/_embed.h index a016443ec4..ad27b655b4 100644 --- a/src/libs/karm-sys/_embed.h +++ b/src/libs/karm-sys/_embed.h @@ -12,7 +12,7 @@ namespace Karm::Sys::_Embed { -/* --- File I/O ------------------------------------------------------------- */ +// MARK: File I/O -------------------------------------------------------------- Res> openFile(Mime::Url const &url); @@ -32,7 +32,7 @@ Res> readDir(Mime::Url const &url); Res stat(Mime::Url const &url); -/* --- Sockets -------------------------------------------------------------- */ +// MARK: Sockets --------------------------------------------------------------- Res> listenUdp(SocketAddr addr); @@ -42,13 +42,13 @@ Res> listenTcp(SocketAddr addr); Res> listenIpc(Mime::Url url); -/* --- Time ----------------------------------------------------------------- */ +// MARK: Time ------------------------------------------------------------------ TimeStamp now(); TimeSpan uptime(); -/* --- Memory Managment ----------------------------------------------------- */ +// MARK: Memory Managment ------------------------------------------------------ Res memMap(Sys::MmapOptions const &options); @@ -58,7 +58,7 @@ Res<> memUnmap(void const *buf, usize len); Res<> memFlush(void *flush, usize len); -/* --- System Informations -------------------------------------------------- */ +// MARK: System Informations --------------------------------------------------- Res<> populate(Sys::SysInfo &); @@ -70,13 +70,13 @@ Res<> populate(Sys::UserInfo &); Res<> populate(Vec &); -/* --- Process Managment ---------------------------------------------------- */ +// MARK: Process Managment ----------------------------------------------------- Res<> sleep(TimeSpan); Res<> exit(i32); -/* --- Asynchronous I/O ----------------------------------------------------- */ +// MARK: Asynchronous I/O ------------------------------------------------------ Sched &globalSched(); diff --git a/src/libs/karm-sys/async.h b/src/libs/karm-sys/async.h index a0b350fe4b..cf8c9b2516 100644 --- a/src/libs/karm-sys/async.h +++ b/src/libs/karm-sys/async.h @@ -8,7 +8,7 @@ namespace Karm::Sys { -/* --- Event ---------------------------------------------------------------- */ +// MARK: Event ----------------------------------------------------------------- enum struct Propagation { NONE, //< Don't propagate futher than the target sink @@ -112,7 +112,7 @@ Box makeEvent(Propagation propagation, Args &&...args) { return makeBox<_Event>(propagation, std::forward(args)...); } -/* --- Scheduler ------------------------------------------------------------ */ +// MARK: Scheduler ------------------------------------------------------------- struct Sched : Meta::Static { diff --git a/src/libs/karm-sys/socket.cpp b/src/libs/karm-sys/socket.cpp index cd9250d5d0..0ff884fc63 100644 --- a/src/libs/karm-sys/socket.cpp +++ b/src/libs/karm-sys/socket.cpp @@ -4,14 +4,14 @@ namespace Karm::Sys { -/* --- Udp Socket ----------------------------------------------------------- */ +// MARK: Udp Socket ------------------------------------------------------------ Res UdpConnection::listen(SocketAddr addr) { auto fd = try$(_Embed::listenUdp(addr)); return Ok(UdpConnection(std::move(fd), addr)); } -/* --- Tcp Socket ----------------------------------------------------------- */ +// MARK: Tcp Socket ------------------------------------------------------------ Res TcpConnection::connect(SocketAddr addr) { auto fd = try$(_Embed::connectTcp(addr)); @@ -23,7 +23,7 @@ Res TcpListener::listen(SocketAddr addr) { return Ok(TcpListener(std::move(fd), addr)); } -/* --- Ipc Socket ----------------------------------------------------------- */ +// MARK: Ipc Socket ------------------------------------------------------------ Res IpcListener::listen(Mime::Url url) { auto fd = try$(_Embed::listenIpc(url)); diff --git a/src/libs/karm-sys/socket.h b/src/libs/karm-sys/socket.h index 7981c6592c..8704dfb4d8 100644 --- a/src/libs/karm-sys/socket.h +++ b/src/libs/karm-sys/socket.h @@ -6,7 +6,7 @@ namespace Karm::Sys { -/* --- Abstract Socket ------------------------------------------------------ */ +// MARK: Abstract Socket ------------------------------------------------------- struct _Connection : public Io::Reader, @@ -82,7 +82,7 @@ struct _Listener : Strong fd() { return _fd; } }; -/* --- Udp Socket ----------------------------------------------------------- */ +// MARK: Udp Socket ------------------------------------------------------------ struct UdpConnection : Meta::NoCopy { @@ -114,7 +114,7 @@ struct UdpConnection : } }; -/* --- Tcp Socket ----------------------------------------------------------- */ +// MARK: Tcp Socket ------------------------------------------------------------ struct TcpConnection : public Connection { @@ -146,7 +146,7 @@ struct TcpListener : } }; -/* --- Ipc Socket ---------------------------------------------------------- */ +// MARK: Ipc Socket ----------------------------------------------------------- struct IpcConnection { Strong _fd; diff --git a/src/libs/karm-ui/anim.cpp b/src/libs/karm-ui/anim.cpp index c76f8e80e9..41570865bb 100644 --- a/src/libs/karm-ui/anim.cpp +++ b/src/libs/karm-ui/anim.cpp @@ -2,7 +2,7 @@ namespace Karm::Ui { -/* --- Slide In ------------------------------------------------------------- */ +// MARK: Slide In -------------------------------------------------------------- struct SlideIn : public ProxyNode { SlideFrom _from; @@ -68,7 +68,7 @@ Child slideIn(SlideFrom from, Ui::Child child) { return makeStrong(from, std::move(child)); } -/* --- Carousel ------------------------------------------------------------- */ +// MARK: Carousel -------------------------------------------------------------- struct Carousel : public GroupNode { usize _selected; diff --git a/src/libs/karm-ui/anim.h b/src/libs/karm-ui/anim.h index 983986152b..3d97fad7c5 100644 --- a/src/libs/karm-ui/anim.h +++ b/src/libs/karm-ui/anim.h @@ -164,7 +164,7 @@ using Eased2i = Eased2; using Eased2f = Eased2; -/* --- Slide In ------------------------------------------------------------- */ +// MARK: Slide In -------------------------------------------------------------- enum struct SlideFrom { START, @@ -181,7 +181,7 @@ inline auto slideIn(SlideFrom from) { }; } -/* --- Carousel ------------------------------------------------------------- */ +// MARK: Carousel -------------------------------------------------------------- Child carousel(usize selected, Children children, Layout::Flow flow = Layout::Flow::LEFT_TO_RIGHT); diff --git a/src/libs/karm-ui/drag.cpp b/src/libs/karm-ui/drag.cpp index d7e7eff0f1..a9d36d3af0 100644 --- a/src/libs/karm-ui/drag.cpp +++ b/src/libs/karm-ui/drag.cpp @@ -2,7 +2,7 @@ namespace Karm::Ui { -/* --- Dismisable ----------------------------------------------------------- */ +// MARK: Dismisable ------------------------------------------------------------ struct Dismisable : public ProxyNode { @@ -123,7 +123,7 @@ Child dismisable(OnDismis onDismis, DismisDir dir, f64 threshold, Ui::Child chil return makeStrong(std::move(onDismis), dir, threshold, std::move(child)); } -/* --- Drag Region ---------------------------------------------------------- */ +// MARK: Drag Region ----------------------------------------------------------- struct DragRegion : public ProxyNode { bool _grabbed{}; @@ -170,7 +170,7 @@ Child dragRegion(Child child) { return makeStrong(child); } -/* --- Handle --------------------------------------------------------------- */ +// MARK: Handle ---------------------------------------------------------------- Child handle() { return empty({128, 4}) | diff --git a/src/libs/karm-ui/drag.h b/src/libs/karm-ui/drag.h index 3ca149a493..0398cb28ae 100644 --- a/src/libs/karm-ui/drag.h +++ b/src/libs/karm-ui/drag.h @@ -7,7 +7,7 @@ namespace Karm::Ui { -/* --- Drag Event ----------------------------------------------------------- */ +// MARK: Drag Event ------------------------------------------------------------ struct DragEvent { enum { @@ -18,7 +18,7 @@ struct DragEvent { Math::Vec2i delta{}; }; -/* --- Dismisable ----------------------------------------------------------- */ +// MARK: Dismisable ------------------------------------------------------------ enum struct DismisDir { LEFT = 1 << 0, @@ -42,7 +42,7 @@ inline auto dismisable(OnDismis onDismis, DismisDir dir, f64 threshold) { }; } -/* --- Drag Region ---------------------------------------------------------- */ +// MARK: Drag Region ----------------------------------------------------------- Child dragRegion(Child child); @@ -52,7 +52,7 @@ inline auto dragRegion() { }; } -/* --- Handle --------------------------------------------------------------- */ +// MARK: Handle ---------------------------------------------------------------- Child handle(); diff --git a/src/libs/karm-ui/funcs.h b/src/libs/karm-ui/funcs.h index 5e4dd3430d..d3f529c7ec 100644 --- a/src/libs/karm-ui/funcs.h +++ b/src/libs/karm-ui/funcs.h @@ -4,7 +4,7 @@ namespace Karm::Ui { -/* --- Utilities ------------------------------------------------------------ */ +// MARK: Utilities ------------------------------------------------------------- template inline void event(Node &n, Args &&...args) { @@ -46,7 +46,7 @@ inline Opt> bindBubbleIf(bool cond, Args &&...args) { return bindBubble(args...); } -/* --- Helpers -------------------------------------------------------------- */ +// MARK: Helpers --------------------------------------------------------------- inline void shouldRepaint(Node &n) { bubble(n, n.bound()); diff --git a/src/libs/karm-ui/input.cpp b/src/libs/karm-ui/input.cpp index af55551a64..27bd7d63ac 100644 --- a/src/libs/karm-ui/input.cpp +++ b/src/libs/karm-ui/input.cpp @@ -7,7 +7,7 @@ namespace Karm::Ui { -/* --- Button ---------------------------------------------------------------- */ +// MARK: Button ----------------------------------------------------------------- ButtonStyle ButtonStyle::none() { return {}; @@ -260,7 +260,7 @@ Child button(OnPress onPress, Mdi::Icon i, Str t) { return button(std::move(onPress), ButtonStyle::regular(), i, t); } -/* --- Input ---------------------------------------------------------------- */ +// MARK: Input ----------------------------------------------------------------- struct Input : public View { Gfx::TextStyle _style; @@ -325,7 +325,7 @@ Child input(Strong text, OnChange<> onChange) { return makeStrong(TextStyles::bodyMedium(), text, std::move(onChange)); } -/* --- Toggle --------------------------------------------------------------- */ +// MARK: Toggle ---------------------------------------------------------------- struct Toggle : public View { bool _value = false; @@ -389,7 +389,7 @@ Child toggle(bool value, OnChange onChange) { return makeStrong(value, std::move(onChange)); } -/* --- Checkbox ------------------------------------------------------------- */ +// MARK: Checkbox -------------------------------------------------------------- struct Checkbox : public View { bool _value = false; @@ -448,7 +448,7 @@ Child checkbox(bool value, OnChange onChange) { return makeStrong(value, std::move(onChange)); } -/* --- Radio ----------------------------------------------------------------- */ +// MARK: Radio ------------------------------------------------------------------ struct Radio : public View { bool _value = false; @@ -505,7 +505,7 @@ Child radio(bool value, OnChange onChange) { return makeStrong(value, std::move(onChange)); } -/* --- Slider ---------------------------------------------------------------- */ +// MARK: Slider ----------------------------------------------------------------- struct Slider : public ProxyNode { f64 _value = 0.0f; @@ -559,7 +559,7 @@ Child slider(f64 value, OnChange onChange, Child child) { return makeStrong(value, std::move(onChange), std::move(child)); } -/* --- Color ---------------------------------------------------------------- */ +// MARK: Color ----------------------------------------------------------------- Child color(Gfx::Color color, OnChange) { return button( @@ -577,7 +577,7 @@ Child color(Gfx::Color color, OnChange) { ); } -/* --- Intent --------------------------------------------------------------- */ +// MARK: Intent ---------------------------------------------------------------- struct Intent : public ProxyNode { Func _map; diff --git a/src/libs/karm-ui/input.h b/src/libs/karm-ui/input.h index 0dd6114f3c..45ff9345cb 100644 --- a/src/libs/karm-ui/input.h +++ b/src/libs/karm-ui/input.h @@ -17,7 +17,7 @@ using OnChange = Meta::Cond< template [[gnu::used]] static auto IGNORE(Ui::Node &, T) {} -/* --- Button --------------------------------------------------------------- */ +// MARK: Button ---------------------------------------------------------------- struct MouseListener { enum MouseState { @@ -160,25 +160,25 @@ Child button(OnPress onPress, Mdi::Icon i); Child button(OnPress onPress, Mdi::Icon i, Str t); -/* --- Input ---------------------------------------------------------------- */ +// MARK: Input ----------------------------------------------------------------- Child input(Strong text, OnChange<> onChange, Gfx::TextStyle style); Child input(Strong text, OnChange<> onChange); -/* --- Toggle --------------------------------------------------------------- */ +// MARK: Toggle ---------------------------------------------------------------- Child toggle(bool value, OnChange onChange); -/* --- Checkbox ------------------------------------------------------------- */ +// MARK: Checkbox -------------------------------------------------------------- Child checkbox(bool value, OnChange onChange); -/* --- Radio ---------------------------------------------------------------- */ +// MARK: Radio ----------------------------------------------------------------- Child radio(bool value, OnChange onChange); -/* --- Slider --------------------------------------------------------------- */ +// MARK: Slider ---------------------------------------------------------------- Child slider(f64 value, OnChange onChange, Child child); @@ -188,13 +188,13 @@ static inline auto slider(f64 value, OnChange onChange) { }; } -/* --- Select --------------------------------------------------------------- */ +// MARK: Select ---------------------------------------------------------------- -/* --- Color ---------------------------------------------------------------- */ +// MARK: Color ----------------------------------------------------------------- Child color(Gfx::Color color, OnChange onChange); -/* --- Intent --------------------------------------------------------------- */ +// MARK: Intent ---------------------------------------------------------------- using Filter = Func; diff --git a/src/libs/karm-ui/layout.cpp b/src/libs/karm-ui/layout.cpp index 4bed1d661a..c644776252 100644 --- a/src/libs/karm-ui/layout.cpp +++ b/src/libs/karm-ui/layout.cpp @@ -6,7 +6,7 @@ namespace Karm::Ui { struct Grow; -/* --- Empty ---------------------------------------------------------------- */ +// MARK: Empty ----------------------------------------------------------------- struct Empty : public View { Math::Vec2i _size; @@ -43,7 +43,7 @@ Child cond(bool cond, Child child) { return empty(); } -/* --- Bound ---------------------------------------------------------------- */ +// MARK: Bound ----------------------------------------------------------------- struct Bound : public ProxyNode { Math::Recti _bound; @@ -101,7 +101,7 @@ Child placed(Math::Recti place, Child child) { return makeStrong(place, child); } -/* --- Separator ------------------------------------------------------------ */ +// MARK: Separator ------------------------------------------------------------- struct Separator : public View { Math::Vec2i size(Math::Vec2i, Layout::Hint) override { @@ -120,7 +120,7 @@ Child separator() { return makeStrong(); } -/* --- Align ---------------------------------------------------------------- */ +// MARK: Align ----------------------------------------------------------------- struct Align : public ProxyNode { Layout::Align _align; @@ -187,7 +187,7 @@ Child vcenterFill(Child child) { return align(Layout::Align::VCENTER | Layout::Align::HFILL, child); } -/* --- Sizing --------------------------------------------------------------- */ +// MARK: Sizing ---------------------------------------------------------------- struct Sizing : public ProxyNode { Math::Vec2i _min; @@ -257,7 +257,7 @@ Child pinSize(isize size, Child child) { return minSize(Math::Vec2i{size}, child); } -/* --- Spacing -------------------------------------------------------------- */ +// MARK: Spacing --------------------------------------------------------------- struct Spacing : public ProxyNode { Layout::Spacingi _spacing; @@ -294,7 +294,7 @@ Child spacing(Layout::Spacingi s, Child child) { return makeStrong(s, child); } -/* --- Aspect Ratio --------------------------------------------------------- */ +// MARK: Aspect Ratio ---------------------------------------------------------- struct AspectRatio : public ProxyNode { f64 _ratio; @@ -329,7 +329,7 @@ Child aspectRatio(f64 ratio, Child child) { return makeStrong(ratio, child); } -/* --- Stack ---------------------------------------------------------------- */ +// MARK: Stack ----------------------------------------------------------------- struct StackLayout : public GroupNode { using GroupNode::GroupNode; @@ -350,7 +350,7 @@ Child stack(Children children) { return makeStrong(children); } -/* --- Flow ----------------------------------------------------------------- */ +// MARK: Flow ------------------------------------------------------------------ struct Grow : public ProxyNode { isize _grow; @@ -471,7 +471,7 @@ Child flow(FlowStyle style, Children children) { return makeStrong(style, children); } -/* --- Grid ----------------------------------------------------------------- */ +// MARK: Grid ------------------------------------------------------------------ struct Cell : public ProxyNode { Math::Vec2i _start{}; diff --git a/src/libs/karm-ui/layout.h b/src/libs/karm-ui/layout.h index bc5d65d04d..aa3775c941 100644 --- a/src/libs/karm-ui/layout.h +++ b/src/libs/karm-ui/layout.h @@ -9,7 +9,7 @@ namespace Karm::Ui { inline constexpr auto UNCONSTRAINED = -1; -/* --- Empty ---------------------------------------------------------------- */ +// MARK: Empty ----------------------------------------------------------------- Child empty(Math::Vec2i size = {}); @@ -21,7 +21,7 @@ inline auto cond(bool c) { }; } -/* --- Bound ---------------------------------------------------------------- */ +// MARK: Bound ----------------------------------------------------------------- Child bound(Child child); @@ -39,11 +39,11 @@ inline auto placed(Math::Recti bound) { }; } -/* --- Separator ------------------------------------------------------------ */ +// MARK: Separator ------------------------------------------------------------- Child separator(); -/* --- Grow ----------------------------------------------------------------- */ +// MARK: Grow ------------------------------------------------------------------ Child grow(Opt child); @@ -61,7 +61,7 @@ inline auto grow(isize g) { }; } -/* --- Align ---------------------------------------------------------------- */ +// MARK: Align ----------------------------------------------------------------- Child align(Layout::Align align, Child child); @@ -143,7 +143,7 @@ inline auto vcenterFill() { }; } -/* --- Sizing --------------------------------------------------------------- */ +// MARK: Sizing ---------------------------------------------------------------- Child sizing(Math::Vec2i min, Math::Vec2i max, Child child); @@ -201,7 +201,7 @@ inline auto pinSize(isize size) { }; } -/* --- Spacing -------------------------------------------------------------- */ +// MARK: Spacing --------------------------------------------------------------- Child spacing(Layout::Spacingi s, Child child); @@ -211,7 +211,7 @@ inline auto spacing(Layout::Spacingi s) { }; } -/* --- Aspect Ratio --------------------------------------------------------- */ +// MARK: Aspect Ratio ---------------------------------------------------------- Child aspectRatio(f64 ratio, Child child); @@ -221,7 +221,7 @@ inline auto aspectRatio(f64 ratio) { }; } -/* --- Stack ---------------------------------------------------------------- */ +// MARK: Stack ----------------------------------------------------------------- Child stack(Children children); @@ -229,7 +229,7 @@ inline Child stack(auto... children) { return stack(Children{children...}); } -/* --- Flow ----------------------------------------------------------------- */ +// MARK: Flow ------------------------------------------------------------------ struct FlowStyle { Layout::Flow flow = Layout::Flow::LEFT_TO_RIGHT; @@ -295,7 +295,7 @@ inline Child vflow(isize gaps, Layout::Align align, Children children) { return flow({.flow = Layout::Flow::TOP_TO_BOTTOM, .align = align, .gaps = gaps}, children); } -/* --- Grid ----------------------------------------------------------------- */ +// MARK: Grid ------------------------------------------------------------------ struct GridUnit { enum _Unit { diff --git a/src/libs/karm-ui/node.h b/src/libs/karm-ui/node.h index d2649e0c42..cc31d3ec1f 100644 --- a/src/libs/karm-ui/node.h +++ b/src/libs/karm-ui/node.h @@ -26,7 +26,7 @@ using Child = Strong; using Children = Vec; using Visitor = Func; -/* --- Node ----------------------------------------------------------------- */ +// MARK: Node ------------------------------------------------------------------ using Key = Opt; @@ -116,7 +116,7 @@ always_inline auto operator|(Decorator auto decorator, Decorator auto decorator2 }; } -/* --- LeafNode ------------------------------------------------------------- */ +// MARK: LeafNode -------------------------------------------------------------- template struct LeafNode : public Node { @@ -162,7 +162,7 @@ struct LeafNode : public Node { } }; -/* --- GroupNode ------------------------------------------------------------ */ +// MARK: GroupNode ------------------------------------------------------------- template struct GroupNode : public LeafNode { @@ -240,7 +240,7 @@ struct GroupNode : public LeafNode { } }; -/* --- ProxyNode ------------------------------------------------------------ */ +// MARK: ProxyNode ------------------------------------------------------------- template struct ProxyNode : public LeafNode { diff --git a/src/libs/karm-ui/reducer.h b/src/libs/karm-ui/reducer.h index 4fca9a3ad1..3b6a27d21b 100644 --- a/src/libs/karm-ui/reducer.h +++ b/src/libs/karm-ui/reducer.h @@ -4,7 +4,7 @@ namespace Karm::Ui { -/* --- Reducer -------------------------------------------------------------- */ +// MARK: Reducer --------------------------------------------------------------- template struct Model { @@ -67,7 +67,7 @@ struct Reducer : (*_child)->detach(this); } - /* --- Build ------------------------------------------------------------ */ + // MARK: Build ------------------------------------------------------------- void rebuild() { if (_child) { @@ -90,7 +90,7 @@ struct Reducer : } } - /* --- Node ------------------------------------------------------------- */ + // MARK: Node -------------------------------------------------------------- void reconcile(Reducer &o) override { _build = std::move(o._build); @@ -157,7 +157,7 @@ inline Child reducer(Func build) { return makeStrong>(typename Model::State{}, std::move(build)); } -/* --- State ---------------------------------------------------------------- */ +// MARK: State ----------------------------------------------------------------- template inline Child state(T init, auto build) { diff --git a/src/libs/karm-ui/scroll.cpp b/src/libs/karm-ui/scroll.cpp index 6b306c98c4..08836e1819 100644 --- a/src/libs/karm-ui/scroll.cpp +++ b/src/libs/karm-ui/scroll.cpp @@ -2,7 +2,7 @@ namespace Karm::Ui { -/* --- Scroll --------------------------------------------------------------- */ +// MARK: Scroll ---------------------------------------------------------------- struct Scroll : public ProxyNode { bool _mouseIn = false; diff --git a/src/libs/karm-ui/view.cpp b/src/libs/karm-ui/view.cpp index 43561416cc..263f69e42b 100644 --- a/src/libs/karm-ui/view.cpp +++ b/src/libs/karm-ui/view.cpp @@ -4,7 +4,7 @@ namespace Karm::Ui { -/* --- Text ----------------------------------------------------------------- */ +// MARK: Text ------------------------------------------------------------------ static Opt> _regularFontface = NONE; Strong regularFontface() { @@ -255,7 +255,7 @@ Child text(Str text) { return makeStrong(TextStyles::labelMedium(), text); } -/* --- Badge ---------------------------------------------------------------- */ +// MARK: Badge ----------------------------------------------------------------- Child badge(Gfx::Color color, String t) { BoxStyle boxStyle = { @@ -279,7 +279,7 @@ Child badge(BadgeStyle style, String t) { return badge(COLORS[static_cast(style)], t); } -/* --- Icon ----------------------------------------------------------------- */ +// MARK: Icon ------------------------------------------------------------------ struct Icon : public View { Media::Icon _icon; @@ -316,7 +316,7 @@ Child icon(Mdi::Icon i, f64 size, Opt color) { return icon(Media::Icon{i, size}, color); } -/* --- Image ---------------------------------------------------------------- */ +// MARK: Image ----------------------------------------------------------------- struct Image : public View { Media::Image _image; @@ -355,7 +355,7 @@ Child image(Media::Image image, Gfx::BorderRadius radius) { return makeStrong(image, radius); } -/* --- Canvas --------------------------------------------------------------- */ +// MARK: Canvas ---------------------------------------------------------------- struct Canvas : public View { OnPaint _onPaint; @@ -389,7 +389,7 @@ Child canvas(OnPaint onPaint) { return makeStrong(std::move(onPaint)); } -/* --- Filter --------------------------------------------------------------- */ +// MARK: Filter ---------------------------------------------------------------- struct BackgroundFilter : public ProxyNode { Gfx::Filter _filter; diff --git a/src/libs/karm-ui/view.h b/src/libs/karm-ui/view.h index 93b3d9b477..16bd412164 100644 --- a/src/libs/karm-ui/view.h +++ b/src/libs/karm-ui/view.h @@ -6,7 +6,7 @@ namespace Karm::Ui { -/* --- Base ----------------------------------------------------------------- */ +// MARK: Base ------------------------------------------------------------------ template struct View : public LeafNode { @@ -21,7 +21,7 @@ struct View : public LeafNode { } }; -/* --- Text ----------------------------------------------------------------- */ +// MARK: Text ------------------------------------------------------------------ struct TextStyles { private: @@ -100,7 +100,7 @@ DEF_STYLE(codeSmall) #undef DEF_STYLE -/* --- Badge ---------------------------------------------------------------- */ +// MARK: Badge ----------------------------------------------------------------- enum struct BadgeStyle { INFO, @@ -115,25 +115,25 @@ Child badge(Gfx::Color color, String text); Child badge(BadgeStyle style, String text); -/* --- Icon ----------------------------------------------------------------- */ +// MARK: Icon ------------------------------------------------------------------ Child icon(Media::Icon icon, Opt color = NONE); Child icon(Mdi::Icon icon, f64 size, Opt color = NONE); -/* --- Image ---------------------------------------------------------------- */ +// MARK: Image ----------------------------------------------------------------- Child image(Media::Image image); Child image(Media::Image image, Gfx::BorderRadius radius); -/* --- Canvas --------------------------------------------------------------- */ +// MARK: Canvas ---------------------------------------------------------------- using OnPaint = Func; Child canvas(OnPaint onPaint); -/* --- Blur ----------------------------------------------------------------- */ +// MARK: Blur ------------------------------------------------------------------ Child backgroundFilter(Gfx::Filter f, Child child); diff --git a/src/specs/bmp/spec.h b/src/specs/bmp/spec.h index 1e14efd3ec..4efa5eb69b 100644 --- a/src/specs/bmp/spec.h +++ b/src/specs/bmp/spec.h @@ -17,7 +17,7 @@ namespace Bmp { struct Image { - /* --- Loading ---------------------------------------------------------- */ + // MARK: Loading ----------------------------------------------------------- static bool isBmp(Bytes slice) { return slice.len() >= 2 and @@ -40,7 +40,7 @@ struct Image { return Ok(image); } - /* --- Header ----------------------------------------------------------- */ + // MARK: Header ------------------------------------------------------------ usize _dataOffset; @@ -108,7 +108,7 @@ struct Image { return Ok(); } - /* --- Palette ---------------------------------------------------------- */ + // MARK: Palette ----------------------------------------------------------- Vec _palette; @@ -125,7 +125,7 @@ struct Image { return Ok(); } - /* --- Pixels ----------------------------------------------------------- */ + // MARK: Pixels ------------------------------------------------------------ Bytes _pixels; @@ -135,7 +135,7 @@ struct Image { return Ok(); } - /* --- Decoding --------------------------------------------------------- */ + // MARK: Decoding ---------------------------------------------------------- Res<> decode(Gfx::MutPixels pixels) { Io::BScan s{_pixels}; @@ -194,7 +194,7 @@ struct Image { return Ok(); } - /* --- Dumping ---------------------------------------------------------- */ + // MARK: Dumping ----------------------------------------------------------- void dump(Io::Emit &e) { e("BMP image"); diff --git a/src/specs/efi/spec.h b/src/specs/efi/spec.h index 21a627ca8c..6fb1026d74 100644 --- a/src/specs/efi/spec.h +++ b/src/specs/efi/spec.h @@ -118,7 +118,7 @@ using DummyFunction = void *; static_assert(sizeof(Method<>) == sizeof(void *), "Method must be packed"); -/* --- 4 System Table ------------------------------------------------------- */ +// MARK: 4 System Table -------------------------------------------------------- struct TableHeader { u64 signature; @@ -132,7 +132,7 @@ struct Table { TableHeader header; }; -/* --- 4.3 System Table ----------------------------------------------------- */ +// MARK: 4.3 System Table ------------------------------------------------------ struct SimpleTextInputProtocol; struct SimpleTextOutputProtocol; @@ -177,7 +177,7 @@ struct SystemTable : public Table { } }; -/* --- 7 Boot Services ------------------------------------------------------ */ +// MARK: 7 Boot Services ------------------------------------------------------- enum struct AllocateType : u32 { ANY_PAGES, @@ -288,7 +288,7 @@ struct BootService : public Table { DummyFunction createEventEx; }; -/* --- 8 Runtime Services --------------------------------------------------- */ +// MARK: 8 Runtime Services ---------------------------------------------------- enum struct ResetType { RESET_COLD, @@ -325,7 +325,7 @@ struct RuntimeService : public Table { DummyFunction queryVariableInfo; }; -/* --- 9.1 Load Image Protocol ---------------------------------------------- */ +// MARK: 9.1 Load Image Protocol ----------------------------------------------- struct DevicePathProtocol; @@ -353,7 +353,7 @@ struct LoadedImageProtocol { Function unload; }; -/* --- 10 Device Path Protocol ---------------------------------------------- */ +// MARK: 10 Device Path Protocol ----------------------------------------------- struct DevicePathProtocol { static constexpr Guid GUID = Guid{0x09576e91, 0x6d3f, 0x11d2, {0x8e, 0x39, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b}}; @@ -363,7 +363,7 @@ struct DevicePathProtocol { u8 length[2]; }; -/* --- 12.3 Simple Text Input Protocol -------------------------------------- */ +// MARK: 12.3 Simple Text Input Protocol --------------------------------------- enum ScanCode : u16 { NONE = 0x00, @@ -508,7 +508,7 @@ struct SimpleTextInputProtocol { Event waitForKey; }; -/* --- 12.4 Simple Text Output Protocol ------------------------------------- */ +// MARK: 12.4 Simple Text Output Protocol -------------------------------------- #define EFI_BLACK 0x00 #define EFI_BLUE 0x01 @@ -556,7 +556,7 @@ struct SimpleTextOutputProtocol { SimpleTextOutputMode *mode; }; -/* --- 12.9 Graphics Output Protocol ---------------------------------------- */ +// MARK: 12.9 Graphics Output Protocol ----------------------------------------- struct PixelBitmask { u32 redMask; @@ -600,7 +600,7 @@ struct GraphicsOutputProtocol { GraphicsOutputProtocolMode *mode; }; -/* --- 13.4 Simple File System Protocol ------------------------------------- */ +// MARK: 13.4 Simple File System Protocol -------------------------------------- struct FileProtocol; @@ -611,7 +611,7 @@ struct SimpleFileSystemProtocol { Method openVolume; }; -/* --- 13.5 File Protocol --------------------------------------------------- */ +// MARK: 13.5 File Protocol ---------------------------------------------------- struct FileInfo { static constexpr Guid GUID = Guid{0x09576e92, 0x6d3f, 0x11d2, {0x8e, 0x39, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b}}; diff --git a/src/specs/jpeg/spec.h b/src/specs/jpeg/spec.h index aeb9baeb8a..02be1e72d7 100644 --- a/src/specs/jpeg/spec.h +++ b/src/specs/jpeg/spec.h @@ -17,7 +17,7 @@ namespace Jpeg { -/* --- Constantes ----------------------------------------------------------- */ +// MARK: Constantes ------------------------------------------------------------ enum Marker : Byte { NIL = 0x00, @@ -120,7 +120,7 @@ inline constexpr Array ZIGZAG = { 53, 60, 61, 54, 47, 55, 62, 63 }; -/* --- Bit Stream ----------------------------------------------------------- */ +// MARK: Bit Stream ------------------------------------------------------------ struct BitStream { Io::BScan &s; @@ -181,7 +181,7 @@ struct BitStream { } }; -/* --- Decoder -------------------------------------------------------------- */ +// MARK: Decoder --------------------------------------------------------------- struct Image { static bool isJpeg(Bytes slice) { @@ -260,7 +260,7 @@ struct Image { s.skip(len - 2); } - /* --- Quantization Tables ---------------------------------------------- */ + // MARK: Quantization Tables ----------------------------------------------- using Quant = Array; Array, 4> _quant; @@ -295,7 +295,7 @@ struct Image { return Ok(); } - /* --- Start of frame --------------------------------------------------- */ + // MARK: Start of frame ---------------------------------------------------- isize _width = 8; isize _height = 8; @@ -373,7 +373,7 @@ struct Image { return Ok(); } - /* --- Restart interval ------------------------------------------------- */ + // MARK: Restart interval -------------------------------------------------- usize _restartInterval = 0; @@ -393,7 +393,7 @@ struct Image { return Ok(); } - /* --- Huffman Tables --------------------------------------------------- */ + // MARK: Huffman Tables ---------------------------------------------------- struct HuffmanTable { Array offs = {}; @@ -471,7 +471,7 @@ struct Image { return Ok(); } - /* --- Start of scan ---------------------------------------------------- */ + // MARK: Start of scan ----------------------------------------------------- struct ScanComponent { u8 dcHuffId; @@ -564,7 +564,7 @@ struct Image { return Ok(); } - /* --- Huffman Data ----------------------------------------------------- */ + // MARK: Huffman Data ------------------------------------------------------ using Mcu = Array; @@ -671,7 +671,7 @@ struct Image { return Ok(); } - /* --- Decoding --------------------------------------------------------- */ + // MARK: Decoding ---------------------------------------------------------- void idct(Array &mcu) { f32 m0 = 2.0 * Math::cos(1.0 / 16.0 * 2.0 * Math::PI); @@ -864,7 +864,7 @@ struct Image { return Ok(); } - /* --- Dumping ---------------------------------------------------------- */ + // MARK: Dumping ----------------------------------------------------------- void dump(Io::Emit &e) { e("JPEG image"); diff --git a/src/specs/sbi/sbi.h b/src/specs/sbi/sbi.h index d71dc39210..3a9362a2e6 100644 --- a/src/specs/sbi/sbi.h +++ b/src/specs/sbi/sbi.h @@ -45,7 +45,7 @@ Ret ecall(usize eid, usize fid = 0, usize arg0 = 0, usize arg1 = 0, usize arg2 = return {a0, a1}; } -/* --- Base Extension ------------------------------------------------------- */ +// MARK: Base Extension -------------------------------------------------------- static constexpr usize BASE = 0x10; @@ -107,7 +107,7 @@ Ret getMimpid() { return ecall(BASE, 6); } -/* --- Legacy Extension ----------------------------------------------------- */ +// MARK: Legacy Extension ------------------------------------------------------ usize legacyPutChar(char c) { return ecall(0x1, 0, c).err; @@ -125,7 +125,7 @@ usize legacyGetChar() { return ecall(0x2, 0).val; } -/* --- System Reset Extension ----------------------------------------------- */ +// MARK: System Reset Extension ------------------------------------------------ static constexpr usize SYSTEM_RESET = 0x10; @@ -145,7 +145,7 @@ Ret systemReset(ResetType type, ResetReason reason) { return ecall(SYSTEM_RESET, 0, (usize)type, (usize)reason); } -/* --- Debug Console Extension ---------------------------------------------- */ +// MARK: Debug Console Extension ----------------------------------------------- static constexpr usize DEBUG_CONSOLE = 0x4442434E; diff --git a/src/specs/textbox/model.h b/src/specs/textbox/model.h index 504a8402f2..f9f382c92f 100644 --- a/src/specs/textbox/model.h +++ b/src/specs/textbox/model.h @@ -55,7 +55,7 @@ struct Model { _buf.pushBack(r); } - /* --- Operations --- */ + // MARK: Operations void _do(Record &r) { switch (r.op) { @@ -146,7 +146,7 @@ struct Model { _group++; } - /* --- Movements --- */ + // MARK: Movements usize _prev(usize pos) const { if (pos == 0) @@ -222,7 +222,7 @@ struct Model { return _buf.len(); } - /* --- Commands --- */ + // MARK: Commands void insert(Rune rune) { _checkpoint(); diff --git a/src/specs/ttf/spec.h b/src/specs/ttf/spec.h index 7a2e2fcccc..dd23954d72 100644 --- a/src/specs/ttf/spec.h +++ b/src/specs/ttf/spec.h @@ -119,7 +119,7 @@ struct Font { Font(Bytes slice) : _slice(slice) {} - /* --- Parsing Api ------------------------------------------------------ */ + // MARK: Parsing Api ------------------------------------------------------- Io::BScan begin() const { return _slice; diff --git a/src/srvs/grund-device/cmos.cpp b/src/srvs/grund-device/cmos.cpp index aedf399d72..7457c47819 100644 --- a/src/srvs/grund-device/cmos.cpp +++ b/src/srvs/grund-device/cmos.cpp @@ -4,7 +4,7 @@ namespace Grund::Device::Cmos { -/* --- CMOS ----------------------------------------------------------------- */ +// MARK: CMOS ------------------------------------------------------------------ Cmos::Cmos(Strong io) : _io(std::move(io)) {} @@ -37,7 +37,7 @@ Res<> Cmos::waitUpdate() { return Ok(); } -/* --- RTC ------------------------------------------------------------------ */ +// MARK: RTC ------------------------------------------------------------------- static inline u8 fomBcd(u8 value) { return (value / 16) * 10 + (value & 0xf); diff --git a/src/srvs/grund-device/cmos.h b/src/srvs/grund-device/cmos.h index 85a917fbee..2ee26f7fcb 100644 --- a/src/srvs/grund-device/cmos.h +++ b/src/srvs/grund-device/cmos.h @@ -16,7 +16,7 @@ struct Device : public Node { Device(Cmos &cmos) : _cmos(cmos) {} }; -/* --- CMOS ----------------------------------------------------------------- */ +// MARK: CMOS ------------------------------------------------------------------ struct Cmos : public Node { using AddrReg = Hal::Reg; @@ -48,7 +48,7 @@ struct Cmos : public Node { Res<> waitUpdate(); }; -/* --- RTC ------------------------------------------------------------------ */ +// MARK: RTC ------------------------------------------------------------------- struct Rtc : public Device { using Device::Device; diff --git a/src/srvs/grund-device/pci.h b/src/srvs/grund-device/pci.h index 7293d8b241..bb0804ed56 100644 --- a/src/srvs/grund-device/pci.h +++ b/src/srvs/grund-device/pci.h @@ -21,7 +21,7 @@ struct Addr { struct Device : public Node { }; -/* --- Group, Bus, Slot, Func ----------------------------------------------- */ +// MARK: Group, Bus, Slot, Func ------------------------------------------------ struct Group : public Device { }; diff --git a/src/srvs/grund-device/ps2.cpp b/src/srvs/grund-device/ps2.cpp index 2673361690..5f7abe8971 100644 --- a/src/srvs/grund-device/ps2.cpp +++ b/src/srvs/grund-device/ps2.cpp @@ -5,7 +5,7 @@ namespace Grund::Device::Ps2 { -/* --- Controller ----------------------------------------------------------- */ +// MARK: Controller ------------------------------------------------------------ Res<> I8042::init() { logInfo("ps2: i8042 initializing..."); @@ -25,7 +25,7 @@ Res<> I8042::flush() { return Ok(); } -/* --- Data and Status --- */ +// MARK: Data and Status Res> I8042::readStatus() { auto status = try$(io().read()); @@ -70,7 +70,7 @@ Res<> I8042::writeCmd(Cmd cmd) { return Ok(); } -/* --- Configs --- */ +// MARK: Configs Res<> I8042::writeConfig(Flags cfg) { try$(writeCmd(Cmd::WRITE_CONFIG)); @@ -84,7 +84,7 @@ Res> I8042::readConfig() { return Ok(static_cast(cfg)); } -/* --- Keyboard ------------------------------------------------------------- */ +// MARK: Keyboard -------------------------------------------------------------- Res<> Keyboard::init() { logInfo("ps2: keyboard initializing..."); @@ -125,7 +125,7 @@ Res<> Keyboard::event(Sys::Event &e) { return Device::event(e); } -/* --- Mouse ---------------------------------------------------------------- */ +// MARK: Mouse ----------------------------------------------------------------- Res<> Mouse::init() { logInfo("ps2: mouse initializing..."); diff --git a/src/srvs/grund-device/ps2.h b/src/srvs/grund-device/ps2.h index ad322a2baa..474c71cf2c 100644 --- a/src/srvs/grund-device/ps2.h +++ b/src/srvs/grund-device/ps2.h @@ -78,7 +78,7 @@ struct I8042 : public Node { Res<> flush(); - /* --- Data and Status --- */ + // MARK: Data and Status Res> readStatus(); @@ -92,7 +92,7 @@ struct I8042 : public Node { Res<> writeCmd(Cmd cmd); - /* --- Configs --- */ + // MARK: Configs Res<> writeConfig(Flags cfg); diff --git a/src/web/web-dom/node.h b/src/web/web-dom/node.h index baf5ea2346..cf43201a87 100644 --- a/src/web/web-dom/node.h +++ b/src/web/web-dom/node.h @@ -47,7 +47,7 @@ struct Node : virtual NodeType nodeType() const = 0; - /* --- Parent --- */ + // MARK: Parent Node &parentNode() { if (not _parent) @@ -66,7 +66,7 @@ struct Node : } } - /* --- Children --- */ + // MARK: Children bool hasChildren() { return _children.len() > 0; @@ -96,7 +96,7 @@ struct Node : child->_detachParent(); } - /* --- Siblings --- */ + // MARK: Siblings Strong previousSibling() { usize index = _parentIndex(); @@ -127,7 +127,7 @@ struct Node : e(")\n"); } - /* --- Operators --- */ + // MARK: Operators bool operator==(Node const &other) const { return this == &other;