Merge: objcwrapper: wrapper generator to access Objective-C services from Nit
authorJean Privat <jean@pryen.org>
Fri, 21 Aug 2015 19:48:25 +0000 (15:48 -0400)
committerJean Privat <jean@pryen.org>
Fri, 21 Aug 2015 19:48:25 +0000 (15:48 -0400)
commitaeb87fda7bac878ef4ce25421d7b652340ae5992
treead8f7a18eab149ab88e0dea41ad28eb00d019d9e
parenta7621d37c40123612b0a70e2042fa6a54892727e
parent031983f6b64dc3759938d6dd0a1c528dd5bdd794
Merge: objcwrapper: wrapper generator to access Objective-C services from Nit

This PR introduces *objcwrapper*, a wrapper generator to access Objective-C services from Nit. At this point, *objcwrapper* can parse large Objective-C header files from Apple, and generate valid Nit code to wrap simple classes.

This PR contains the work of @Tagachi (as the first commit), some of my refactoring and new features. Because of this, there is some rewrite between commits. I chose to keep them as-is because it may be useful to debug regressions in the future. Actually, some of the refactoring remove a few features (such as super class declaration parsing), they will be brought back in future PRs.

This is a good base for future work but also a work in progress. Please restrain comments to structural and algorithmic problems, the doc and manual will be completed with the missing features.

Working features:
- [x] Generate a Nit extern class for each Objective-C `@interface` block.
- [x] Generate Nit extern methods to wrap Objective-C methods (`- `).
- [x] Generate getters for attributes `@property`.
- [x] Basic type conversion from Objective-C to Nit.
- [x] Partial detection of supported and unsupported types.

Todo features:
- [ ] Static functions (`+`) as top-level methods.
- [ ] Attribute setter (when not `readonly`).
- [ ] Intro and use an `ObjcType` instead of a `String`.
- [ ] Reproduce class hierarchy.
- [ ] Reuse wrapped classes (serialize the model alongside the wrapper).
- [ ] Deal with incompatible types: function pointers and others.
- [ ] Print a report on unsupported services.
- [ ] Support parsing GNUstep classes.
- [ ] Generate valid Nit code with Apple classes.
- [ ] Merge with *jwrapper*?

Pull-Request: #1647
Reviewed-by: Jean Privat <jean@pryen.org>
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>