      GLfloat *array, GLint stride, GLenum type );

GLUAPI void GLAPIENTRY gluNurbsCallback( GLUnurbsObj *nobj, GLenum which,
                                       void (GLCALLBACK *fn)() );



/*
 *
 * Polygon tesselation
 *
 */

GLUAPI GLUtriangulatorObj* GLAPIENTRY gluNewTess( void );

GLUAPI void GLAPIENTRY gluTessCallback( GLUtriangulatorObj *tobj, GLenum which,
                                      void (GLCALLBACK *fn)() );

GLUAPI void GLAPIENTRY gluDeleteTess( GLUtriangulatorObj *tobj );

GLUAPI void GLAPIENTRY gluBeginPolygon( GLUtriangulatorObj *tobj );

GLUAPI void GLAPIENTRY gluEndPolygon( GLUtriangulatorObj *tobj );

GLUAPI void GLAPIENTRY gluNextContour( GLUtriangulatorObj *tobj, GLenum type );

GLUAPI void GLAPIENTRY gluTessVertex( GLUtriangulatorObj *tobj, GLdouble v[3],
                                    void *data );



/*
 *
 * New functions in GLU 1.1
 *
 */

GLUAPI const GLubyte* GLAPIENTRY gluGetString( GLenum name );


#if defined(__BEOS__) || defined(__QUICKDRAW__)
#pragma export off
#endif


#ifdef macintosh
	#pragma enumsalwaysint reset
	#if PRAGMA_IMPORT_SUPPORTED
	#pragma import off
	#endif
#endif


#ifdef __cplusplus
}
#endif


#endif
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               /* $Id: glu_mangle.h,v 3.1 1999/06/21 22:00:42 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: glu_mangle.h,v $
 * Revision 3.1  1999/06/21 22:00:42  brianp
 * added #ifndef GLU_MANGLE_H stuff
 *
 * Revision 3.0  1998/02/20 05:04:45  brianp
 * initial rev
 *
 */

#ifndef GLU_MANGLE_H
#define GLU_MANGLE_H


#define gluLookAt mgluLookAt
#define gluOrtho2D mgluOrtho2D
#define gluPerspective mgluPerspective
#define gluPickMatrix mgluPickMatrix
#define gluProject mgluProject
#define gluUnProject mgluUnProject
#define gluErrorString mgluErrorString
#define gluScaleImage mgluScaleImage
#define gluBuild1DMipmaps mgluBuild1DMipmaps
#define gluBuild2DMipmaps mgluBuild2DMipmaps
#define gluNewQuadric mgluNewQuadric
#define gluDeleteQuadric mgluDeleteQuadric
#define gluQuadricDrawStyle mgluQuadricDrawStyle
#define gluQuadricOrientation mgluQuadricOrientation
#define gluQuadricNormals mgluQuadricNormals
#define gluQuadricTexture mgluQuadricTexture
#define gluQuadricCallback mgluQuadricCallback
#define gluCylinder mgluCylinder
#define gluSphere mgluSphere
#define gluDisk mgluDisk
#define gluPartialDisk mgluPartialDisk
#define gluNewNurbsRenderer mgluNewNurbsRenderer
#define gluDeleteNurbsRenderer mgluDeleteNurbsRenderer
#define gluLoadSamplingM-tableau start-slot)))
	((> end-slot 1)
	 (and (not (eq? (is-red? (get-top-card end-slot))
			(is-red? (car card-list))))
	      (= (+ 1 (get-value (get-top-card end-slot)))
		 (get-value (car card-list)))
	      (move-n-cards! start-slot end-slot (reverse card-list))
	      (add-to-score! (length card-list))
	      (empty-tableau start-slot)
	      (give-status-message)))
	(#t #f)))

(define (button-clicked slot-id)
  (and (= slot-id 0)
       (flip-stock 0 1 1)
       (give-status-message)))

(define (move-to-foundation slot-id foundation-id)
  (cond ((= foundation-id 10)
	 #f)
	((and (not (eq? (is-red? (get-top-card slot-id))
			(is-red? (get-top-card foundation-id))))
	      (= (+ 1 (get-value (get-top-card foundation-id)))
		 (get-value (get-top-card slot-id))))
	 (and (move-n-cards! slot-id
			     foundation-id
			     (list (get-top-card slot-id)))
	      (remove-card slot-id)
	      (empty-tableau slot-id)))
	(#t (move-to-foundation slot-id (+ 1 foundation-id)))))

(define (button-double-clicked slot-id)
  (and (not (empty-slot? slot-id))
       (or (= slot-id 1)
	   (> slot-id 9))
       (move-to-foundation slot-id 2)
       (add-to-score! 1)))

(define (game-continuable)
  (get-hint))

(define (game-won)
  (and (= (length (get-cards 2)) 13)
       (= (length (get-cards 3)) 13)
       (= (length (get-cards 4)) 13)
       (= (length (get-cards 5)) 13)
       (= (length (get-cards 6)) 13)
       (= (length (get-cards 7)) 13)
       (= (length (get-cards 8)) 13)
       (= (length (get-cards 9)) 13)))

(define (dealable?)
  (or (and (not (empty-slot? 0))
	   (list 0 "Deal another round"))
      (and (not (empty-slot? 1))
	   (< FLIP-COUNTER 1)
	   (list 0 "Move waste back to stock"))))

(define (check-a-foundation slot-id foundation-id)
  (cond ((= foundation-id 10)
	 #f)
	((and (not (eq? (is-red? (get-top-card slot-id))
			(is-red? (get-top-card foundation-id))))
	      (= (+ 1 (get-value (get-top-card foundation-id)))
		 (get-value (get-top-card slot-id))))
	 #t)
	(#t
	 (check-a-foundation slot-id (+ 1 foundation-id)))))

(define (check-to-foundations slot-id)
  (cond ((= slot-id 18)
	 #f)
	((= slot-id 2)
	 (check-to-foundations 10))
	((and (not (empty-slot? slot-id))
	      (check-a-foundation slot-id 2))
	 (list 2 
	       (get-name (get-top-card slot-id)) 
	       "the appropriate Foundation pile"))
	(#t
	 (check-to-foundations (+ 1 slot-id)))))

(define (check-a-tableau slot1 card-list slot2)
  (cond ((= slot2 18)
	 #f)
	((and (not (= slot1 slot2))
	      (not (eq? (is-red? (car card-list))
			(is-red? (get-top-card slot2))))
	      (= (+ 1 (get-value (car card-list)))
		 (get-value (get-top-card slot2)))
	      (or (= slot1 1)
		  (= (length card-list) 1)
		  (check-a-tableau slot1 (cdr card-list) 10)))
	 (list 1
	       (get-name (car card-list))
	       (get-name (get-top-card slot2))))
	(#t 
	 (check-a-tableau slot1 card-list (+ 1 slot2)))))

(define (check-to-tableaus slot-id)
  (cond ((= slot-id 18)
	 #f)
	((= slot-id 2)
	 (check-to-tableaus 10))
	((and (not (empty-slot? slot-id))
	      (check-a-tableau slot-id (get-cards slot-id) 10))
	 (check-a-tableau slot-id (get-cards slot-id) 10))
	(#t (check-to-tableaus (+ 1 slot-id)))))

(define (get-hint)
  (or (check-to-foundations 1)
      (check-to-tableaus 1)
      (dealable?)))

(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-continuable game-won get-hint get-options
apply-options timeout)
@
