[comp.sys.amiga.tech] Errant Wait

allen@tcville.HAC.COM (Allen Farrington) (10/25/89)

This being my foray into the Wait() function, I seem to
need a bit of assistance.  I've included my program below
without the comments except for the one above the call to
Wait().  The problem is this, the window opens correctly
but will not close.  When I click on the close gadget, 
the box highlights briefly but nothing further happens.

If I substitute a null FOR loop for the Wait(), the
window opens, remains briefly, and closes correctly.

Any help would be appreciated.

  --Allen

/********** Start of Program ***********/

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

struct  Window  *OpenWindow();
struct  IntuitionBase *IntuitionBase;
struct  GfxBase       *GfxBase;
void    *OpenLibrary();

struct  Window  *Wdw;

#define BLUP  0
#define WHTP  1
#define BLKP  2
#define ORNP  3

struct  NewWindow NewWdw = 
  {
  0,0,
  640,200,
  BLUP, WHTP,
  CLOSEWINDOW,
  SMART_REFRESH | ACTIVATE | WINDOWCLOSE,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
  0,0,
  0,0,
  WBENCHSCREEN
  };

main()
{
  IntuitionBase = ( struct IntuitionBase *)
                      OpenLibrary( "intuition.library", LIBRARY_VERSION );
  
  if ( IntuitionBase == NULL ) 
  {
    printf( "No Intuition.\n" );
    exit( FALSE );
  }

  GfxBase = ( struct GfxBase *)
                OpenLibrary( "graphics.library", LIBRARY_VERSION );

  if ( GfxBase == NULL ) 
  {
    printf( "No Graphics.\n" );
    exit( FALSE );
  }

  Wdw = (struct Window *)OpenWindow( &NewWdw );

  if( Wdw == NULL )
  {
    printf( "No Window.\n" );
    exit( FALSE );
  }

/* ERROR occurs here, I think */
  
  Wait( 1 << Wdw->UserPort->mp_SigBit );

  CloseWindow( Wdw );
  CloseLibrary( GfxBase );
  CloseLibrary( IntuitionBase );

}
  

-- 
|======================================================================|
|  Allen H. Farrington         smart:  allen@tcville.hac.com           |
|   (213) 436-0483        CompuServe:  74010,1775                      |
|======================================================================|

allen@tcville.HAC.COM (Allen Farrington) (10/26/89)

Geez! What a bonehead question.

I figured out why my program didn't work.  After compiling
with the +L option (Aztec), it worked ok.  I then altered
the source to be:

Wait( 1L << Wdw -> UserPort -> mp_SigBit );  /* notice the L */

Gee, I feel like a real bonehead, especially with 3000+ lines
of 3D rendering code under my belt.

So, as the late Emily Latella would say -- Never mind.

  --Allen

-- 
|======================================================================|
|  Allen H. Farrington         smart:  allen@tcville.hac.com           |
|   (213) 436-0483        CompuServe:  74010,1775                      |
|======================================================================|