Reverse Polish Notation

I would like to learn more abut RPN to write gauges code. Up to now I could not find any document that describes the RPN syntax like what operators and statements are supported and the use of white space (required, possible, forbiden). Is there any such document for FSX or else where can I find such information? If no such document exists has anybody written his own RPN cheatsheet that I could use?

I also would like to know if developers 'normally' code in RPN directly or if a tool is used that translates 'normal' code into RPN (I am aware of Infix2Postfix from the FSX SDK).

Thanks a lot for your answers
Hannes
 

n4gix

Resource contributor
I would like to learn more abut RPN to write gauges code. Up to now I could not find any document that describes the RPN syntax like what operators and statements are supported and the use of white space (required, possible, forbiden). Is there any such document for FSX or else where can I find such information? If no such document exists has anybody written his own RPN cheatsheet that I could use?
See this site for XML tutorials:
Welcome to the fs2x Tutorials Page.
This is the page to get XML coding information, an XML reference list, 'student' produced gauges, and a number of guest tutorials.
 

tgibson

Resource contributor
The SDKs contain a document on XML gauge coding, which contains listings for most of the valid operators. Some others may work too though.
 
Thanks a lot for your answers! My mistake was that I assumed RPN is not just a methode to write code but actually a coding language (which it is not!). Since I found the coding definitions in the SDK which is what I have been looking for. And to have tutorials how gauges are coded is great.
 
I have a further question to the code section of a gauge. A good many informations I can find to this refer to FS2004. My question:

Are there any known differences (in the code section of a gauge) between FS2004 and FSX? Like new / changed operators, statements and other syntax elements. I am aware that idenifiers and id's have changed but these I can lookup in the FSX SDK.
 

n4gix

Resource contributor
Hannes, I've found that aside from a few rarely used operators (such as rotating an arc or pie), there is nothing that the so-called "FSX XML Syntax" can accomplish that cannot be done in the previous "FS2004" syntax.

In addition, FS2004 syntax is much less verbose and faster to script.
 

tgibson

Resource contributor
That said, there are a few commands that are treated differently in FSX vs FS2004, so if writing gauges for both sims you do need to be aware of this. For example, fuel density is handled differently and the FS version must be detected and the proper code activated. I use a macro for this.

XML:
    <!--  Determine fuel density for FS2004 (pounds per gallon) or FSX (pounds).  FSX will return 0 for pounds per gallon, but FS9 does NOT return 0 for pounds. -->
    <Macro Name="Fuel_Weight"> (A:Fuel weight per gallon, pounds per gallon) 0 == if{ (A:Fuel weight per gallon, pounds) } els{ (A:Fuel weight per gallon, pounds per gallon)  } </Macro>
 

rcbarend

Resource contributor
Thanks a lot for your answers! My mistake was that I assumed RPN is not just a methode to write code but actually a coding language (which it is not!).
Right.
RPN is not a coding language, but a method to exchange information (operators, data) based on a stacked-memory.
As used in calculator devices a long time ago (and probably still)

And as such, I wouldn't even classify XML as a real programming language; originally intended to structure information in data/documents.
Microsoft just used that same principles for flightsim, so it just looks a bit like a sequential programming language.

In that aspect: the old-style FS9 XML syntax looks more like a "programming language" then the FSX XML syntax.
Like Bill, I've never seen any advantage to use the FSX XML syntax in my gauges (works in FS9, FSX and even P3Dv4).
Allthough, as Tom stated, there are some subtill difference between these various Flightsim versions.
But these are generally not related to the syntax of XML, but to events and variables you can use, and how they are set/interpreted by the sim.

Rob
 
Again thanks a lot for your answers. @tgibson: I really love things that are almost the same! But I think you learn such fine details only after searching for hours why the damm gauge is not working. @rcbarend: That XML is not a coding language that I am aware; it is just to structrue data. I used XML quite a bit during my professional life.

In your answers the terms 'FS9 XML' and 'FSX XML' have been used. I assume this refers to the XML descriptions in the FS2004 SDK and the FSX SDK. In case I am wrong where could I find more information about 'FS9 XML' and 'FSX XML' and their differences?

Hannes
 

tgibson

Resource contributor
For me the easiest way I got information on both formats was to examine gauges made with each format. Especially similar gauges (i.e. altimeters) made in the two different formats. But my gauges need to be FS2004 compatible so I stuck with that.
 
In your answers the terms 'FS9 XML' and 'FSX XML' have been used. I assume this refers to the XML descriptions in the FS2004 SDK and the FSX SDK. In case I am wrong where could I find more information about 'FS9 XML' and 'FSX XML' and their differences?
FS9 XML and FSX XML are another way of saying FS9 XML Schema and FSX XML Schema. Do a search for Schema in This Forum (upper right hand corner of this page) and you'll get lots of hits.

Hope this helps,

Bob
 
Thanks a lot for your ansers! @rpmc: Very helpful hint. As a result of a search for Schema I have the impression that all the gauges I have been looking at were all written in FS9 XML schema. Question: Is there anywhere an XSD to be found for the FS9 XML and the FSX XML?
 
There are no .XSD's for either.
In FS9 there was .DTD & .XDR (pick your poison) - located in FS2004SDK\Panels_SDK\inc. If they are anything like the FS8 (2002) versions they are very restrictive, buggy and in need of some mods in order to validate even the most basic of gauges.
For FSX there is no schema validator at all unless you are planning to use the ace.exe simprop compiler. For a reference only you could see SDK\SimObject Creation Kit\Panels and Gauges SDK\PropDefs\propgauge.xml. This acts as a validator during the compile process.

Roman
 
Last edited:
Top