lang: rename signed integer types sN -> iN
Surface rename of the signed integer family: s1..s64 become i1..i64
(u1..u64, usize, isize unchanged). 'string' keeps the s-prefix arm in
name classification; width parsing moves to the i-prefix arm next to
isize.
Internal TypeId tags follow the surface (.s8/.s16/.s32/.s64 ->
.i8/.i16/.i32/.i64), as do mono-key mangle fragments (ptr_i64,
tu_i64_bool) and all display/diagnostic formatting (i{d}).
Migrated in the same sweep: stdlib + examples + issue repros + FFI C
companions (shared symbol names like ffi_id_i64), expected
stdout/stderr/ir snapshots, specs.md, readme.md, CLAUDE.md/AGENTS.md,
implementation_plan.md, docs/, issue writeups. Vendored stb_image and
historical flow state left untouched.
zig build test: 426/426; examples suite: 595/595.
This commit is contained in:
@@ -56,7 +56,7 @@ SurfaceView :: #foreign #jni_class("android/view/SurfaceView") {
|
||||
SurfaceHolderCallback :: #foreign #jni_class("android/view/SurfaceHolder$Callback") { }
|
||||
|
||||
MotionEvent :: #foreign #jni_class("android/view/MotionEvent") {
|
||||
getAction :: (self: *Self) -> s32;
|
||||
getAction :: (self: *Self) -> i32;
|
||||
getX :: (self: *Self) -> f32;
|
||||
getY :: (self: *Self) -> f32;
|
||||
}
|
||||
@@ -72,23 +72,23 @@ ActivityClass :: #foreign #jni_class("android/app/Activity") {
|
||||
// can route through `AAssetManager_open` when running on Android.
|
||||
sx_android_set_asset_manager :: (mgr: *void) #foreign;
|
||||
|
||||
__android_log_print :: (prio: s32, tag: *u8, fmt: *u8) -> s32 #foreign;
|
||||
usleep :: (us: u32) -> s32 #foreign;
|
||||
__android_log_print :: (prio: i32, tag: *u8, fmt: *u8) -> i32 #foreign;
|
||||
usleep :: (us: u32) -> i32 #foreign;
|
||||
|
||||
// libandroid
|
||||
ANativeWindow_fromSurface :: (env: *void, surface: *void) -> *void #foreign;
|
||||
ANativeWindow_release :: (window: *void) #foreign;
|
||||
ANativeWindow_getWidth :: (window: *void) -> s32 #foreign;
|
||||
ANativeWindow_getHeight :: (window: *void) -> s32 #foreign;
|
||||
ANativeWindow_setBuffersGeometry :: (w: *void, width: s32, height: s32, fmt: s32) -> s32 #foreign;
|
||||
ANativeWindow_getWidth :: (window: *void) -> i32 #foreign;
|
||||
ANativeWindow_getHeight :: (window: *void) -> i32 #foreign;
|
||||
ANativeWindow_setBuffersGeometry :: (w: *void, width: i32, height: i32, fmt: i32) -> i32 #foreign;
|
||||
|
||||
AAssetManager_fromJava :: (env: *void, mgr: *void) -> *void #foreign;
|
||||
|
||||
// pthread (link libpthread is built into bionic).
|
||||
pthread_create :: (thread: *u64, attr: *void, start: (*void) -> *void callconv(.c), arg: *void) -> s32 #foreign;
|
||||
pthread_mutex_init :: (m: *void, attr: *void) -> s32 #foreign;
|
||||
pthread_mutex_lock :: (m: *void) -> s32 #foreign;
|
||||
pthread_mutex_unlock :: (m: *void) -> s32 #foreign;
|
||||
pthread_create :: (thread: *u64, attr: *void, start: (*void) -> *void callconv(.c), arg: *void) -> i32 #foreign;
|
||||
pthread_mutex_init :: (m: *void, attr: *void) -> i32 #foreign;
|
||||
pthread_mutex_lock :: (m: *void) -> i32 #foreign;
|
||||
pthread_mutex_unlock :: (m: *void) -> i32 #foreign;
|
||||
|
||||
// EGL. Constants from <EGL/egl.h>. We bring up an ES3 context with a
|
||||
// 24-bit RGB framebuffer + 24-bit depth (same shape chess used under
|
||||
@@ -99,25 +99,25 @@ EGL_NO_CONTEXT :*void: null;
|
||||
EGL_NO_SURFACE :*void: null;
|
||||
EGL_TRUE :u32: 1;
|
||||
EGL_FALSE :u32: 0;
|
||||
EGL_NONE :s32: 0x3038;
|
||||
EGL_RED_SIZE :s32: 0x3024;
|
||||
EGL_GREEN_SIZE :s32: 0x3023;
|
||||
EGL_BLUE_SIZE :s32: 0x3022;
|
||||
EGL_ALPHA_SIZE :s32: 0x3021;
|
||||
EGL_DEPTH_SIZE :s32: 0x3025;
|
||||
EGL_RENDERABLE_TYPE :s32: 0x3040;
|
||||
EGL_SURFACE_TYPE :s32: 0x3033;
|
||||
EGL_OPENGL_ES3_BIT :s32: 0x00000040;
|
||||
EGL_WINDOW_BIT :s32: 0x0004;
|
||||
EGL_NATIVE_VISUAL_ID :s32: 0x302E;
|
||||
EGL_CONTEXT_CLIENT_VERSION :s32: 0x3098;
|
||||
EGL_NONE :i32: 0x3038;
|
||||
EGL_RED_SIZE :i32: 0x3024;
|
||||
EGL_GREEN_SIZE :i32: 0x3023;
|
||||
EGL_BLUE_SIZE :i32: 0x3022;
|
||||
EGL_ALPHA_SIZE :i32: 0x3021;
|
||||
EGL_DEPTH_SIZE :i32: 0x3025;
|
||||
EGL_RENDERABLE_TYPE :i32: 0x3040;
|
||||
EGL_SURFACE_TYPE :i32: 0x3033;
|
||||
EGL_OPENGL_ES3_BIT :i32: 0x00000040;
|
||||
EGL_WINDOW_BIT :i32: 0x0004;
|
||||
EGL_NATIVE_VISUAL_ID :i32: 0x302E;
|
||||
EGL_CONTEXT_CLIENT_VERSION :i32: 0x3098;
|
||||
|
||||
eglGetDisplay :: (id: u64) -> *void #foreign;
|
||||
eglInitialize :: (d: *void, major: *s32, minor: *s32) -> u32 #foreign;
|
||||
eglChooseConfig :: (d: *void, attrs: *s32, configs: **void, sz: s32, num: *s32) -> u32 #foreign;
|
||||
eglGetConfigAttrib :: (d: *void, cfg: *void, attr: s32, value: *s32) -> u32 #foreign;
|
||||
eglCreateContext :: (d: *void, cfg: *void, share: *void, attrs: *s32) -> *void #foreign;
|
||||
eglCreateWindowSurface :: (d: *void, cfg: *void, window: *void, attrs: *s32) -> *void #foreign;
|
||||
eglInitialize :: (d: *void, major: *i32, minor: *i32) -> u32 #foreign;
|
||||
eglChooseConfig :: (d: *void, attrs: *i32, configs: **void, sz: i32, num: *i32) -> u32 #foreign;
|
||||
eglGetConfigAttrib :: (d: *void, cfg: *void, attr: i32, value: *i32) -> u32 #foreign;
|
||||
eglCreateContext :: (d: *void, cfg: *void, share: *void, attrs: *i32) -> *void #foreign;
|
||||
eglCreateWindowSurface :: (d: *void, cfg: *void, window: *void, attrs: *i32) -> *void #foreign;
|
||||
eglMakeCurrent :: (d: *void, draw: *void, read: *void, ctx: *void) -> u32 #foreign;
|
||||
eglSwapBuffers :: (d: *void, surface: *void) -> u32 #foreign;
|
||||
eglDestroyContext :: (d: *void, ctx: *void) -> u32 #foreign;
|
||||
@@ -127,7 +127,7 @@ eglTerminate :: (d: *void) -> u32 #foreign;
|
||||
// ── Touch ring ──────────────────────────────────────────────────────────
|
||||
|
||||
TouchEvent :: struct {
|
||||
action: s32;
|
||||
action: i32;
|
||||
x: f32;
|
||||
y: f32;
|
||||
}
|
||||
@@ -136,10 +136,10 @@ TouchEvent :: struct {
|
||||
//
|
||||
// Every per-instance piece of state — EGL handles, ANativeWindow, render
|
||||
// thread, touch ring + mutex, frame closure, user main fn — lives here.
|
||||
// No module-level globals: a previous shape had `g_viewport_w : s32` at
|
||||
// No module-level globals: a previous shape had `g_viewport_w : i32` at
|
||||
// module scope, which silently shadowed chess's own
|
||||
// `g_viewport_w : f32` on `#import` and caused the renderer to receive
|
||||
// a logical width cast to s32 instead of the physical pixel width.
|
||||
// a logical width cast to i32 instead of the physical pixel width.
|
||||
//
|
||||
// `logical_w` is the consumer's design width in points (e.g. chess sets
|
||||
// 414 to match an iPhone 12 layout). `begin_frame` derives `dpi_scale`
|
||||
@@ -149,8 +149,8 @@ TouchEvent :: struct {
|
||||
|
||||
AndroidPlatform :: struct {
|
||||
title: [:0]u8 = "";
|
||||
width: s32 = 0;
|
||||
height: s32 = 0;
|
||||
width: i32 = 0;
|
||||
height: i32 = 0;
|
||||
|
||||
// Set by consumer code BEFORE `init` if a fixed design width is
|
||||
// wanted (chess uses 414). When 0, the platform reports
|
||||
@@ -168,8 +168,8 @@ AndroidPlatform :: struct {
|
||||
|
||||
// Pixel-size from ANativeWindow_get{Width,Height}; derived dpi_scale
|
||||
// (pixel_w / logical_w when logical_w > 0, else 1.0).
|
||||
pixel_w: s32 = 0;
|
||||
pixel_h: s32 = 0;
|
||||
pixel_w: i32 = 0;
|
||||
pixel_h: i32 = 0;
|
||||
dpi_scale: f32 = 1.0;
|
||||
|
||||
// Render thread lifecycle. `user_main_fn` is the consumer's `main`
|
||||
@@ -238,7 +238,7 @@ sx_android_detach_window :: (plat: *AndroidPlatform) {
|
||||
}
|
||||
}
|
||||
|
||||
sx_android_set_viewport :: (plat: *AndroidPlatform, w: s32, h: s32) {
|
||||
sx_android_set_viewport :: (plat: *AndroidPlatform, w: i32, h: i32) {
|
||||
plat.pixel_w = w;
|
||||
plat.pixel_h = h;
|
||||
sx_android_recompute_scale(plat);
|
||||
@@ -280,11 +280,11 @@ sx_android_egl_init :: (plat: *AndroidPlatform) -> bool {
|
||||
plat.egl_display = eglGetDisplay(EGL_DEFAULT_DISPLAY);
|
||||
if plat.egl_display == EGL_NO_DISPLAY { return false; }
|
||||
|
||||
major : s32 = 0;
|
||||
minor : s32 = 0;
|
||||
major : i32 = 0;
|
||||
minor : i32 = 0;
|
||||
if eglInitialize(plat.egl_display, @major, @minor) == EGL_FALSE { return false; }
|
||||
|
||||
cfg_attrs : [13]s32 = .{
|
||||
cfg_attrs : [13]i32 = .{
|
||||
EGL_RENDERABLE_TYPE, EGL_OPENGL_ES3_BIT,
|
||||
EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
|
||||
EGL_RED_SIZE, 8,
|
||||
@@ -293,15 +293,15 @@ sx_android_egl_init :: (plat: *AndroidPlatform) -> bool {
|
||||
EGL_DEPTH_SIZE, 24,
|
||||
EGL_NONE,
|
||||
};
|
||||
num_cfg : s32 = 0;
|
||||
num_cfg : i32 = 0;
|
||||
if eglChooseConfig(plat.egl_display, @cfg_attrs[0], @plat.egl_config, 1, @num_cfg) == EGL_FALSE { return false; }
|
||||
if num_cfg < 1 { return false; }
|
||||
|
||||
visual_id : s32 = 0;
|
||||
visual_id : i32 = 0;
|
||||
eglGetConfigAttrib(plat.egl_display, plat.egl_config, EGL_NATIVE_VISUAL_ID, @visual_id);
|
||||
ANativeWindow_setBuffersGeometry(plat.app_window, 0, 0, visual_id);
|
||||
|
||||
ctx_attrs : [3]s32 = .{ EGL_CONTEXT_CLIENT_VERSION, 3, EGL_NONE };
|
||||
ctx_attrs : [3]i32 = .{ EGL_CONTEXT_CLIENT_VERSION, 3, EGL_NONE };
|
||||
plat.egl_context = eglCreateContext(plat.egl_display, plat.egl_config, EGL_NO_CONTEXT, @ctx_attrs[0]);
|
||||
if plat.egl_context == EGL_NO_CONTEXT { return false; }
|
||||
|
||||
@@ -329,7 +329,7 @@ sx_android_recompute_scale :: (plat: *AndroidPlatform) {
|
||||
|
||||
// ── Touch event queue ───────────────────────────────────────────────────
|
||||
|
||||
sx_android_push_touch :: (plat: *AndroidPlatform, action: s32, x: f32, y: f32) {
|
||||
sx_android_push_touch :: (plat: *AndroidPlatform, action: i32, x: f32, y: f32) {
|
||||
sx_android_ensure_touch_mutex(plat);
|
||||
pthread_mutex_lock(xx @plat.touch_mutex_storage[0]);
|
||||
next := (plat.touch_tail + 1) % 64;
|
||||
@@ -373,7 +373,7 @@ sx_android_ensure_touch_mutex :: (plat: *AndroidPlatform) {
|
||||
// ── Platform impl ───────────────────────────────────────────────────────
|
||||
|
||||
impl Platform for AndroidPlatform {
|
||||
init :: (self: *AndroidPlatform, title: [:0]u8, w: s32, h: s32) -> bool {
|
||||
init :: (self: *AndroidPlatform, title: [:0]u8, w: i32, h: i32) -> bool {
|
||||
self.title = title;
|
||||
self.width = w;
|
||||
self.height = h;
|
||||
|
||||
Reference in New Issue
Block a user