* Intro to using the VGA/Mesa interface
 *
 * 1. #include the <vga.h> file
 * 2. Call vga_init() to initialize the SVGA library.
 * 3. Call vga_setmode() to specify the screen size and color depth.
 * 4. Call SVGAMesaCreateContext() to setup a Mesa context.  If using 8-bit
 *    color Mesa assumes color index mode, if using 16-bit or deeper color
 *    Mesa assumes RGB mode.
 * 5. Call SVGAMesaMakeCurrent() to activate the Mesa context.
 * 6. You can now use the Mesa API functions.
 * 7. Before exiting, call SVGAMesaDestroyContext() then vga_setmode(TEXT)
 *    to restore the original text screen.
 *
 * Notes
 * 1. You must run your executable as root (or use the set UID-bit) because
 *    the SVGA library requires it.
 * 2. The SVGA driver is not fully implemented yet.  See svgamesa.c for what
 *    has to be done yet.
 */


#ifndef SVGAMESA_H
#define SVGAMESA_H


#define SVGAMESA_MAJOR_VERSION 3
#define SVGAMESA_MINOR_VERSION 0


#ifdef __cplusplus
extern "C" {
#endif


#include "GL/gl.h"



/*
 * This is the SVGAMesa context 'handle':
 */
typedef struct svgamesa_context *SVGAMesaContext;



/*
 * doubleBuffer flag new in version 2.4
 */
extern SVGAMesaContext SVGAMesaCreateContext( GLboolean doubleBuffer );

extern void SVGAMesaDestroyContext( SVGAMesaContext ctx );

extern void SVGAMesaMakeCurrent( SVGAMesaContext ctx );

extern SVGAMesaContext SVGAMesaGetCurrentContext( void );

extern void SVGAMesaSwapBuffers( void );


#ifdef __cplusplus
}
#endif


#endif
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 /* $Id: wmesa.h,v 3.2 1999/01/03 02:54:45 brianp Exp $ */

/*
 * Mesa 3-D graphics library
 * Version:  3.0
 * Copyright (C) 1995-1998  Brian Paul
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public
 * License along with this library; if not, write to the Free
 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 *
 */


/*
 * $Log: wmesa.h,v $
 * Revision 3.2  1999/01/03 02:54:45  brianp
 * updated per Ted Jump
 *
 * Revision 3.1  1998/12/01 02:34:27  brianp
 * applied Mark Kilgard's patches from November 30, 1998
 *
 * Revision 3.0  1998/02/20 05:06:59  brianp
 * initial rev
 *
 */


/*
 * Windows driver by: Mark E. Peterson (markp@ic.mankato.mn.us)
 * Updated by Li Wei (liwei@aiar.xjtu.edu.cn)
 *
 *
 ***************************************************************
 *                     WMesa                                   *
 *                     version 2.3                             *	
 *                                                             *
 *                        By                                   *
 *                      Li Wei                                 *
 *       Institute of Artificial Intelligence & Robotics       *
 *       Xi'an Jiaotong University                             *
 *       Email: liwei@aiar.xjtu.edu.cn                         * 
 *       Web page: http://sun.aiar.xjtu.edu.cn                 *
 *                                                             *
 *	       July 7th, 1997				       *
 ***************************************************************
 */


#ifndef WMESA_H
#define WMESA_H


#ifdef __cplusplus
extern "C" {
#endif


#include "gl\gl.h"

#pragma warning (disable:4273)
#pragma warning( disable : 4244 ) /* '=' : conversion from 'const double ' to 'float ', possible loss of data */
#pragma warning( disable : 4018 ) /* '<' : signed/unsigned mismatch */
#pragma warning( disable : 4305 ) /* '=' : truncation from 'const double ' to 'float ' */
#pragma warning( disable : 4013 ) /* 'function' undefined; assuming extern returning int */
#pragma warning( disable : 4761 ) /* integral size mismatch in argument; conversion supplied */
#pragma warning( disable : 4273 ) /* 'identifier' : inconsistent DLL linkage. dllexport assumed */
#if (MESA_WARNQUIET>1)
#	pragma warning( disable : 4146 ) /* unary minus operator applied to unsigned type, result still unsigned */
#endif

/*
 * This is the WMesa context 'handle':
 */
typedef struct wmesa_context *WMesaContext;



/*
 * Create a new WMesaContext for rendering into a window.  You must
 * have already created the window of correct visual type and with an
 * appropriate colormap.
 *
 * Input:
 *         hWnd - Window handle
 *         Pal  - Palette to use
 *         rgb_flag - GL_TRUE = RGB mode,
 *                    GL_FALSE = color index mode
 *         db_flag - GL_TRUE = double-buffered,
 *                   GL_FALSE = single buffered
 *
 * Note: Indexed mode requires double buffering under Windows.
 *
 * Return:  a WMesa_context or NULL if error.
 */
extern WMesaContext WMesaCreateContext(HWND hWnd,HPALETTE* pPal,
                                       GLboolean rgb_flag,GLboolean db_flag);


/*
 * Destroy a rendering context as returned by WMesaCreateContext()
 */
/*extern void WMesaDestroyContext( WMesaContext ctx );*/
extern void WMesaDestroyContext( void );



/*
 * Make the specified context the current one.
 */
extern void WMesaMakeCurrent( WMesaContext ctx );


/*
 * Return a handle to the current context.
 */
extern WMesaContext WMesaGetCurrentContext( void );


/*
 * Swap the front and back buffers for the current context.  No action
 * taken if the context is not double buffered.
 */
extern void WMesaSwapBuffers(void);


/*
 * In indexed color mode we need to know when the palette changes.
 */
extern void WMesaPaletteChange(HPALETTE Pal);

extern void WMesaMove(void);



#ifdef __cplusplus
}
#endif


#endif

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             /* $Id: xmesa.h,v 1.3 1999/02/24 22:43:27 jens Exp $ */

/*
 * Mesa 3-D graphics library
 * Version:  3.1
 * 
 * Copyright (C) 1999  Brian Paul   All Rights Reserved.
 * 
 * Permission is hereby granted, free of charge, to any person obtaining a
 * copy of this software and associated documentation files (the "Software"),
 * to deal in the Software without restriction, including without limitation
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
 * and/or sell copies of the Software, and to permit persons to whom the
 * Software is furnished to do so, subject to the following conditions:
 * 
 * The above copyright notice and this permission notice shall be included
 * in all copies or substantial portions of the Software.
 * 
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
 * BRIAN PAUL BE LIABLE FOR ANYet-top-card slot-id))))))
	(#t (check-to-foundations? (+ 1 slot-id)))))

(define (stripped card-list card)
  (if (<= (length card-list) 1)
      '()
      (if (eq? card (car card-list))
	  (cdr card-list)
	  (if (= (length card-list) 2)
	      '()
	      (stripped (cdr card-list) card)))))

(define (check-a-tableau card slot1 card-list slot2 imbedded?)
  (cond ((or (= (length card-list) 0)
	     (not (is-visible? (car card-list))))
	 #f)
	((and (not (eq? (is-red? (car card-list))
			(is-red? card)))
	      (= (+ 1 (get-value (car card-list)))
		 (get-value card)))
	 (if (or  (= (length card-list) 1)
		  (eq? (is-red? (car card-list))
		       (is-red? (cadr card-list)))
		  imbedded?
		  (not (= (+ 1 (get-value (car card-list)))
			  (get-value (cadr card-list))))
		  (check-a-foundation (cadr card-list) 0)
		  (check-a-tableau (get-top-card slot2)
				   slot1	
				   (cdr card-list)
				   slot2
				   #t)
		  (check-a-tableau (cadr card-list)
				   slot2
				   (get-cards slot1)
				   slot1
				   #t)
		  (check-a-tableau (cadr card-list)
				   slot2
				   (stripped (get-cards slot2)
					     (car card-list))
				   slot2
				   #t))
	     (list 1 (get-name (car card-list)) (get-name card))
	     (and (not imbedded?)
		  (check-a-tableau card 
				   slot1 
				   (cdr card-list) 
				   slot2 
				   imbedded?))))
	(imbedded? #f)
	(#t (check-a-tableau card slot1 (cdr card-list) slot2 imbedded?))))

(define (check-to-tableau? slot1 slot2)
  (cond ((= slot1 8)
	 #f)
	((or (= slot2 8)
	     (empty-slot? slot1))
	 (check-to-tableau? (+ 1 slot1) 1))
	((and (not (= slot1 slot2))
	      (check-a-tableau (get-top-card slot1) 
			       slot1 
			       (get-cards slot2) 
			       slot2 
			       #f))
	 (check-a-tableau (get-top-card slot1) 
			  slot1 
			  (get-cards slot2) 
			  slot2 
			  #f))
	(#t (check-to-tableau? slot1 (+ 1 slot2)))))

(define (get-hint)
  (or (check-to-foundations? 1)
      (check-to-tableau? 1 2)
      (check-for-empty)))

(define (get-options) #f)

(define (apply-options options) #f)

(define (timeout) #f)

(set-lambda new-game button-pressed button-released button-clicked button-double-clicked game-over game-won get-hint get-options apply-options timeout)
@


1.6
log
@bug fixes...
Hint support for scorpion complete
Hint support for yukon in progress.
@
text
@a221 1
(display "caf\n")
a234 1
(display "ctf\n")
a248 9
  (display "stripped:  ")
  (display card-list)
  (display "  ")
  (display card)
  (newline)
  (display (length card-list))
  (display "  ")
  (display (<= (length card-list) 1))
  (newline)
d250 6
a255 15
      (begin
	(display "stripped to null\n")
	'())
      (begin
	(display "borp!\n")
	(if (eq? card (car card-list))
	    (begin (display "stripped to:  ")
		   (display card-list)
		   (newline)
		   (cdr card-list))
	    (if (= (length card-list) 2)
		(begin
		  (display "also stripped to null\n")
		  '())
		(stripped (cdr card-list) card))))))
d270 18
a287 1
			  (get-value (cadr card-list)))))
d289 6
a294 22
	     (if (= 0 
		    (length 
		     (stripped 
		      (reverse (get-cards slot1))
		      (car card-list))))
		 (if (check-a-tableau (cadr card-list)
				      slot1
				      (get-cards slot2)
				      slot2
				      #t)
		     (list 1 (get-name (car card-list)) (get-name card))
		     #f)
		 (if (check-a-tableau (cadr card-list) 
				      slot1 
				      (append (stripped 
					       (reverse (get-cards slot1)) 
					       (car card-list))
					      (get-cards slot2)) 
				      slot2 
				      #t)
		     (list 1 (get-name (car card-list)) (get-name card))
		     #f))))
a298 1
(display "ctt\n")
@


1.5
log
@
license changed from LGPL to GPL.
oops....
@
text
@d183 2
a184 6
  (if (and (= 13 (length (get-cards 0)))
	   (= 13 (length (get-cards 8)))
	   (= 13 (length (get-cards 9)))
	   (= 13 (length (get-cards 10))))
      #f
      #t))
d194 143
d338 3
a340 1
  #f)
@


1.4
log
@Updates for compatibility with guile-1.3
@
text
@d1 1
a1 1
; Aisleriot - yukon.scm
d3 15
@


1.3
log
@added options for klondike/ potential for other games
@
text
@d87 1
a87 1
  (cond ((and (= (list-length card-list) 1)
d168 4
a171 4
  (if (and (= 13 (list-length (get-cards 0)))
	   (= 13 (list-length (get-cards 8)))
	   (= 13 (list-length (get-cards 9)))
	   (= 13 (list-length (get-cards 10))))
d176 4
a179 4
  (if (and (= 13 (list-length (get-cards 0)))
	   (= 13 (list-length (get-cards 8)))
	   (= 13 (list-length (get-cards 9)))
	   (= 13 (list-length (get-cards 10))))
@


1.2
log
@10/25/98:  fixed yukon double click bug, added rules for doublets and yukon
@
text
@d167 1
a167 1
(define (game-over borp)
d175 1
a175 1
(define (game-won borp)
d183 1
a183 1
(define (get-hint borp)
d186 7
a192 1
(set-lambda new-game button-pressed button-released button-clicked button-double-clicked game-over game-won get-hint)
@


1.1
log
@10/21/98:  added yukon.scm
@
text
@d132 1
a132 1
		  (complete-transaction slot (list top-card) 8)))))
@

