1
zero-epwing/book.h

68 lines
1.9 KiB
C
Raw Normal View History

2016-11-21 02:23:50 +00:00
/*
2017-02-05 20:30:57 +00:00
* Copyright (c) 2017 Alex Yatskov <alex@foosoft.net>
2016-11-21 02:23:50 +00:00
* Author: Alex Yatskov <alex@foosoft.net>
*
2017-02-05 20:30:57 +00:00
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
2016-11-21 02:23:50 +00:00
*
2017-02-05 20:30:57 +00:00
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
2016-11-21 02:23:50 +00:00
*
2017-02-05 20:30:57 +00:00
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2016-11-21 02:23:50 +00:00
*/
#ifndef BOOK_H
#define BOOK_H
#include <stdio.h>
/*
* Types
*/
typedef struct {
char* text;
2016-11-30 16:55:54 +00:00
int page;
int offset;
2016-11-30 17:26:50 +00:00
} Book_Block;
2016-11-30 16:55:54 +00:00
typedef struct {
2016-11-30 17:26:50 +00:00
Book_Block heading;
Book_Block text;
2016-11-21 02:23:50 +00:00
} Book_Entry;
typedef struct {
2016-11-30 17:26:50 +00:00
char* title;
Book_Block copyright;
Book_Entry* entries;
int entry_count;
int entry_alloc;
2016-11-21 02:23:50 +00:00
} Book_Subbook;
typedef struct {
2016-11-29 05:24:51 +00:00
char char_code[32];
2016-11-22 06:44:33 +00:00
char disc_code[32];
2016-11-21 02:23:50 +00:00
Book_Subbook* subbooks;
int subbook_count;
} Book;
/*
* Functions
*/
2016-11-22 06:31:01 +00:00
void book_init(Book* book);
2016-11-21 02:23:50 +00:00
void book_free(Book* book);
int book_import(Book* book, const char path[], int flags);
2016-12-05 02:36:06 +00:00
int book_export(FILE* fp, const Book* book, int flags);
2016-11-21 02:23:50 +00:00
#endif /* BOOK_H */