1 // This file is part of Freecell Solver. It is subject to the license terms in
2 // the COPYING.txt file found in the top-level directory of this distribution
3 // and at http://fc-solve.shlomifish.org/docs/distro/COPYING.html . No part of
4 // Freecell Solver, including this file, may be copied, modified, propagated,
5 // or distributed except according to the terms contained in the COPYING file.
6 //
7 // Copyright (c) 2000 Shlomi Fish
8 // internal_move_struct.h - header file for the internal move structure.
9 //
10 // This file is not exposed to the outside.
11 #pragma once
12 
13 #ifdef __cplusplus
14 extern "C" {
15 #endif
16 
17 #include "freecell-solver/fcs_conf.h"
18 
19 #ifdef FCS_WITH_MOVES
20 
21 #include "freecell-solver/fcs_move.h"
22 
23 #ifdef FCS_USE_COMPACT_MOVE_TOKENS
24 typedef struct
25 {
26     unsigned int type : 4;
27     unsigned int src : 4;
28     unsigned int dest : 4;
29     unsigned int num_cards_in_seq : 4;
30 } fcs_internal_move;
31 #else
32 typedef fcs_move_t fcs_internal_move;
33 #endif
34 
35 #ifdef FCS_USE_COMPACT_MOVE_TOKENS
36 #define fcs_int_move_set_src(move, value) (move).src = ((unsigned int)(value))
37 #define fcs_int_move_set_dest(move, value) (move).dest = ((unsigned int)(value))
38 #define fcs_int_move_set_type(move, value) (move).type = ((unsigned int)(value))
39 #define fcs_int_move_set_num_cards_in_seq(move, value)                         \
40     (move).num_cards_in_seq = ((unsigned int)(value))
41 
42 #define fcs_int_move_get_src(move) ((move).src)
43 #define fcs_int_move_get_dest(move) ((move).dest)
44 #define fcs_int_move_get_type(move) ((move).type)
45 #define fcs_int_move_get_num_cards_in_seq(move) ((move).num_cards_in_seq)
46 
47 #else
48 
49 #define fcs_int_move_set_src(move, value)                                      \
50     fcs_move_set_src_stack((move), (value))
51 #define fcs_int_move_set_dest(move, value)                                     \
52     fcs_move_set_dest_stack((move), (value))
53 #define fcs_int_move_set_type(move, value) fcs_move_set_type((move), (value))
54 #define fcs_int_move_set_num_cards_in_seq(move, value)                         \
55     fcs_move_set_num_cards_in_seq((move), (value))
56 
57 #define fcs_int_move_get_src(move) fcs_move_get_src_stack((move))
58 #define fcs_int_move_get_dest(move) fcs_move_get_dest_stack((move))
59 #define fcs_int_move_get_type(move) fcs_move_get_type((move))
60 #define fcs_int_move_get_num_cards_in_seq(move)                                \
61     fcs_move_get_num_cards_in_seq((move))
62 
63 #endif
64 
65 typedef struct
66 {
67     fcs_internal_move *moves;
68     uint_fast32_t num_moves;
69 } fcs_move_stack;
70 
71 #endif
72 
73 #ifdef __cplusplus
74 }
75 #endif
76