mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-05-02 18:13:50 +02:00

o blocks are implemented as a variation of procedure variables o declaration of a block variable: "test: procedure(c: char) is block;" (C equivalent: (void)(^test)(char c) ) o the compiler automatically converts procedures/functions whose address is passed to a block parameter or assigned to a block variable into a "block". This consists of 1) generating a block descriptor (containing the size of the "block literal" (see below) and the signature of the invocation function encoded as an Objective-C selector) 2) generating a wrapper function around the original funcion (with C calling convention), that has an extra first hidden parameter (marked as vo_is_parentfp in the compiler) whose type is a pointer to the describing "block literal" 3) generating the "block literal", which contains a pointer to an external variable indicating whether this block captures context or not, some flags (see compiler/blockutl.get_block_literal_flags for info), a pointer to the wrapper function and a pointer to the descriptor. In the future, it will also contain captured variables. o right now, only global procedures/functions can be converted to blocks (because they don't require state capturing). The next steps are (Object Pascal) methods (not Objective-C methods, because Objective-C method procvars don't exist) and finally nested functions o on Mac OS X, the functionality will only work on Mac OS X 10.7 and later, because we have to use the so-called "ABI.2010.3.16" to ensure that our blocks aren't called as variadic functions by the runtime (which came out after the Mac OS X 10.6 release) o while the currently implemented functionality does not require any library support at all, there's no use enabling it on other platforms because unless it has been confirmed to work with a blocks runtime, there's no point in using blocks (they're just somewhat bulky procvars right now). Enabling it on other platforms (in combination with the GNUStep Objective-C run time), should simply be a matter of adding the right {$linklib xxx} statement to rtl/inc/blockrtl.pp file, adding that file to Makefile.fpc for that platform and adding that platform to the compiler/systems.systems_blocks_supported set git-svn-id: branches/blocks@28232 -
84 lines
2.3 KiB
XML
84 lines
2.3 KiB
XML
<?xml version="1.0" encoding="UTF-8"?>
|
|
<CONFIG>
|
|
<ProjectOptions>
|
|
<Version Value="9"/>
|
|
<PathDelim Value="\"/>
|
|
<General>
|
|
<Flags>
|
|
<MainUnitHasUsesSectionForAllUnits Value="False"/>
|
|
<MainUnitHasCreateFormStatements Value="False"/>
|
|
<MainUnitHasTitleStatement Value="False"/>
|
|
<LRSInOutputDirectory Value="False"/>
|
|
</Flags>
|
|
<SessionStorage Value="InProjectDir"/>
|
|
<MainUnit Value="0"/>
|
|
<Title Value="ppc386"/>
|
|
</General>
|
|
<BuildModes Count="1">
|
|
<Item1 Name="default" Default="True"/>
|
|
</BuildModes>
|
|
<PublishOptions>
|
|
<Version Value="2"/>
|
|
<IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/>
|
|
<ExcludeFileFilter Value="*.(bak|ppu|ppw|o|so);*~;backup"/>
|
|
</PublishOptions>
|
|
<RunParams>
|
|
<local>
|
|
<FormatVersion Value="1"/>
|
|
</local>
|
|
</RunParams>
|
|
<Units Count="3">
|
|
<Unit0>
|
|
<Filename Value="pp.pas"/>
|
|
<IsPartOfProject Value="True"/>
|
|
<UnitName Value="pp"/>
|
|
</Unit0>
|
|
<Unit1>
|
|
<Filename Value="x86\symold86.pas"/>
|
|
<IsPartOfProject Value="True"/>
|
|
<UnitName Value="symold86"/>
|
|
</Unit1>
|
|
<Unit2>
|
|
<Filename Value="i8086\symcpu.pas"/>
|
|
<IsPartOfProject Value="True"/>
|
|
<UnitName Value="symcpu"/>
|
|
</Unit2>
|
|
</Units>
|
|
</ProjectOptions>
|
|
<CompilerOptions>
|
|
<Version Value="11"/>
|
|
<PathDelim Value="\"/>
|
|
<Target>
|
|
<Filename Value="i386\pp"/>
|
|
</Target>
|
|
<SearchPaths>
|
|
<IncludeFiles Value="i386"/>
|
|
<OtherUnitFiles Value="i386;x86;systems"/>
|
|
<UnitOutputDirectory Value="i386\lazbuild"/>
|
|
</SearchPaths>
|
|
<Parsing>
|
|
<SyntaxOptions>
|
|
<CStyleOperator Value="False"/>
|
|
<AllowLabel Value="False"/>
|
|
<CPPInline Value="False"/>
|
|
<UseAnsiStrings Value="False"/>
|
|
</SyntaxOptions>
|
|
</Parsing>
|
|
<Other>
|
|
<Verbosity>
|
|
<ShowWarn Value="False"/>
|
|
<ShowNotes Value="False"/>
|
|
<ShowHints Value="False"/>
|
|
</Verbosity>
|
|
<ConfigFile>
|
|
<StopAfterErrCount Value="50"/>
|
|
</ConfigFile>
|
|
<CompilerMessages>
|
|
<UseMsgFile Value="True"/>
|
|
</CompilerMessages>
|
|
<CustomOptions Value="-di386"/>
|
|
<CompilerPath Value="$(CompPath)"/>
|
|
</Other>
|
|
</CompilerOptions>
|
|
</CONFIG>
|