Commit Graph

41388 Commits

Author SHA1 Message Date
nickysn
70937d93c1 * WinMinX, WinMinY, WinMaxX and WinMaxY helper functions replaced with absolute packed records overlaid on top of WindMin and WindMax for faster access
git-svn-id: trunk@25474 -
2013-09-12 23:39:56 +00:00
paul
e42e9bb677 compiler: support ORD() intrinsic in preprocessor expressions
git-svn-id: trunk@25471 -
2013-09-12 12:52:07 +00:00
paul
974aeb5573 compiler: support MOD, DIV, SHR, SHL in preprocessor expressions
git-svn-id: trunk@25469 -
2013-09-12 11:22:59 +00:00
paul
cc37b19bb2 compiler: allow 1 and 0 to be used as Booleans in preprocessor expressions
git-svn-id: trunk@25467 -
2013-09-12 09:30:48 +00:00
paul
06e7808f64 compiler: return short evaluation of preprocessor expressions with AND or OR. This fixes univint package compilation.
git-svn-id: trunk@25466 -
2013-09-12 09:06:13 +00:00
paul
038b7746fb compiler: implement preprocessor expressions (fixes mantis #0010671)
- move operator_levels to topens.pas - it is used from 2 units now
  - implement pexpr like sub_expr for preprocessor expressions
  - implement +,-,*,/ expressions for the moment
  * move OR, AND, IN implemenetation to the new logic

git-svn-id: trunk@25465 -
2013-09-12 08:35:24 +00:00
paul
6eba4226b6 compiler: move OR and AND preprocessor evaluation to texprvalue.evaluate
git-svn-id: trunk@25464 -
2013-09-12 06:59:12 +00:00
paul
7ecaaf0ef8 compiler: further improve preprocessor evaluator:
* support TRUE,FALSE for all modes
  * refactor texprvalue.evaluate to support arithmetic expressions and implement them here
  * simplify read_expr and read_factor code

git-svn-id: trunk@25463 -
2013-09-12 06:01:49 +00:00
paul
cac09f9df1 compiler: better handling of '$','%','&' in macros
git-svn-id: trunk@25462 -
2013-09-12 02:33:02 +00:00
paul
0eb4244a67 compiler: implement compile-time expression with float numbers (issue #0010670), better handling of integer expressions too
git-svn-id: trunk@25461 -
2013-09-12 01:59:26 +00:00
paul
eff0403fc1 compiler: reimplement handling of compile time variables - they are stored like tconstsym now instead of string. Expressions are evaluated more accurate now.
git-svn-id: trunk@25460 -
2013-09-12 00:38:17 +00:00
svenbarth
6f5a648516 Improve the cpu type handling for M68k just in case we should branch 2.8.0 before I can start working on M68k again.
Therefor the cpu type (-Cp...) "coldfire" was split up into "isaa", "isaa+", "isab" and "isac". The Linux RTL can currently compiled for "68020", "isab" and "isac". For the other three Bcc.L must be handled differently (only Bcc.B/W supported) and for "68000" also EXT.L needs to be handled differently.

fpcdefs.inc:
  + define CPUCAPABILITIES if capabilities can be set for a certain CPU type (currently ARM, AVR and M68k)
options.pas:
  * check for CPUCAPABILITIES instead of specific CPUs
assemble.pas:
  - the handling of the CPU type is already done in m68k/ag68kgas.pas, Tm68kGNUAssembler.MakeCmdLine (and thereby already using the gascputypestr array!)
m68k/cpuinfo.pas:
  - tcputype: remove "cpu_coldfire"
  + tcputype: add "cpu_isa_a", "cpu_isa_a_p", "cpu_isa_b" and "cpu_isa_c"
  + add "cpu_coldfire" constant which contains all Coldfire specific cpu types
  * adjust "cputypestr" and  "gascputypestr"
  + add tcpuflags and cpu_capabilities (DBRA restriction was checked with CPUCOLDFIRE, CAS/TAS will be needed for atomic operations and BRAL restriction was discovered during testing of new cpu types)
m68k/cgcpu.pas:
  * adjust checks for "cpu_coldfire"
m68k/n68kadd.pas:
  * don't use a BRA.L if it is not supported, but (at least for now) a BRA.W
aggas.pas:
  * adjusted check for Coldfire

git-svn-id: trunk@25457 -
2013-09-11 17:07:32 +00:00
svenbarth
2e70575afc Allow compilation of compiler with 2.6.x RTL for simplyfied development.
cfileutl.pas:
  + define a TRawByteSearchRec if we're not compiling with at least a 2.7.1 compiler

git-svn-id: trunk@25456 -
2013-09-11 16:05:24 +00:00
nickysn
6ef912a7a0 * GetScreenCursor (and all places where it's called) var parameters changed to smallint, which is more optimal on i8086
git-svn-id: trunk@25455 -
2013-09-11 14:51:59 +00:00
nickysn
771301d7db * SetScreenCursor parameters changed to smallint, which is more optimal on i8086
git-svn-id: trunk@25454 -
2013-09-11 14:40:26 +00:00
nickysn
987e759e20 * WinMinX, WinMinY, WinMaxX and WinMaxY helper functions changed to return 0 based result, which results in slightly more optimal code in a lot of places
git-svn-id: trunk@25453 -
2013-09-11 14:18:30 +00:00
lacak
47f9c32f11 fcl-db: tests: fix TestStreamingNullFieldsXML (only fields which are not required and not readonly can be set to Null)
git-svn-id: trunk@25452 -
2013-09-11 12:05:20 +00:00
lacak
91783105cc fcl-db: tests: improve testing Blobs (use not only ascii characters, but also binary data etc.)
git-svn-id: trunk@25451 -
2013-09-11 10:48:44 +00:00
paul
385fc9cb37 compiler: remove strange nowhere used define
git-svn-id: trunk@25450 -
2013-09-11 03:06:47 +00:00
nickysn
8251031adf - rm redundant double initialization of regs.realecx from Crt.CursorOn
git-svn-id: trunk@25448 -
2013-09-10 15:28:39 +00:00
nickysn
d64cea05df - rm redundant double initialization of regs.realecx from Crt.CursorOn
git-svn-id: trunk@25447 -
2013-09-10 15:28:01 +00:00
nickysn
e7cbd41670 - rm redundant double initialization of regs.cx from Crt.CursorOn
git-svn-id: trunk@25446 -
2013-09-10 15:27:06 +00:00
nickysn
76cbda0983 + 83/84-key keyboard support added to unit crt
git-svn-id: trunk@25445 -
2013-09-09 20:55:08 +00:00
nickysn
766b7745bd * counter variable in CrtWrite changed to SmallInt in order to generate more efficient code on the 16-bit i8086
git-svn-id: trunk@25444 -
2013-09-09 12:29:13 +00:00
sergei
5de4bdac40 * tx86addnode.second_cmpfloat: use getresflags() to reduce code duplication.
git-svn-id: trunk@25443 -
2013-09-09 11:25:49 +00:00
nickysn
5ffca2e66f * CrtOpen, CrtClose, CrtRead, CrtWrite and CrtReturn changed to procedures, instead of functions
git-svn-id: trunk@25442 -
2013-09-08 21:22:40 +00:00
nickysn
4f96e8a20d * convert i8086 inline asm instruction 'call symbol' to 'call far symbol' in memory models with far code
git-svn-id: trunk@25438 -
2013-09-08 16:34:12 +00:00
nickysn
5a42a8d707 + added an i8086 test tfarcal1.pp, which tests calling a far procedure from within inline asm code
git-svn-id: trunk@25435 -
2013-09-08 13:43:52 +00:00
florian
b4481544ef * work with actualtargetnode when checking load nodes for cse
git-svn-id: trunk@25434 -
2013-09-07 17:44:44 +00:00
florian
dc567acc9a * accumulate register weight instead of taking only the maximum
git-svn-id: trunk@25433 -
2013-09-07 17:44:41 +00:00
Jonas Maebe
cde2d1b8ee o merged cpstrrtl branch (includes unicode branch). In general, this adds
support for arbitrarily encoded ansistrings to many routines related to
    file system access (and some others).
    
  WARNING: while the parameters of many routines have been changed from
    "ansistring" to "rawbytestring" to avoid data loss due to conversions,
    this is not a panacea. If you pass a string concatenation to such a
    parameter and not all strings in this concatenation have the same
    code page, all strings and the result will be converted to
    DefaultSystemCodePage (= ansi code page by default). In particular,
    concatenating e.g. an Utf8String with a constant string and passing
    the result to a RawByteString parameter will convert the result into
    the DefaultSystemCodePage (unless the source code is compiler with
    {$modeswitch systemcodepage} or {$mode delphiunicode} *and* the ansi
    code page on the system you are compiling *on* happens to be UTF-8)
    
    You can define and use alternative routines that explicitly accept
    Utf8String parameters to avoid this pitfall. Internally, all of these
    routines ensure that they never trigger this condition and ensure that
    not unnecessary/unwanted code page conversions occur.

  + DefaultFileSystemCodePage variable that holds the code page used for
    communicating with the OS single byte file system APIs, and for the
    strings returned by those same APIs. Initialized with
   o the result of GetACP in the system unit of Windows platforms, except for
     WinCE which uses UTF-8 since its file system OS API calls already use
     the UTF-16 versions
   o CP_UTF8 on Unix platforms with FPCRTL_FILESYSTEM_UTF8 defined, and with
     DefaultSystemCodePage on other Unix platforms
   o DefaultSystemCodePage on Java/Android JVM targets
  + DefaultRTLFileSystemCodePage variable that holds the code page used to
    encode strings returned by RTL routines that return filenames obtained
    from OS API calls. By default the same as DefaultFileSystemCodePage on
    all platforms. Separate from DefaultFileSystemCodePage for clarity on
    platforms that may use either utf-16 or single byte OS API calls to
    send/receive file names (such as most Windows platforms)
  + new scpFileSystemSingleByte enum that can be passed to
    GetStandardCodePage() to get the default code page for OS single byte file
    system APIs, with implementations for Unix and Windows
  + SetMultiByteFileSystemCodePage() procedure to override the value of
    DefaultFileSystemCodePage
  + ToSingleByteFileSystemEncodedFileName() function to convert a string to to
    DefaultFileSystemCodePage (does *not* take care of OS-specific quirks like
    Darwin always returning file names in decomposed UTF-8)
  + support for CP_OEMCP
  * textrec/filerec now store the filename by default using widechar. It is
    possible to switch back to ansichars using the FPC_ANSI_TEXTFILEREC define.
    In that case, from now on the filename will always be stored in
    DefaultFileSystemEncoding
  * fixed potential buffer overflows and non-null-terminated file names in
    textrec/filerec

  * when concatenating ansistrings, do not map CP_NONE (rawbytestring) to
    CP_ACP (defaultsystemcodepage), because if all input strings have the
    same code page then the result should also have that code page if it's
    assigned to a rawbytestring rather than getting defaultsystemcodepage
  * do not consider empty strings to determine the code page of the result
    in fpc_AnsiStr_Concat_multi(), because that will cause a different
    result than when using a sequence of fpc_AnsiStr_Concat() calls (it
    ignores empty strings to determine the result code page) and it's also
    slower

  * do not consider the run time code page of the destination string in
    fpc_AnsiStr_Concat(_multi)() because Delphi does not do so either. This
    was introduced in r19118, probably to hide another bug + test
  * never change the code page of a non-empty string when calling setlength on
    it

  * handle the fact that GetEnvironmentStringsA returns the environment in the
    OEM instead of in the Ansi code page (mantis #22524, #15233)
  * don't truncate environment variable strings in GetEnvironmentString(),
    its result is now ansistring/unicodestring depending on whether the
    RTL was compiled with FPC_RTL_UNICODE

  * unix:
   o made the ansistring parameters of the fp*() file system routine overloads
     constant, changed them to rawbytestring and added
     DefaultFileSystemCodePage conversions
   o unicodestring support for POpen(), and DefaultFileSystemCodePage support
     for POpen(RawByteString)

  + DefaultFileSystemCodePage support for dynlibs unit

  + rawbytestring/unicodestring overloads for:
   o system: fexpand, lowercase, uppercase, getdir, mkdir, chdir, rmdir,
     assign, erase, rename
   o objpas: AssignFile, 
   o sysutils: FileCreate, FileOpen, FileExists, DirectoryExists, FileSetDate,
     FileGetAttr, FileSetAttr, DeleteFile, RenameFile, FileSearch, ExeSearch,
     FindFirst, FindNext, FindClose, FileIsReadOnly, GetCurrentDir,
     SetCurrentDir, ChangeFileExt, ExtractFilePath, ExtractFileDrive,
     ExtractFileName, ExtractFileExt, ExtractFileDir, ExtractShortPathName,
     ExpandFileName, ExpandFileNameCase, ExpandUNCFileName,
     ExtractRelativepath, IncludeTrailingPathDelimiter,
     IncludeTrailingBackslash, ExcludeTrailingBackslash,
     ExcludeTrailingPathDelimiter, IncludeLeadingPathDelimiter,
     ExcludeLeadingPathDelimiter, IsPathDelimiter, DoDirSeparators,
     SetDirSeparators, GetDirs, ConcatPaths, GetEnvironmentVariable

    -- the default string type used by FindFirst/Next depends on whether the
      RTL was compiled with FPC_RTL_UNICODE. To force the RawByteString
      version pass a TRawByteSearchRec, for the UnicodeString version pass
      a TUnicodeSearchRec.

  + paramstr(longint):unicodestring available for {$modeswitch unicodestrings}

  + pwidechar versions in sysutils of strecopy, strend, strcat, strcomp,
    strlcomp, stricomp, strlcat, strrscan,strlower, strupper, strlicomp,
    strpos, WideStrAlloc, StrBufSize, StrDispose + tests
    

git-svn-id: trunk@25432 -
2013-09-06 11:04:32 +00:00
Jonas Maebe
de56f909d5 * synchronized with trunk up to and including r25430
git-svn-id: branches/cpstrrtl@25431 -
2013-09-06 10:09:26 +00:00
Jonas Maebe
f539e9158a * small change to r24997: also use the {$modeswitch unicodestrings} state to
determine whether (wide)char->pchar will be preferred over (wide)char ->
    p(wide)char or not (always convert to pchar if mode switch is not active,
    otherwise always to pwidechar). Delphi-compatible + consistent with the
    behaviour added for constant strings in that revision + tests

git-svn-id: branches/cpstrrtl@25430 -
2013-09-06 08:02:59 +00:00
Jonas Maebe
b3b404db4b * handle any char constant -> p(wide)char conversions via cunicodestringtype
because the compiler cannot convert arbitrary unicodechar constants at
  compile time to a shortstring (since it doesn't know the code page to use)
  (test part of next commit)

git-svn-id: branches/cpstrrtl@25429 -
2013-09-06 08:02:52 +00:00
Jonas Maebe
3c3ad705f1 * changed fpc_(u)char_to_shortstr() from a procedure into a function, like
the other fpc_(u)char_to_*str() routines (exception dates back to the
    time calls to these routines were still inserted "manually" in the
    compiler). Fixes the compilation of "shortstr:=widecharconstant" after
    r23613 and simplifies other code calling this helper + test

git-svn-id: branches/cpstrrtl@25428 -
2013-09-06 08:02:46 +00:00
florian
e0f48b9f02 * calculate stack correction on exit correctly if stack parameters are passed
git-svn-id: trunk@25427 -
2013-09-05 21:40:33 +00:00
florian
36e6f99843 * fix tthumbcgarm.g_flags2reg, mov reg,#imm for thumb updates the flags
git-svn-id: trunk@25426 -
2013-09-05 21:40:30 +00:00
sergei
5039ddc4a7 * Changed definition of XMM register save area from array to record, removes compilation warnings about reference size mismatch. The cause of warnings is rautils.getrecordoffsetsize function which, for array types, returns size of element and not size of array itself.
git-svn-id: trunk@25425 -
2013-09-05 12:39:16 +00:00
sergei
7e6a7f20cc - Removed unused variables and dead assignments.
git-svn-id: trunk@25424 -
2013-09-05 09:05:56 +00:00
paul
8d526e9b07 compiler: add a check for srsym <> nil since try_consume_unitsym may change srsym to nil, better error message
git-svn-id: trunk@25423 -
2013-09-05 08:39:10 +00:00
paul
3f2e62874b compiler: handle unit, namespace and class/record/object prefixes before identifiers while parsing {$IF ...} expressions (fixes mantis #0020996)
git-svn-id: trunk@25422 -
2013-09-05 07:05:19 +00:00
paul
4fd0245120 compiler: fix indentation
git-svn-id: trunk@25421 -
2013-09-05 06:29:06 +00:00
paul
1b81afcd42 compiler: allow to hide parent function identifier inside them (by a nested function with the same name or by a local variable). Fixes mantis #0024129.
git-svn-id: trunk@25420 -
2013-09-05 01:10:04 +00:00
paul
d25ae84113 compiler: don't output an error twice in 'on Exception do' block if Exception is not a valid type
git-svn-id: trunk@25419 -
2013-09-05 00:46:26 +00:00
florian
e2ec3bbcb0 * do shifts for sign/zero extensions correctly
git-svn-id: trunk@25418 -
2013-09-04 21:00:46 +00:00
florian
a240e74591 * check cputhumb/cputhumb2 to detect instruction set
git-svn-id: trunk@25417 -
2013-09-04 21:00:44 +00:00
florian
6f11e3f316 * clz is only available on thumb2/arm
git-svn-id: trunk@25416 -
2013-09-04 21:00:01 +00:00
Jonas Maebe
d2bad665fa * fixed a_op_*_reg() for OP_NOT/OP_NEG (due to the register allocation the
generated code often was still valid though)

git-svn-id: trunk@25415 -
2013-09-04 19:16:59 +00:00
sergei
da2887a4ec * x86_64-win64: SEH finalization procedures have frame pointer set to RBP but since r25389 they save registers relative to RSP. Fixed offsets for .seh_savereg/.seh_savexmm directives.
* In epilogue, deallocate current_procinfo.framepointer, not RBP.

git-svn-id: trunk@25414 -
2013-09-04 15:31:55 +00:00
Károly Balogh
2c49af3191 added missing closing parentheses
git-svn-id: trunk@25413 -
2013-09-04 14:56:53 +00:00