Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Sonstige Fragen zu Delphi (https://www.delphipraxis.net/19-sonstige-fragen-zu-delphi/)
-   -   Delphi TMS Unicode Components und RAD2009 (https://www.delphipraxis.net/136077-tms-unicode-components-und-rad2009.html)

messie 23. Jun 2009 08:01


TMS Unicode Components und RAD2009
 
Moin,

ich war ja gestern am rätseln, wo die Suchpfade einzustellen waren. Heute habe ich bemerkt, dass es nicht an den Suchpfaden lag, sondern an der netten Anweisung
Delphi-Quellcode:
{$IFNDEF DELPHI_UNICODE}
Scheint also, als hätte TMS eine Art Selbstzerstörungsmechanismus eingebaut. Für mich ist das ungünstig, weil ich keine Lust habe, alle alten Quellen umzuschreiben.

Wo ist denn DELPHI_UNICODE festgelegt? Hat da jemand das Problem schon gehabt?

Grüße, Messie

Bernhard Geyer 23. Jun 2009 08:12

Re: TMS Unicode Components und RAD2009
 
Zitat:

Zitat von messie
Wo ist denn DELPHI_UNICODE festgelegt?

Glaskugel auspack (alte TMS-Version): Schau mal in die tmsdefs.inc (oder andere *.inc-Datei die es geben sollte).

messie 23. Jun 2009 08:34

Re: TMS Unicode Components und RAD2009
 
Danke, gute Idee.
Delphi-Quellcode:
{$ifdef Win32}

  {$ifdef VER200}
    {$define COMPILER_10}
    {$define DELPHI}
    {$define DELPHI_10}
    {$define DELPHI_UNICODE}
  {$endif}
Verstehe ich das richtig, dass der Compiler seine eigene Versionsnummer wie eine Compilerdirektive behandelt?

Grüße, Messie

himitsu 23. Jun 2009 09:23

Re: TMS Unicode Components und RAD2009
 
Liste der Anhänge anzeigen (Anzahl: 1)
Diese ja, aber es gibt notfalls auch noch eine Konstante

die Konstante könnte man nun per Compilerdirektive abfragen, oder auch dirtekt im Code verwenden und sie ist virtuell in der System-Unit definiert:
Delphi-Quellcode:
{$IFDEF CONDITIONALEXPRESSIONS}
  {$IF CompilerVersion >= 20.0} {$DEFINE Delphi2009plus} {$IFEND}
{$ENDIF}

IF CompilerVersion >= 20 Then ...
da gibt es auch eine Constante für die verwendete RTL
und ich hab grad die Lizenz gefunden :nerd:
Delphi-Quellcode:
unit System;

...

interface

(* You can use RTLVersion in $IF expressions to test the runtime library
  version level independently of the compiler version level.
  Example: {$IF RTLVersion >= 16.2} ... {$IFEND}                  *)

const
  RTLVersion = 20.00;

{$EXTERNALSYM CompilerVersion}

(*
const
  CompilerVersion = 0.0;

  CompilerVersion is assigned a value by the compiler when
  the system unit is compiled. It indicates the revision level of the
  compiler features / language syntax, which may advance independently of
  the RTLVersion. CompilerVersion can be tested in $IF expressions and
  should be used instead of testing for the VERxxx conditional define.
  Always test for greater than or less than a known revision level.
  It's a bad idea to test for a specific revision level.
*)

{$IFDEF DECLARE_GPL}
(* The existence of the GPL symbol indicates that the System unit
  and the rest of the Delphi runtime library were compiled for use
  and distribution under the terms of the GNU General Public License (GPL).
  Under the terms of the GPL, all applications compiled with the
  GPL version of the Delphi runtime library must also be distributed
  under the terms of the GPL.
  For more information about the GNU GPL, see
  [url]http://www.gnu.org/copyleft/gpl.html[/url]

  The GPL symbol does not exist in the Delphi runtime library
  purchased for commercial/proprietary software development.

  If your source code needs to know which licensing model it is being
  compiled into, you can use {$IF DECLARED(GPL)}...{$IFEND} to
  test for the existence of the GPL symbol. The value of the
  symbol itself is not significant.  *)

const
  GPL = True;
{$ENDIF}

PS: falls du dich nicht auf die Versionsnummer stützen willst, dann kannst du auch andere Merkmale abfragen, denn ab der nächsten Delphiversion müßtest du deine Versionsabfrage wieder anpassen (abgesehn vorm vorherigen Beispiel, aber VER200 wird da nicht mehr definiert sein)
denn:
siehe Code weiter oben
It's a bad idea to test for a specific revision level.


Delphi-Quellcode:
{$UNDEF UseUnicode}
{$IFDEF CONDITIONALEXPRESSIONS}
  {$IF SizeOf(Char)=2} {$DEFINE UseUnicode} {$IFEND}
{$ENDIF}
oder falls man nur wissen möchte, ob ein gestimmter Datentyp vorhanden ist
Delphi-Quellcode:
{$UNDEF SupportUnicode}
{$IFDEF CONDITIONALEXPRESSIONS}
  {$IF Declared(UnicodeString)} {$DEFINE SupportUnicode} {$IFEND}
{$ENDIF}

hatte so bis vor knapp 1,5 Jahren immer soeine Datei verwendet (sowas gibt es auch in den JEDIs),
aber inzwischen stütze ich mich oftmals nur noch direkt auf Feature-Checking und spar mir das Dazulegen einer weiteren Datei, vorallem wenn es mir in dem Code nur um ein/zwei Dinge geht.


PS:
Delphi-Quellcode:
{$IFDEF CONDITIONALEXPRESSIONS}
ist in "neueren" mindestens seit Delphi 6 (weiß es nicht genau) nicht mehr nötig, da diese das {$IF } kennen.

messie 25. Jun 2009 10:15

Re: TMS Unicode Components und RAD2009
 
Ich habe mal versucht, ein wenig an den Einstellungen der TntCompilers.inc rumzubasteln. Es geht immer wieder schief, weil die Abhängigkeiten zu groß sind. Wenn ich DELPHI_UNICODE nicht setze, gibt es wegen der hohen Versionsnummer des Compilers Späne in den TMS Tools. Wenn ich alles auf den vorherigen Zustand setze (D6) fehlen mir wieder viele Features die ich eigentlich gerade gekauft hatte.
Sieht so aus, als hätte TMS den Übergang nur sehr halbherzig gemacht.

Hat noch jemand damit Erfahrungen gemacht?

Grüße, Messie


Alle Zeitangaben in WEZ +1. Es ist jetzt 00:09 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz