| 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_ROLLScxx . . $ `rolldice.h:38:9`! 0 |
| 39 | #define NUM_DICEcxx . . $ `rolldice.h:39:9`! 1 |
| 40 | #define NUM_SIDEScxx . . $ `rolldice.h:40:9`! 2 |
| 41 | #define MULTIPLIERcxx . . $ `rolldice.h:41:9`! 3 |
| 42 | #define MODIFIERcxx . . $ `rolldice.h:42:9`! 4 |
| 43 | #define NUM_DROPcxx . . $ `rolldice.h:43:9`! 5 |
| 44 | #define NUM_INITIALIZEDcxx . . $ `rolldice.h:44:9`! 6 |
| 45 | #define DICE_ARRAY_SIZEcxx . . $ `rolldice.h:45:9`! 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_IDENTcxx . . $ `rolldice.h:51:9`! "x" |
| 52 | #define DICE_SIDES_IDENTcxx . . $ `rolldice.h:52:9`! "d" |
| 53 | #define MULTI_IDENTcxx . . $ `rolldice.h:53:9`! "*" |
| 54 | #define MOD_PLUS_IDENTcxx . . $ `rolldice.h:54:9`! "+" |
| 55 | #define MOD_MINUS_IDENTcxx . . $ `rolldice.h:55:9`! "-" |
| 56 | #define DROP_IDENTcxx . . $ `rolldice.h:56:9`! "s" |
| 57 | |
| 58 | // Defines values for true and false, just for testing stuff boolean-wise :) |
| 59 | #define TRUE_VALcxx . . $ `rolldice.h:59:9`! 1 |
| 60 | #define FALSE_VALcxx . . $ `rolldice.h:60:9`! 0 |
| 61 | |
| 62 | // Defines values for the random number file to use |
| 63 | typedef enumcxx . . $ $anonymous_type_acf09785621713f4_0# {UNDEFcxx . . $ UNDEF., URANDOMcxx . . $ URANDOM., RANDOMcxx . . $ RANDOM.} rand_typecxx . . $ rand_type#; |
| 64 | |
| 65 | // External function declarations for using rolldice() and kin. |
| 66 | extern int parse_stringcxx . . $ parse_string(b0a0d720b596a511).(char *dice_string, int *dice_nums); |
| 67 | extern int rolldiecxx . . $ rolldie(7864480464b09eea).(int num_sides); |
| 68 | extern void init_randomcxx . . $ init_random(bc2330f64d909df9).(rand_typecxx . . $ rand_type# rand_file); |