aaaaaa123456789 icon

Common library headers

aaaaaa123456789 | PRO | 12/16/13 09:19:01 AM UTC | 0 ⭐ | 407 👁️ | Never ⏰ | []
C |

1.35 KB

|

None

|

0 👍

/

0 👎

/*
  This file is hereby released to the public domain.
  ~aaaaaa123456789, 2015-01-21
  
  last updated 2015-01-23
*/
 
#ifndef COMMON_H_
 
#define COMMON_H_
 
typedef enum {
  LCERR_OK = 0,
  LCERR_LINE_TOO_LONG = 1,
  LCERR_LINE_TOO_SHORT = 2,
  LCERR_SPURIOUS_CHARS = 4,
  LCERR_INVALID_REPLACEMENT = -1
} line_check_error_t;
 
char * get_line(unsigned char * reachedEOF);
char ** get_lines(unsigned lines, const char * stopper, int single_pointer,
                  unsigned char * reachedEOF);
char * read_all(FILE * stream);
unsigned read_all_binary(FILE * stream, char ** result);
void free_lines_array(char ** lines, unsigned count);
int check_line(char ** line, unsigned expected_size, const char * valid_chars,
               char replacement, FILE * error_stream, unsigned line_number);
unsigned get_number(void);
int array_each(void * array, unsigned item_size, unsigned count, void * stopper,
               int (* callback) (void *, void *), void * data);
int array_all(void * array, unsigned item_size, unsigned count, void * stopper,
              int (* callback) (void *, void *), void * data);
unsigned count_lines(char ** lines);
char ** tokenize_string(const char * string, const char * delimiters,
                        int single_pointer);
void * xmalloc(size_t size);
void * xrealloc(void * buffer, size_t size);
 
#endif

Comments