Conversation
- CHANGELOG.md: 新增 3 条修复记录 - stream.h: 非阻塞 socket EAGAIN/EWOULDBLOCK/EINTR 处理 (accept/recvfrom/sendto 返回错误值不抛异常) - try.h: 未捕获异常 use-after-free 崩溃 (消息提取到 malloc 缓冲区再清理) - CodeGenerator: 数组对象属性访问 getter 类型推断 (void* 使用 object getter) - FUNCTIONS.md: 更新 stream_socket_recvfrom/sendto 描述,补充非阻塞 EAGAIN 行为 - 新增测试: test/stream/stream_nonblock_eagain.php
- try.h: tp_throw/tp_throw_ex 未捕获路径调整为先 tphp_rt_free_all (析构 stdout) 后打印 stderr, 避免析构输出在 Fatal error 之后导致 #debug 行号错位 (error_test.php 回归) - stream.h: stream_socket_accept 开头检查 server_fd<0 抛异常, 避免 FD_SET 对负 fd 未定义行为导致 POSIX select 返回 0 不报错 (stream_nonblock_eagain.php test 4) - uncaught_exception_msg.php: 删除描述性 #debug 行 (process should exit with code 1...) 本地 TCC Windows x86_64 三测试全部 PASS
新增 ext/ui 扩展:基于 sokol C 库的跨平台图形界面,纯 phpc 模式。 - 9 个 PHP 类 + 9 个枚举:App/Window/Event/Color/Rect/Graphics/Widget/Button/Label/TextBox/CheckBox/Slider/Stack/CanvasLayout/SoftInput - 平台后端:Windows/Linux=OpenGL 3.3 Core,macOS=Metal - 异常处理契约(杜绝静默崩溃):自定义 _ui_slog_func 替代 abort(),三个 sokol 回调包裹 TP_TRY/TP_CATCH_ANY,sapp_run 异常包裹,pass_active 自动收尾 - 参数校验:width/height/cursor/event 指针等均抛异常而非静默处理 - CodeGenerator 优化支持 C-> 调用模式 - 测试:4 个集成测试(@Skip 需图形环境)+ 单元测试
- ui.h: 预探测 GPU 可用性,无 GPU 时直接走 CPU 后端;sapp_run panic 时用 EnumWindows 销毁所有 SOKOLAPP 孤儿窗口,解决 WGL 失败导致的两个窗口问题 - ui_widget.php: Slider 拖动改浮点除法修复中点返回 0;TextBox Backspace/Delete 处理 TinyPHP substr length=0 表示到末尾的行为差异 - CodeGenerator.php: 字符串局部变量重赋值引入临时变量先求值再释放旧值,修复自赋值 use-after-free
- Linux: 安装 libgl1-mesa-dev/libx11-dev/libxi-dev/libxcursor-dev 提供 GL/gl.h - macOS+tcc: 标记 @Skip:darwin+tcc, TCC 不支持 -framework 链接选项(gcc/clang 正常)
BOOL/CALLBACK/HWND/LPARAM/GetClassNameW/wcscmp 均为 Windows 专有,非 Windows 平台编译报错
- CodeGenerator: visitReturnStmt 添加子类→父类 upcast,与参数 upcast 对称。修复 gcc -Wincompatible-pointer-types 报错(如 Layout::asWidget(): Widget { return \$this; } 生成 (Widget*)this)
- tphp.php: macOS+clang/gcc 编译含 sokol_app.h 的代码时添加 -x objective-c,sokol_app.h #import <AppKit/AppKit.h> 需要 ObjC 编译模式
生成的 .c 文件只 #include ui.h,不直接包含 sokol_app.h,原 strpos 检测失败。改为检测 ui.h 或 extraFlags 中的 ui/sokol 路径
- ui.h: Windows+clang 包含 <sal.h> 解决 UCRT 头 SAL 注解未定义(_In_opt_z_/_Check_return_ 等) - ui.h: macOS 包含 sokol 头前 #undef null,包含后恢复 #define null,解决 ObjC +null 方法声明被宏破坏 - tphp.php: macOS+clang/gcc 添加 -x objective-c 编译模式(检测 extraFlags 含 ui/sokol 路径) - 15 个 UI 测试回退为 @Skip:darwin+tcc(仅 TCC 跳过,clang/gcc 正常运行)
ObjC 编译模式下 AppKit→netinet/ip.h 的 BSD 类型 u_int/u_char/u_short 定义链断裂,显式包含 <sys/types.h> 补全
ObjC 模式下 <sys/types.h> 的 BSD 类型被 _POSIX_C_SOURCE guard 排除,直接 typedef 定义缺失类型,避免依赖系统头不确定行为
CAMetalLayer 和 kCAFilterNearest 在 QuartzCore 框架中,sokol Metal 后端依赖
- 新增 test/ui/ui_full_integration.php:单窗口集成验证 Button/Label/ TextBox/CheckBox/Slider/Stack::row 的渲染、事件处理和布局系统 - 绕过 TinyPHP 静态分派限制:onEvent 中直接调用类型化控件变量方法, 不通过 WidgetContainer::dispatch*(数组元素方法调用会走基类空实现) - 修复 Slider::draw() 手柄位置不变:int / int 生成整数除法导致 ratio 恒为 0,改为 (float) 强制浮点除法,与 updateValueFromX 逻辑一致
- test.yml: 非 tcc 时把 C:/msys64/mingw64/bin 前置 PATH,确保 clang/gcc 解析到 MSYS2 MinGW 版(gnu target),而非 runner 预装的 MSVC-target LLVM 版。 后者会拉取 MSVC UCRT 头(corecrt.h),导致 sokol 的 SAL 注解未定义而编译失败。 - sal.h: TCC 走 SAL 空定义分支; clang/gcc 用 #include_next 穿透到系统 真实 sal.h(MinGW 自带完整定义),避免不完整垫片遮蔽系统头。 - .gitignore: 忽略 .workbuddy 工作目录。 项目不支持 MSVC,移除此前错误的 -fms-compatibility 兼容方向。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.