• Which the release of FS2020 we see an explosition of activity on the forun and of course we are very happy to see this. But having all questions about FS2020 in one forum becomes a bit messy. So therefore we would like to ask you all to use the following guidelines when posting your questions:

    • Tag FS2020 specific questions with the MSFS2020 tag.
    • Questions about making 3D assets can be posted in the 3D asset design forum. Either post them in the subforum of the modelling tool you use or in the general forum if they are general.
    • Questions about aircraft design can be posted in the Aircraft design forum
    • Questions about airport design can be posted in the FS2020 airport design forum. Once airport development tools have been updated for FS2020 you can post tool speciifc questions in the subforums of those tools as well of course.
    • Questions about terrain design can be posted in the FS2020 terrain design forum.
    • Questions about SimConnect can be posted in the SimConnect forum.

    Any other question that is not specific to an aspect of development or tool can be posted in the General chat forum.

    By following these guidelines we make sure that the forums remain easy to read for everybody and also that the right people can find your post to answer it.

G:Vars

My original point was

]It suggests that all the "case" expressions are evaluated - not just the one that's actually selected?

I suggest that's still correct.

All expressions are evaluated by the parser, without caring about case, and, +, - etc. Is really so difficult for you to understand this??

Tom
 
All expressions are evaluated by the parser, without caring about case, and, +, - etc. Is really so difficult for you to understand this??

Tom
Is it really so difficult for you to accept that "all the "case" expressions are evaluated - not just the one that's actually selected"?

What evaluates them is irrelevant here - they are evaluated. XML seems inefficiently to evaluate all the expressions and then select the appropriate one. In the worst scenario 27 such expressions would be evaluated when only the result of one evaluation is needed. Other languages (C/C++) select the required expression and only evaluates that.




Code:
 
Is it really so difficult for you to accept that "all the "case" expressions are evaluated - not just the one that's actually selected"?

What evaluates them is irrelevant here - they are evaluated. XML seems inefficiently to evaluate all the expressions and then select the appropriate one. In the worst scenario 27 such expressions would be evaluated when only the result of one evaluation is needed. Other languages (C/C++) select the required expression and only evaluates that.


But there ain't case expressions!! Only stack member values and case as an operator, acting similar to any other operator like + - * , etc. Would you say that the "+" operator does an evaluation of two numbers, or just an addition of two values that have been evaluated previously (otherwise they wouldn't be present in the stack) ? If it's the first case for you then ok, I could understand your POV, however I strongly believe in the second meaning. I think this is kinda semantic discussion that leads to nothing.
And I don't think XML parser is inefficient; I am almost sure it uses assembler functions to do the parsing, pushing and popping stack byter, jumping to macro scripts memory areas, etc, etc, all managed by low level code. If you think assembler isn't fast enough...

Tom

Edit: I think I got your point. You argue that n values need to be pushed onto the stack just to extract only one. So what? In C++ you still need to code the complete content of a select function, not only the one that is being selected and jumped in; and this also occupies bytes in memory. For simple operations like the ones the XML parser does, (like case for example) I don't think I could find a more efficient function in any high level language like C/C++.
 
Last edited:
Consider the simple example case statement

Code:
 (L:Var1, number) (L:Var2, number) * (L:Var2, number)  (L:Var3,number) * (L:Var3, number)  (L:Var4, number) * 3 (L:CaseVar, number) case

Surely this consists of 3 "case" expressions -

Code:
(L:Var1, number) (L:Var2, number) *
(L:Var2, number)  (L:Var3,number) *
(L:Var3, number)  (L:Var4, number) *

all lf which have to be evaluated but only the one corresponding to (L:CaseVar, number) is used. Each evaluation takes unneccesary time.

C/C++ avoids this waste and also uses assembly code for execution!
 
So, all of this discussion just to state that C++ is a better code source than XML?? (which you don't like at all, obviously)

:eek:

Tom
 
So, all of this discussion just to state that C++ is a better code source than XML?? (which you don't like at all, obviously)

:eek:

Tom

No, but because my original innocuous statement that "all the "case" expressions are evaluated - not just the one that's actually selected" was disputed.
 
OK its officially weird.

Use G:Var1 in the code I have written it works perfectly.

If I replace G:Var1 with L:MAIW_FLAP_POS,number throughout all the code...

It doesn't work.

<code>
(A:GENERAL ENG COMBUSTION:1,bool)
if{ (L:MAIW_FLAP_POS,number) 0 == if{ (A:VELOCITY BODY Z,knots) 125 &lt; if{ (A:LIGHT BEACON,bool) 50 * } els{ 1 (&gt;L:MAIW_FLAP_POS,number) 0 } }
(L:MAIW_FLAP_POS,number) 1 == if{ (A:PLANE PITCH DEGREES,degrees) 0 &lt; (A:VELOCITY BODY Z,knots) 65 &lt; and if{ 2 (&gt;L:MAIW_FLAP_POS,number) 0 } 0 }
(L:MAIW_FLAP_POS,number) 2 == if{ (A:LIGHT STROBE,bool) (A:VELOCITY BODY Y,knots) 10 &lt; and if{ (A:VELOCITY BODY Z,knots) 55 &lt; if{ 100 } els{ (A:VELOCITY BODY Z,knots) 130 &lt; if{ 50 } els{ 0 } } } els{ (A:LIGHT STROBE,bool) if{ 1 (&gt;L:MAIW_FLAP_POS,number) 0 } els{ 0 } } } }
els{ 0 (&gt;L:MAIW_FLAP_POS,number) 0 }
</code>

Should add its an AI aircraft therefore no gauges.
 
Last edited:
Back
Top