Moving to MCA 2.6

From Mca2
Revision as of 14:16, 26 September 2012 by Musiol (Talk | contribs)

Jump to: navigation, search

Now you will change the edges of the calculator to a xml basis. Through this the edges wont be pre-defined by the code, but in xml and connected live with the program start.


1 Scons interactive console and directory console

First you switch to an interactive mode by typing

  scons --interactive -j9

into the console in our homefolder ../mca2

This is a timesaving step which is only useful when you do not edit or change SConscript. This will be your building console called scons console.

You will need a second console to start your programs, which we call directory console. Splitting your console window is done by holding ctr + left shift + t. Now you can switch between the two windows with ctr + left shift + up/down.

2 Building the mcaeditor

Now you open our calculator in mcaeditor. First we have to build the editor by typing

  b mcaeditor

into the scons console.

3 Creating xml file

Create a folder xml in ../projects/calculator/etc/ by typing into the directory console:

  mkdir xml

4 Starting the mcaeditor

Open the newly built editor in your directory console by typing


The MCAeditor will now create an xml file for us, by marking PocketCalc and chosing Generate XML Recursive under File. MCAeditor.png

Save the file under ../projects/calculator/etc/xml with the recommended title.

Now we close the editor and comment out/delete the edges we defined in gpocketCalc.cpp, save the file build the calculator new.

  scons console: b pcalc

The next command opens pcalc with respect to the just created xml file.

  directory console ../projects/calculator:  pcalc -x etc/xml/gPocketCalc-PocketCalc.xml 

5 Overview in Mcaeditor and Explanation

We can now open pcalc with the mcaeditor and see that the calculator looks like the old calculator with the same connections and edges.

  directory console ../projects/calculator: mcaeditor pcalc

Why did we switch to the xml files if the calculator is now the same as before?

What we actually did is switch from enums to strings (or in other words we switched from numbers to names). This makes it much easier to control the edges. Assume we have a file with over a hundred edges and we would like to add a new edge in the middle block. If we add the new edge all the enums below our new edge change the channel. This leads to a new configuration which we have to redirect manually. It is easy to understand that connecting "mAdd" to "mMultiplexer" is much simpler than connecting channel 3 to channel 6. To see an example of the xml edges expressed in words. open the xml file you created above.


                   <Description>Calculation Type MUX </Description>
               <ToDescription>00 Result</ToDescription>
Personal tools