Created on 1st October 2003 EsseEmmeErreSoftwareSolutions.jpg Updated on 24th March 2008

My first C program!
/*
-> Avventura by Stefano Maria
i> 23 febbraio 2001
m> 24 febbraio 2001
m> 2 marzo 2001
m> 22,26 luglio 2001
m> 14 febbraio 2002
m> 29 agosto 2003
m> 5,7,12 settembre 2003
m> 30,31 dicembre 2004
m> 12 gennaio 2005
m> 7,8,9,11,13,24,28 aprile 2005
m> primo maggio 2005
---------------------
*/

#include <stdio.h>
#include <string.h>
#include <exec/types.h>

STATIC TEXT Esco[5]="esco";
STATIC TEXT FraseDigitata[81];
STATIC BOOL EsciDallAvventura=FALSE;

void main()
{
 do
 {
  do
  {
   printf("Azione>");
   gets(FraseDigitata);
  }
  while (FraseDigitata[0]==NULL);
  printf("%s\n",FraseDigitata);
  if(stricmp(Esco,FraseDigitata)==0) EsciDallAvventura=TRUE;
  else(printf("Digita [esco] per uscire...\n"));
 }
 while (EsciDallAvventura==FALSE);/*fine ciclo do while/do while cycle end*/
 printf("Fine dell'avventura!\n");
}/*fine ciclo main()/main() cycle end*/
 
This first version of my C program is visibile if executed from command line, otherwise its activity is not visible.
The (bugged) evolution of my first C program!
/*
-> PrimaAvventura by Stefano Maria
d> 3 febbraio 2006 da Avventura
m> 18,19 aprile 2006
m> 22,24 maggio 2006
m> 3,13,23,24,25 giugno 2006
----------------------------
*/

#include <stdio.h>
#include <string.h>
#include <exec/types.h>
#include <intuition/intuition.h>

struct IntuitionBase * IntuitionBase;
struct Library * OpenLibrary(CONST_STRPTR,ULONG);
struct Window * OpenWindow(struct NewWindow *);
struct Window * Finestra;

VOID SetWindowTitles(struct Window *,CONST_STRPTR,CONST_STRPTR);
VOID CloseWindow(struct Window *);
VOID CloseLibrary(struct Library *);
VOID Exit(ULONG);

UWORD XPosFinestra=0;
UWORD YPosFinestra=13;
UWORD XLunFinestra=640;
UWORD YLunFinestra=64;
UWORD YLunMaxFinestra=128;
WORD PennaDettagli=-1;
WORD PennaBlocchi=-1;

ULONG TipoFinestra=
WFLG_SIZEGADGET    |
WFLG_DRAGBAR       |
WFLG_DEPTHGADGET   |
WFLG_CLOSEGADGET   |
/*
WFLG_SIZEBRIGHT     |
WFLG_SIZEBBOTTOM    |
WFLG_REFRESHBITS    |
WFLG_SMART_REFRESH  |
WFLG_SIMPLE_REFRESH |
WFLG_SUPER_BITMAP   |
WFLG_OTHER_REFRESH  |
WFLG_BACKDROP       |
WFLG_REPORTMOUSE    |
WFLG_GIMMEZEROZERO  |
WFLG_BORDERLESS     |
*/
WFLG_ACTIVATE      |
WFLG_RMBTRAP;
/*
WFLG_NOCAREREFRESH |
V36 new Flags which the programmer may specify in NewWindow.
WFLG_NW_EXTENDED   |

V39 new Flags which the programmer may specify in NewWindow.
WFLG_NEWLOOKMENUS  |

These flags are set only by Intuition.
YOU MAY NOT SET THEM YOURSELF!
WFLG_WINDOWACTIVE
WFLG_INREQUEST
WFLG_MENUSTATE
WFLG_WINDOWREFRESH
WFLG_WBENCHWINDOW
WFLG_WINDOWTICKED

V36 and higher flags to be set only by Intuition:
WFLG_VISITOR
WFLG_ZOOMED
WFLG_HASZOOM

Other window values:
DEFAULTMOUSEQUEUE
*/

TEXT Esco[5]="esco";
TEXT FraseDigitata[81];
BOOL EsciDallAvventura=FALSE;

struct NewWindow NuovaFinestra=
{
 XPosFinestra,
 YPosFinestra,
 XLunFinestra,
 YLunFinestra,
 PennaDettagli,
 PennaBlocchi,
 CLOSEWINDOW|
 NEWSIZE,
 TipoFinestra,
 NULL,
 NULL,
 "Avventura by Stefano Maria",
 0,
 NULL,
 XLunFinestra,
 YLunFinestra,
 XLunFinestra,
 YLunMaxFinestra,
 WBENCHSCREEN
};
 void main()
{
 IntuitionBase=(struct IntuitionBase *)OpenLibrary("intuition.library",0L);
 if (IntuitionBase==NULL) Exit(FALSE);
 NuovaFinestra.Screen=(struct Screen *)WBENCHSCREEN;
 Finestra=OpenWindow(NuovaFinestra);
 if (Finestra==NULL)
 {
  CloseLibrary(IntuitionBase);
  Exit(FALSE);
 }
 SetWindowTitles(Finestra,"Prima Avventura by Stefano Maria","Sintassi: Verbo Seconda parola[ Terza Parola[ Quarta Parola]]");
 do
 {
  do
  {
   printf("Azione>");
   gets(FraseDigitata);
  }
  while (FraseDigitata[0]==NULL);
  printf("%s\n",FraseDigitata);
  if(stricmp(Esco,FraseDigitata)==0) EsciDallAvventura=TRUE;
  else(printf("Digita [esco] per uscire...\n"));
 }
 while (EsciDallAvventura==FALSE);/* fine ciclo do while/do while cycle end */
printf("Fine dell'avventura!\n");
CloseWindow(Finestra);
CloseLibrary(IntuitionBase);
Exit(TRUE);
}/* fine ciclo main()/main() cycle end */ }
This second version of my C program retains 3 errors that break the executable creation, and if i remove them and my AMIGA creates it successfully, launching it its window do not appears on screen!
The second (bugged) evolution of my first C program!
/*
-> PrimaAvventura by Stefano Maria
d> 3 febbraio 2006 da Avventura
m> 18,19 aprile 2006
m> 22,24 maggio 2006
m> 3,13,23,24,25 giugno 2006
m> 22 dicembre 2006
--------------------
*/

#include <stdio.h>
#include <string.h>
#include <exec/types.h>
#include <intuition/intuition.h>

struct IntuitionBase * BaseDiIntuition;
struct Library * OpenLibrary(STRPTR,ULONG);
struct Window * Finestra;
struct Window * OpenWindow(struct NuovaFinestra *);

VOID SetWindowTitles(struct Window *,UBYTE *,UBYTE *);
VOID CloseWindow();
VOID CloseLibrary();
VOID Exit(ULONG);

STATIC UWORD XPosFinestra=0;
STATIC UWORD YPosFinestra=13;
STATIC UWORD XLunFinestra=640;
STATIC UWORD YLunFinestra=64;
STATIC UWORD YLunMaxFinestra=128;
STATIC WORD PennaDettagli=1;
STATIC WORD PennaBlocchi=2;
STATIC ULONG TipoFinestra=
     WFLG_SIZEGADGET     |
     WFLG_DRAGBAR        |
     WFLG_DEPTHGADGET    |
     WFLG_CLOSEGADGET    |
     WFLG_SIZEBRIGHT     |
     WFLG_SIZEBBOTTOM    |
/*   WFLG_REFRESHBITS    |
     WFLG_SMART_REFRESH  |
     WFLG_SIMPLE_REFRESH |
     WFLG_SUPER_BITMAP   |
     WFLG_OTHER_REFRESH  |
     WFLG_BACKDROP       |
     WFLG_REPORTMOUSE    |
     WFLG_GIMMEZEROZERO  |
     WFLG_BORDERLESS     |*/
     WFLG_ACTIVATE       |
     WFLG_RMBTRAP
/*   WFLG_NOCAREREFRESH  |

  V36 new Flags which the programmer may specify in NewWindow.Flags
     WFLG_NW_EXTENDED    |

  V39 new Flags which the programmer may specify in NewWindow.Flags
     WFLG_NEWLOOKMENUS   |

  These flags are set only by Intuition.  YOU MAY NOT SET THEM YOURSELF!
     WFLG_WINDOWACTIVE
     WFLG_INREQUEST
     WFLG_MENUSTATE
     WFLG_WINDOWREFRESH
     WFLG_WBENCHWINDOW
     WFLG_WINDOWTICKED

  V36 and higher flags to be set only by Intuition:
     WFLG_VISITOR
     WFLG_ZOOMED
     WFLG_HASZOOM

   Other window values:
     DEFAULTMOUSEQUEUE */;

struct NewWindow NuovaFinestra=
{
 XPosFinestra,
 YPosFinestra,
 XLunFinestra,
 YLunFinestra,
 PennaDettagli,
 PennaBlocchi,
 IDCMP_CLOSEWINDOW|
 IDCMP_NEWSIZE,
 TipoFinestra,
 NULL,
 NULL,
 NULL,
 0,
 NULL,
 XLunFinestra,
 YLunFinestra,
 XLunFinestra,
 YLunMaxFinestra,
 WBENCHSCREEN
};

STATIC TEXT TitoloFinestra[33]="Prima Avventura by Stefano Maria";
STATIC TEXT TitoloSchermo[62]="Sintassi: Verbo Seconda parola[ Terza Parola[ Quarta Parola]]";
STATIC TEXT FraseDigitata[81];
STATIC TEXT Esco[5];
STATIC BOOL EsciDallAvventura=FALSE;

void main()
{
 BaseDiIntuition=(struct IntuitionBase *)OpenLibrary("intuition.library",0L);
 if (BaseDiIntuition==NULL) Exit(FALSE);
 Finestra=OpenWindow(NuovaFinestra);
 if (Finestra==NULL)
 {
  CloseLibrary(BaseDiIntuition);
  Exit(FALSE);
 }
 SetWindowTitles(Finestra,TitoloFinestra,TitoloSchermo);
 do
 {
  do
  {
   printf("Azione>");
   gets(FraseDigitata);
  }
  while (FraseDigitata[0]==NULL);
  printf("%s\n",FraseDigitata);
  if(stricmp(Esco,FraseDigitata)==0) EsciDallAvventura=TRUE;
  else(printf("Digita [esco] per uscire...\n"));
 }
 while (EsciDallAvventura==FALSE);/* fine ciclo do while/do while cycle end */
 printf("Fine dell'avventura!\n");
 CloseWindow(Finestra);
 CloseLibrary(BaseDiIntuition);
 Exit(TRUE);
}/* fine ciclo main()/main() cycle end */
 
This third version retains one compilation error only and if I remove it the window do not appears on screen yet!
AmyC++.jpg
Here you can see the STORM C 3.0 DEVELOPMENT ENVIRONMENT at start into my best AMIGA emulated on the PC!