123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- // names of everything are prefixed to avoid library collisions
- #ifndef basic_types_h
- #define basic_types_h
- // all dependencies
- #include <stdio.h>
- // basic integer types
- // minimum and maximum
- typedef unsigned char owl_byte;
- typedef char owl_char;
- typedef unsigned long long int owl_umax;
- typedef long long int owl_smax;
- // useful in some cases
- #define NOT_NULL ((void *) NULL + 1)
- // this library assumes 1 byte = 8 bits
- #define OWL_BYTE_BITS 8
- // float and boolean
- typedef double owl_fmax;
- typedef owl_char owl_bool;
- #define owl_false 0
- #define owl_true 1
- #define owl_bool_err 2
- // owl_type_basic_types_h enum
- // this enum will be extended each time a new type (without
- // including these enums) is introduced into the library
- typedef enum
- {
- OWL_TYPE_NONE,
- OWL_TYPE_BYTE,
- OWL_TYPE_CHAR,
- OWL_TYPE_UMAX,
- OWL_TYPE_SMAX,
- OWL_TYPE_FMAX,
- OWL_TYPE_BOOL,
- } owl_type_basic_types_h;
- // mask enum as an integer type for
- // variable type function arguments
- typedef owl_type_basic_types_h owl_type;
- // creating and destroying is not
- // necessary with these simple data types
- // internal use function
- owl_bool owl_check_ptr(void * ptr, owl_umax size);
- // printing functions
- owl_umax owl_print_byte_bin(owl_byte * mem, owl_umax mem_size);
- owl_umax owl_print_byte_dec(owl_byte * mem, owl_umax mem_size);
- owl_umax owl_print_byte_hex(owl_byte * mem, owl_umax mem_size);
- owl_umax owl_print_char_dec(owl_byte * mem, owl_umax mem_size);
- owl_umax owl_print_char_char(owl_byte * mem, owl_umax mem_size);
- owl_umax owl_print_umax_dec(owl_byte * mem, owl_umax mem_size);
- owl_umax owl_print_umax_hex(owl_byte * mem, owl_umax mem_size);
- owl_umax owl_print_smax_dec(owl_byte * mem, owl_umax mem_size);
- owl_umax owl_print_fmax(owl_byte * mem, owl_umax mem_size);
- owl_umax owl_print_bool(owl_byte * mem, owl_umax mem_size);
- // compare functions and some defs
- #define owl_comp_less -1
- #define owl_comp_equal 0
- #define owl_comp_greater 1
- #define owl_comp_err 2
- owl_char owl_comp_byte(owl_byte * byte1, owl_byte * byte2);
- owl_char owl_comp_char(owl_byte * char1, owl_byte * char2);
- owl_char owl_comp_umax(owl_byte * umax1, owl_byte * umax2);
- owl_char owl_comp_smax(owl_byte * smax1, owl_byte * smax2);
- owl_char owl_comp_fmax(owl_byte * fmax1, owl_byte * fmax2);
- owl_char owl_comp_bool(owl_byte * bool1, owl_byte * bool2);
- #include "basic_types.c"
- #endif // basic_types_h
|