Commit Graph

33173 Commits

Author SHA1 Message Date
paul
726ea27bc0 compiler:
- add mode switch extendedrecords to allow/disallow extended records syntax, add this mode switch to delphi mode by default
  - disable/enable extended records parsing based on extendedreocrds mode switch

git-svn-id: branches/paul/extended_records@16561 -
2010-12-13 07:03:53 +00:00
paul
11d4eddf67 compiler: a trial to implement record constructor
- map self to constructor result
  - don't push vmt for records

At the moment generated assembler has errors although node tree is correct

git-svn-id: branches/paul/extended_records@16560 -
2010-12-13 06:39:29 +00:00
marco
aa93519b5a * fix for bug #18196, moving teventype broke examples.
git-svn-id: trunk@16559 -
2010-12-12 22:11:08 +00:00
sergei
13bea29253 * win/sysutils.pp, FileOpen and FileCreate, removed manual zero-termination of strings. This unit compiles in {$h+} state, and AnsiString zero-termination is handled automatically these days.
git-svn-id: trunk@16558 -
2010-12-12 15:07:38 +00:00
sergei
3c2d918cfe * Partially undo revision 16529: removing VariantToShortString breaks webtbs/tw14536 which calls the mentioned function directly instead of using typecast.
git-svn-id: trunk@16557 -
2010-12-11 23:25:20 +00:00
Jonas Maebe
29265ed672 * also compile freeglutdemo (mantis #18108)
git-svn-id: trunk@16556 -
2010-12-11 22:19:59 +00:00
florian
142e42bd81 o NativeNT target patch by Sven Barth, resolves with r16553 and r16554 #18195
* enables some disabled features for NativeNT in the compiler (all except stackcheck).

git-svn-id: trunk@16555 -
2010-12-11 20:41:37 +00:00
florian
3eec5d1b12 + added Makefile
git-svn-id: trunk@16554 -
2010-12-11 20:39:37 +00:00
florian
382dc3e413 o update by Sven Barth to the NativeNT RTL:
* Many more RTL units are enabled now, like SysUtils, Classes, Math, FGL, etc and Text-, File- and ConsoleIO features are enabled now as well (Threading and Processes are enabled, too, but their implementations are only stubs!). ConsoleIO isn't tested though, because the processes that are started by SMSS have their Standard Handles set to 0.

git-svn-id: trunk@16553 -
2010-12-11 20:39:05 +00:00
Jonas Maebe
a2e8134b7c * part of r16533, forgot to commit
* also fixes CharLengthPChar() for non-BeOS by initialising the mbstate
    parameter passed to mbrlen() to 0 (otherwise its contents are interpreted
    as already valid, containing information about the current shiftstate etc)

git-svn-id: trunk@16552 -
2010-12-11 18:08:16 +00:00
michael
2f5f98d7e5 * Patch from Darius Blaszijk to make some methods protected, virtual
git-svn-id: trunk@16551 -
2010-12-11 14:03:57 +00:00
paul
582ab2dd32 compiler: disallow regular class methods in records and allow only static class methods. delphi do so and it is logical because records have no inheritance. + tests
git-svn-id: branches/paul/extended_records@16550 -
2010-12-11 10:21:09 +00:00
sergei
179229007e * win/sysutils.pp: fix/clean up loading dll for SHGetFolderPath.
* Don't attempt to load shell32.dll, since every system with shell32.dll that exports SHGetFolderPath also has shfolder.dll present.
  * Load shfolder.dll using a full path in order to prevent loading of malicious code by placing a same-named dll into program directory (Mantis #18185).

git-svn-id: trunk@16549 -
2010-12-11 10:05:10 +00:00
paul
17815ce7a2 compiler: implement properties in records:
- rename property_dec from pdecobj to struct_property_dec because pdecl also has property_dec and move it to interface to use by records + allow properties for records
  - use struct_property_dec in record parser
  - change structh type from objectdef to abstractrecorddef in read_property_dec to use by records
  - disallow stored and default modifiers for records because records are not used for streaming
  - fix misuse of search_sym_in_class for records in few places

git-svn-id: branches/paul/extended_records@16548 -
2010-12-11 08:42:26 +00:00
paul
69d3bb2ffc compiler: rename aclass->astruct in read_property_dec because records will have properties too
git-svn-id: branches/paul/extended_records@16547 -
2010-12-11 08:08:22 +00:00
paul
4c7e2679df tests: add a test which checks that records destructors are not allowed
git-svn-id: branches/paul/extended_records@16546 -
2010-12-11 07:58:14 +00:00
paul
52cd624a76 compiler: fix static fields creation and access for records
+ extend test to check class constructor/destructor for records and static fields access

git-svn-id: branches/paul/extended_records@16545 -
2010-12-11 07:48:13 +00:00
paul
7852295f26 compiler: start parsing of record constructors and destructors:
- disallow record destructor
  - raise internal error for constructor because it is not yet implemented
  - handle class constructors and destructors for records
  - move find_procdef_bytype to tabstractpointerdef

git-svn-id: branches/paul/extended_records@16544 -
2010-12-11 07:31:27 +00:00
paul
4e73e280f9 compiler: move constructor, destructor parsers to interface section to allow future use by records + change current_objectdef to current_structdef for the same reason, make constructor return type = record for records
git-svn-id: branches/paul/extended_records@16543 -
2010-12-11 07:29:08 +00:00
paul
289c9bd192 compiler: remove unneeded checks and typecasting caused by move of objectoptions into tabstractrecorddef
git-svn-id: branches/paul/extended_records@16542 -
2010-12-11 07:00:46 +00:00
paul
4f274b157c compiler: move objectoptions to tabstractrecorddef because it will be needed for records too
git-svn-id: branches/paul/extended_records@16541 -
2010-12-11 06:48:08 +00:00
sergei
c5162a7816 * win/sysutils.pp: Use GetModuleHandle for dynamic loading of kernel32.dll instead of LoadLibrary, this is possible because kernel32 is statically linked by RTL and is therefore always loaded with application. Also makes FreeLibrary at finalization unnecessary.
- Removed checks for Windows version, they are redundant. GetProcAddress simply returns nil if the function is not present.

git-svn-id: trunk@16540 -
2010-12-11 04:47:33 +00:00
Jonas Maebe
8c9d0f1f78 * fixed Windows compilation after r16533
git-svn-id: trunk@16539 -
2010-12-10 17:27:25 +00:00
joost
6182f885f8 * Fixed detection of regular strings, so that a normal search is performed
* Strings with a braces, parentheses and pipe-symbols are always handled as regex-patterns

git-svn-id: trunk@16537 -
2010-12-10 15:40:33 +00:00
joost
af2ef60a29 * Avoid possible AV when the string-index is larger then the string-length
git-svn-id: trunk@16536 -
2010-12-10 15:32:34 +00:00
Jonas Maebe
deece746a3 + support for the freeglut extensions (patch by Michalis Kamburelis,
mantis #18108)

git-svn-id: trunk@16535 -
2010-12-10 15:29:19 +00:00
joost
e6e02a6176 * Refactored, replaced case for if, nested if for and, removed needless
comparision
 * Removed a Fillchar to clear the statetable, I don't see it's use

git-svn-id: trunk@16534 -
2010-12-10 15:27:32 +00:00
Jonas Maebe
f4c31ecf3c + widestringmanager.codepointlengthproc added, which can be used to
determine the length of a multi-byte character. The return values
    are defined to be the same as those of POSIX' mblen: -1 =
    invalid/incomplete sequence, 0 = #0, > 0 = length of sequence in
    bytes.
  + default implementation for widestringmanager.codepointlengthproc
    (assumes all code points have length 1) and Unix implementation
    (based on mb(r)len); Windows implementation is still required
  * replaced default implementation of
    widestringmanager.CharLengthPCharProc with strlen() of the input
    instead of an error (correct if all code points have length 1,
    still needs Windows implementation)
  + implemented fpc_text_read_{wide,unicode}str() and
    fpc_text_read_widechar() (mantis #18163); fpc_text_read_widechar()
    uses the new widestringmanager.codepointlengthproc()
  + unicodestring support for readstr/writestr
  * fixed declaration of fpc_Write_Text_UnicodeStr (unicodestring
    instead of widestring parameter)
  * extended test/twide*.pp tests to test the new/fixed functionality

git-svn-id: trunk@16533 -
2010-12-10 14:10:01 +00:00
Jonas Maebe
9410f7d5d3 - obsolete, removed (handled by regular script)
git-svn-id: trunk@16532 -
2010-12-10 10:13:55 +00:00
paul
4640d096c4 compiler: redo searchsym_type:
- remove complex condition which was used previosly to decide whether objectsymtable or recordsymtable requires a search for type or not - they require a search because contains types (although not all object types)
  - don't search only for typesym but for other symbols too - for example UnitSym.TypeSym or ConstSym..ConstSym are also valid types. Skip the next symtypes during the search because they can't be used in type declaration: fieldvarsym, paravarsym, propertysym, procsym, labelsym

git-svn-id: branches/paul/extended_records@16531 -
2010-12-10 09:12:44 +00:00
paul
b317139006 compiler: fix compilation problems caused by tprocdef._class -> tprocdef.struct rename which was found by make fullcycle
git-svn-id: branches/paul/extended_records@16530 -
2010-12-10 06:50:58 +00:00
sergei
ae7018cf85 variants, varutils: another portion of misc fixes:
* Handle Variant to ShortString conversions entirely in variants unit, removed VarUtils.VariantToShortString
+ support varUString in DoVarClearComplex
* fixed missing result assignment in TCustomVariantType.VarDataIsEmptyParam
* TCustomVariantType.UnaryOp and BinaryOp now 'implemented', they raise EVariantInvalidOp

git-svn-id: trunk@16529 -
2010-12-10 03:38:21 +00:00
sergei
ae028b1e1d * Intel assembler writer, don't truncate written values to 32 bits, as this code is also used for x86_64. Fixes Mantis #18020.
git-svn-id: trunk@16528 -
2010-12-10 01:51:57 +00:00
sergei
5bf51c991c * VarUtils, fixed missing support for interfaces
- NoInterfaces() not used anymore, removed
+ Basic test for VariantArray of IInterface

git-svn-id: trunk@16527 -
2010-12-09 16:38:55 +00:00
paul
56bf42de57 compiler: implement record methods and class methods:
- rename tprocdef._class to tprocdef.struct and change the type from tobjectdef to tabstractrecorddef because methods can belong not to classes only now but to records too
  - replace in many places use of current_objectdef to current_structdef with typcast where is needed
  - add an argument to comp_expr, expr, factor, sub_expr to notify that we are searching type only symbol to solve the problem with records,objects,classes which contains fields with the same name as previosly declared type (like:
  HWND = type Handle;
  rec = record 
    hWnd: HWND;
  end;)
  - disable check in factor_read_id which was made for object that only static fields can be accessed as TObjectType.FieldName outside the object because it makes SizeOf(TObjectType.FieldName) imposible and since the same method was extended to handle records it also breaks a52 package compilation
  - rename tcallcandidates.collect_overloads_in_class to tcallcandidates.collect_overloads_in_struct and addapt the code to handle overloads in records too
  - fix searchsym_type to search also in object ancestors if we found an object symtable
  - add pd_record, pd_notrecord flags to mark procedure modifies which can or can't be used with records. Disallow the next modifiers for records: abstract, dynamic, export, external, far, far16, final, forward, internconst, internproc, interrupt, message, near, override, public, reintroduce, virtual, weakexternal,
Allow the next modifiers for records: static

git-svn-id: branches/paul/extended_records@16526 -
2010-12-09 02:24:46 +00:00
sergei
4e3cedb492 * VariantInit is a procedure, not a function (according to both MSDN and Delphi docs).
git-svn-id: trunk@16525 -
2010-12-09 01:27:09 +00:00
sergei
ddfb032913 * VarUtils, fixed a wrong identifier
git-svn-id: trunk@16524 -
2010-12-08 23:42:39 +00:00
Jonas Maebe
3a089cea10 * give an error when trying to let an objcclass conform to a
forward-declared objcprotocol (mantis #17341)

git-svn-id: trunk@16523 -
2010-12-08 22:17:24 +00:00
Jonas Maebe
a880603816 * updated version of the conversion script, used to generate the previously
committed cocoa unit conversions, and which can also be used to translate
    the iOS SDK 3.2 headers
  + scripts (make-cocoa-headers.sh, make-ios-headers.sh) to (re)build the
    Cocoa/iOS headers, along with skeleton directories that contain the
    necessary helper files and a few required patches
  + frameworks.xml used by the conversion script
  * updated build instructions

git-svn-id: trunk@16522 -
2010-12-08 21:12:27 +00:00
Jonas Maebe
c132727caf * updated to Mac OS X 10.6 SDK
* generated with version 2.1.2 of the conversion script, with many
    improvements (script and instructions to regenerate headers will
    be committed separately)
   o QuartzCore framework translation
   o categories are no longer merged into classes, but separate
   o corrected several C->Pascal type definitions
   o handle pointer types for parameters, return types and property types 
   o handle struct/class fields that are arrays or pointers
   o handle pointers to id
   o handle external functions that return "void *" (they were parsed as
     procedures)
   o handle anonymous classes (@class NSAnonType, such as CIImage) using
     the "NSAnonType = objcclass; external;" syntax
   o corrected handling of opaque structs
   o fixed parsing of function pointer types
   o instance-bitfields that do not appear in a struct are now recognised
   o bitpacked structs are now translated into bitpacked records (but only
     if they only contain bitpacked fields)
   o C macros indicating deprecation are now translated into "deprecated"
     modifiers for methods/variables/functions/properties
   o no longer ignore deprecated categories, because some categories are
     deprecated in Mac OS X 10.5/10.6, and we want to support writing code
     for older systems too
   o several fixes to property and enum parsing

git-svn-id: trunk@16521 -
2010-12-08 11:27:05 +00:00
Jonas Maebe
43e57f3911 r332 | jonas | 2010-12-08 11:18:24 +0100 (Wed, 08 Dec 2010) | 3 lines
* enable parts of Security framwork for iOS because newer iOS SDK versions
    depend on them

git-svn-id: trunk@16520 -
2010-12-08 10:19:08 +00:00
paul
26cef34005 compiler:
- move objname, objrealname fields from tobjectdef to tabstractrecorddef, 
  - load and save them from/to ppu file, 
  - use tabstarctrecorddef in some more places where previously code worked for tobjectdef
  - change push_nested_hierarchy, pop_nested_hierarchy to handle records too

git-svn-id: branches/paul/extended_records@16519 -
2010-12-08 06:58:48 +00:00
Jonas Maebe
8c4b6c9de2 + full contents of NSZone.h
+ several missing categories and protocols (NSCodingProtocol,
    NSCopyingProtocol, NSCoderMethods, ...)
  * renamed classDescription method to _classDescription because there
    is a method in another class in the Cocoa frameworks that also called
    "classDescription"
  + added overloaded versions of all base methods without the trailing
    underscore, since that seems what everyone has settled to using for
    the rest of the Cocoa translations

git-svn-id: trunk@16518 -
2010-12-07 22:27:46 +00:00
ivost
0876df07f0 * changed output only parameters from var to out
git-svn-id: trunk@16517 -
2010-12-07 21:23:03 +00:00
paul
d7c8d9e620 compiler: allow access other record symbols than fields, first extended records tests
git-svn-id: branches/paul/extended_records@16516 -
2010-12-07 09:53:57 +00:00
paul
902a78eec1 compiler: add current_structdef: tabstractrecorddef and point current_objectdef to it
git-svn-id: branches/paul/extended_records@16515 -
2010-12-07 09:35:10 +00:00
paul
5d1c9ab6ba compiler: check visibility of record members, allow access to record consts and types:
- add searchsym_in_record function
  - change is_visible_for_object to accept tabstractrecorddef instead of tobjectdef arguments because records also have visibility sections now
  - change arguments in do_member_read, do_proc_call to tabstractrecorddef from tobjectdef to accept records
  - rename classh arguments to structh and change their type to tabstractrecorddef to show that they can accept records now too
  - move RttiName from tobjectdef to tabstractrecorddef

git-svn-id: branches/paul/extended_records@16514 -
2010-12-07 08:58:29 +00:00
paul
8e36256bc9 compiler: add support for visibility blocks in records and type, const declarations:
- add parse_record_members function to parse record blocks based on parse_object_members code
  - disable published section in records
  - rename in_class argument in some functions to in_structure because the same code can work for records now which are not classes

git-svn-id: branches/paul/extended_records@16513 -
2010-12-07 07:40:34 +00:00
paul
9a6ae5ef6d create a branch for extended records implementation
git-svn-id: branches/paul/extended_records@16512 -
2010-12-06 06:28:29 +00:00
Jonas Maebe
f8369032da * same fixes as in r16255 for x86_64 (fixes webtbs/tw17714 on Darwin/x86_64)
git-svn-id: trunk@16508 -
2010-12-05 16:45:31 +00:00