Files
kryon/include/ui_app_shell_props.generated.h
T
waozi fcb1716054 Declare the app-shell route and layout ABI in a props module
include/app_shell.h is deleted. runtime/app_shell_props.kry declares
KryRouteAllowedFn as a one-line "#type", KryRouteList/KryRouteStack/
KryAppShellLayoutSpec/KryAppShellLayout as real structs (plain int records,
no Go or web namesakes), and the thirteen route/list/stack/layout calls as
"#extern #export" declarations. The module imports kryon_compat like its
siblings; a C import also marks a module C-referencing for strict checking,
which pointer-bearing records require.

Gates: generated-runtime-parity-test, fast-test, k2c/k2cpp/k2go-syntax-test,
go-runtime-test, examples-syntax-test, kryon-boundary-check, and the refreshed
public-API snapshot pass.
2026-09-21 02:47:12 -03:00

82 lines
2.7 KiB
C

/* Generated by k2c from runtime/app_shell_props.kry. */
#ifndef K_RUNTIME_APP_SHELL_PROPS_H
#define K_RUNTIME_APP_SHELL_PROPS_H
#include <stdint.h>
#include <stdbool.h>
#include "kry_bounds.h"
#ifndef KIR_STRING_VALUE_DEFINED
#define KIR_STRING_VALUE_DEFINED
#include <stddef.h>
#include <string.h>
/* Immutable borrowed UTF-8 bytes; length preserves embedded nulls. */
typedef struct String { const char *data; size_t length; } String;
static inline String StringView(const char *data, size_t length) {
String value = {data, length};
return value;
}
static inline bool StringEqual(String a, String b) {
return a.length == b.length && (a.length == 0 || memcmp(a.data, b.data, a.length) == 0);
}
#endif
#include "kryon_compat.generated.h"
typedef int (*KryRouteAllowedFn)(int route, void *user);
typedef struct KryRouteList {
int32_t* routes;
int32_t count;
int32_t capacity;
int32_t empty_route;
} KryRouteList;
typedef struct KryRouteStack {
int32_t* routes;
int32_t count;
int32_t capacity;
int32_t root_route;
} KryRouteStack;
typedef struct KryAppShellLayoutSpec {
int32_t view_width;
int32_t view_height;
int32_t safe_left;
int32_t safe_top;
int32_t safe_right;
int32_t safe_bottom;
int32_t padding;
int32_t nav_height;
int32_t sidebar_breakpoint;
int32_t sidebar_width;
int32_t min_content_width;
int32_t max_content_width;
} KryAppShellLayoutSpec;
typedef struct KryAppShellLayout {
int32_t compact;
int32_t sidebar_width;
int32_t content_x;
int32_t content_y;
int32_t content_width;
int32_t content_height;
int32_t nav_x;
int32_t nav_y;
int32_t nav_width;
int32_t nav_height;
} KryAppShellLayout;
int32_t KryRouteListContains(const int32_t* routes, int32_t count, int32_t route);
int32_t KryRouteAllowedInSet(int32_t route, const int32_t* allowed_routes, int32_t allowed_count);
int32_t KryRouteListSanitize(KryRouteList list, KryRouteAllowedFn allowed, void* user);
int32_t KryRouteListSanitizeSet(KryRouteList list, const int32_t* allowed_routes, int32_t allowed_count);
int32_t KryRouteListMove(KryRouteList list, int32_t from_index, int32_t to_index);
int32_t KryRouteListFirstUnused(const int32_t* routes, int32_t count, const int32_t* candidates, int32_t candidate_count, int32_t fallback);
void KryRouteStackInit(KryRouteStack* stack, int32_t* routes, int32_t capacity, int32_t root_route);
int32_t KryRouteStackCurrent(const KryRouteStack* stack);
int32_t KryRouteStackPush(KryRouteStack* stack, int32_t route);
int32_t KryRouteStackPop(KryRouteStack* stack);
void KryRouteStackReset(KryRouteStack* stack, int32_t root_route);
KryAppShellLayout KryAppShellMeasure(KryAppShellLayoutSpec spec);
#endif /* K_RUNTIME_APP_SHELL_PROPS_H */