1 /* Including standard libraries */
12 /* Define a shorthand for unsigned int */
13 #define uint unsigned int
15 /* Define a boolean type */
20 /* Macros for determining min or max of two given values. */
21 #define MAX( a, b ) a < b ? b : a
22 #define MIN( a, b ) a > b ? b : a
24 /* Macros for abs and int functions. */
25 #define ABS( x ) ( ( x ) < 0 ) ? -( x ) : ( x )
26 #define INT( x ) ( int ) x
29 /* >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> STRUCTURE DECLARATIONS <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<*/
32 // At some point test if typdef struct list list will allow us to move all this stuff to list.h and list.c
35 /* Singly linked list with a pointer to the next element and a pointer to a value. */
42 /* Singly linked list with a pointer to the next element and an integer value. */
50 /* >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> ERROR HANDLING <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<*/
53 /* Print error message to stderr and exit. */
54 void die( char *error_msg );
56 /* Print warning message to stderr. */
57 void warn( char *warn_msg );
60 /* >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> ARRAYS <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<*/
63 /* Binary search an array of integers for an integer value. */
64 bool binary_search_array( int *array, int array_size, int val );
67 /* >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> MISC <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<*/
70 /* Split a given line and a delimiter return the split result as a list. */
71 void split( char *string, char delimit, struct list **fields );
73 /* Mockup version of Perl substr. */
74 char *substr( char *string, int offset, int len );
76 /* Return a binary number as a string of 1's and 0's. */
77 char *bits2string( uint bin );
80 /* >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<*/