将用 Ada 编写的 Windows/Mac 应用程序移植到 iOS
我拥有一个字典应用程序(接受文本作为输入,输出定义+语法分析)。我有所有用 Ada 编写的源文件(大约 50 页代码),以及 Windows 和 Unix 可执行文件。我希望能够在 iOS 应用程序中使用这本词典。
我对 Ada 一点也不熟悉,所以我的问题是,简而言之,是否有任何快捷方式可以以某种方式包装应用程序并在 iOS 上使用它?或者用 C/Objective-C 重写整个应用程序是唯一的方法吗?
I am in possession of a dictionary application (takes in text as input, outputs definitions + grammar analysis). I have all the source files (about 50 pages of code), written in Ada, as well as Windows and Unix executables. I want to be able to use this dictionary in an iOS app.
I'm not at all familiar with Ada, so my question is, in a nutshell—are there any shortcuts to somehow wrap the application and use it on iOS? Or is the only way just re-writing the entire application in C/Objective-C?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Shark8 提到了针对 JVM 的 Ada。 ACT 销售针对 JVM 的 Gnat 版本。但是,我不认为 iOS 设备当前运行 Java。苹果不想失去对平台的控制,所以他们不允许除了他们自己的基于 Objective C 的开发环境之外的任何开发环境。我知道 Java 人员正在努力解决这个问题,但即使他们这样做,苹果也可能会拒绝允许任何此类应用程序进入他们的在线商店。请注意,这并不是 Ada 独有的问题。任何使用 C 或 Objective C 以外的语言编写的应用程序在 iOS 上都存在同样的问题。 (这是开发人员倾向于选择 Android 平台而不是 iOS 的众多原因之一)。
所以你真正需要的是能让你的代码可以用 Apple 的 Objective C 编译器编译的东西。据说 Objective C 是 C 的严格超集。如果 Apple 的实现确实如此,那么输出可编译 C 源代码的 Ada 编译器应该可以为您完成这项工作。
幸运的是,有这样一个 Ada 编译器(或者至少曾经有)。 AdaMagic 曾一度将 C 作为“目标”。现在由 SofCheck 销售。当我几年前最后一次看到对其的讨论时,他们将其称为“服务”,就像编译器一样,因此它可能并不便宜。但如果您有真正的业务需求,那么它肯定比花费数年时间重写一个工作应用程序要便宜。
当然,你的另一个选择是说“去他妈的苹果和他们的法西斯操作系统”,然后转而选择 Android。遗憾的是,出于商业原因,这可能不可行。 :-(
更新 (2016/2012):SofCheck 的资产已可从 AdaCore 获取,因为这两家公司已于 2012 年初合并。
Shark8 mentioned JVM-targeted Ada. ACT sells a version of Gnat that targets the JVM. However, I do not believe iOS devices currently run Java. Apple does not want to lose control of the platform, so they do not allow any development environments other than their own, which is Objective C based. I understand the Java folks are working to fix this, but even if they do Apple will probably refuse to allow any such app into their online store. Note that this is not a problem unique to Ada. Any app written in any language other than C or Objective C has the same problem with iOS. (This is one of the many reasons why developers tend to prefer to target Android platforms than iOS).
So what you really need is something that can get your code compilable with Apple's Objective C compiler. Supposedly Objective C is a strict superset of C. If this is true for Apple's implementation, then an Ada compiler that outputs compilable C sources should do the job for you.
Fortunately, there is such an Ada compiler (or at least there used to be). AdaMagic at one point had C available as a "target". It is now sold by SofCheck. When last I saw a discussion of it years and years ago, they referred to it as a "service" as much as a compiler, so it may not be cheap. But if you have a real business need, it would certainly be cheaper than spending man-years rewriting a working app.
Your other option of course would be to say "Screw Apple and their facist OS", and shoot for Android instead. Sadly, for business reasons, that may not be feasible. :-(
Update (2016/2012): The assets of SofCheck have become available from AdaCore, as the two companies have merged in early 2012.
好吧,如果有一个针对 iOS 的 Ada 编译器——并且可能考虑到 GCC 有一个 Ada 前端——那么只要源不是编译器,重用这些包就应该是直接的——(对于不同的编译器)或特定于体系结构。
我将 Ada 移植到其他架构的最大经验是将我在本机上编译的一些代码移植到 JVM(有一个针对 JVM 的 Ada 编译器); “陷阱”更多的是 JVM 的区分大小写与 Ada 命名类和包时不区分大小写的相互作用。
Well, if there is an Ada compiler that targets iOS -- and there probably is considering that GCC has an Ada front-end -- then re-using the packages should be straight-forward so long as the source isn't compiler- (for a different compiler) or architecture-specific.
The most experience I have with porting Ada to other architectures was to port some code I had compiling to the native machine to the JVM (there's an Ada compiler which targets the JVM); the "gotchas" were more along the line of the JVM's case-sensitivity interacting with Ada's case insensitivity for naming classes and packages.