[utils] string utils, file utils, contiguous arrays of strings used for storing tokenized strings, klib for generic hashtables and vectors, antirez's sds for certain types of string building, utf8proc for iterating over utf-8 strings and unicode normalization

This commit is contained in:
Al
2015-03-03 12:27:19 -05:00
parent 27269e18ca
commit 5216aba1b6
16 changed files with 16961 additions and 0 deletions

45
src/file_utils.h Normal file
View File

@@ -0,0 +1,45 @@
#ifndef FILE_UTILS_H
#define FILE_UTILS_H
#ifdef __cplusplus
extern "C" {
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
#ifndef BUFSIZ
#define BUFSIZ 4096
#endif
#ifdef _WIN32
#define PATH_SEPERATOR "\\"
#else
#define PATH_SEPERATOR "/"
#endif
#define PATH_SEPERATOR_LEN strlen(PATH_SEPERATOR)
char *file_getline(FILE * f);
bool file_read_int32(FILE *file, int32_t *value);
bool file_write_int32(FILE *file, int32_t value);
bool file_read_int16(FILE *file, int16_t *value);
bool file_write_int16(FILE *file, int16_t value);
bool file_read_int8(FILE *file, int8_t *value);
bool file_write_int8(FILE *file, int8_t value);
bool file_read_chars(FILE *file, char *buf, size_t len);
bool file_write_chars(FILE *file, const char *buf, size_t len);
#ifdef __cplusplus
}
#endif
#endif