Commit Graph

50258 Commits

Author SHA1 Message Date
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
Jonas Maebe
6d5339cdb6 * CP819/IBM819 should be mapped to Windows code page 28591 (ISO8859-1)
(mantis #30639)

git-svn-id: trunk@35397 -
2017-02-04 22:44:36 +00:00
florian
b41989adfa * offset of vstr/vld is limited to +/- 1020, take care of this during spilling
git-svn-id: trunk@35396 -
2017-02-04 18:42:02 +00:00
joost
f0ebae94a7 * Changed CheckFPMakeDependencies from global function to method
git-svn-id: trunk@35395 -
2017-02-04 18:18:02 +00:00
svenbarth
7af52f81a7 * initialize boheader to avoid a warning
git-svn-id: trunk@35392 -
2017-02-04 13:57:47 +00:00
michael
53cccb6981 * Fix bug introduced by caret handling
git-svn-id: trunk@35391 -
2017-02-04 13:55:16 +00:00
svenbarth
669be1e4c2 * don't directly use sym.value as that is not necessarily initialized anymore
git-svn-id: trunk@35389 -
2017-02-04 13:49:44 +00:00
svenbarth
7e85e27865 * fix ncgrtti correctly (for once that warning was indeed useful :P )
git-svn-id: trunk@35388 -
2017-02-04 13:46:26 +00:00
florian
4b63da81aa * initialize para to avoid warning
git-svn-id: trunk@35387 -
2017-02-04 13:30:19 +00:00
florian
8ba0abf0d7 * avoid warning about OutName not being initialized
git-svn-id: trunk@35386 -
2017-02-04 13:25:38 +00:00
florian
23a02c9063 * fix arm compiler building
git-svn-id: trunk@35385 -
2017-02-04 13:20:45 +00:00
michael
eaa02f2f88 * Basic RTL for pas2js generated programs
git-svn-id: trunk@35384 -
2017-02-04 11:31:55 +00:00
michael
393b4caba2 * Patch from Mattias Gaertner:
jswriter: more compact try..catch

pasresolver:
- mark function calls without ()
- "with type do ;"
- constructor call store TPasType
- mark if a constructor call creates a new
  instance or is a normal call
- same for destructor
- fixed checking assign operator types
- more tests

fppas2js:
- convert implicit calls in Pascal to explicit calls in JS
- built in procedure "exit" and "exit(value)"
- if loopvar is used afterwards append  if($loopend>i)i--;
- classes
  - declare using createClass, needs rtl magic
  - constructor
  - destructor
  - vars
  - ancestor
  - virtual, override, abstract
  - "is" operator
  - "as" operator
  - call inherited "inherited;", "inherited funcname;"
- dynamic arrays
  - init as "arr = []"
  - SetLength(arr,newlength)
  - length(arr)
- try..except, on .. do, raise
- insert default values in calls

git-svn-id: trunk@35383 -
2017-02-04 11:26:59 +00:00
svenbarth
a9888eba70 * also generate Big Obj COFF files with the GNU utilities (needs 2.25 or newer), at least as long as the new option -a5 isn't given, which disables this
Note 1: using an older AS might fail anyway if the amount of sections is too high (like in packages\odata\src\sharepoint.pp)
Note 2: it might be an idea to keep track of the created sections in the asmlists and only enable the option if *really* necessary (like with the internal COFF output generator), though this might lead to false positives due to multiple sections with the same name (since I'd prefer to use the KISS principle only a counter would be used)

git-svn-id: trunk@35381 -
2017-02-03 22:45:32 +00:00
svenbarth
76445fd4b7 + add ability to generate Big Obj COFF files if required due to the section count being higher than $7fff
Note: such files can be linked GNU ld only starting from 2.25; then again the older versions would fail anyway as they'd complain about a too high section count...

git-svn-id: trunk@35380 -
2017-02-03 22:40:10 +00:00
svenbarth
95bea696ca + add ability to read Big Obj COFF files as generated by MSVC with /bigobj and GNU AS with -mbig-obj (starting from version 2.25); this format allows 2^31 sections per COFF file instead of 2^16, thus solving the problem of compiling packages\odata\src\sharepoint.pp
Note: the field names of tcoffbigobjheader and coffbigobjsymbol are inspired from the field names of the structs declared in LLVM

git-svn-id: trunk@35379 -
2017-02-03 22:36:58 +00:00
joost
addb92e62b * Replaced global variable for field
git-svn-id: trunk@35378 -
2017-02-02 21:47:17 +00:00
svenbarth
11493de99b + add test from Mantis #31305 for completeness sake
git-svn-id: trunk@35377 -
2017-01-31 18:24:00 +00:00
svenbarth
c1390b3442 * fix for Mantis #31249: applied (adjusted) patch provided by Maciej Izak
Commit message:
[PATCH] More consistent RTTI (also better performance) for classic
 objects (reference to initrtti from fullrtti).

git-svn-id: trunk@35376 -
2017-01-31 18:21:53 +00:00
Károly Balogh
a34b6c7c53 m68k: atari also uses syscalls, so update the comment for that too
git-svn-id: trunk@35375 -
2017-01-31 14:43:25 +00:00
svenbarth
d149f260fc - remove no longer needed gen_fpc_dummy()
git-svn-id: trunk@35374 -
2017-01-29 22:40:36 +00:00
svenbarth
cc42bb8a7a * generate the package stub for all Windows and NativeNT targets
git-svn-id: trunk@35373 -
2017-01-29 22:39:34 +00:00
svenbarth
48bddbbc43 * use new potype_pkgstub instead of gen_fpc_dummy() as the former works on all platforms that needs it
With this dynamic packages are starting to work on x86_64-win64

git-svn-id: trunk@35372 -
2017-01-29 22:39:06 +00:00
svenbarth
1a6a8b7c9f + introduce a new potype for the main stub of a package library (which on Windows is simply a DLLMain returning True)
git-svn-id: trunk@35371 -
2017-01-29 22:37:40 +00:00
svenbarth
1c98a48c47 * mark __FPC_specific_handler as an external symbol
git-svn-id: trunk@35370 -
2017-01-29 22:26:13 +00:00
svenbarth
cfa5b9d809 - the external declaration of PascalMain is no longer needed for Win64 on 3.1.1+
git-svn-id: trunk@35369 -
2017-01-29 20:18:18 +00:00
svenbarth
69fa837266 * NASM supports DQ already since version 2.00 (from 10 years ago) and it's already in the ait_const2str array, so use it! (doesn't mean that it works on Win64 however...)
git-svn-id: trunk@35368 -
2017-01-29 17:49:27 +00:00
svenbarth
f517311227 * ensure that the indirect symbols for VMT, RTTI and IID reside in the same sections as the symbols they point to -> reduces the amount of sections for them by half
git-svn-id: trunk@35367 -
2017-01-29 17:43:39 +00:00
svenbarth
c1db48c8c6 * add ability to disable the generation of an indirect symbol if needed (useful if that's done by the constant builder)
Note: I'm not yet really happy with both AT_DATA_FORCEINDIRECT and AT_DATA_NOINDIRECT; maybe I should replace them with flags or something like that...

git-svn-id: trunk@35366 -
2017-01-29 17:42:00 +00:00
svenbarth
822d96776b * extend tai_typedconstbuilder with the ability to add an indirect symbol to the same section as the one that's generated for the constant data (at least if it's also rodata)
git-svn-id: trunk@35365 -
2017-01-29 17:39:52 +00:00
svenbarth
b813fc641f * put data that's used by the VMT into the same section (that also means changing some sections from rodata_norel to rodata); this way the amount of sections per class is reduced (e.g. two for classes that inherited from a class with interfaces)
git-svn-id: trunk@35364 -
2017-01-29 17:37:13 +00:00
svenbarth
deb86a9e70 * Windows and GNU AS both correctly handle read only sections with relocations, so make use of that
git-svn-id: trunk@35363 -
2017-01-29 17:33:30 +00:00