1
zero-epwing/book.h

64 lines
1.5 KiB
C
Raw Normal View History

2016-11-21 02:23:50 +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 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 */