DataMuseum.dk

Presents historical artifacts from the history of:

DKUUG/EUUG Conference tapes

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about DKUUG/EUUG Conference tapes

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - metrics - download
Index: T x

⟦730f855a3⟧ TextFile

    Length: 1989 (0x7c5)
    Types: TextFile
    Names: »xloop.c«

Derivation

└─⟦b20c6495f⟧ Bits:30007238 EUUGD18: Wien-båndet, efterår 1987
    └─⟦this⟧ »EUUGD18/X/Xgo/xloop.c« 

TextFile

/*
 * $Header: xloop.c,v 1.3 88/02/19 13:49:42 hale Exp $
 */

/*

        Copyright 1987      Greg Hale

Permission to use, copy, modify, and distribute this
software and its documentation for any purpose and without
fee is hereby granted, provided that the above copyright
notice appear in all copies and that both that copyright
notice and this permission notice appear in supporting
documentation.  No representations are made about the
suitability of this software for any purpose.  It is
provided "as is" without express or implied warranty.

*/


#include "xgo.h"
#undef DEBUG
#define DEBUG(m) 

Loop()
{
    int mask=0,i,retry;

    addmes("- GO  By Greg Hale");
    addmes("- Set up handicap.");

    while (!AreWe(EXIT)) {
	do {
			myturn = (!player && curplr) ||
				(player && !curplr);
			if (mask  == sockmask[1]) {
				DEBUG(printf("Socket message received\n");)
				myturn = !myturn;
				DoOther();
				myturn = !myturn;
			}
			while (i=XPending()) {
				myturn = (!player && curplr) ||
					(player && !curplr);
				DEBUG(printf("#PENDING:%d\n",i);)
				procev();
			}

		mask = sockmask[0] | sockmask[1];
		DEBUG(printf("	SELECT on mask:%x\n",mask);)
		if (AreWe(EXIT)) break;

		if (AreWe(PLAY)) {
			if (!curplr) SetBlkCur();
			else SetWhtCur(); 
		}


	} while (select(32,&mask,0,0,0)!=0);
    }
}



procev()
{
	XEvent *ev,_ev;
	ev = &_ev;


	while (XSetDisplay(dis), QLength()) {
	    XNextEvent(ev);
	    DEBUG(printf("EVENT TYPE:%d\n", ev->type);)
	    
	    switch (ev->type) {
		    WHEN ButtonPressed: click(ev);
		    WHEN KeyPressed: KeyPress(ev);
		    WHEN ExposeWindow:
		    case ExposeRegion: Expose(ev); 
	    }
	} 
}

NxtPlr()
{
	curplr = !curplr;
}
\f


/*
 * $Log:	xloop.c,v $
 * Revision 1.3  88/02/19  13:49:42  hale
 * Added io changes for loading games.
 * Load game is cleaned up.  Variable board
 * sizes and formats available in save game
 * as well as printed comments.
 * 
 * Revision 1.2  88/02/13  12:54:54  hale
 * added logging.
 * 
 */