Debian Codegraph @

rolldice.h

raw symbols SCIP
1 /*
2 * rolldice.h - v1.14 - 18 December 2012
3 * (c) Stevie Strickland, 1999-2012
4 *
5 * This program has been placed under the GPL. Any bugfixes or enhancements
6 * will be greatly appreciated :)
7 *
8 * Stevie Strickland - [email protected]
9 */
10
11 /* Standard includes */
12 #include <stdio.h>
13 #include <stdlib.h>
14
15 /* For GNU getopt */
16 #include <getopt.h>
17
18 /* For GNU readline */
19 #include <readline/readline.h>
20
21 /* For exit values */
22 #include <sysexits.h>
23
24 /* For the time() function */
25 #include <time.h>
26
27 /* For the strstr() function */
28 #include <string.h>
29
30 /* For some bounds */
31 #include <limits.h>
32
33 /* The following #defines give the position of each important dice-related
34 * number inside of the dice_nums array. The final #define gives us the
35 * size of the dice_nums array, which should be the number of other
36 * #defines below.
37 */
38 #define NUM_ROLLS 0
39 #define NUM_DICE 1
40 #define NUM_SIDES 2
41 #define MULTIPLIER 3
42 #define MODIFIER 4
43 #define NUM_DROP 5
44 #define NUM_INITIALIZED 6
45 #define DICE_ARRAY_SIZE 7
46
47 /* The following #defines give the tokens for each part of the format
48 * string. Perhaps eventually I'll change parse_string to use strtok()
49 * instead of strstr() :)
50 */
51 #define ROLL_IDENT "x"
52 #define DICE_SIDES_IDENT "d"
53 #define MULTI_IDENT "*"
54 #define MOD_PLUS_IDENT "+"
55 #define MOD_MINUS_IDENT "-"
56 #define DROP_IDENT "s"
57
58 // Defines values for true and false, just for testing stuff boolean-wise :)
59 #define TRUE_VAL 1
60 #define FALSE_VAL 0
61
62 // Defines values for the random number file to use
63 typedef enum {UNDEF, URANDOM, RANDOM} rand_type;
64
65 // External function declarations for using rolldice() and kin.
66 extern int parse_string(char *dice_string, int *dice_nums);
67 extern int rolldie(int num_sides);
68 extern void init_random(rand_type rand_file);