lang migration: rename signed integer types sN -> iN
Mechanical sweep of all .sx sources and plan docs (PLAN.md, current/, .agents/) for the sx language rename (s8/s16/s32/s64 -> i8/i16/i32/i64). Verified: make build + make test, 14/14.
This commit is contained in:
@@ -96,7 +96,7 @@ render_buf :: () -> string {
|
||||
// ── responses ─────────────────────────────────────────────────────────
|
||||
|
||||
// JSON error body in the CLI's error shape, sent with the HTTP status.
|
||||
respond_error :: (client: s32, code: s64, fail_code: string, fail_message: string) {
|
||||
respond_error :: (client: i32, code: i64, fail_code: string, fail_message: string) {
|
||||
f : jout.CliFailure = .{ code = fail_code, message = fail_message };
|
||||
raw : [4096]u8 = ---;
|
||||
werr := false;
|
||||
@@ -110,7 +110,7 @@ respond_error :: (client: s32, code: s64, fail_code: string, fail_message: strin
|
||||
|
||||
// Reload the persisted model. Null means the store has no readable
|
||||
// db.json — the 503 error response has already been sent.
|
||||
load_or_503 :: (client: s32, store_dir: string) -> ?Repo {
|
||||
load_or_503 :: (client: i32, store_dir: string) -> ?Repo {
|
||||
if !exists(path_join(store_dir, "db.json")) {
|
||||
respond_error(client, 503, "store.load",
|
||||
concat("no db.json under the store (nothing published yet): ", store_dir));
|
||||
@@ -126,7 +126,7 @@ load_or_503 :: (client: s32, store_dir: string) -> ?Repo {
|
||||
}
|
||||
|
||||
// `{"apps":[...]}` into `dst`, returning the bytes written.
|
||||
render_apps_json :: (repo: *Repo, dst: []u8) -> (s64, !JsonError) {
|
||||
render_apps_json :: (repo: *Repo, dst: []u8) -> (i64, !JsonError) {
|
||||
alloc := context.allocator;
|
||||
root : Object = .{};
|
||||
arr : Array = .{};
|
||||
@@ -142,7 +142,7 @@ render_apps_json :: (repo: *Repo, dst: []u8) -> (s64, !JsonError) {
|
||||
}
|
||||
|
||||
// `{"app":..,"releases":[..],"channels":[..]}` for `app` into `dst`.
|
||||
render_app_detail_json :: (repo: *Repo, app: App, dst: []u8) -> (s64, !JsonError) {
|
||||
render_app_detail_json :: (repo: *Repo, app: App, dst: []u8) -> (i64, !JsonError) {
|
||||
alloc := context.allocator;
|
||||
root : Object = .{};
|
||||
root.put("app", db.app_to_json(app, alloc), alloc);
|
||||
@@ -172,7 +172,7 @@ render_app_detail_json :: (repo: *Repo, app: App, dst: []u8) -> (s64, !JsonError
|
||||
|
||||
// Send `n` rendered bytes of `buf` as 200 JSON — or the overflow error
|
||||
// when the render didn't fit RENDER_CAP.
|
||||
respond_render :: (client: s32, buf: string, n: s64, overflowed: bool) {
|
||||
respond_render :: (client: i32, buf: string, n: i64, overflowed: bool) {
|
||||
if overflowed {
|
||||
respond_error(client, 500, "http.response_overflow",
|
||||
"response exceeded the server's render buffer");
|
||||
@@ -271,7 +271,7 @@ render_index :: (repo: *Repo) -> string {
|
||||
return concat(page, INDEX_FOOT);
|
||||
}
|
||||
|
||||
handle_index :: (client: s32, store_dir: string) {
|
||||
handle_index :: (client: i32, store_dir: string) {
|
||||
rq := load_or_503(client, store_dir);
|
||||
if rq == null { return; }
|
||||
repo := rq!;
|
||||
@@ -280,7 +280,7 @@ handle_index :: (client: s32, store_dir: string) {
|
||||
|
||||
// ── routes ────────────────────────────────────────────────────────────
|
||||
|
||||
handle_apps_index :: (client: s32, store_dir: string) {
|
||||
handle_apps_index :: (client: i32, store_dir: string) {
|
||||
rq := load_or_503(client, store_dir);
|
||||
if rq == null { return; }
|
||||
repo := rq!;
|
||||
@@ -291,7 +291,7 @@ handle_apps_index :: (client: s32, store_dir: string) {
|
||||
respond_render(client, buf, n, werr);
|
||||
}
|
||||
|
||||
handle_app_detail :: (client: s32, store_dir: string, slug: string) {
|
||||
handle_app_detail :: (client: i32, store_dir: string, slug: string) {
|
||||
rq := load_or_503(client, store_dir);
|
||||
if rq == null { return; }
|
||||
repo := rq!;
|
||||
@@ -309,7 +309,7 @@ handle_app_detail :: (client: s32, store_dir: string, slug: string) {
|
||||
respond_render(client, buf, n, werr);
|
||||
}
|
||||
|
||||
handle_download :: (client: s32, store_dir: string, sha: string) {
|
||||
handle_download :: (client: i32, store_dir: string, sha: string) {
|
||||
if !is_hex64(sha) {
|
||||
respond_error(client, 404, "download.bad_key",
|
||||
"download key must be a 64-char lowercase-hex sha256");
|
||||
@@ -327,7 +327,7 @@ handle_download :: (client: s32, store_dir: string, sha: string) {
|
||||
}
|
||||
|
||||
// Route one parsed request. GET only; the path decides the handler.
|
||||
route :: (client: s32, store_dir: string, method: string, path: string) -> s64 {
|
||||
route :: (client: i32, store_dir: string, method: string, path: string) -> i64 {
|
||||
if method != "GET" {
|
||||
respond_error(client, 405, "http.method_not_allowed",
|
||||
"every distd route is GET for now (writes go through the dist CLI)");
|
||||
@@ -362,7 +362,7 @@ route :: (client: s32, store_dir: string, method: string, path: string) -> s64 {
|
||||
|
||||
// Read one request off `client`, route it, log the result line. All
|
||||
// allocations land in the pushed per-request context allocator.
|
||||
serve_one :: (client: s32, store_dir: string) {
|
||||
serve_one :: (client: i32, store_dir: string) {
|
||||
buf : [8192]u8 = ---;
|
||||
n := sock.read(client, @buf[0], 8192);
|
||||
if n <= 0 { return; }
|
||||
@@ -383,7 +383,7 @@ serve_one :: (client: s32, store_dir: string) {
|
||||
// time — the deployment story is LAN/NAS-scale). Returns only when the
|
||||
// socket can't be opened. Per-request allocations live in an arena that
|
||||
// dies with the request.
|
||||
run_server :: (store_dir: string, port: s64) -> !ServeErr {
|
||||
run_server :: (store_dir: string, port: i64) -> !ServeErr {
|
||||
fd, fe := http.listen_on(port);
|
||||
if fe { raise error.Bind; }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user