2016-11-01 02:32:40 +00:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2016 Alex Yatskov <alex@foosoft.net>
|
|
|
|
* Author: Alex Yatskov <alex@foosoft.net>
|
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef UTIL_H
|
|
|
|
#define UTIL_H
|
|
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
2016-11-01 03:40:52 +00:00
|
|
|
/*
|
|
|
|
Dictionary structures
|
|
|
|
*/
|
|
|
|
|
2016-11-01 05:24:20 +00:00
|
|
|
typedef struct {
|
|
|
|
char* heading;
|
|
|
|
char* text;
|
|
|
|
} TextBlock;
|
|
|
|
|
2016-11-01 03:40:52 +00:00
|
|
|
typedef struct {
|
|
|
|
char* heading;
|
|
|
|
char* text;
|
|
|
|
char* error;
|
|
|
|
|
|
|
|
int page;
|
|
|
|
int offset;
|
|
|
|
} Entry;
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
char* title;
|
2016-11-01 05:24:20 +00:00
|
|
|
char* copyright;
|
2016-11-01 03:40:52 +00:00
|
|
|
char* error;
|
|
|
|
|
|
|
|
Entry* entries;
|
|
|
|
int entry_count;
|
|
|
|
} Subbook;
|
|
|
|
|
|
|
|
typedef struct {
|
2016-11-01 05:24:20 +00:00
|
|
|
char character_code[256];
|
|
|
|
char disc_code[256];
|
2016-11-01 03:40:52 +00:00
|
|
|
|
|
|
|
Subbook* subbooks;
|
|
|
|
int subbook_count;
|
|
|
|
|
|
|
|
char error[256];
|
|
|
|
} Book;
|
|
|
|
|
|
|
|
/*
|
|
|
|
Array
|
|
|
|
*/
|
|
|
|
|
2016-11-01 02:32:40 +00:00
|
|
|
typedef struct {
|
2016-11-01 02:45:05 +00:00
|
|
|
void** ptr;
|
2016-11-01 02:32:40 +00:00
|
|
|
size_t used;
|
|
|
|
size_t size;
|
|
|
|
} Array;
|
|
|
|
|
2016-11-01 02:45:05 +00:00
|
|
|
void array_init(Array* arr, size_t size);
|
|
|
|
void array_push(Array* arr, void* data);
|
2016-11-01 02:32:40 +00:00
|
|
|
void array_free(Array* arr);
|
|
|
|
|
|
|
|
#endif
|