Jump to content
Sign in to follow this  
barryward12345

What is the language of this coding?

Recommended Posts

I understand the basic Syntax of XML -- for example the need for correct "nesting" , etc .I understand the various XML "TAGS" that "do " things in the XML files. I understand that it all works using RPN (Reverse Polish Notation" - very diffucult to get your head around , but you can get information to helpBut what I CANT understand is -- what language is this??(L:adfhz1,Kilohertz) 0 == if{ (A:ADF1 ACTIVE FREQUENCY, Kilohertz)(>L:adfhz1,Kilohertz) } els{ (L:adfhz1,Kilohertz) s0 1000 < if{ l0 10 * near10000 % d 10 % r 10 / int d 10 % r 10 / int d 10 % r 10 / int 16 * + 16 * +16 * + (>K:ADF_LOWRANGE_SET) } els{ l0 10 * near 10000 % d 10 % r 10 / int d10 % r 10 / int d 10 % r 10 / int 16 * + 16 * + 16 * +(>K:ADF_HIGHRANGE_SET) } }Could somebody describe in ENGLISH what this staement is saying.And then could you put it into a computer language that I do understand (BASIC) .Any help would be much appreciated . I "think" that I can see that essentially it is a very basic thing - even though it looks extrmely complex.Barry

Share this post


Link to post
Share on other sites
Guest

Er........this is still XML.The code is from my aircraft panel for my C4SST aircraft package.A bit of background. This is from my radio frequency memory bank, where active radio frequencies can be stored, and retrieved later simply by clicking. Note that the frequencies are stored as numbers (see later in text).Basically, when you click in the 'memory' box, the current active frequency is stored in this box. If the active frequency is changed for whatever reason, clicking the 'memory' box will install the memorised frequency back into the active part of the radio. There is also a 'clear' box you can click to clear the memory box. The code you have shown just happens to come from my ADF memory, there are others for the other radio types, and (L:adfhz1,Kilohertz) shows we are dealing with the first stored memory and is stored as a number with the variable name adfhz1.So, when you click the 'memory' box............(L:adfhz1,Kilohertz) 0 ==checks to see if the box is empty. If it is empty,if{ (A:ADF1 ACTIVE FREQUENCY, Kilohertz) (>L:adfhz1,Kilohertz) }sets adfhz1 to the current active frequency and is memorised with this variable name. If it is not empty, that is, a frequency has been previously stored, the memorised value will be reinstalled as the radio active frequency and done byels{ (L:adfhz1,Kilohertz) s0 1000 < if{ l0 10 * near 10000 % d 10 % r 10 / int d 10 % r 10 / int d 10 % r 10 / int 16 * + 16 * + 16 * + (>K:ADF_LOWRANGE_SET) }Two things here, the first is to compare to 1000, and if less than 1000, set the radio to low range,that is,(L:adfhz1,Kilohertz) s0 1000 < if{ l0 10 * near 10000 % d 10 % r 10 / int d 10 % r 10 / int d 10 % r 10 / int 16 * + 16 * + 16 * + (>K:ADF_LOWRANGE_SET) }and if greater than 1000,els{ l0 10 * near 10000 % d 10 % r 10 / int d 10 % r 10 / int d 10 % r 10 / int 16 * + 16 * + 16 * + (>K:ADF_HIGHRANGE_SET) }The second thing is the code l0 10 * near 10000 % d 10 % r 10 / int d 10 % r 10 / int d 10 % r 10 / int 16 * + 16 * + 16 * + The l0 (note, lower case L plus zero) brings the stored number back to the top of the stack. FS2002 will not accept a number as a frequency. The above code converts the number into something FS2002 understands. It is called BCD (Binary Coded Decimal) conversion. Arne Bartels came up with this device.Without going into great depth and explaining how the BCD conversion works, I think that explains what the code does. Do a search for BCD in this forum for more information.I hope this has helped.Nick Pike.

Share this post


Link to post
Share on other sites

Nick Thanks for that -- I will just have to go slowly through this piece of "code" and see if I can follow it.BTW , I like your C4SST -- actually, I downloaded it specifically for the reason that it contains lots of XML gauges and code. There is so much to learn - associated with FS2002 . I am slowly getting there but keep getting sidetracked .Regards Barry

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Tom Allensworth,
    Founder of AVSIM Online


  • Flight Simulation's Premier Resource!

    AVSIM is a free service to the flight simulation community. AVSIM is staffed completely by volunteers and all funds donated to AVSIM go directly back to supporting the community. Your donation here helps to pay our bandwidth costs, emergency funding, and other general costs that crop up from time to time. Thank you for your support!

    Click here for more information and to see all donations year to date.
×
×
  • Create New...