Commit Graph

50139 Commits

Author SHA1 Message Date
maciej-izak
5a7d4eb25f * Call management initialize operator for records inside classes (record with management operators as field) (rtl/inc/objpas.inc, TObject.InitInstance)
git-svn-id: trunk@35449 -
2017-02-19 12:17:20 +00:00
maciej-izak
9a9eb1b840 * Use RTTIRecordRttiInfoToInitInfo (when FPC_HAS_MANAGEMENT_OPERATORS is not defined) for records/objects in fpc_Copy as well as for fpc_Initialize, fpc_finalize, fpc_Addref
git-svn-id: trunk@35448 -
2017-02-19 11:53:52 +00:00
maciej-izak
8a68a7aea8 * Declare field RecordOp for TRecordInfoInit only when FPC_HAS_MANAGEMENT_OPERATORS is defined, same for additional types for management operators.
git-svn-id: trunk@35447 -
2017-02-19 01:26:08 +00:00
maciej-izak
d42428bc3c * Initial support for management operators in RTL (rtl/inc/rtti.inc):
* fpc_Initialize: Initialize operator is called after recordrtti(data,typeinfo,@int_initialize);
  * fpc_Finalize: Finalize operator is called before recordrtti(data,typeinfo,@int_finalize);
  * fpc_Addref: AddRef operator is called after recordrtti(data,typeinfo,@int_addref);
  * fpc_Copy: Copy operator (if exists) is called instead of default copy behavior
  * replace RTTIRecordRttiInfoToInitInfo function (which was introduced only to speed-up InitializeArray/FinalizeArray) with a more advanced RTTIRecordOp function. Result of RTTIRecordRttiInfoToInitInfo is now returned in initrtti parameter. Additionally as new result is returned PRecordInfoInit which is usefully in basic RTL functions: fpc_Initialize, fpc_Finalize, fpc_Addref, fpc_Copy

git-svn-id: trunk@35446 -
2017-02-19 01:18:35 +00:00
maciej-izak
af8e0efe57 * Rtti info about Management Operators (MO) in init table for records. Note: commit contains minimal changes for RTL (for proper "make") no functional changes. More RTL changes for fully functionally MO in next commits.
compiler/ncgrtti.pas
  + write_record_operators procedure which fills simple VMT like table for MO.
  * recorddef_rtti save MO (if exists)
  * objectdef_rtti_fields save nil pointer/entry for objects rtti (have same RTL parts like for records)

compiler/options.pas
  + new define FPC_HAS_MANAGEMENT_OPERATORS

compiler/symconst.pas
  + new item itp_init_record_operators for tinternaltypeprefix enum
  + new entry '$init_record_operators$' in internaltypeprefixName

rtl/inc/rtti.inc
  + new field RecordOp (pointer to MO VMT table) in TRecordInfoInit
  + new types to handle MO VMT: TRTTIRecordOpVMT, PRTTIRecordOpVMT, TRTTIRecCopyOp, TRTTIRecVarOp

rtl/objpas/typinfo.pp
  + RecordOp field for TRecInitData record

git-svn-id: trunk@35445 -
2017-02-19 00:22:59 +00:00
maciej-izak
25db29d0a6 * symtable.pas:
+ search_management_operator function to find Tprocdef for selected management operator in record definition

tokens.pas:
  + new constants: first_managment_operator and last_managment_operator used in search_management_operator

git-svn-id: trunk@35444 -
2017-02-18 19:27:53 +00:00
maciej-izak
9441fb3968 * ngenutil.pas, tnodeutils.sym_maybe_initialize: Ensure that management operator (Initialize) is used also for local variables.
git-svn-id: trunk@35443 -
2017-02-18 19:19:46 +00:00
maciej-izak
520bb31fa6 * Parse management operators. Each management operator is special kind of operator without result.
git-svn-id: trunk@35442 -
2017-02-18 19:12:48 +00:00
maciej-izak
168e59837a * New function token2managementoperator for conversion: ttoken to tmanagementoperator
git-svn-id: trunk@35441 -
2017-02-18 18:58:32 +00:00
maciej-izak
b912deae33 * each record with managed field or with any management operator needs init table (update for symdef.pas, trecorddef.needs_inittable)
git-svn-id: trunk@35440 -
2017-02-18 18:50:57 +00:00
maciej-izak
15ba9b54c6 Store informations about management operators in ppu files for records.
ppu.pas:
  * increase ppu version

symconst.pas:
  + new enum tmanagementoperator and set tmanagementoperators

symtable.pas, trecordsymtable:
  + new field managementoperators
  + new method includemanagementoperator

symdef.pas, trecorddef.ppuload and trecorddef.ppuwrite:
  * save/load for managementoperators

git-svn-id: trunk@35439 -
2017-02-18 18:43:25 +00:00
maciej-izak
48b149acd4 New tokens for new management operators: Initialize, Finalize, AddRef and Copy. Small code adjustment for parser (pdecobj.pas, pstatmnt.pas, psub.pas, ptype.pas) was required because few of old token has from now value which is outside range of set: _CONSTRUCTOR, _FINALIZATION.
New tokens for operators:
  * _OP_INITIALIZE, _OP_FINALIZE, _OP_ADDREF, _OP_COPY

New tokens:
  * _INITIALIZE, _FINALIZE, _ADDREF, _COPY

git-svn-id: trunk@35438 -
2017-02-18 18:12:45 +00:00
pierre
3f8f7bc04a Regenerate Makefile after: Add explicit rule for uuchar unit
git-svn-id: trunk@35437 -
2017-02-16 18:24:33 +00:00
pierre
31d9be0c9d Add explicit rule for uuchar unit
git-svn-id: trunk@35436 -
2017-02-16 18:24:14 +00:00
michael
00450470e2 * Make port not stored, since it is in params already
git-svn-id: trunk@35435 -
2017-02-14 21:17:38 +00:00
Tomas Hajny
12dddfb6c8 * fix base path handling - ensure using full path in the cfg files and avoid double slashes
git-svn-id: trunk@35433 -
2017-02-13 00:03:15 +00:00
florian
3d6d5145bf * fix handling of const string symbols in preprocessor expressions
+ accept string constants in preprocessor expressions, resolves #31246

git-svn-id: trunk@35432 -
2017-02-12 17:29:45 +00:00
Tomas Hajny
0276bb374d * remove duplicated SDL sources entry
git-svn-id: trunk@35431 -
2017-02-12 17:10:01 +00:00
florian
c961c72c30 * tarmtypeconvnode.first_int_to_real should call the generic method in the parent class, if soft fpu code is generated, resolves #31350
git-svn-id: trunk@35430 -
2017-02-12 16:05:13 +00:00
michael
7702ebb261 * Patch from Mattias Gaertner; SetCharAt
git-svn-id: trunk@35429 -
2017-02-12 15:17:12 +00:00
michael
bc22805000 * Patch from Mattias Gaertner:
pastree: 
    - allow custom data to be chained.
  pparser:
    - procedure modifier assembler
    - Self[]
    - Self.member
    - fixed some wrong parents
  pasresolver:
    - aString[i]:=
    - check proc external modifier
    - test if WithExprScope is set
    - Self[]
    - Self.member
  fppas2js:
    - proc assembler modifier
    - assigned(class-instance)
    - class default property
    - low(array), high(array)
    - multi dim arrays [index1,index2] -> [index1][index2]
    - string: read and write char aString[]
    - procedure modifier external name 'funcname'
    - option to add "use strict";
    - with-do using local var
    - with record do i:=v;
    - with classinstance do begin create; i:=v; f(); i:=a[]; end;
    - Self[]
    - Self.member

git-svn-id: trunk@35428 -
2017-02-12 15:16:00 +00:00
joost
09f415dc81 * Refactored so that TFPCustomPackagesStructure has access to the (compiler-)options
git-svn-id: trunk@35427 -
2017-02-12 14:18:20 +00:00
Jonas Maebe
015f034904 * reverted r35424, wasn't ready for commit yet
git-svn-id: trunk@35426 -
2017-02-11 21:21:44 +00:00
Jonas Maebe
265c8e7bbc + support for specifying ms_abi_default, ms_abi_cdelc, sysv_abi_default, and
sysv_abi_cdecl calling conventions on x86-64 to force using the SYSV/
    Microsoft ABI on platforms that don't use it by default (mainly to ease
    porting pure assembler routines)

git-svn-id: trunk@35425 -
2017-02-11 19:57:12 +00:00
Jonas Maebe
4d9617da97 * fixed check to determine whether a record parameter can be subscripted
directly in inline assembly: that's only possible if it's a register
    parameter where the address of the record was passed (rather than the
    record itself)

git-svn-id: trunk@35424 -
2017-02-11 19:57:08 +00:00
michael
dc500f7276 * Support for exact YearsBetween calculation (bug ID 31233)
git-svn-id: trunk@35423 -
2017-02-11 15:18:37 +00:00
michael
268693f0d5 * Support for exact MonthsBetween calculation (bug ID 31354)
git-svn-id: trunk@35422 -
2017-02-11 15:13:11 +00:00
michael
3bd8da04c7 * Better check for empty Refresh SQL statement
git-svn-id: trunk@35421 -
2017-02-11 14:03:38 +00:00
michael
89c2d0a9dc * Fix AVs when no description nodes available
git-svn-id: trunk@35420 -
2017-02-11 10:10:59 +00:00
michael
faa70adcd3 * Publish and observe port
git-svn-id: trunk@35419 -
2017-02-11 09:45:13 +00:00
michael
f5b76b62fe * Patch from Mattias Gaertner:
- set operator functions
  - dyn array can be null

git-svn-id: trunk@35418 -
2017-02-10 23:26:14 +00:00
michael
25fc79b2b8 * Patch from Mattias Gaertner:
- char and string literals
  - setlength() for string
  - property read accessor var and function
  - property write accessor var and function
  - property with param list
  - property of type array
  - class property
  - convert "a div b" to "Math.floor(a / b)"
  - and, or, xor, not: logical or bitwise
  - enum type with values and names
  - enums: option to write numbers instead of variables
  - enums: ord(), low(), high(), pred(), succ()
  - type cast number to enum
  - set of enum
  - include(), exclude()
  - assign := for sets
  - constant set: enums, enum vars, ranges
  - set operators +, -, *, ><, =, <>, >=, <=
  - set in-operator
  - sets: low(), high()
  - assign nil to dyn array

git-svn-id: trunk@35417 -
2017-02-10 23:25:10 +00:00
michael
55241e283f * Patch from Mattias Gaertner
- quote object keys if needed  { "1":"value" }
  - use " or ' for string literals

git-svn-id: trunk@35416 -
2017-02-10 23:24:13 +00:00
michael
203bd85c38 * Patch from Mattias Gaertner:
pscanner: 
  - fixed reading ^a char literals

  pasresolver:
  - pred(), succ()
  - option for class properties non static
  - type cast integer to enum
  - <= and >= for sets
  - property of type array
  - low(), high() for sets
  - call constructor in class method
  - assign nil to dynamic array
  - resolve const expression

git-svn-id: trunk@35415 -
2017-02-10 23:23:24 +00:00
svenbarth
58abeb4a34 * also test IIDStr of raw interfaces
git-svn-id: trunk@35414 -
2017-02-10 16:06:47 +00:00
svenbarth
9ead39404b + print headers for the tested interfaces
git-svn-id: trunk@35413 -
2017-02-10 16:06:18 +00:00
svenbarth
6418f22ae0 * enable raw interface testing
git-svn-id: trunk@35412 -
2017-02-10 16:05:35 +00:00
svenbarth
870bffc70d * provide access to the method table for raw interfaces (it is written even though $M is not respected by such interfaces currently)
git-svn-id: trunk@35411 -
2017-02-10 16:03:57 +00:00
svenbarth
fd1047c715 * use the correct alignment for the field following the unit name of an interface (raw or not doesn't matter)
git-svn-id: trunk@35410 -
2017-02-10 16:02:23 +00:00
svenbarth
ca11a4baaa * only generate a big obj COFF file if the high bound of the sections is larger than $7fff (it could be that the final count is smaller again as sections that have the same name are combined)
git-svn-id: trunk@35409 -
2017-02-10 14:40:23 +00:00
svenbarth
c6bfb0064f * keep track of the sections that are created in the asmlists
git-svn-id: trunk@35408 -
2017-02-10 14:38:53 +00:00
maciej-izak
49f7e90827 Clean up Generics.Collections. Remove old useless bugs workarounds. More details in mantis 27206.
git-svn-id: trunk@35407 -
2017-02-06 22:47:29 +00:00
maciej-izak
79076c695d Remove redundant TArray<T> declaration in Generics.Collections. Was introduced before objpas.TArray<T> declaration but objpas.TArray<T> is more proper and Delphi compatible.
git-svn-id: trunk@35406 -
2017-02-06 22:16:49 +00:00
maciej-izak
b38243c5cb Improvement for IsManaged in RTTI module: ShortString is not managed type. Test corrected.
git-svn-id: trunk@35405 -
2017-02-06 20:41:28 +00:00
maciej-izak
a4952071e3 Corrected function IsManaged for RTTI module. Return true if is passed managed type (finally it is possible thanks to r35180 and mantis 31249).
New test case "TestIsManaged" added in tests.rtti

git-svn-id: trunk@35404 -
2017-02-06 20:35:25 +00:00
maciej-izak
1d301b6dbe More consequent writing of Rtti. Part of code related to recorddef moved from recorddef_rtti to write_child_data_rtti(). When typeinfo is used in code init Rtti is a child of the full Rtti. Commit also contains correction for code commited for mantis #31249 (r35376) and mantis #31305 (r35377) for objects. Before was impossible to compile code with usage of typeinfo() function for object without managed fields ("Undefined symbol" error).
+ Test attached

git-svn-id: trunk@35403 -
2017-02-06 18:52:37 +00:00
michael
767645014c * Patch from Mattias Gaertner:
jswriter: 
    less duplicate brackets
  pasresolver:  
    break, continue, option to fix case of overrides
  pas2js:
    procedure args default values,
    try..except,
    try..except..on..else,
    raise, raise E,
    class vars, 
    call class methods,
    break,
    continue,
    rename name conflicts with JS identifiers: apply, call, null, ...

git-svn-id: trunk@35402 -
2017-02-06 10:44:39 +00:00
florian
41b028ffc0 * unpcklp* require aligned memory, so do not spill replace their first operand by a memory location, resolves #31332
git-svn-id: trunk@35400 -
2017-02-05 20:59:54 +00:00
marcus
8e123e7b37 Amiga: fix fp.dsk saving
git-svn-id: trunk@35399 -
2017-02-05 16:36:11 +00:00
michael
c3e50a36cc * Move fpdoc block after uses clause
git-svn-id: trunk@35398 -
2017-02-05 09:51:43 +00:00