This is the doxygen documentation for gtkboard.

.
Main Page   Data Structures   File List   Data Fields   Globals  

stack.c File Reference

implements a stack for navigating undoing and redoing moves. More...

#include "stack.h"
#include "game.h"
#include "move.h"
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <signal.h>

Go to the source code of this file.

Defines

#define STACK_SIZE   4096
 Maximum size of stack.


Functions

void stack_free ()
void movstack_init ()
int movstack_get_num_moves ()
void movstack_push (byte *board, byte *move)
byte* movstack_pop ()
void movstack_trunc ()
 Truncates a stack to the current poisition. More...

byte* movstack_forw ()
byte* movstack_back ()
void movstack_free ()
void statestack_push (void *state)
void* statestack_peek ()
void* statestack_pop ()
void statestack_trunc ()
void* statestack_forw ()
void* statestack_back ()
void statestack_free ()

Variables

int movstack_ptr = 0
 Current position in the stack.

int movstack_max = 0
 Current size of the stack.

byte* movstack [STACK_SIZE]
 Array for moves.

byte* movinvstack [STACK_SIZE]
 Array for move inverses. See mov_getinv().

int statestack_ptr = 0
int statestack_max = 0
void* statestack [STACK_SIZE]


Detailed Description

implements a stack for navigating undoing and redoing moves.

stack is as follows: 0 ---> movstack_ptr : "back" list; movstack_ptr ---> movstack_max : "forward" list

Definition in file stack.c.


Define Documentation

#define STACK_SIZE   4096
 

Maximum size of stack.

Definition at line 44 of file stack.c.


Function Documentation

byte* movstack_back ( )
 

Definition at line 107 of file stack.c.

Referenced by engine_back_move().

byte* movstack_forw ( )
 

Definition at line 99 of file stack.c.

Referenced by engine_forw_move().

void movstack_free ( )
 

Definition at line 115 of file stack.c.

Referenced by stack_free().

int movstack_get_num_moves ( )
 

Definition at line 63 of file stack.c.

void movstack_init ( )
 

Definition at line 58 of file stack.c.

byte* movstack_pop ( )
 

Definition at line 78 of file stack.c.

void movstack_push ( byte * board,
byte * move )
 

Definition at line 68 of file stack.c.

void movstack_trunc ( )
 

Truncates a stack to the current poisition.

This will be called when the user makes a move when it is not the final poisition.

Definition at line 87 of file stack.c.

Referenced by engine_make_move(), and engine_take_move().

void stack_free ( )
 

Definition at line 52 of file stack.c.

Referenced by engine_new_game(), and engine_reset_game().

void* statestack_back ( )
 

Definition at line 180 of file stack.c.

Referenced by engine_back_move().

void* statestack_forw ( )
 

Definition at line 172 of file stack.c.

Referenced by engine_forw_move().

void statestack_free ( )
 

Definition at line 188 of file stack.c.

Referenced by stack_free().

void* statestack_peek ( )
 

Definition at line 149 of file stack.c.

Referenced by engine_make_move(), and engine_take_move().

void* statestack_pop ( )
 

Definition at line 156 of file stack.c.

void statestack_push ( void * state )
 

Definition at line 136 of file stack.c.

void statestack_trunc ( )
 

Definition at line 163 of file stack.c.


Variable Documentation

byte* movinvstack[STACK_SIZE] [static]
 

Array for move inverses. See mov_getinv().

Definition at line 50 of file stack.c.

byte* movstack[STACK_SIZE] [static]
 

Array for moves.

Definition at line 47 of file stack.c.

int movstack_max = 0 [static]
 

Current size of the stack.

Definition at line 41 of file stack.c.

int movstack_ptr = 0 [static]
 

Current position in the stack.

Definition at line 38 of file stack.c.

void* statestack[STACK_SIZE] [static]
 

Definition at line 133 of file stack.c.

int statestack_max = 0 [static]
 

Definition at line 131 of file stack.c.

int statestack_ptr = 0 [static]
 

Definition at line 131 of file stack.c.