mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-07-28 19:06:02 +02:00

* re-enabled support for ignoring certain methods, but removed all ignored methods because all of them are handled correctly with the current version - disabled adding the script version and time stamp to the generated headers, so not all headers change every time they are re-parsed + support for optional/required sections in protocols + documentation from Ryan git-svn-id: trunk@16923 -
34 lines
3.8 KiB
Plaintext
34 lines
3.8 KiB
Plaintext
{\rtf1\ansi\ansicpg1252\cocoartf1038\cocoasubrtf350
|
|
{\fonttbl\f0\fnil\fcharset0 Verdana;}
|
|
{\colortbl;\red255\green255\blue255;}
|
|
\margl1440\margr1440\vieww10500\viewh9000\viewkind0
|
|
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural\pardirnatural
|
|
|
|
\f0\fs24 \cf0 1) Locate the .framework you want to parse and record the path for later use when building the command line.\
|
|
\
|
|
2) Add an entry to frameworks.xml (in the parser directory) with the appropriate tags for the framework. To make configuring the parser easier many options are specified here in XML instead of editing PHP variables.\
|
|
\
|
|
<root> tag is the relative path to the root include file (see step 4). The path is relative to the -root path (see step 5)\
|
|
<headers> tag is the path to the directory which contains the Objective-C headers (usually in /System/Library/Frameworks).\
|
|
<include_pattern> is a regular expression that captures the Pascal syntax of include files in the root .inc file. This is usually \{[$]+include (.*).inc\}.\
|
|
<header_pattern> is a regular expression that captures files in the header directory (defined in <headers>). This is usually ^(.*)\\.h.\
|
|
<ignore_lines> is a regular expression that causes to parser to ignore lines that present parsing errors you want to skip and edit by hand.\
|
|
<ignore_comments> is a regular expression that causes to parser to ignore comments. Note, if the comment is found inside a multi-line comment block it will break the entire block.\
|
|
<external_macro> In the frameworks the macro which defines NSString constants changes from framework to framework so you must specify it here or NSString constants will not get parsed. For example in UIKit.framework it is UIKIT_EXTERN and in QuartzCore.framework it is CA_EXTERN. AppKit and Foundation macros are defined internally as PHP variables so you do not need to specify them here.\
|
|
<ignore_types> and <ignore_methods> will cause the parser to ignore these types and methods when parsing. Separate multiple values by commas without spaces.\
|
|
<replace_types> causes the parser to replace types with a different name. For example: <type>CGFLOAT_DEFINED=__CGFLOAT_DEFINED</type> will replace all occurrences of CGFLOAT_DEFINED with __CGFLOAT_DEFINED.\
|
|
\
|
|
3) Make a framework directory in the root directory (see step 5 and -root).\
|
|
\
|
|
4) Make the root .inc file with all units which will be parsed and put it in the directory created in step 3.\
|
|
4a) Usually named a header with the same name as the framework for example, AppKit.h contains all the headers in the framework.\
|
|
4b) This step involves taking care to arrange the included units in the proper order. The order in the original "umbrella" header is usually pretty close but often requires some rearranging.\
|
|
\
|
|
5) Make the command line for the parser\
|
|
5a) Frameworks assigned in -frameworks and prefixed ^ will parse but not print.\
|
|
5b) The ^foundation framework is usually always included so extra class information is parsed for the other frameworks as they all use foundation classes occasionally. If you do not specify foundation then classes will be printed as pointers (NSStringPointer instead of NSString).\
|
|
\
|
|
The example below will parse the entire WebKit framework.\
|
|
php parser.php -objp -all -root="/Developer/ObjectivePascal" -frameworks="^foundation,webkit" \
|
|
\
|
|
6) Make the master unit file named after the framework, like AppKit.pas. This unit will include all the .inc files in the framework directory that was created in step 3. You can add extra code here if you like but normally it's enough to copy a template like AppKit.pas and change a few lines. For example, the $linkframework macro should be changed and possibly some interfaces added to the uses clause. Usually CocoaAll.pas will need to be added in order to get Foundation and AppKit functionality in supporting frameworks.} |