File: internal_move_struct.h

package info (click to toggle)
freecell-solver 5.0.0-4
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 4,256 kB
  • sloc: ansic: 28,700; perl: 10,050; xml: 5,600; python: 1,339; sh: 533; cpp: 275; makefile: 20; javascript: 8
file content (79 lines) | stat: -rw-r--r-- 2,622 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
/*
 * This file is part of Freecell Solver. It is subject to the license terms in
 * the COPYING.txt file found in the top-level directory of this distribution
 * and at http://fc-solve.shlomifish.org/docs/distro/COPYING.html . No part of
 * Freecell Solver, including this file, may be copied, modified, propagated,
 * or distributed except according to the terms contained in the COPYING file.
 *
 * Copyright (c) 2000 Shlomi Fish
 */
// internal_move_struct.h - header file for the internal move structure.
//
// This file is not exposed to the outside.
#pragma once

#ifdef __cplusplus
extern "C" {
#endif

#include "fcs_conf.h"

#ifdef FCS_WITH_MOVES

#include "freecell-solver/fcs_move.h"

#ifdef FCS_USE_COMPACT_MOVE_TOKENS
typedef struct
{
    unsigned int type : 4;
    unsigned int src : 4;
    unsigned int dest : 4;
    unsigned int num_cards_in_seq : 4;
} fcs_internal_move;
#else
typedef fcs_move_t fcs_internal_move;
#endif

#ifdef FCS_USE_COMPACT_MOVE_TOKENS
#define fcs_int_move_set_src(move, value) (move).src = ((unsigned int)(value));
#define fcs_int_move_set_dest(move, value)                                     \
    (move).dest = ((unsigned int)(value));
#define fcs_int_move_set_type(move, value)                                     \
    (move).type = ((unsigned int)(value));
#define fcs_int_move_set_num_cards_in_seq(move, value)                         \
    (move).num_cards_in_seq = ((unsigned int)(value));

#define fcs_int_move_get_src(move) ((move).src)
#define fcs_int_move_get_dest(move) ((move).dest)
#define fcs_int_move_get_type(move) ((move).type)
#define fcs_int_move_get_num_cards_in_seq(move) ((move).num_cards_in_seq)

#else /* Not FCS_USE_COMPACT_MOVE_TOKENS */

#define fcs_int_move_set_src(move, value)                                      \
    fcs_move_set_src_stack((move), (value))
#define fcs_int_move_set_dest(move, value)                                     \
    fcs_move_set_dest_stack((move), (value))
#define fcs_int_move_set_type(move, value) fcs_move_set_type((move), (value))
#define fcs_int_move_set_num_cards_in_seq(move, value)                         \
    fcs_move_set_num_cards_in_seq((move), (value))

#define fcs_int_move_get_src(move) fcs_move_get_src_stack((move))
#define fcs_int_move_get_dest(move) fcs_move_get_dest_stack((move))
#define fcs_int_move_get_type(move) fcs_move_get_type((move))
#define fcs_int_move_get_num_cards_in_seq(move)                                \
    fcs_move_get_num_cards_in_seq((move))

#endif

typedef struct
{
    fcs_internal_move *moves;
    size_t num_moves;
} fcs_move_stack;

#endif

#ifdef __cplusplus
}
#endif