Wiki copymirror

This is a mirror of the wiki at pascal.chat. Editing, history and sign-in are there.

iPhone headers translator

(iOS only)

Pascal iPhone header translator

Author

Anton e-mail: ast DOT a_s AT mail DOT ru

Introduction

Because no one can redistribute Pascal units for iOS SDK we need a tool that can produce such units from official C headers. Of course everyone can take original headers and manually translate them but it is not the simplest work. Indeed this process can be (at least partially) automated. I'd like to present iPhone headers translator that is written in FPC.

File structure

There are several files zip available fro download page:

Features (main goals of project)

Version review

Translation process was tested for the following SDKs:

iPhoneSimulator 3.0, 3.2, 4.0, 4.1, 4.2, 4.3, 5.0;

iPhoneOS 5.0.

Compilation of produced units was tested only for iPhoneSimulator 5.0.

Test project can be found on download page (ipt.zip contains Lazarus project, notes about its compilation can be found in next section).

Some frameworks (applicationservices, coreservices, accelerate, carbon) for now are translated to empty units because translation of "nested frameworks" is not implemented yet. Parsing process was tested for iPhoneSimulator 5.0 and iPhoneOS 5.0, compilation was tested only for simulator.

How to parse

To build parser "fpc parser" is enough. Of course you need to install iPhone SDK. Cause I have only simulator, I will use its SDK. Typically it is installed to /Developer/Platforms/iPhoneSimulator/Developer/SDKs/iPhoneSimulator5.0.sdk (for 5.0 version). The path to SDK will be used as a parameter of parser. Indeed, it's time to start it. Parser contains a little help, so it can be used (--help or without parameters).

Parser parameters:

  1. one of parameter must be sdk="path_to_sdk" (mandatory);
  2. there can be parameter dest="output_path" (to place Pascal units, if not specified "src" is used);
  3. all other parameters are regarded as names of frameworks to parse.

Example:

text
$ ./parser sdk=/Developer/Platforms/iPhoneSimulator/Developer/SDKs/iPhoneSimulator5.0.sdk UIKit

will translate UIKit and all dependant frameworks (cfnetwork, corefoundation, coregraphics, coreimage, corevideo, foundation, opengles, security). I've tested it for SDKs 3.0, 3.2, 4.0, 4.1, 4.2, 4.3, 5.0. Although now it works good there are some "todo's" and unimplemented parts.

ip_pars20120410.zip contains two scripts that can be used to start translation process:

  1. start_ios.sh for iPhoneOS 5.0 SDK;
  2. start_sim.sh for iPhoneSimulator 5.0 SDK.

Notes:

Testing

My test program is also attached (ipt.zip contains Lazarus project). Project output directory must be changed. In order to run it in Simulator I have created empty XCode project "iphone_test" and run it. After that I've closed XCode and run only simulator - it has contained my new program "iphone_test". After that I've simply replaced binary /Users/macuser/Library/Application Support/iPhone Simulator/5.0/Applications/C93F7A57-E612-4A40-B155-DB106CA860D6/iphone_test.app/iphone_test

Download

From here: http://sourceforge.net/projects/p-tools/files/iPhone%20headers%20translator/

https://github.com/odisey1245/ip_parse

See Also


From the Free Pascal wiki, page "iPhone headers translator", as it stood on 2015-03-07 after a change by Penilopa P, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's Licensing page. If you have concerns about this material, message the admin.

Revision 2, last changed by WikiArchive .