Oc2mango
convert Objective-C to mango script:https://github.com/YPLiang19/Mango
Install / Use
/learn @SilverFruity/Oc2mangoREADME
项目介绍
1. oc2mango
将Objective-C转换为MangoFix脚本.
- 输入Objective-C源码文件夹,通过oc2mangoLib转换为AST,再将AST转换为mongo script.
使用示例
# 先在releases中下载最新的oc2mango.zip
# 解压文件夹
unzip ~/Downloads/oc2mango.zip -d ~/Downloads/
# 执行oc2mango
~/Downloads/oc2mango input_dir[包含Objective-C .h .m的文件夹] output_dir[.mg的输出文件夹]
# 例如: ~/Downloads/oc2mango ~/Desktop/InputOCFilesDir ~/Desktop/OuputMongoFilesDir
2. PatchGenerator
将Objective-C转换为OCRunner热更新补丁.
- 输入Objective-C文件集合或者文件夹,通过oc2mangoLib转换为AST,再使用ORPatchFile,将AST序列化为可被OCRunner执行的二进制补丁或JSON补丁,.
使用示例
- -files: Objective-C源文件列表或者文件夹
- -refs: 外部引用的文件列表或者是文件夹. 比如:OCRunnerDemo/Scripts.bundle中的UIKit、GCD Refrences. 主要包含一些结构体声明、枚举声明、typedef、系统函数声明.
- -output: 补丁文件最终保存的路径
# 1: -files: files
PatchGenerator -files ~/OCRunnerDemo/ViewController1 ~/OCRunnerDemo/ViewController2 ~/OCRunnerDemo/ViewController3 -refs ~/Scripts.bundle -output ~/OCRunnerDemo/binarypatch
PatchGenerator -files ~/OCRunnerDemo/ViewController1 -refs ~/Scripts.bundle -output ~/OCRunnerDemo/binarypatch
# 2: -files: dir
PatchGenerator -files ~/OCRunnerDemo/ViewController1/ -refs ~/Scripts.bundle -output ~/OCRunnerDemo/binarypatch
3. oc2mangoLib
- 将Objective-C源码,通过flex&bsion转换为语法树
4. ORPatchFile
- oc2mango、oc2mangoLib、OCRunner、PatchGenerator的基础库.
- 包含了所有的语法节点类,以及补丁文件的序列化与反序列化. (RunnerClasses、ORPatchFile).
- 包含两种补丁:二进制补丁和JSON形式的补丁.
- 其中二进制补丁,反序列化速度和文件大小皆是最优秀.
5. BinaryPatchCodeGenerator
- 输入RunnerClasses.h文件,然后生成BinaryPatchHelper.h,BinaryPatchHelper.m两个文件.
不支持
- 预编译相关
- 编译器内置函数以及属性__attribute__等
- a[x], {x,y,z}, a->x
- id a = ( identifier )object; 类型转换. 但支持id a = (identifier *)object;
除以上列表,其余语法皆已支持。有问题,欢迎提交issue。
Related Skills
node-connect
344.4kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
99.2kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
344.4kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
344.4kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
