Commit Graph

169 Commits

Author SHA1 Message Date
Jonas Maebe
dd94f5cf2b * no longer allow typed files of reference counted data (mantis #15447)
git-svn-id: trunk@14509 -
2010-01-01 14:56:33 +00:00
Jonas Maebe
f8754d8fab + Objective-C category support (old and new ABI, both external and
implemented in Pascal). See
    http://wiki.freepascal.org/FPC_PasCocoa#Category_declaration for syntax
    details

git-svn-id: trunk@14196 -
2009-11-16 00:12:08 +00:00
florian
5d01732128 * several fixes which improve the behaviour of nested generics, resolves #15077
git-svn-id: trunk@14176 -
2009-11-14 22:24:55 +00:00
Jonas Maebe
f238f7c74b + allow defining classrefdefs for objcclasses. Note, this happens using the
"class" keyword like for regular Object Pascal classes, not using the
    "objcclass" keyword. E.g.: NSObjectClass = class of NSObject;
  * modified tobjc18 to test this functionality

git-svn-id: branches/objc@13701 -
2009-09-12 16:46:41 +00:00
Jonas Maebe
a149674a75 Merged revisions 13458-13596 via svnmerge from
svn+ssh://jonas@svn.freepascal.org/FPC/svn/fpc/trunk

git-svn-id: branches/objc@13598 -
2009-08-25 19:47:36 +00:00
Jonas Maebe
3ed4734f85 * fixed position where error message is given about wrong "class of"
type definitions (was at the position of the invalid x type in
    "class of x", rather than at the position of the "class of x" definition
    itself)

git-svn-id: trunk@13555 -
2009-08-18 18:04:55 +00:00
Jonas Maebe
335e159c11 Merged revisions 13351-13373,13376-13457 via svnmerge from
svn+ssh://jonas@svn.freepascal.org/FPC/svn/fpc/trunk

git-svn-id: branches/objc@13458 -
2009-07-26 14:31:50 +00:00
Jonas Maebe
5a2ccfff52 --WARNING: start build process with FPC 2.2.4; won't work when
starting with a previous 2.3.1 or compiler built from the objc branch
  + added basic objcprotocol support (only for external protocols
    currently)
     o use in type declaration: "type xp = objcprotocol ... end;"
     o when defining a root class that implements it:
       "type yc = objcclass(xp) ... end" (note: no support yet
       for something like "objcclass(id,xp)" or so)
     o when defining a non-root class that implements a protocol:
       "type zc = objcclass(nsobject,xp) ... end"
     o includes support for "required" and "optional" sections
     o no support yet for the objcprotocol(<protocol>) expression
       that enables getting a class instance representing the
       protocol (e.g., for use with "conformsToProtocol:")
     o message names have to specified in protocol declarations,
       but if an objcclass implements a protocol, the message names do
       not have to be repeated (but if they are, they have to match;
       the same goes when overriding inherited methods)
  + allow specifying the external name of Objective-C classes and
    protocols, since classes and protocols can have the same name
    (and you cannot use the same Pascal identifier in such caseq)
  + added NSObject protocol, and make the NSObject class use it
  + added missing NSObject class methods that have the same name
    as instance methods (added "class" name prefix to avoid clashes)
  * fixed several cases where the compiler did not treat Objective-C
    classes/protocols the same as Object Pascal classes/interfaces
    (a.o., forward declarations, alignment, regvars, several type
     conversions, ...)
  * allow "override" directive in objcclass declarations, and print
    a hint if it's forgotten in an external declaration (because it
    doesn't really matter there, and may make automated header
    conversion harder than necessary) and an error if will be used in
    a non-external declaration (because it is not possible to start
    a new vmt entry-tree in Objective-C, you can only override parent
    methods)
  * reject objcclasses/protocols as parameters to typeof()
  * don't try to test VMT validity of objcclasses/protocols

git-svn-id: branches/objc@13375 -
2009-07-09 20:48:28 +00:00
Jonas Maebe
52c6f14de5 * do not allow local type definitions such as string[1] and "file of byte"
inside parameter lists and function results (fixes second problem
    reported in mantis #14104, see also
    http://wiki.freepascal.org/User_Changes_Trunk#Local_type_definitions_in_parameter_lists
    )

git-svn-id: trunk@13372 -
2009-07-08 20:21:37 +00:00
Jonas Maebe
a63d4e3ad0 * fixed indentation
git-svn-id: branches/objc@13169 -
2009-05-17 20:03:52 +00:00
Jonas Maebe
b1b9894ae3 * initial Objective-C 1.0 support:
o support for declaring external Objective-C classes (see
      rtl/inc/objcbase.pas), including derived classes
    o support for converting methods of objcclasses into selectors
      (see tests/test/tobjc1.pp)
    o support for loading from/storing to fields of objcclasses
    o support for calling Objective-C methods using regular
      Object Pascal syntax (see tests/test/tobjc1.pp)
    o some things that are known to be not yet working:
      o automatic conversion from ID to objcclasses and back
      o declaring and implementing new objcclasses/methods in Pascal code
      o debug information (objcclasses are currently plain pointers
        as far as the debugger knows)

git-svn-id: branches/objc@13162 -
2009-05-17 13:42:50 +00:00
peter
a3a66ba74d * split tvisibility from tsymoptions
* replace current_object_option with symtable.currentvisibility

git-svn-id: trunk@12048 -
2008-11-11 09:05:39 +00:00
peter
af437d5beb * refactor the forward type declaration handling, remove
global typecanbeforward and move 'class of ..' parsing
    to ptype

git-svn-id: trunk@12045 -
2008-11-09 22:07:36 +00:00
peter
b6dcffe79b * remove obsolete bt_specialize
git-svn-id: trunk@12031 -
2008-11-07 00:14:08 +00:00
peter
84112032c3 * rename aktobjectdef to current_objectdef
git-svn-id: trunk@12027 -
2008-11-06 19:46:31 +00:00
florian
d2214685c3 * fixes compiler crash with out of memory on illegal array declarations
git-svn-id: trunk@11505 -
2008-08-03 10:34:41 +00:00
yury
4cabbe0e39 * Fixed compiler cycling with enabled range and overflow checking.
git-svn-id: trunk@11489 -
2008-07-29 21:11:03 +00:00
peter
6c586e4eca * store specializations in globalsymtable for units, use localsymtable
for programs. this allows speciailizations to be done in the interface
    part of the unit
  * support tobject.typemember.typemember nesting for generics
  * fix generic parameter checking when a typemember was created with the
    type of a parameter
  * known issue is nested specializations don't work yet because the token
    replay can't handled nested replays yet

git-svn-id: trunk@11404 -
2008-07-18 23:30:44 +00:00
Jonas Maebe
f36e5411af * split cpu64bit compiler define into
a) cpu64bitaddr, which means that we are generating a compiler which
       will generate code for targets with a 64 bit address space/abi
    b) cpu64bitalu, which means that we are generating a compiler which
       will generate code for a cpu with support for 64 bit integer
       operations (possibly running in a 32 bit address space, depending
       on the cpu64bitaddr define)
   All cpus which had cpu64bit set now have both the above defines set,
   and none of the 32 bit cpus have cpu64bitalu set (and none will
   compile with it currently)
  + pint and puint types, similar to aint/aword (not pword because that
    that conflicts with pword=^word)
  * several changes from aint/aword to pint/pword
  * some changes of tcgsize2size[OS_INT] to sizeof(pint)

git-svn-id: trunk@10320 -
2008-02-13 20:44:00 +00:00
Jonas Maebe
8349cde7db * changed byte/word/longbool to be Delphi-compatible (+ similar changes
for qwordbool) + test:
    o assigning true to such a variable now sets them to $ff/$ffff/$ffffffff
    o these types are now all signed
    o converting an integer type to a byte/word/long/qwordbool using an
      explicit type cast keeps the integer's original value stored in the
      bool, instead of forcing it to ord(true)/ord(false)
    (mantis #10233 and #10613, implemented for all architectures, testsuite
     tested for ppc32, sparc and x86)
  * fixed some places where the rtl depended on longbool(true) having the
    value 1
  * extended several boolean tests (and adapted some to no longer assume
    that byte/word/long/qwordbool(true)=1)
  + support for converting to qwordbool in second_int_to_bool for x86, ppc
    and sparc

git-svn-id: trunk@9898 -
2008-01-24 21:30:55 +00:00
florian
2d91fef4f1 + accept system.string, resolves #10489
git-svn-id: trunk@9727 -
2008-01-12 22:25:33 +00:00
peter
1e123d66ba * improved generics
git-svn-id: trunk@8838 -
2007-10-18 00:24:05 +00:00
florian
7229dcfdcb * setup a proper symtable stack before parsing the generic declaration itself, resolves #9419
git-svn-id: trunk@8820 -
2007-10-15 19:43:01 +00:00
Jonas Maebe
0040eecf9f + support for extra packing of sets whose lower element number
is <> 0 (Delphi compatible now, + various tests)
  + support for enums and sets in is_in_limit()
  * fixed converting smallset expressions to varsets
  * improved choosing an appropriate common set type when mixing
    set types in an expression
  - removed no longer used normalset code from nadd.pas
  - disabled large set (>256 elements) support for now, because
    they are not yet supported entirely throughout the compiler
    and this causes errors at run time in several situations

git-svn-id: trunk@8515 -
2007-09-16 20:04:45 +00:00
Jonas Maebe
eddc507a13 * disallow widechar sets (Delphi 7 compatible, and were handled wrongly
by FPC previously)
  * tbs/tb0474 now fails -> renamed to tbf/tb0201 (+ new test tbf/tb0202)

git-svn-id: trunk@8284 -
2007-08-14 14:27:59 +00:00
florian
4b9669a081 * give proper error location if something is wrong with the type argument list, resolves #9112
git-svn-id: trunk@8122 -
2007-07-21 21:49:59 +00:00
florian
fa2a2b0bd0 * generics without specialization can't be used as a type, resolves #9225
git-svn-id: trunk@8116 -
2007-07-21 17:39:49 +00:00
daniel
9adb202a92 * Rework the constexprint to allow operations from low(int64) to high(qword).
+ Some initial work on a formaldef which also carries the typinfo of a parameter.

git-svn-id: trunk@7639 -
2007-06-13 07:41:18 +00:00
florian
301be02148 * forbid anonymous generic specializations
git-svn-id: trunk@6627 -
2007-02-24 10:06:53 +00:00
peter
91dbd27a42 * cleanup deleting of defs
git-svn-id: trunk@5902 -
2007-01-11 20:46:57 +00:00
florian
11aa2b483e * kicked ignore_equal, usage was wrong anyways
git-svn-id: trunk@5763 -
2006-12-31 00:48:52 +00:00
florian
c4d96ec538 * only non generic types can be used when specializing generics, fixes 7735
git-svn-id: trunk@5754 -
2006-12-30 21:51:24 +00:00
peter
9ae8e9fa21 * refactor tclassheader in tvmtbuilder and tvmtwriter
* fix rtti generation
  * rtti is now written at the end of a module when all info is available,
    this prevents some duplicate rtti entries cause by inheritance

git-svn-id: trunk@5363 -
2006-11-13 22:03:17 +00:00
florian
b0104f2ec8 * fixed parsing of spezialitions taking more than one argument
git-svn-id: trunk@5311 -
2006-11-10 18:33:08 +00:00
peter
84a96d66de * move rtti and vmt table generation into write_persistent_type_info
* call write_persistent_type_info also for typed consts in interface

git-svn-id: trunk@5239 -
2006-11-05 12:40:13 +00:00
peter
658c46b903 * remove tdictionary and tindexarray
* symtables based on TFPHashObjectList and TFPObjectList
  * rename torddef.typ to torddef.ordtype
  * rename tfloatdef.typ to tfloatdef.floattype
  * rename tdef.deftype to tdef.typ
  * remove obsolete browser code, browcol is kept so the ide
    can still be compiled

git-svn-id: trunk@5192 -
2006-11-03 00:30:30 +00:00
florian
bce905b106 * give correct error locations for errors when specializing templates
* removed more germanisms
* better dumping of tokenbuf in ppudump

git-svn-id: trunk@5101 -
2006-10-30 23:28:06 +00:00
florian
85d63d9fa9 * settings refactored
git-svn-id: trunk@5094 -
2006-10-30 18:02:58 +00:00
peter
3078a1927f * remove ttype
* rename old ttype variables *type to *def
  * rename resulttypepass to pass_typecheck
  * rename pass_2 to pass_generate_code

git-svn-id: trunk@5077 -
2006-10-29 22:19:39 +00:00
peter
71af18855e * remove sym from ttype, we can now reference any def in any unit directly
git-svn-id: trunk@5063 -
2006-10-29 16:32:07 +00:00
Jonas Maebe
3bb41dcf9a * fixed writing "packed" status of bitpacked records to ppu files.
Not sure how it ever worked, nor how exactly symtable ppu entries
    work -- but it's now stored with the recorddef (which also means
    that bitpacking is disabled currently for objects and classes,
    since they are based on tabstractrecorddef rather than trecorddef)

git-svn-id: trunk@4679 -
2006-09-21 20:39:36 +00:00
Jonas Maebe
2b3250aac0 * no support yet for packed records which need to be initialized
git-svn-id: trunk@4499 -
2006-08-24 10:02:19 +00:00
Jonas Maebe
1f42ee201b + support for bitpacked records, except for:
* rtti
    * typed constants

git-svn-id: trunk@4489 -
2006-08-23 15:44:13 +00:00
florian
9e66674ff9 + first part of qwordbool implementation
git-svn-id: trunk@4462 -
2006-08-19 23:16:17 +00:00
Jonas Maebe
eccbc78e04 + support for bitpacked arrays:
+ use {$bitpacking on/+} to change the meaning of "packed"
      into "bitpacked" for arrays. This is the default for MacPas.
      You can also define individual arrays as "bitpacked", but
      this is not encouraged since this keyword is not known by
      other compilers and therefore makes your code unportable.
    + pack(unpackedarray,index,packedarray) to pack
      length(packedarray) elements starting at
      unpackedarray[index] into packedarray.
    + unpack(packedarray,unpackedarray,index) to unpack
      packedarray into unpackedarray, with the first
      element being stored at unpackedarray[index]
  * todo:
    * "open packed arrays" and rtti for packed arrays are not
      yet supported
    * gdb does not properly support bitpacked arrays

git-svn-id: trunk@4449 -
2006-08-19 12:54:12 +00:00
Jonas Maebe
6fd4c50f0a * give proper error message when upper or lower bound of array type is out
of range (bounds error instead of "upper bound lower than lower bound")

git-svn-id: trunk@4383 -
2006-08-07 14:42:21 +00:00
Jonas Maebe
d75b19e484 * removed/conditionalised several unused variables
git-svn-id: trunk@4194 -
2006-07-14 19:44:54 +00:00
Jonas Maebe
a12f293781 * fixed wrong note about explictly valued enumeration types if the lower
bound is <= -1

git-svn-id: trunk@4182 -
2006-07-14 17:16:27 +00:00
florian
5ef2566381 + parse packed set, fixes #6735
git-svn-id: trunk@3578 -
2006-05-19 12:31:38 +00:00
florian
91434bd791 * fixed several dispinterface parsing related stuff
git-svn-id: trunk@3373 -
2006-04-29 21:39:21 +00:00