Commit Graph

374 Commits

Author SHA1 Message Date
florian
0e41df598e * merge i8086 branch by Nikolay Nikolov
git-svn-id: trunk@24324 -
2013-04-25 20:23:51 +00:00
florian
7ac7d8a4b6 + define UNICODE as well as FPC_UNICODESTRINGS
git-svn-id: trunk@24214 -
2013-04-09 13:05:29 +00:00
Jonas Maebe
8b7071c8e8 * fixed recording generics token line info on big endian systems
git-svn-id: trunk@23926 -
2013-03-18 13:29:15 +00:00
florian
d4613fe961 * update init_settings.setalloc in SetCompileMode if changeinit is set
git-svn-id: trunk@23898 -
2013-03-17 16:42:34 +00:00
florian
20a534e63f * fixed code which causes range check errors when compiled with -Cr
git-svn-id: trunk@23889 -
2013-03-17 14:24:50 +00:00
nickysn
7d212a7e79 * default to intel assembler for delphi/tp7 modes also on i8086
git-svn-id: branches/i8086@23838 -
2013-03-14 22:19:10 +00:00
paul
3682fddc49 compiler: minor optimization of tscannerfile.recordtoken
git-svn-id: trunk@23798 -
2013-03-12 01:32:07 +00:00
paul
2a3618fb6c compiler: set apptype using new SetAppType routine, add 'CONSOLE' define for console apptype.
git-svn-id: trunk@23603 -
2013-02-13 03:21:03 +00:00
paul
8db6118965 compiler: define FPC_UNICODESTRINGS when UnicodeString is a default string type (for issue #0023861)
git-svn-id: trunk@23601 -
2013-02-13 01:02:40 +00:00
svenbarth
d49b4043ab Implement DECLARED() for generic symbols. This fixes Mantis #21829 . The syntax is SomeGenericType<> for a generic with only one type parameter and SomeGeneric<,[,]*> for a generic with more than one type parameter. Spaces between the commas or brackets are allowed.
scanner.pas, parse_compiler_expr.read_factor:
  + allow "<>" after "declared" (handle "<>" operator specially)
  + count "," to get correct amount of type parameters
  + check together with the count string for symbols 
  + correctly handle dummy symbols

+ added tests

git-svn-id: trunk@23544 -
2013-01-30 16:10:15 +00:00
svenbarth
632db2229f Fix for Mantis #23700 .
scanner.pas, parse_compiler_expr.read_factor:
  * initialize result value

git-svn-id: trunk@23454 -
2013-01-20 11:21:20 +00:00
svenbarth
b5827ce363 Move the handling of "misstyled" floating point constants like "2." or "2.e10" from the scanner to the parser. This way type helpers calls for integer constants can be parsed correctly in the future.
Note: the error messages for incorrect "misstyled" floating point numbers (e.g. "2e10foo") have changed because of this.

scanner.pas, tscannerfile.readtoken:
  instead of tokenizing "2.", "2.e10", "2.e+10" and "2.e-10" as "_REALNUMBER" tokenize them as "_INTCONST _POINT", "_INTCONST _POINT _ID", "_INTCONST _POINT _ID _PLUS _INTCONST" "_INTCONST _POINT _ID _PLUS _INTCONST"; tokenizing of normal floating constants is not changed

pexpr.pas:
  factor: 
    * extract the code for creating a new constant floating point from "factor" into a new function "real_const_node_from_pattern"
    + allow the parsing of postfixoperators for integer constants if a "." is encountered
  + postfixoperators: check for a "misstyled" floating point number if an ordinal const (not an enum and not a boolean) is encountered (the code is already partially prepared for type helper support)
  
+ Added tests

git-svn-id: trunk@23356 -
2013-01-10 16:23:00 +00:00
florian
f25f44605e - get rid of m_all, use a set instead for tokens, this allows to disable/enable tokens depending on the language mode
git-svn-id: trunk@22506 -
2012-09-30 21:03:35 +00:00
paul
57da93dd11 compiler: don't reject utf-8 codepage as default althought it is not present in mapping tables
git-svn-id: trunk@22409 -
2012-09-17 02:24:56 +00:00
Jonas Maebe
07ebc51b6c * always store generics token streams in little endian, so we don't have to
keep a separate field for each tstoreddef that records whether the
    endianness needs to be swapped

git-svn-id: trunk@21914 -
2012-07-15 16:09:14 +00:00
svenbarth
f90e686be2 Always try to present file/line information for generics even if no source is available or the unit was compiled as release unit. This allows IDE like Lazarus to correctly navigate to an error or warning even if the unit containing the generic was compiled as a release unit.
* pscanner.pas, tscannerfile.replaytoken: remove the checks for "sources_avail" and always update the read file/line information 
* fppu.pas, tppumodule.readsourcefiles: always load at least the filenames which were used when compiling the unit from the ppu file, so that file/line information will be correctly shown, but don't touch the "sources_avail" flag of the tppumodule

git-svn-id: trunk@21657 -
2012-06-20 09:01:28 +00:00
svenbarth
e0b41141d2 "SizeInt" inside the compiler references the "size of an int" on the Host platform. What we want for writing size information in PPUs for Generics is "ASizeInt" which is the "size of an int" of the target platform. This fixes Mantis #20947.
* pscanner.pas: change SizeInt to ASizeInt for tokenreadsizeint and tokenwritesizeint and change necessary other locations for record- and replaytokenbuffers
+ Added a test in the hope that some test-platforms do cross platform (e.g. win32 => win64) compilation.

git-svn-id: trunk@21651 -
2012-06-19 08:47:30 +00:00
pierre
261538f9c2 Fix bug report 22265
git-svn-id: trunk@21609 -
2012-06-14 14:00:44 +00:00
pierre
41248ea4f7 Hopefully correct fix for ReplayToken TSettings record writes
git-svn-id: trunk@21605 -
2012-06-14 10:14:24 +00:00
pierre
1d4862f3c1 * Remove obsolete size check leading to failure for generics tests
git-svn-id: trunk@21604 -
2012-06-14 07:28:55 +00:00
pierre
d67d1abcba * Use field by field write of current_settings for replaytoken and remove packed attribute for tsettings type
git-svn-id: trunk@21594 -
2012-06-13 21:51:59 +00:00
paul
d79eee8ed1 compiler: write a warning if unit should be compiled with built-in system codepage for ansistring constants but this codepage is not known by the compiler
git-svn-id: trunk@21269 -
2012-05-10 01:24:18 +00:00
Jonas Maebe
50d2fa7134 * after changing a modeswitch, only change related module/localswitches that
depend on the modeswitch that was just changed (so that e.g. changing
    the nested procvars setting has no effect on the state of $h+/$h-)
    (mantis #21951)

git-svn-id: trunk@21247 -
2012-05-06 14:56:49 +00:00
paul
aad9294c27 compiler: when explicit codepage modeswitch is installed and compiler has no codepage map for the DefaultSystemCodepage use default compiler codepage
git-svn-id: trunk@21223 -
2012-05-04 06:09:35 +00:00
Jonas Maebe
14cfe770a4 * replaced most (if not all) remaining fields/parameters in the compiler
that deal with paths/filenames with TPathStr (= ansistring) to prevent
    cutting off long paths (no change in speed when compiling the compiler,
    1% extra memory usage)

git-svn-id: trunk@21120 -
2012-04-29 17:36:23 +00:00
Jonas Maebe
aee5380ae0 * merged trunk up to r20882
o support for the new codepage-aware ansistrings in the jvm branch
   o empty ansistrings are now always represented by a nil pointer rather than
     by an empty string, because an empty string also has a code page which
     can confuse code (although this will make ansistrings harder to use
     in Java code)
   o more string helpers code shared between the general and jvm rtl
   o support for indexbyte/word in the jvm rtl (warning: first parameter
     is an open array rather than an untyped parameter there, so
     indexchar(pcharvar^,10,0) will be equivalent to
     indexchar[pcharvar^],10,0) there, which is different from what is
     intended; changing it to an untyped parameter wouldn't help though)
   o default() support is not yet complete
   o calling fpcres is currently broken due to limitations in
     sysutils.executeprocess() regarding handling unix quoting and
     the compiler using the same command lines for scripts and directly
     calling external programs
   o compiling the Java compiler currently requires adding ALLOW_WARNINGS=1
     to the make command line

git-svn-id: branches/jvmbackend@20887 -
2012-04-15 15:54:10 +00:00
pierre
1c27730c8c * Give debug information once for each conditional directive
git-svn-id: trunk@20648 -
2012-03-28 14:09:04 +00:00
florian
99b0421193 + patch by Seth Grover to support line number macro returning a numerical number, resolves #21372
git-svn-id: trunk@20608 -
2012-03-23 20:35:42 +00:00
Jonas Maebe
a6a43c71ec * give an error message when including a file starting with an UTF-8 BOM
in a compilation module parsed using a different code page, because this
    changes the default ansistring type and {$codepage xxx} is also not
    allowed in the middle of a unit (mantis #21445)

git-svn-id: trunk@20488 -
2012-03-09 22:50:14 +00:00
florian
4a79262728 * make asciinr string long enough for binary char constants as pointed out by Matti Kronman, resolves #20821
git-svn-id: trunk@19782 -
2011-12-08 22:04:32 +00:00
paul
c6ca9e5091 compiler:
- add helper function getansistringcodepage which returns explicitly set codepage or 0 in other case
  - add helper function getansistringdef which return a def with explicitly set codepage or cansistringtype in other case
  - change tstoreddef.createnai constructor to allow set codepage in constructor
  - don't convert string constants to rawbytestring. if string constant already has a codepage - preserve it or convert to ansistring codepage (delphi compatible)
  - don't perform string conversion from ansistring to strings with explicitly set codepage (by directive or by compiler switch) and vice versa (delphi compatible)
  + test which covers most of the cases

git-svn-id: trunk@19510 -
2011-10-19 02:45:52 +00:00
florian
73a084d662 * fixes bootstrapping with 2.6.0
git-svn-id: trunk@19491 -
2011-10-15 12:42:33 +00:00
paul
21ac5dfb3b compiler: output ansistring constants in explicit codepage if codepage is explicitly defined using either $codepage directive or compiler switch or for SystemCodepage modeswitch
git-svn-id: trunk@19462 -
2011-10-11 08:58:56 +00:00
paul
a99ffb3097 compiler: apply patches from Inoussa and Jonas:
defcmp: Address code paged' string type comparison taking care of the code page
  ncnv: Remove un-needed code page comparison to CP_UTF8, some fixes regarding shortstrings and wide char/string 
  ncon: For the case of tstringconstnode.changestringtype (ncon.pas) where the code page are of CP_NONE or 0 no translation is done as :
    * CP_NONE is compatible to all
    * For 0 the raw bytes are just copied.
 My changes:
  - change ascii2unicode to allow pass source codepage, 
  - convert in both cases when source or destination is UTF8

git-svn-id: trunk@19457 -
2011-10-11 01:21:07 +00:00
paul
6f185f2184 compiler: replace {$ifdef FPC_FULLVERSION<20700} with {$ifdef VER2_4} for including ccharset as in other compiler places
git-svn-id: trunk@19284 -
2011-09-29 14:15:09 +00:00
florian
a6d01c09aa * make compiler compilable with 2.4.4 rtl
git-svn-id: trunk@19269 -
2011-09-28 18:54:32 +00:00
florian
d7f7a9bb76 * patch by Alexander Shishkin to clean up $ifopt usage by $push/$pop, resolves #20346
git-svn-id: trunk@19256 -
2011-09-27 20:22:40 +00:00
Jonas Maebe
cf47b8d422 * fixed all known memory leaks in the code added for the JVM port
git-svn-id: branches/jvmbackend@19248 -
2011-09-26 19:31:34 +00:00
pierre
10586b19c3 * Reading tsettings field by field
git-svn-id: trunk@19167 -
2011-09-21 15:34:16 +00:00
paul
828367bebd compiler:
- return default compiler codepage to 8859-1
  - emit ansistring constants in CP_NONE by default
  - add new modeswitch systemcodepage which sets default compiler codepage to system and emits ansistring constants with systemcodepage as delphi do
  - add new mode DelphiUnicode with has the same switches as delphi mode + systemcodepage switch. Later it will also have string = unicodestring by default.

git-svn-id: trunk@19165 -
2011-09-21 01:23:42 +00:00
paul
4d3da666db compiler: replace string codepage comparison to numeric. store codepage as number in current settings
git-svn-id: trunk@19144 -
2011-09-19 00:48:43 +00:00
paul
f3ebaab222 merge r19075 from cpstrnew branch by paul:
compiler: partly revert r17434 because of a test regression. Also this is delphi compatible (although delphi does not know a {$codepage} directive)

git-svn-id: trunk@19127 -
2011-09-17 14:26:30 +00:00
paul
1db610ecbd merge r17434 from cpstrnew branch by michael:
* Patch from Inoussa to fix constant strings with codepage

git-svn-id: trunk@19109 -
2011-09-17 13:19:59 +00:00
pierre
47f39748f6 Handle FileIndex/Line/Column for change_nedian in token buffer for generics
git-svn-id: trunk@19014 -
2011-09-07 16:27:33 +00:00
pierre
57f3f0a82b scanner unit:
treplaystack class: added change_endian boolean field
  treplaystack.create added achange_endian parameter
  tscannerfile class: added tokenbuf_change_endian boolean field
  readsizeint method: use tokenbuf_change_endian to maybe swap sizeint
  startreplaytokens method: added achange_endian field
  psub and ptype units:
  adapt to tscannerfile.startreplaytokens change above.

git-svn-id: trunk@19012 -
2011-09-07 13:13:15 +00:00
pierre
b526bb4dfa * Fix failures introduced by rev 18975
git-svn-id: trunk@18976 -
2011-09-05 07:51:22 +00:00
pierre
68d27263e7 Try to improve RecordTokenBuf with respect to PPU reading
git-svn-id: trunk@18975 -
2011-09-04 22:43:41 +00:00
pierre
637a4671d9 Fix messages to tokenbuufer writing to zvoid problems with PPU
git-svn-id: trunk@18957 -
2011-09-03 17:38:53 +00:00
Jonas Maebe
28c20cfc5e * the default string type for the JVM target is no longer automatically
unicodestring = java.lang.String. The reason this was the default in
    the past is that this was the first string type that was implemented,
    and without it being the default most code involving string operations
    would fail. Now the default strings types are the same as for other
    targets
  + new {$modeswitch unicodestrings} directive, that when activated
    *together* with {$h+},
   1) changes char into an alias for widechar
   2) changes string into an alias for unicodestring
   3) changes the preferred string evaluation type (in case of uncertainty)
      to unicodestring
    {$modeswitch unicodestrings} with {$h-} does not change anything at all
    regarding the string type (it still changes the char type)
  + new uuchar unit that redefines char as widechar, and which is automatically
    included by the compiler if {$modeswitch unicodestrings} is enabled

git-svn-id: branches/jvmbackend@18781 -
2011-08-20 08:35:47 +00:00
Jonas Maebe
e534a17c01 - removed unused scanner.tscannerstate, inserttext_begin and inserttext_end
(leftovers from the initial symcreat implementations that didn't work)

git-svn-id: branches/jvmbackend@18637 -
2011-08-20 08:20:13 +00:00