<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Recent changes to Home</title><link>https://sourceforge.net/p/cppviz/wiki/Home/</link><description>Recent changes to Home</description><atom:link href="https://sourceforge.net/p/cppviz/wiki/Home/feed" rel="self"/><language>en</language><lastBuildDate>Fri, 06 Jul 2018 20:48:01 -0000</lastBuildDate><atom:link href="https://sourceforge.net/p/cppviz/wiki/Home/feed" rel="self" type="application/rss+xml"/><item><title>Home modified by Georg Ulbrich</title><link>https://sourceforge.net/p/cppviz/wiki/Home/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v12
+++ v13
@@ -122,6 +122,100 @@

 Well, the specific landing functions/macros you will have to write for yourself :-)

+Finally, a translation for a complete example. First, the source code
+
+~~~
+/* Include the magick. */
+#include "cppviz.h"
+
+/* and some other stuff */
+#include &amp;lt;stdio.h&amp;gt;
+
+/*
+Create the data table for planets. The table name has to end
+with "_DATA", everything before "_DATA" will be the main name,
+here "PLANET". Sorry for the crude underscore parameters ...
+*/
+#define PLANET_DATA(_,__,___, T, A, E) \
+    T(_,__,___, int         , char *        , int    ) \
+    A(_,__,___, id          , name          , radius ) \
+    /*----------------------------------------------*/ \
+    E(_,__,___, MERCURY     , "Mercury"     , 2439   ) \
+    E(_,__,___, VENUS       , "Venus"       , 6051   ) \
+    E(_,__,___, EARTH       , "Earth"       , 6378   )
+
+/* Now, create the enum, simple as that! */
+ENUM(PLANET);
+
+/* We want to access the planets attributes, name and radius. Simple as that! */
+ATTRIBUTE(PLANET, 2);
+ATTRIBUTE(PLANET, 3);
+
+/* We also want the enum ELEMENT NAMES of all planets, simple as that! */
+NAMES(PLANET);
+
+/* The landing procedures, one for each planet. Your job to fill them ... */
+void PLANET_MERCURY_landing_procedure(int x, int y) { /* ... */ }
+void PLANET_VENUS_landing_procedure(int x, int y) { /* ... */ }
+void PLANET_EARTH_landing_procedure(int x, int y) { /* ... */ }
+
+/* Let the spaceship roll! */
+int main() {
+
+    /* Some totally relevant x, y coordinates. */
+    int x, y;
+
+    /* Print stuff for each planet, simple as that! */
+    FOREACH(PLANET, planet) {
+        printf("%s %s %d\n", PLANET_element_name[planet], PLANET_name[planet], PLANET_radius[planet]);
+    }
+
+    /* Perform the planet specific landing procedure. */
+    /* Yes, simple as that! */
+    PLANET planet;
+    /* ... */
+    SWITCH(PLANET, planet, landing_procedure(x, y));
+
+}
+~~~
+
+and the result is
+
+~~~
+typedef enum _e_PLANET { PLANET_MERCURY, PLANET_VENUS, PLANET_EARTH, } PLANET;
+char * PLANET_name[] = { "Mercury", "Venus", "Earth", };
+int PLANET_radius[] = { 2439, 6051, 6378, };
+const char * PLANET_element_name[] = { "MERCURY", "VENUS", "EARTH", };
+
+void PLANET_MERCURY_landing_procedure(int x, int y) { }
+void PLANET_VENUS_landing_procedure(int x, int y) { }
+void PLANET_EARTH_landing_procedure(int x, int y) { }
+
+int main() {
+    int x, y;
+
+    for (PLANET planet = (PLANET) 0; (int) planet &amp;lt; (0 + 1 + 1 + 1); planet = (PLANET) (((int) planet) + 1)) {
+        printf("%s %s %d\n", PLANET_element_name[planet], PLANET_name[planet], PLANET_radius[planet]);
+    }
+
+    PLANET planet;
+
+    switch (planet) {
+    case PLANET_MERCURY:
+        PLANET_MERCURY_landing_procedure(x, y);
+        break;
+    case PLANET_VENUS:
+        PLANET_VENUS_landing_procedure(x, y);
+        break;
+    case PLANET_EARTH:
+        PLANET_EARTH_landing_procedure(x, y);
+        break;
+    default:
+        break;
+    };
+
+}
+~~~
 # Technical details
 You guessed it, some conventions are called for.

&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Georg Ulbrich</dc:creator><pubDate>Fri, 06 Jul 2018 20:48:01 -0000</pubDate><guid>https://sourceforge.net69b19a033c411ce9a91314a8a177f2744a55958e</guid></item><item><title>Home modified by Georg Ulbrich</title><link>https://sourceforge.net/p/cppviz/wiki/Home/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v11
+++ v12
@@ -131,6 +131,7 @@
 4. The A-row describes the names of the attributes.
 5. The E-rows describe the elements of the enum.
 6. When using the ATTRIBUTE macro, the attribute index is 1-based and starts with the column of enum ids (MERCURY, VENUS, EARTH).
+7. At the moment, a data table can have up to 100 attributes, but if need be, you can increase this number by adjusting the line "n=100" in cppviz.h and running the Makefile.

 Thats about it, have fun!
 Georg
&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Georg Ulbrich</dc:creator><pubDate>Fri, 06 Jul 2018 20:39:35 -0000</pubDate><guid>https://sourceforge.netf39d51ef907c2371ba418f9495ada3e4530dae5a</guid></item><item><title>Home modified by Georg Ulbrich</title><link>https://sourceforge.net/p/cppviz/wiki/Home/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v10
+++ v11
@@ -126,11 +126,11 @@
 You guessed it, some conventions are called for.

 1. The naming scheme is that the name of the data table consists of the object name (PLANET) followed by "\_DATA".
-2. The signature (\_,\_\_,\_\_\_, T, A, E) of the data table macro is necessary. The underscore parameters are a technical necessity.
+2. The signature (\_,\_\_,\_\_\_, T, A, E) of the data table macro is mandatory. The underscore parameters are a technical necessity.
 3. The T-row in the data table describes the types of the attributes.
 4. The A-row describes the names of the attributes.
 5. The E-rows describe the elements of the enum.
-6. When using the ATTRIBUTE macro, the attribute index is 1-based and starts with the enum ids (MERCURY, VENUS, EARTH).
+6. When using the ATTRIBUTE macro, the attribute index is 1-based and starts with the column of enum ids (MERCURY, VENUS, EARTH).

 Thats about it, have fun!
 Georg
&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Georg Ulbrich</dc:creator><pubDate>Fri, 06 Jul 2018 20:31:54 -0000</pubDate><guid>https://sourceforge.net282e87f213469a07b185bf660702d9e4c738d6c6</guid></item><item><title>Home modified by Georg Ulbrich</title><link>https://sourceforge.net/p/cppviz/wiki/Home/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v9
+++ v10
@@ -86,7 +86,7 @@
 NAMES(PLANET);
 ~~~

-and this will create a table
+and this will create the array

 ~~~
 const char * PLANET_element_name[] = {
&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Georg Ulbrich</dc:creator><pubDate>Fri, 06 Jul 2018 20:29:22 -0000</pubDate><guid>https://sourceforge.net7099c2182d4c698e96cd3ddf2161519d1ec6617f</guid></item><item><title>Home modified by Georg Ulbrich</title><link>https://sourceforge.net/p/cppviz/wiki/Home/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v8
+++ v9
@@ -125,7 +125,7 @@
 # Technical details
 You guessed it, some conventions are called for.

-1. The naming scheme is, that the name of the data table consists of the object name (PLANET) followed by "\_DATA".
+1. The naming scheme is that the name of the data table consists of the object name (PLANET) followed by "\_DATA".
 2. The signature (\_,\_\_,\_\_\_, T, A, E) of the data table macro is necessary. The underscore parameters are a technical necessity.
 3. The T-row in the data table describes the types of the attributes.
 4. The A-row describes the names of the attributes.
&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Georg Ulbrich</dc:creator><pubDate>Fri, 06 Jul 2018 20:12:40 -0000</pubDate><guid>https://sourceforge.net89ac08d7ffec0d7104413dbb7050272a0e1dded1</guid></item><item><title>Home modified by Georg Ulbrich</title><link>https://sourceforge.net/p/cppviz/wiki/Home/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v7
+++ v8
@@ -43,22 +43,16 @@
 which is ... ehm ... kind of right :-) Well, if you can count it, you can iterate through it!

 ~~~
-int main() {
-    FOREACH(PLANET, x) {
-        printf("%d\n", (int) x);
-    }
-    return 0;
+FOREACH(PLANET, planet) {
+    printf("%d\n", (int) planet);
 }
 ~~~

 From this, the preprocessor will create

 ~~~
-int main() {
-    for (PLANET x = (PLANET) 0; x &amp;lt; (0 + 1 + 1 + 1); x = (PLANET) (((int) x) + 1)) {
-        printf("%d\n", (int) x);
-    }
-    return 0;
+for (PLANET planet = (PLANET) 0; planet &amp;lt; (0 + 1 + 1 + 1); planet = (PLANET) (((int) planet) + 1)) {
+    printf("%d\n", (int) planet);
 }
 ~~~

@@ -131,8 +125,8 @@
 # Technical details
 You guessed it, some conventions are called for.

-1. The naming scheme is, that the name of the data table consists of the object name (PLANET) followed by "_DATA".
-2. The signature (_,__,___, T, A, E) of the data table macro is necessary. The underscore parameters are a technical necessity.
+1. The naming scheme is, that the name of the data table consists of the object name (PLANET) followed by "\_DATA".
+2. The signature (\_,\_\_,\_\_\_, T, A, E) of the data table macro is necessary. The underscore parameters are a technical necessity.
 3. The T-row in the data table describes the types of the attributes.
 4. The A-row describes the names of the attributes.
 5. The E-rows describe the elements of the enum.
&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Georg Ulbrich</dc:creator><pubDate>Fri, 06 Jul 2018 20:07:49 -0000</pubDate><guid>https://sourceforge.net222c4cc20057ca9ce8f2e14af09c2edc57401015</guid></item><item><title>Home modified by Georg Ulbrich</title><link>https://sourceforge.net/p/cppviz/wiki/Home/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v6
+++ v7
@@ -66,8 +66,8 @@
 To grab display name and radius, just add

 ~~~
-ATTRIBUTE(PLANET, 2);
-ATTRIBUTE(PLANET, 3);
+ATTRIBUTE(PLANET, 2); /* for the "name" attribute */
+ATTRIBUTE(PLANET, 3); /* for the "radius" attribute */
 ~~~

 resulting in two arrays
&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Georg Ulbrich</dc:creator><pubDate>Fri, 06 Jul 2018 20:05:03 -0000</pubDate><guid>https://sourceforge.neta13cfe1940f056ab5d7684369b33b1d0de7897c9</guid></item><item><title>Home modified by Georg Ulbrich</title><link>https://sourceforge.net/p/cppviz/wiki/Home/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v5
+++ v6
@@ -1,6 +1,6 @@
-Welcome to **cppviz**!
+# Welcome to cppviz!

-Ever wished, you had C enums as similar powerful as Java enums? cppviz aims in this direction.
+Ever wished, you had C enums as similar powerful as Java enums? **cppviz** aims in this direction.

 For example,  write in your C code

@@ -128,7 +128,17 @@

 Well, the specific landing functions/macros you will have to write for yourself :-)

-Have fun!
+# Technical details
+You guessed it, some conventions are called for.
+
+1. The naming scheme is, that the name of the data table consists of the object name (PLANET) followed by "_DATA".
+2. The signature (_,__,___, T, A, E) of the data table macro is necessary. The underscore parameters are a technical necessity.
+3. The T-row in the data table describes the types of the attributes.
+4. The A-row describes the names of the attributes.
+5. The E-rows describe the elements of the enum.
+6. When using the ATTRIBUTE macro, the attribute index is 1-based and starts with the enum ids (MERCURY, VENUS, EARTH).
+
+Thats about it, have fun!
 Georg

 GCC-tested!
&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Georg Ulbrich</dc:creator><pubDate>Fri, 06 Jul 2018 20:02:42 -0000</pubDate><guid>https://sourceforge.net360bda371289c65fe0da5eed6cfbb158bf6fcb27</guid></item><item><title>Home modified by Georg Ulbrich</title><link>https://sourceforge.net/p/cppviz/wiki/Home/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v4
+++ v5
@@ -62,7 +62,31 @@
 }
 ~~~

-printing each planets ordinal. Want to have the names of each of the enum elements? Get them with
+printing each planets ordinal. Nice, but nicer would be to have the attributes of each planet at hand, right?
+To grab display name and radius, just add
+
+~~~
+ATTRIBUTE(PLANET, 2);
+ATTRIBUTE(PLANET, 3);
+~~~
+
+resulting in two arrays
+
+~~~
+char * PLANET_name[] = {
+    "Mercury",
+    "Venus",
+    "Earth",
+};
+
+int PLANET_radius[] = {
+    2439,
+    6051,
+    6378,
+};
+~~~
+
+Want to have the ENUM NAMES  of each of the planets, too? Get them with

 ~~~
 NAMES(PLANET);
@@ -104,8 +128,6 @@

 Well, the specific landing functions/macros you will have to write for yourself :-)

-Attributes coming soon! You don't want to miss the planets radius, right?!
-
 Have fun!
 Georg

&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Georg Ulbrich</dc:creator><pubDate>Fri, 06 Jul 2018 19:46:52 -0000</pubDate><guid>https://sourceforge.netbf5a0881eb255b3bee3938bd2050a47b049f4f28</guid></item><item><title>Home modified by Georg Ulbrich</title><link>https://sourceforge.net/p/cppviz/wiki/Home/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v3
+++ v4
@@ -1,6 +1,6 @@
 Welcome to **cppviz**!

-Ever wished, you had C enums similar powerful to Java enums? cppviz aims in this direction.
+Ever wished, you had C enums as similar powerful as Java enums? cppviz aims in this direction.

 For example,  write in your C code

&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Georg Ulbrich</dc:creator><pubDate>Fri, 06 Jul 2018 18:48:33 -0000</pubDate><guid>https://sourceforge.netdd2bf13abae82ca8a0aa7eefc8d6a497d8b12792</guid></item></channel></rss>