Commit Graph

33279 Commits

Author SHA1 Message Date
svenbarth
3b4eae7d23 Updated some test cases (especially with OK statements to see the results when they are run by themselves).
git-svn-id: branches/svenbarth/classhelpers@16795 -
2011-01-19 19:54:57 +00:00
svenbarth
dde7290439 compiler/symtable.pas:
Add function to search for class helper symbols. This is completely different from the ObjC one (Note to self: rename that function), because in Delphi only one class helper can be in scope at a given time. Also class helper symbols are searched BEFORE the symbols of the class.

So the search works like this:
1) search the last available class helper for the given class 
2) search for the given symbol (method/property) in the found class helper (if any)
3) if not found then use the helper parent of the class helper and continue with (2)

Especially step 1 might easily lead to longer compile times if no class helper for a class is in scope, but many units are included. I'll need to test this by cycling the compiler with and without that search and will then decided whether I should think about something better.

Note: Overloaded methods are not yet supported.

git-svn-id: branches/svenbarth/classhelpers@16794 -
2011-01-19 19:53:32 +00:00
svenbarth
433851ab36 - compiler/pdecsub.pas:
* added flag pd_nothelper which tells the "directive parser" not to use this directive with class helpers
* added pd_nothelper flag to definitely forbidden directive (I'm not so happy about "abstract" though, as the error message because of this isn't very descriptive, because abstract is treated as field)
* some directives that are useless in class helpers are forbidden in mode ObjFPC only (e.g. "message", "virtual", "override")
- compiler/pdecobj.pas: as class helpers don't support some concepts used in normal classes (e.g. virtual methods) they are simply ignored and thus the corresponding flags are removed (this is for mode Delphi)

git-svn-id: branches/svenbarth/classhelpers@16793 -
2011-01-19 19:46:35 +00:00
svenbarth
d4be11cb42 Implement advanced class helper syntax which allows "inheritance" of class helpers. This is not the same as normal class inheritance as its only used to extend the scope to other class helpers (that pseudo heritage line) when searching for a symbol. The real parent is always the extended class.
- compiler/symdef.pas: add "helperparent" which contains the class helper the current class helper "inherits" from (its real parent is the extended class); it's saved to ppu as well
- compiler/ppu.pas: increase ppu version
- compiler/pdecobj.pas: 
* parse the "parent" of a class helper before parsing the extended class (the real parent)
* also disallow to inherit from class helpers for normal class (and to extend class helpers for class helpers)
* disallow the declarations of fields
* disallow the use of destructors
* don't parse abstract/sealed for class helpers
- compiler/ptyp.pas: _FOR is now parsed inside pdecobj.pas
- compiler/msg*: 
* extended some messages for class helpers
* added some class helper related messages (perhaps the one or other will vanish again...)

git-svn-id: branches/svenbarth/classhelpers@16792 -
2011-01-19 19:39:47 +00:00
svenbarth
a9b64c80ad Rebase to revision 16728
git-svn-id: branches/svenbarth/classhelpers@16732 -
2011-01-07 23:06:09 +00:00
svenbarth
9b05909944 I don't know why, but the tests 3-34 weren't commited the first time although I selected all of them
git-svn-id: branches/svenbarth/classhelpers@16731 -
2011-01-07 22:02:01 +00:00
svenbarth
18ed600cbe Added 36 tests (tchlp*.pp) and some units (uchlp*).
git-svn-id: branches/svenbarth/classhelpers@16730 -
2011-01-07 21:56:35 +00:00
svenbarth
aed9f0a5f7 Added first version of class helper support (not fully working and not fully featured)
- tokens: added support for "helper" token
- symconst.tobjecttyp: added a new entry "odt_classhelper"
- symdef: added two functions to check whether a "tdef" instance is a class helper in general ("is_classhelper") or an Object Pascal class helper in particular ("is_objectpascal_classhelper")
- symdef.tobjectdef: added a new method "finish_classhelper" which calls "create_class_helper_for_procdef" for every method (maybe this can be used for Objective-C categories as well)
- symdef.tobjectdef.create: "ImplementedInterfaces" must be created for class helpers as well
- symtable.searchsym_in_class: class helper methods must be searched for Object Pascal classes as well (this is currently wrong, as those must be searched before the class symbols, but for a first test it's sufficient)
- ptype.read_named_type: "helper for" currently indicates a class helper ("for" should be checked inside "object_dec" though, as after "helper" there might be a parent class helper)
- pdecobj.parse_parent_classes: parse the name of the extended class and disable sealed check for those
- pdecobj.object_dec: "odt_classhelper" are changed to "odt_class" and "oo_is_classhelper" is added to the object options
- pdecl.types_dec: create class helper symbols by using "finish_classhelper"

git-svn-id: branches/svenbarth/classhelpers@16729 -
2011-01-07 21:38:56 +00:00
Jonas Maebe
b49b3ecc61 * one more fix that should have been part of r16717: also generate
addr_pic_no_got references for linux in a_loadaddr_ref_reg()

git-svn-id: trunk@16728 -
2011-01-07 19:17:47 +00:00
paul
4e93ecda3d utils: fix ppudump generic tokenbuf reading
git-svn-id: trunk@16727 -
2011-01-07 17:47:23 +00:00
paul
f5965a9ce4 compiler: specialize record methods the same way as currently done for object and class methods + test
git-svn-id: trunk@16726 -
2011-01-07 16:57:21 +00:00
marco
24813219da * update of openbsd sysnr by Jasper Lievisse Adriaanse
git-svn-id: trunk@16725 -
2011-01-07 14:13:16 +00:00
paul
e0e01899e5 compiler: move parse_generic_parameters to the interface of pdecl unit, move insert_generic_parameter_types to pdecl unit to access them from pdecsub (preparations for generic methods implementation)
git-svn-id: trunk@16724 -
2011-01-06 17:53:46 +00:00
paul
31de2aab1b compiler: change parse_proc_head pd argument access type from var to out
git-svn-id: trunk@16723 -
2011-01-06 17:14:09 +00:00
joost
d97d2490c8 * Fixed the order in which the httpd-units are searched for (bug 18405)
git-svn-id: trunk@16722 -
2011-01-06 14:42:57 +00:00
paul
2599cc63bd compiler: implement generic procedural types
- store type parameter in parasymtable, push it to the symtablestack before parsing arguments and return type
  - move procedure/function declaration parsing to procvar_dec subroutine
  - don't skip parasymtable while searching types because they store type parameters now
  - add TParaSymTable.ReadOnly field to prevent adding defs into symtable. Add defs to the parent symtable in this case (we are adding this symtable to stack to read type parameters only, add defs should go to parent in this case as it was before)

git-svn-id: trunk@16719 -
2011-01-06 11:53:51 +00:00
paul
fab44804d2 test: forgotten { %fail } directive
git-svn-id: trunk@16718 -
2011-01-06 09:32:15 +00:00
Jonas Maebe
0da9d36116 * fixed internal assembler for x86-64 so that it correctly handles
relocations for addr_pic_no_got references (do not go via the GOT)
  * fixed code generator so that it generates addr_pic_no_got references
    also for platforms that use the internal assembler (this will break linking
    of some tests that check static data > 2GB on Linux/x86-64, but they were
    already broken before as well because we don't use the "huge" x86-64
    execution model)
  * fixed x86-64 Linux syscall code to not expect GOT-based relocations for
    the system unit's errno variable (it's an implementation-only variable)

git-svn-id: trunk@16717 -
2011-01-06 09:28:25 +00:00
michael
bd7b4840b0 * Forgot to add fpjsonrtti to makefile
git-svn-id: trunk@16716 -
2011-01-06 08:31:00 +00:00
Tomas Hajny
b8062957b9 * fix check for necessity of LIBPATH changes
git-svn-id: trunk@16714 -
2011-01-05 23:05:03 +00:00
michael
6898dcee66 * Example for streaming
git-svn-id: trunk@16713 -
2011-01-05 22:54:45 +00:00
michael
8390a18298 * Support for RTTI streaming
git-svn-id: trunk@16712 -
2011-01-05 22:49:00 +00:00
michael
853a1eb31c * Added support for project file
git-svn-id: trunk@16711 -
2011-01-05 22:19:53 +00:00
paul
749075a851 compiler: ignore case when check type parameters for identity
git-svn-id: trunk@16710 -
2011-01-05 18:27:05 +00:00
paul
0d6b62d293 compiler: allow generic inline specialization for delphi mode (like TFoo<Integer>.Create)
git-svn-id: trunk@16709 -
2011-01-05 18:12:44 +00:00
paul
d55a141d70 compiler: allow generics as class parents + fixed test
git-svn-id: trunk@16708 -
2011-01-05 05:03:21 +00:00
paul
bd64575add compiler: require generic name with type parameters for the method class prefix (like TGenericClass<T>.MethodName instead of TGenericClass.MethodName) in delphi mode
git-svn-id: trunk@16707 -
2011-01-05 04:35:56 +00:00
paul
fa41b6ffe3 compiler: allow generic classes to derive from generic classes and generic interfaces
- change id_type to single_type in readImplementedInterfacesAndProtocols to allow use of interface specializations inside class parent block
  - change single_type boolean arguments to set, add stoParseClassParent option to that set
  - move parse_generic variable assignment from parse_object_members to outer routine to setup it before parsing class parents
  - return paticular generic in generate_specialization instead of undefineddef to pass class/interface checks inside parent class block
  - add test for delphi mode
  - modify tw11431 to be syntatically correct

git-svn-id: trunk@16706 -
2011-01-04 18:20:40 +00:00
paul
4cfcc7ae7b compiler: implement delphi generic syntax for delphi mode
git-svn-id: trunk@16705 -
2011-01-04 11:06:29 +00:00
marco
a7c1e0f134 * ptypes updates from Jasper Lievens.
git-svn-id: trunk@16704 -
2011-01-04 09:33:55 +00:00
marco
ab744932b2 * errnostr by Jasper Lievens.
git-svn-id: trunk@16703 -
2011-01-04 09:14:03 +00:00
marco
56ca6b2db3 * small fix from Jasper Lievens.
git-svn-id: trunk@16702 -
2011-01-04 08:31:39 +00:00
Tomas Hajny
d2262b1a41 * avoid warning during compilation
git-svn-id: trunk@16701 -
2011-01-03 23:21:15 +00:00
Tomas Hajny
f0084393de + support for passing of options via environment variable added
git-svn-id: trunk@16700 -
2011-01-03 23:19:43 +00:00
Tomas Hajny
c12b695eb2 * added comment about planned support for passing of options via environment variable
git-svn-id: trunk@16699 -
2011-01-03 22:41:01 +00:00
Tomas Hajny
cbf2e4fc96 + rmwait building now included for os2, emx, go32v2 and windows targets; it should work on Unix targets too but no support for handling of Unix permissions required for proper working of --force is implemented yet
git-svn-id: trunk@16698 -
2011-01-03 22:29:52 +00:00
Tomas Hajny
0449c62dff + proper Makefile for rmwait added
git-svn-id: trunk@16697 -
2011-01-03 22:24:41 +00:00
Tomas Hajny
c59fc868e6 + have fpmc built for os2 and emx targets too
git-svn-id: trunk@16696 -
2011-01-03 22:17:10 +00:00
Tomas Hajny
dc21a0d721 * old make versions require a separator after colon in rule definitions
git-svn-id: trunk@16695 -
2011-01-03 22:13:33 +00:00
paul
e69de6110b rtl: add mkOperatorOverload to TMethodKind enum
git-svn-id: trunk@16694 -
2011-01-03 16:10:36 +00:00
pierre
f4597459b5 * Correct keybrd2 => keyboard2
git-svn-id: trunk@16693 -
2011-01-03 13:31:27 +00:00
Jonas Maebe
6fe0084caa * fixed result of NSObject(Protocol).hash: cuint -> NSUInteger (fixes 64 bit
compilation of cocoain)

git-svn-id: trunk@16692 -
2011-01-03 12:14:12 +00:00
Tomas Hajny
f5d9ab3038 * fixes for OS/2 threading support by Stefan Zigulec
git-svn-id: trunk@16691 -
2011-01-02 23:08:15 +00:00
marco
efabb72e71 * grapviz output for fpclasschart, mantis 18201
git-svn-id: trunk@16690 -
2011-01-02 21:09:30 +00:00
Jonas Maebe
5fc94a5076 * don't look for helper executables (assembler, linker, resource compiler,
wpo helpers) in the current directory

git-svn-id: trunk@16689 -
2011-01-02 20:25:41 +00:00
paul
dd921ffc9d utils: fix ppudump:
- show array symtable
  - support unicodestring
  - don't read "Last VTable idx" field in case of interface - this entry is not stored in ppu

git-svn-id: trunk@16688 -
2011-01-02 19:08:35 +00:00
marco
e896d94650 * fix for 18366, maximum_processors for 64-bit
git-svn-id: trunk@16687 -
2011-01-02 18:50:29 +00:00
paul
7c33505916 compiler: don't create enum defs for specializations declarations. Enums are stored in the unit symtables and generic declarations already add them there. Therefore specializations should search for enum defs declared by generics and use them instead of own.
git-svn-id: trunk@16686 -
2011-01-02 17:41:51 +00:00
Jonas Maebe
360d102ea4 * fixed some comments after r16684
git-svn-id: trunk@16685 -
2011-01-02 15:31:41 +00:00
Jonas Maebe
3ca3276400 * changed syntax of external objcclasses (see wiki/FPC_PasCocoa). Another
change is that it is now also allowed to specify an external name for
    formal external class definitions, but if they are later mixed with
    regular class definitions the external names have to match.
   o because the "external" status of methods is now set while parsing the
     class rather than afterwards, some procdir compatibility checks had to
     be inlined because they only have to be performed for 
  * also adapted the syntax for external cppclasses in the same way
  * fixed return type of NSObject.retainCount and NSObject.hash
    (NSUInteger instead of cint)
  * moved "patches" directory from cocoaint/src to cocoaint/utils/cocoa-skel
    so they are used by the conversion script when re-parsing the headers
  * updated Objective-C header parser script to
   o use the new external class syntax
   o not write inheritance information for root classes (NSObject, NSProxy)
   o use internal translation tables for some conflicting method names that
    are named specially in objcbase.pp
   and updated parsed headers
  * fixed rtl/inc/objcbase.pp and tests to conform to the new external class
    syntax

git-svn-id: trunk@16684 -
2011-01-02 14:50:46 +00:00