#include "squid_class.h"
#include <iostream.h>
#include <stdlib.h>
#include <clib/alib_protos.h>
#include <clib/asl_protos.h>
#include <clib/dos_protos.h>
#include <clib/exec_protos.h>
#include <clib/gadtools_protos.h>
#include <clib/graphics_protos.h>
#include <clib/intuition_protos.h>
#include <clib/locale_protos.h>
#include <clib/utility_protos.h>
#include <clib/wb_protos.h>
#include <clib/colorwheel_protos.h>
#include <clib/datebrowser_protos.h>
#include <clib/resource_protos.h>
#include <clib/texteditor_protos.h>
#include <gadgets/colorwheel.h>
#include <gadgets/datebrowser.h>
#include <gadgets/gradientslider.h>
#include <gadgets/tapedeck.h>
#include <gadgets/texteditor.h>
#include <proto/texteditor.h>
#include <reaction/reaction.h>
#include <intuition/icclass.h>
#include <intuition/imageclass.h>
#include <intuition/gadgetclass.h>
#include <workbench/startup.h>
#include <wbstartup.h>

Object *winobj=NULL;

struct Window *win=NULL;

void main()
{
    int x=0, i=0;
    cout <<"combien d'objets? ";
    cin >>x;
    Cell *C = (Cell*) malloc(x*sizeof(Cell));
    if(C==NULL)
    {
        cout <<"erreur d'allocation\n";
    }
    else
    {
        cout <<"allocation de " <<x <<" objets effectuée\n";
        cout <<"la mémoire utilisée est de " <<x*sizeof(Cell) <<" octets\n";

        winobj = (Object*) WindowObject,
            WA_Left,    100,
            WA_Top,     100,
            WA_Width,   300,
            WA_Height,  300,
            WA_DragBar, TRUE,
            //WA_Title,   "Sortie graphique",
            WA_PubScreen, Screen1,
            //WA_CloseGadget,  TRUE,
            WA_DepthGadget, TRUE,
            WA_SuperBitMap, TRUE,
            WA_IDCMP,  IDCMP_GADGETDOWN | IDCMP_GADGETUP | IDCMP_GADGETHELP | IDCMP_MENUPICK | IDCMP_MENUHELP | IDCMP_CLOSEWINDOW | IDCMP_ACTIVEWINDOW | IDCMP_INACTIVEWINDOW | IDCMP_RAWKEY | IDCMP_VANILLAKEY | IDCMP_MOUSEBUTTONS | IDCMP_MOUSEMOVE | IDCMP_NEWSIZE | IDCMP_CHANGEWINDOW | IDCMP_SIZEVERIFY | IDCMP_REFRESHWINDOW | IDCMP_INTUITICKS,
            WA_RMBTrap, TRUE,
        EndWindow;
        win = RA_OpenWindow (winobj);
        winport = win->RPort;
        DrawEllipse(RPort, 50, 50, 10, 20);

        free(C);
        /*if(C==NULL)
        {
            cout <<"mémoire libérée\n";
        }
        else
        {
            cout <<"échec de libération\n";
        }*/
    }
}
