Advertisement
aaaaaa123456789

Common library headers

Dec 16th, 2013
179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.35 KB | None | 0 0
  1. /*
  2.   This file is hereby released to the public domain.
  3.   ~aaaaaa123456789, 2015-01-21
  4.  
  5.   last updated 2015-01-23
  6. */
  7.  
  8. #ifndef COMMON_H_
  9.  
  10. #define COMMON_H_
  11.  
  12. typedef enum {
  13.   LCERR_OK = 0,
  14.   LCERR_LINE_TOO_LONG = 1,
  15.   LCERR_LINE_TOO_SHORT = 2,
  16.   LCERR_SPURIOUS_CHARS = 4,
  17.   LCERR_INVALID_REPLACEMENT = -1
  18. } line_check_error_t;
  19.  
  20. char * get_line(unsigned char * reachedEOF);
  21. char ** get_lines(unsigned lines, const char * stopper, int single_pointer,
  22.                   unsigned char * reachedEOF);
  23. char * read_all(FILE * stream);
  24. unsigned read_all_binary(FILE * stream, char ** result);
  25. void free_lines_array(char ** lines, unsigned count);
  26. int check_line(char ** line, unsigned expected_size, const char * valid_chars,
  27.                char replacement, FILE * error_stream, unsigned line_number);
  28. unsigned get_number(void);
  29. int array_each(void * array, unsigned item_size, unsigned count, void * stopper,
  30.                int (* callback) (void *, void *), void * data);
  31. int array_all(void * array, unsigned item_size, unsigned count, void * stopper,
  32.               int (* callback) (void *, void *), void * data);
  33. unsigned count_lines(char ** lines);
  34. char ** tokenize_string(const char * string, const char * delimiters,
  35.                         int single_pointer);
  36. void * xmalloc(size_t size);
  37. void * xrealloc(void * buffer, size_t size);
  38.  
  39. #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement