Ticket #44: 0002-Fix-an-example-whose-build-has-failed-since-Kevin-mo.patch

File 0002-Fix-an-example-whose-build-has-failed-since-Kevin-mo.patch, 11.0 KB (added by debrouxl, 3 years ago)

Patch that fixes the "Dialog Struct" example and adds a script for regression tests

  • trunk/tigcc/doc/System/Include/dialogs.h/SIZED_DIALOG.hsf

    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 b Definition=#define SIZED_DIALOG(NumbItems,StrLen) struct { unsigned short TextOf 
    88A macro to help defining dialogs, it is nearly the same as DIALOG. 
    99 
    1010[Explanation] 
    11 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. 
     11There 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. 
    1212<BR>Secondly it doesn't include strings, which should better be placed just after the DIALOG in memory. 
    1313<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> 
  • trunk/tigcc/examples/Dialog

    diff --git a/trunk/tigcc/examples/Dialog Struct.c b/trunk/tigcc/examples/Dialog Struct.c
    index 8d521ed..053cac1 100644
    a b void _main(void) 
    2121   
    2222  #define ItemsNum 3 
    2323  #define MyStrings "EXAMPLE\0EnterYourName (max. 20 chars)\0Your name" 
    24   static SIZED_DIALOG(ItemsNum,sizeof(MyString)) DialogWindow={offsetof(SIZED_DIALOG(ItemsNum,0),String), ItemsNum,130, 50,NoCallBack, 
     24  static SIZED_DIALOG(ItemsNum,sizeof(MyStrings)) DialogWindow={offsetof(SIZED_DIALOG(ItemsNum,0),String), ItemsNum,130, 50,NoCallBack, 
    2525  { 
    2626  {//Title 
    2727        D_HEADER,DF_SKIP,0,0,{.dHeader={0,BT_OK,BT_CANCEL}} 
  • new file trunk/tigcc/examples/build.sh

    diff --git a/trunk/tigcc/examples/build.sh b/trunk/tigcc/examples/build.sh
    new file mode 100755
    index 0000000..c34e200
    - +  
     1#!/bin/sh 
     2tprbuilder -q "Add Arguments.tpr"; if [ $? -ne 0 ]; then echo FAILED building "\"Add Arguments.tpr\""; fi 
     3tprbuilder -q "Adjust Grayscale.tpr"; if [ $? -ne 0 ]; then echo FAILED building "\"Adjust Grayscale.tpr\""; fi 
     4tprbuilder -q "Approximation Mode.tpr"; if [ $? -ne 0 ]; then echo FAILED building "\"Approximation Mode.tpr\""; fi 
     5tprbuilder -q "Argument Test.tpr"; if [ $? -ne 0 ]; then echo FAILED building "\"Argument Test.tpr\""; fi 
     6tprbuilder -q "Basecode Parameters.tpr"; if [ $? -ne 0 ]; then echo FAILED building "\"Basecode Parameters.tpr\""; fi 
     7tprbuilder -q "Big Numbers.tpr"; if [ $? -ne 0 ]; then echo FAILED building "\"Big Numbers.tpr\""; fi 
     8tprbuilder -q "Bitmap Test.tpr"; if [ $? -ne 0 ]; then echo FAILED building "\"Bitmap Test.tpr\""; fi 
     9tprbuilder -q "Catalog.tpr"; if [ $? -ne 0 ]; then echo FAILED building "\"Catalog.tpr\""; fi 
     10tprbuilder -q "Cave Blaster.tpr"; if [ $? -ne 0 ]; then echo FAILED building "\"Cave Blaster.tpr\""; fi 
     11tprbuilder -q "Create Variable.tpr"; if [ $? -ne 0 ]; then echo FAILED building "\"Create Variable.tpr\""; fi 
     12tprbuilder -q "Custom DLL Test.tpr"; if [ $? -ne 0 ]; then echo FAILED building "\"Custom DLL Test.tpr\""; fi 
     13tprbuilder -q "Custom DLL.tpr"; if [ $? -ne 0 ]; then echo FAILED building "\"Custom DLL.tpr\""; fi 
     14tprbuilder -q "Dialog Items AMS1.tpr"; if [ $? -ne 0 ]; then echo FAILED building "\"Dialog Items AMS1.tpr\""; fi 
     15tprbuilder -q "Dialog Items.tpr"; if [ $? -ne 0 ]; then echo FAILED building "\"Dialog Items.tpr\""; fi 
     16tprbuilder -q "Dialog Struct.tpr"; if [ $? -ne 0 ]; then echo FAILED building "\"Dialog Struct.tpr\""; fi 
     17tprbuilder -q "Dialog Test.tpr"; if [ $? -ne 0 ]; then echo FAILED building "\"Dialog Test.tpr\""; fi 
     18tprbuilder -q "Draw Line.tpr"; if [ $? -ne 0 ]; then echo FAILED building "\"Draw Line.tpr\""; fi 
     19tprbuilder -q "Dynamic Matrix.tpr"; if [ $? -ne 0 ]; then echo FAILED building "\"Dynamic Matrix.tpr\""; fi 
     20tprbuilder -q "Dynamic Popup Example.tpr"; if [ $? -ne 0 ]; then echo FAILED building "\"Dynamic Popup Example.tpr\""; fi 
     21tprbuilder -q "Flags of WinStrXYWrap.tpr"; if [ $? -ne 0 ]; then echo FAILED building "\"Flags of WinStrXYWrap.tpr\""; fi 
     22tprbuilder -q "Float Test.tpr"; if [ $? -ne 0 ]; then echo FAILED building "\"Float Test.tpr\""; fi 
     23tprbuilder -q "Folder List.tpr"; if [ $? -ne 0 ]; then echo FAILED building "\"Folder List.tpr\""; fi 
     24tprbuilder -q "Folder.tpr"; if [ $? -ne 0 ]; then echo FAILED building "\"Folder.tpr\""; fi 
     25tprbuilder -q "Function Returning Itself.tpr"; if [ $? -ne 0 ]; then echo FAILED building "\"Function Returning Itself.tpr\""; fi 
     26tprbuilder -q "Get File Name.tpr"; if [ $? -ne 0 ]; then echo FAILED building "\"Get File Name.tpr\""; fi 
     27tprbuilder -q "Graph Function.tpr"; if [ $? -ne 0 ]; then echo FAILED building "\"Graph Function.tpr\""; fi 
     28tprbuilder -q "Gray Test Project in Assembler.tpr"; if [ $? -ne 0 ]; then echo FAILED building "\"Gray Test Project in Assembler.tpr\""; fi 
     29tprbuilder -q "Gray Test Project.tpr"; if [ $? -ne 0 ]; then echo FAILED building "\"Gray Test Project.tpr\""; fi 
     30tprbuilder -q "Guess.tpr"; if [ $? -ne 0 ]; then echo FAILED building "\"Guess.tpr\""; fi 
     31tprbuilder -q "Handle a variable with VAT functions.tpr"; if [ $? -ne 0 ]; then echo FAILED building "\"Handle a variable with VAT functions.tpr\""; fi 
     32tprbuilder -q "Hardware Parameters.tpr"; if [ $? -ne 0 ]; then echo FAILED building "\"Hardware Parameters.tpr\""; fi 
     33tprbuilder -q "Heap Shuffle.tpr"; if [ $? -ne 0 ]; then echo FAILED building "\"Heap Shuffle.tpr\""; fi 
     34tprbuilder -q "Hello World 1.tpr"; if [ $? -ne 0 ]; then echo FAILED building "\"Hello World 1.tpr\""; fi 
     35tprbuilder -q "Hello World 2.tpr"; if [ $? -ne 0 ]; then echo FAILED building "\"Hello World 2.tpr\""; fi 
     36tprbuilder -q "Hello World 3.tpr"; if [ $? -ne 0 ]; then echo FAILED building "\"Hello World 3.tpr\""; fi 
     37tprbuilder -q "Hello World 4.tpr"; if [ $? -ne 0 ]; then echo FAILED building "\"Hello World 4.tpr\""; fi 
     38tprbuilder -q "Hello World 5.tpr"; if [ $? -ne 0 ]; then echo FAILED building "\"Hello World 5.tpr\""; fi 
     39tprbuilder -q "Input String Advanced.tpr"; if [ $? -ne 0 ]; then echo FAILED building "\"Input String Advanced.tpr\""; fi 
     40tprbuilder -q "Input String.tpr"; if [ $? -ne 0 ]; then echo FAILED building "\"Input String.tpr\""; fi 
     41tprbuilder -q "Integrate.tpr"; if [ $? -ne 0 ]; then echo FAILED building "\"Integrate.tpr\""; fi 
     42tprbuilder -q "Interrupt Handler.tpr"; if [ $? -ne 0 ]; then echo FAILED building "\"Interrupt Handler.tpr\""; fi 
     43tprbuilder -q "Key Yes or No.tpr"; if [ $? -ne 0 ]; then echo FAILED building "\"Key Yes or No.tpr\""; fi 
     44tprbuilder -q "Launcher.tpr"; if [ $? -ne 0 ]; then echo FAILED building "\"Launcher.tpr\""; fi 
     45tprbuilder -q "List variables and folders.tpr"; if [ $? -ne 0 ]; then echo FAILED building "\"List variables and folders.tpr\""; fi 
     46tprbuilder -q "Masked Sprite.tpr"; if [ $? -ne 0 ]; then echo FAILED building "\"Masked Sprite.tpr\""; fi 
     47tprbuilder -q "Memory Error.tpr"; if [ $? -ne 0 ]; then echo FAILED building "\"Memory Error.tpr\""; fi 
     48tprbuilder -q "Menu Example 1.tpr"; if [ $? -ne 0 ]; then echo FAILED building "\"Menu Example 1.tpr\""; fi 
     49tprbuilder -q "Menu Example 2.tpr"; if [ $? -ne 0 ]; then echo FAILED building "\"Menu Example 2.tpr\""; fi 
     50tprbuilder -q "Multiply Polynoms.tpr"; if [ $? -ne 0 ]; then echo FAILED building "\"Multiply Polynoms.tpr\""; fi 
     51tprbuilder -q "Othello-Reversi.tpr"; if [ $? -ne 0 ]; then echo FAILED building "\"Othello-Reversi.tpr\""; fi 
     52tprbuilder -q "Popup Menu Example.tpr"; if [ $? -ne 0 ]; then echo FAILED building "\"Popup Menu Example.tpr\""; fi 
     53tprbuilder -q "Pretty Print.tpr"; if [ $? -ne 0 ]; then echo FAILED building "\"Pretty Print.tpr\""; fi 
     54tprbuilder -q "Print EStack.tpr"; if [ $? -ne 0 ]; then echo FAILED building "\"Print EStack.tpr\""; fi 
     55tprbuilder -q "Progress Bar.tpr"; if [ $? -ne 0 ]; then echo FAILED building "\"Progress Bar.tpr\""; fi 
     56tprbuilder -q "Sort Floats.tpr"; if [ $? -ne 0 ]; then echo FAILED building "\"Sort Floats.tpr\""; fi 
     57tprbuilder -q "Sort Integers.tpr"; if [ $? -ne 0 ]; then echo FAILED building "\"Sort Integers.tpr\""; fi 
     58tprbuilder -q "Static Expression.tpr"; if [ $? -ne 0 ]; then echo FAILED building "\"Static Expression.tpr\""; fi 
     59tprbuilder -q "Static Popup.tpr"; if [ $? -ne 0 ]; then echo FAILED building "\"Static Popup.tpr\""; fi 
     60tprbuilder -q "Symbolic Add Arguments.tpr"; if [ $? -ne 0 ]; then echo FAILED building "\"Symbolic Add Arguments.tpr\""; fi 
     61tprbuilder -q "Text Editor.tpr"; if [ $? -ne 0 ]; then echo FAILED building "\"Text Editor.tpr\""; fi 
     62tprbuilder -q "Timers.tpr"; if [ $? -ne 0 ]; then echo FAILED building "\"Timers.tpr\""; fi 
     63tprbuilder -q "Window 1.tpr"; if [ $? -ne 0 ]; then echo FAILED building "\"Window 1.tpr\""; fi 
     64tprbuilder -q "Window 2.tpr"; if [ $? -ne 0 ]; then echo FAILED building "\"Window 2.tpr\""; fi 
     65tprbuilder -q "Window 3.tpr"; if [ $? -ne 0 ]; then echo FAILED building "\"Window 3.tpr\""; fi 
     66tprbuilder -q "Window 4.tpr"; if [ $? -ne 0 ]; then echo FAILED building "\"Window 4.tpr\""; fi 
     67tprbuilder -q "Window 5.tpr"; if [ $? -ne 0 ]; then echo FAILED building "\"Window 5.tpr\""; fi 
     68tprbuilder -q "Windows.tpr"; if [ $? -ne 0 ]; then echo FAILED building "\"Windows.tpr\""; fi 
     69rm *.??z 
     70rm *.??y 
  • new file trunk/tigcc/examples/generatebuild.sh

    diff --git a/trunk/tigcc/examples/generatebuild.sh b/trunk/tigcc/examples/generatebuild.sh
    new file mode 100755
    index 0000000..0288a0b
    - +  
     1#!/bin/sh 
     2ls *.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