mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-29 06:23:43 +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 - |
||
---|---|---|
.. | ||
aix | ||
amiga | ||
android | ||
arm | ||
atari | ||
avr | ||
beos | ||
bsd | ||
charmaps | ||
darwin | ||
embedded | ||
emx | ||
freebsd | ||
gba | ||
go32v2 | ||
haiku | ||
i386 | ||
i8086 | ||
inc | ||
java | ||
jvm | ||
linux | ||
m68k | ||
macos | ||
mips | ||
mipsel | ||
morphos | ||
msdos | ||
nativent | ||
nds | ||
netbsd | ||
netware | ||
netwlibc | ||
objpas | ||
openbsd | ||
os2 | ||
palmos | ||
powerpc | ||
powerpc64 | ||
qnx | ||
solaris | ||
sparc | ||
symbian | ||
ucmaps | ||
unix | ||
watcom | ||
wii | ||
win | ||
win32 | ||
win64 | ||
wince | ||
x86_64 | ||
COPYING.FPC | ||
COPYING.txt | ||
fpmake.inc | ||
fpmake.pp | ||
Makefile | ||
Makefile.fpc | ||
README.txt |
This is the Run-Time Library (RTL) tree for Free Pascal. To recompile the RTL, edit the main makefile. The makefiles NEED a GNU make compatible make, they need unix-like 'rm' and 'mv' commands, as well as some others. You can find these in the gnuutils package on the ftp site. The main makefile is located ABOVE the RTL tree. It uses the FPC makefile.fpc to guess reasonable defaults for everything it needs. (these files can be found in base.zip on the FTP site) The only variable that you may want to set are FPC - What compiler to use. Use an absolute path. (default is ppc386) INSTALL_UNITDIR - Where to install the RTL units OPT - any special options you want to set for the compiler. In principle, you can also descend into the subdirectory of your OS, and type 'make' there, that should also compile everything. The tree contains subdirectories for all the supported operating systems, as well as all processor architectures. The processor directories contain low-level routines which are required for the system unit (if they are not available in high-level language form), as well as optimized versions of the pascal generic routines (the generic routine source code is localed in the inc subdirectory). The following directories are not supported officially and may not work correctly with FreePascal v1.0: go32v1 - The DJGPP go32v1 DOS extender (no longer supported) palmos - The PalmOS directory for the Dragonball (incomplete) Enjoy.