From 81443aa2a3d7ac23c94ecbdbb53897a6635e8f44 Mon Sep 17 00:00:00 2001
From: Lionel Debroux <lionel_debroux@yahoo.fr>
Date: Sun, 7 Jun 2009 17:13:08 +0200
Subject: Fix an example whose build has failed since Kevin modified the code in 2005.
 While at it:
     * add the script used for checking buildability of the examples, and the script used to generate the checker script;
     * fix a typo in SIZED_DIALOG.

---
 .../doc/System/Include/dialogs.h/SIZED_DIALOG.hsf  |    2 +-
 trunk/tigcc/examples/Dialog Struct.c               |    2 +-
 trunk/tigcc/examples/build.sh                      |   70 ++++++++++++++++++++
 trunk/tigcc/examples/generatebuild.sh              |    2 +
 4 files changed, 74 insertions(+), 2 deletions(-)
 create mode 100755 trunk/tigcc/examples/build.sh
 create mode 100755 trunk/tigcc/examples/generatebuild.sh

diff --git a/trunk/tigcc/doc/System/Include/dialogs.h/SIZED_DIALOG.hsf b/trunk/tigcc/doc/System/Include/dialogs.h/SIZED_DIALOG.hsf
index b5c05e3..c16cbb2 100644
--- a/trunk/tigcc/doc/System/Include/dialogs.h/SIZED_DIALOG.hsf
+++ b/trunk/tigcc/doc/System/Include/dialogs.h/SIZED_DIALOG.hsf
@@ -8,6 +8,6 @@ Definition=#define SIZED_DIALOG(NumbItems,StrLen) struct { unsigned short TextOf
 A macro to help defining dialogs, it is nearly the same as DIALOG.
 
 [Explanation]
-There are two main dificulties one encouters using the <A HREF="$$LINK(dialogs.h/DIALOG_STRUCT)">DIALOG structure</A>:<BR>First there is a variable size array, and variable size arrays can't be initialized with non constant value.
+There are two main difficulties one encouters using the <A HREF="$$LINK(dialogs.h/DIALOG_STRUCT)">DIALOG structure</A>:<BR>First there is a variable size array, and variable size arrays can't be initialized with non constant value.
 <BR>Secondly it doesn't include strings, which should better be placed just after the DIALOG in memory.
 <BR>SIZED_DIALOG avoids both of these problems: It needs two argument : the number of Items <I>NumbItems</I> and the size of the all the strings together <I>StrLen</I>, and defines a struct from this, wich is the same as <A HREF="$$LINK(dialogs.h/DIALOG_STRUCT)">DIALOG</A> but with some place for the strings: you can define a dilalog using <I>SIZED_DIALOG(NumbItems,StrLen)={/*Dialog definition*/}</I>. It is done in the given examples. If you use that macro, it will fill to the right number of Item, and If you forget to add an item with type D_END after the last used Item, it is automatically done.<BR><BR>Using SIZED_DIALOG also helps to get the offset of the strings. You can initialize it with <I><A HREF="$$LINK(stddef.h/offsetof)">offsetof</A>(SIZED_DIALOG(ItemsNum,0),String)</I>
diff --git a/trunk/tigcc/examples/Dialog Struct.c b/trunk/tigcc/examples/Dialog Struct.c
index 8d521ed..053cac1 100644
--- a/trunk/tigcc/examples/Dialog Struct.c	
+++ b/trunk/tigcc/examples/Dialog Struct.c	
@@ -21,7 +21,7 @@ void _main(void)
   
   #define ItemsNum 3
   #define MyStrings "EXAMPLE\0EnterYourName (max. 20 chars)\0Your name"
-  static SIZED_DIALOG(ItemsNum,sizeof(MyString)) DialogWindow={offsetof(SIZED_DIALOG(ItemsNum,0),String), ItemsNum,130, 50,NoCallBack,
+  static SIZED_DIALOG(ItemsNum,sizeof(MyStrings)) DialogWindow={offsetof(SIZED_DIALOG(ItemsNum,0),String), ItemsNum,130, 50,NoCallBack,
   {
   {//Title
   	D_HEADER,DF_SKIP,0,0,{.dHeader={0,BT_OK,BT_CANCEL}}
diff --git a/trunk/tigcc/examples/build.sh b/trunk/tigcc/examples/build.sh
new file mode 100755
index 0000000..c34e200
--- /dev/null
+++ b/trunk/tigcc/examples/build.sh
@@ -0,0 +1,70 @@
+#!/bin/sh
+tprbuilder -q "Add Arguments.tpr"; if [ $? -ne 0 ]; then echo FAILED building "\"Add Arguments.tpr\""; fi
+tprbuilder -q "Adjust Grayscale.tpr"; if [ $? -ne 0 ]; then echo FAILED building "\"Adjust Grayscale.tpr\""; fi
+tprbuilder -q "Approximation Mode.tpr"; if [ $? -ne 0 ]; then echo FAILED building "\"Approximation Mode.tpr\""; fi
+tprbuilder -q "Argument Test.tpr"; if [ $? -ne 0 ]; then echo FAILED building "\"Argument Test.tpr\""; fi
+tprbuilder -q "Basecode Parameters.tpr"; if [ $? -ne 0 ]; then echo FAILED building "\"Basecode Parameters.tpr\""; fi
+tprbuilder -q "Big Numbers.tpr"; if [ $? -ne 0 ]; then echo FAILED building "\"Big Numbers.tpr\""; fi
+tprbuilder -q "Bitmap Test.tpr"; if [ $? -ne 0 ]; then echo FAILED building "\"Bitmap Test.tpr\""; fi
+tprbuilder -q "Catalog.tpr"; if [ $? -ne 0 ]; then echo FAILED building "\"Catalog.tpr\""; fi
+tprbuilder -q "Cave Blaster.tpr"; if [ $? -ne 0 ]; then echo FAILED building "\"Cave Blaster.tpr\""; fi
+tprbuilder -q "Create Variable.tpr"; if [ $? -ne 0 ]; then echo FAILED building "\"Create Variable.tpr\""; fi
+tprbuilder -q "Custom DLL Test.tpr"; if [ $? -ne 0 ]; then echo FAILED building "\"Custom DLL Test.tpr\""; fi
+tprbuilder -q "Custom DLL.tpr"; if [ $? -ne 0 ]; then echo FAILED building "\"Custom DLL.tpr\""; fi
+tprbuilder -q "Dialog Items AMS1.tpr"; if [ $? -ne 0 ]; then echo FAILED building "\"Dialog Items AMS1.tpr\""; fi
+tprbuilder -q "Dialog Items.tpr"; if [ $? -ne 0 ]; then echo FAILED building "\"Dialog Items.tpr\""; fi
+tprbuilder -q "Dialog Struct.tpr"; if [ $? -ne 0 ]; then echo FAILED building "\"Dialog Struct.tpr\""; fi
+tprbuilder -q "Dialog Test.tpr"; if [ $? -ne 0 ]; then echo FAILED building "\"Dialog Test.tpr\""; fi
+tprbuilder -q "Draw Line.tpr"; if [ $? -ne 0 ]; then echo FAILED building "\"Draw Line.tpr\""; fi
+tprbuilder -q "Dynamic Matrix.tpr"; if [ $? -ne 0 ]; then echo FAILED building "\"Dynamic Matrix.tpr\""; fi
+tprbuilder -q "Dynamic Popup Example.tpr"; if [ $? -ne 0 ]; then echo FAILED building "\"Dynamic Popup Example.tpr\""; fi
+tprbuilder -q "Flags of WinStrXYWrap.tpr"; if [ $? -ne 0 ]; then echo FAILED building "\"Flags of WinStrXYWrap.tpr\""; fi
+tprbuilder -q "Float Test.tpr"; if [ $? -ne 0 ]; then echo FAILED building "\"Float Test.tpr\""; fi
+tprbuilder -q "Folder List.tpr"; if [ $? -ne 0 ]; then echo FAILED building "\"Folder List.tpr\""; fi
+tprbuilder -q "Folder.tpr"; if [ $? -ne 0 ]; then echo FAILED building "\"Folder.tpr\""; fi
+tprbuilder -q "Function Returning Itself.tpr"; if [ $? -ne 0 ]; then echo FAILED building "\"Function Returning Itself.tpr\""; fi
+tprbuilder -q "Get File Name.tpr"; if [ $? -ne 0 ]; then echo FAILED building "\"Get File Name.tpr\""; fi
+tprbuilder -q "Graph Function.tpr"; if [ $? -ne 0 ]; then echo FAILED building "\"Graph Function.tpr\""; fi
+tprbuilder -q "Gray Test Project in Assembler.tpr"; if [ $? -ne 0 ]; then echo FAILED building "\"Gray Test Project in Assembler.tpr\""; fi
+tprbuilder -q "Gray Test Project.tpr"; if [ $? -ne 0 ]; then echo FAILED building "\"Gray Test Project.tpr\""; fi
+tprbuilder -q "Guess.tpr"; if [ $? -ne 0 ]; then echo FAILED building "\"Guess.tpr\""; fi
+tprbuilder -q "Handle a variable with VAT functions.tpr"; if [ $? -ne 0 ]; then echo FAILED building "\"Handle a variable with VAT functions.tpr\""; fi
+tprbuilder -q "Hardware Parameters.tpr"; if [ $? -ne 0 ]; then echo FAILED building "\"Hardware Parameters.tpr\""; fi
+tprbuilder -q "Heap Shuffle.tpr"; if [ $? -ne 0 ]; then echo FAILED building "\"Heap Shuffle.tpr\""; fi
+tprbuilder -q "Hello World 1.tpr"; if [ $? -ne 0 ]; then echo FAILED building "\"Hello World 1.tpr\""; fi
+tprbuilder -q "Hello World 2.tpr"; if [ $? -ne 0 ]; then echo FAILED building "\"Hello World 2.tpr\""; fi
+tprbuilder -q "Hello World 3.tpr"; if [ $? -ne 0 ]; then echo FAILED building "\"Hello World 3.tpr\""; fi
+tprbuilder -q "Hello World 4.tpr"; if [ $? -ne 0 ]; then echo FAILED building "\"Hello World 4.tpr\""; fi
+tprbuilder -q "Hello World 5.tpr"; if [ $? -ne 0 ]; then echo FAILED building "\"Hello World 5.tpr\""; fi
+tprbuilder -q "Input String Advanced.tpr"; if [ $? -ne 0 ]; then echo FAILED building "\"Input String Advanced.tpr\""; fi
+tprbuilder -q "Input String.tpr"; if [ $? -ne 0 ]; then echo FAILED building "\"Input String.tpr\""; fi
+tprbuilder -q "Integrate.tpr"; if [ $? -ne 0 ]; then echo FAILED building "\"Integrate.tpr\""; fi
+tprbuilder -q "Interrupt Handler.tpr"; if [ $? -ne 0 ]; then echo FAILED building "\"Interrupt Handler.tpr\""; fi
+tprbuilder -q "Key Yes or No.tpr"; if [ $? -ne 0 ]; then echo FAILED building "\"Key Yes or No.tpr\""; fi
+tprbuilder -q "Launcher.tpr"; if [ $? -ne 0 ]; then echo FAILED building "\"Launcher.tpr\""; fi
+tprbuilder -q "List variables and folders.tpr"; if [ $? -ne 0 ]; then echo FAILED building "\"List variables and folders.tpr\""; fi
+tprbuilder -q "Masked Sprite.tpr"; if [ $? -ne 0 ]; then echo FAILED building "\"Masked Sprite.tpr\""; fi
+tprbuilder -q "Memory Error.tpr"; if [ $? -ne 0 ]; then echo FAILED building "\"Memory Error.tpr\""; fi
+tprbuilder -q "Menu Example 1.tpr"; if [ $? -ne 0 ]; then echo FAILED building "\"Menu Example 1.tpr\""; fi
+tprbuilder -q "Menu Example 2.tpr"; if [ $? -ne 0 ]; then echo FAILED building "\"Menu Example 2.tpr\""; fi
+tprbuilder -q "Multiply Polynoms.tpr"; if [ $? -ne 0 ]; then echo FAILED building "\"Multiply Polynoms.tpr\""; fi
+tprbuilder -q "Othello-Reversi.tpr"; if [ $? -ne 0 ]; then echo FAILED building "\"Othello-Reversi.tpr\""; fi
+tprbuilder -q "Popup Menu Example.tpr"; if [ $? -ne 0 ]; then echo FAILED building "\"Popup Menu Example.tpr\""; fi
+tprbuilder -q "Pretty Print.tpr"; if [ $? -ne 0 ]; then echo FAILED building "\"Pretty Print.tpr\""; fi
+tprbuilder -q "Print EStack.tpr"; if [ $? -ne 0 ]; then echo FAILED building "\"Print EStack.tpr\""; fi
+tprbuilder -q "Progress Bar.tpr"; if [ $? -ne 0 ]; then echo FAILED building "\"Progress Bar.tpr\""; fi
+tprbuilder -q "Sort Floats.tpr"; if [ $? -ne 0 ]; then echo FAILED building "\"Sort Floats.tpr\""; fi
+tprbuilder -q "Sort Integers.tpr"; if [ $? -ne 0 ]; then echo FAILED building "\"Sort Integers.tpr\""; fi
+tprbuilder -q "Static Expression.tpr"; if [ $? -ne 0 ]; then echo FAILED building "\"Static Expression.tpr\""; fi
+tprbuilder -q "Static Popup.tpr"; if [ $? -ne 0 ]; then echo FAILED building "\"Static Popup.tpr\""; fi
+tprbuilder -q "Symbolic Add Arguments.tpr"; if [ $? -ne 0 ]; then echo FAILED building "\"Symbolic Add Arguments.tpr\""; fi
+tprbuilder -q "Text Editor.tpr"; if [ $? -ne 0 ]; then echo FAILED building "\"Text Editor.tpr\""; fi
+tprbuilder -q "Timers.tpr"; if [ $? -ne 0 ]; then echo FAILED building "\"Timers.tpr\""; fi
+tprbuilder -q "Window 1.tpr"; if [ $? -ne 0 ]; then echo FAILED building "\"Window 1.tpr\""; fi
+tprbuilder -q "Window 2.tpr"; if [ $? -ne 0 ]; then echo FAILED building "\"Window 2.tpr\""; fi
+tprbuilder -q "Window 3.tpr"; if [ $? -ne 0 ]; then echo FAILED building "\"Window 3.tpr\""; fi
+tprbuilder -q "Window 4.tpr"; if [ $? -ne 0 ]; then echo FAILED building "\"Window 4.tpr\""; fi
+tprbuilder -q "Window 5.tpr"; if [ $? -ne 0 ]; then echo FAILED building "\"Window 5.tpr\""; fi
+tprbuilder -q "Windows.tpr"; if [ $? -ne 0 ]; then echo FAILED building "\"Windows.tpr\""; fi
+rm *.??z
+rm *.??y
diff --git a/trunk/tigcc/examples/generatebuild.sh b/trunk/tigcc/examples/generatebuild.sh
new file mode 100755
index 0000000..0288a0b
--- /dev/null
+++ b/trunk/tigcc/examples/generatebuild.sh
@@ -0,0 +1,2 @@
+#!/bin/sh
+ls *.tpr | awk 'BEGIN {print "#!/bin/sh"} {print "tprbuilder -q \"" $0 "\"; if [ $? -ne 0 ]; then echo FAILED building \"\\\"" $0 "\\\"\"; fi"} END{print "rm *.??z"; print "rm *.??y"}' > build.sh
-- 
1.6.3.2.198.g6096d


