Where are Oxygene Compiler Directives documented?

Hi,
we have an urgent demand to find the exact documentation for all compiler directives.
But in particular the one which turns on/off all the compatibility flags, such as . . .

<AllowLegacyOutParams>
</AllowLegacyOutParams>

http://docs.elementscompiler.com/Oxygene/Delphi/DelphiCompatibilitySettings/#q=out has the delphi compatibility otpions documented (Not the xml tags though)

    AllowLegacyCreate: System.Boolean; // Allow .Create for ctor calls
    AllowLegacyOutParams: System.Boolean; // Allow skipping out/var
    AllowLegacyWith: System.Boolean; // Allow "with" without a name
    AllowUnsafeCode: System.Boolean; // Allow unsafe code (not compatibility)
    DelphiCompatibility: System.Boolean; // Enables legacy keywords that don't do anything, like overload.
    DelphiDivide: System.Boolean; // Make the / operator forced "float"

Thank you Carlo
But how does the proper syntax look to be used in a .pas file for
AllowLegacyCreate
AllowLegacyOutParams
AllowLegacyWith
AllowUnsafeCode
DelphiCompatibility
DelphiDivide
Can you please provide this here OR enahnce the documentation accordingls. What I miss in the documentation is a LIST of ALL, a complete LIST of all Compiler Directives supported by Oxygene. If they are imporatant, then we should fine them in one place in the documentation…

Can I write it as
{$AllowLegacyWith ON/OFF/DEFAULT}
and, does CASE matter and I shall write it as
{$ALLOWLEGACYWITH ON/OFF/DEFAULT}
Its anoying, one never knows.

AND - What happens if DEFAULT is used.
What does the compiler use as DEFAULT for each one.
It is important for me because I am suffering some bugs and like to understand what and why it happens.

Regards
Josef

Fwiw, these farted compiler directives. {$HIDE} is a compiler directive. These do not to map directly to compiler options (i.e. MSBuild properties), and many/most of the latter cannot be toggled via directives. Directives are case insensitive.

I misunderstood your question.

Here it goes; All state flags override the global flags; Default will reset them to what the global settings are:
{$PARAMETER X} oxygene.exe passed parameters will be passed as string here. Deprecated.
{$LINE n} where n can be “HIDDEN ( no debug info)”, “DEFAULT (make it work like it should)” “1 file.pas” makes it act like rthe following line is line 1 from file.pas
{$Q+/-}/{$OVERFLOW ON/OFF/DEFAULT} Overflow checking (makes integer overflow fail)
{$G+/-}{$GLOBALS ON/OFF/DEFAULT} Allow globals
{$R+/-}{$RANGE ON/OFF/DEFAULt} Range checking (not used; for delphi compatibility)
{$HIDE N123}{$HIDEMESSAGE N123} Hides message N123 (only for warnings/hints)
{$SHOW N123}/{$SHOWMESSAGE N123} Shows the message again
{$CROSSPLATFORM ON/OFF/DEFAULT} Enables cross platform warnings/hints mode.
{$TAILCALLS ON/OFF/DEFAULT}Allow tailcalls
{$DELPHI ON/OFF/DEFAULT}{$DELPHICOMPATIBILITY on/off/default} enables/disables delphi compat mode
{$WARNING abc} emits a warning
{$ERROR abc} emits an error
{$HINT abc} emits a hint
{$MESSAGE} emits a message
{$REGION, ENDREGION, HPPEMIT, EXTERNALSYM} ignored
{$INCLUDE file.inc}{$I file.inc} Include a file; Not recommended, provided for compatibility only.
{$DEFINE x} sets a define
{$UNDEF x} {$UNDFINE x} undefine something earlier defined
{$IFDEF/$IF expr} IF condition; supports OR, AND, NOT; only on defines
{$IFNDEF x} reverse of $IF
{$IFOPT x} for delphi compatibility; always acts like an undefined IF
{$ENDIF} end of $IF
{$ELSE} else condition
{$ELSEIF x} else if X condition

Tank you.

Before I go into a large story . . .

what is the syntax to be used in a pas file to toggel ON/OFF/DEFAULT any of the compatibility switches as shown in the project xml file, or as shown in the property page of Visual Studio.

Given, I like to turn ON or OFF for OUT/VAR parameter passing

{$ALLOWLEGACYOUTPARAMS ON}
So is that syntax correct, and can it be used?
Or do I have to write
{$LEGACYOUTPARAMS ON}

And, I think, what we have as a list of compiler directives NOW is NOT WHAT I CONSIDER “DOCUMENTED”. Sorry.

BTW: What are TAILCALLS ?

You can’t.

what does that mean, and why are you yelling?

Not per file/piece of code anyway, only globally. Why do you need this per file?

I am yelling a bit because we loose hours seeking something in the documentation to find out that the topic has only be explained once in the forum. But a forum is not what I consider documentation. No more no less to say.

Yes it was missing from the new docs site.

The reason I posted it here was because you mentioned it was urgent. The docs are being updated to add this information but adding new documentation is a little more involved than a simple forum reply.

Carlo, thank you, you understand my concerns.

The reason I wrote this topic here is, that when one turns ON all compatibility flags, the relevant entries in the project xml file are set to TRUE and some are NOT DEFINED, maybe that means DEFAULT. Then you turn em all OFF and the relevant entries in the project xms file are set to FALSE or are NOT DEFINED, maybe that means DEFAULT.

And now to my problem: Forcing with an editor in the project xml file AllowLegacyOutParams to TRUE, as one can not force it to TRUE otherwise, has no effect. And that may lead to the error E207 when we pass a parameter a such:

Decode ( lnr[i] ) // I think the compiler should pass the address of the integer no more no less

where lnr is an array of Integers and Decode defined as
PROCEDURE Decode ( var lnr : Array[1…100] of Integers );

In this case we like to see that turning ON or OFF AllowLegacyOut Params shows an effect.
The other important THING to know about that failure is, that in our case it is Oxygene version dependent.

Panos has an old version which works and does not emit E207
I have RemObjects Elements 8.2.89.1893.exe installed which does emit E207
Fredy has 8.3 installed and will now turn to a latest BETA, and he has not problem with E207

And we know, meanwhile that VS 2012 is no longer supported and our deps are working to upgrade us,
but that should not have an impact about the compiler. We can invoke the compiler direct if required.

I don’t know off-hand what error E207 is, but i can tell you that the defaults for these settings do not change willy-nilly between versions.

Indeed, the compiler works the same, regardless of VS version. This isn’t Delphi :wink:

http://docs.elementscompiler.com/Compiler/Directives/

FWIW, that link goes to a “page not found” for me.

Fixed. It got moved.

E207 is emitted in this case

If you call

E207Demo( new AClass );

procedure E207Demo( VAR a : AClass )
begin
end;

Then it is said that only local variables and fields can be passed in with VAR

Now in our case we call

E207Demo( lnr[i] );

where lnr is of type int_array which is an alias for SepzplaArray< Integer >
is then instantiated as

var lnr := new int_array(1,Max_TA);

In this case

E207Demo( lnr[i] );

raises the E207 error, even if only the address of an integer in a array has to be passed.
Fredy has a more appropriate explanation for this E207 !

Sorry Sepp, this is not an oxygene problem. Probably you mean the E0 internal compiler error you run into?

Your right, it is a foreseen Oxygene behavior.
Even we pass just an integer indexed out of an array, a special array.

1 Like