-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathpymain.c
98 lines (85 loc) · 2.91 KB
/
pymain.c
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
#include "optimisations/hash.h"
#include "solving/moves_traversal.h"
#include "output/plaintext/language_dependant.h"
#include "output/latex/latex.h"
#include "platform/priority.h"
#include "position/effects/piece_creation.h"
#include "position/effects/piece_readdition.h"
#include "position/effects/piece_removal.h"
#include "position/effects/board_transformation.h"
#include "position/effects/walk_change.h"
#include "position/effects/flags_change.h"
#include "position/effects/side_change.h"
#include "position/effects/piece_movement.h"
#include "position/effects/piece_exchange.h"
#include "input/commandline.h"
#include "input/plaintext/token.h"
#include "stipulation/pipe.h"
#include "debugging/trace.h"
#include <stdio.h>
#include <stdlib.h>
/* Check assumptions made throughout the program. Abort if one of them
* isn't met. */
static void checkGlobalAssumptions(void)
{
check_hash_assumptions();
enforce_piecename_uniqueness();
}
int main(int argc, char *argv[])
{
TraceFunctionEntry(__func__);
TraceFunctionParam("%d",argc);
for (int i = 0; i < argc; ++i)
{
TraceValue("%d",i);
TraceFunctionParam("%s",argv[i]);
}
TraceFunctionParamListEnd();
checkGlobalAssumptions();
platform_set_nice_priority();
initialise_slice_properties();
init_structure_children_visitors();
init_moves_children_visitors();
move_effect_journal_init_move_effect_doers();
position_piece_creation_initialise();
position_piece_removal_initialise();
position_piece_readdition_initialise();
position_board_transformation_initialise();
position_piece_movement_initialise();
position_walk_change_initialise();
position_piece_exchange_initialise();
position_flags_change_initialise();
position_side_change_initialise();
{
slice_index const parser = alloc_command_line_options_parser(argc,argv);
slice_index const prototypes[] =
{
alloc_pipe(STPlatformInitialiser),
alloc_pipe(STHashTableDimensioner),
alloc_pipe(STOutputLaTeXCloser),
/* start timer to be able to display a reasonable time if the user
* aborts execution before the timer is started for the first
* problem */
alloc_pipe(STTimerStarter),
alloc_pipe(STCheckDirInitialiser),
output_plaintext_alloc_writer(stdout),
alloc_pipe(STInputPlainTextUserLanguageDetector),
alloc_pipe(STInputPlainTextProblemsIterator),
alloc_pipe(STConditionsResetter),
alloc_pipe(STOptionsResetter),
alloc_pipe(STInputPlainTextProblemHandler),
alloc_pipe(STTimerStarter),
alloc_pipe(STInputPlainTextInitialTwinReader),
alloc_pipe(STProblemSolvingIncomplete)
};
enum { nr_prototypes = sizeof prototypes / sizeof prototypes[0] };
slice_insertion_insert(parser,prototypes,nr_prototypes);
solve(parser);
dealloc_slices(parser);
assert_no_leaked_slices();
}
TraceFunctionExit(__func__);
TraceFunctionResult("%d",0);
TraceFunctionResultEnd();
return 0;
}