]> git.donarmstrong.com Git - biopieces.git/blob - code_c/Maasha/src/inc/common.h
another c code upgrade
[biopieces.git] / code_c / Maasha / src / inc / common.h
1 /* Including standard libraries */
2 #include <stdio.h>
3 #include <stdlib.h>
4 #include <stdarg.h>
5 #include <string.h>
6 #include <unistd.h>
7 #include <ctype.h>
8 #include <math.h>
9 #include <assert.h>
10 #include <errno.h>
11
12 typedef char bool;
13
14 #define TRUE 1
15 #define FALSE 0
16
17 /* Macros for determining min or max of two given values. */
18 #define MAX( a, b ) a < b ? b : a
19 #define MIN( a, b ) a > b ? b : a
20
21 /* Macros for abs and int functions. */
22 #define ABS( x ) ( ( x ) < 0 ) ? -( x ) : ( x )
23 #define INT( x ) ( int ) x
24
25 /* Neat debug macro. */
26 #define DEBUG_EXIT 0
27 #define die assert( DEBUG_EXIT )
28
29
30 /* >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> STRUCTURE DECLARATIONS <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<*/
31
32
33 // At some point test if typdef struct list list will allow us to move all this stuff to list.h and list.c
34
35
36 /* Singly linked list with a pointer to the next element and a pointer to a value. */
37 struct list
38 {
39     struct list *next;
40     void        *val;
41 };
42
43 /* Singly linked list with a pointer to the next element and an integer value. */
44 struct list_int
45 {
46     struct list *next;
47     int          val;
48 };
49
50
51 /* >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> ARRAYS <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<*/
52
53
54 /* Binary search an array of integers for an integer value. */
55 bool binary_search_array( int *array, int array_size, int val );
56
57
58 /* >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> MISC <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<*/
59
60
61 /* Return a binary number as a string of 1's and 0's. */
62 char *bits2string( uint bin );
63
64
65 /* >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<*/
66
67