Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
.DS_Store
EPUB3Processor.xcodeproj/xcuserdata
*.pyc
# .gitignore


*~
*#
.#*
*rej
*orig
pinentry*
*.hi
*.o
*.a
6 changes: 6 additions & 0 deletions EPUB3.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
#define _POSIX_C_SOURCE 200809L
#include <limits.h>
#ifndef MAXNAMLEN
#define MAXNAMLEN NAME_MAX
#endif

#include "EPUB3.h"
#include "EPUB3_private.h"

Expand Down
7 changes: 7 additions & 0 deletions EPUB3_private.h
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
#include <stdio.h>
#include <string.h>

#include <libxml/tree.h>
#include <libxml/parser.h>
#include <libxml/xmlreader.h>
#include <libxml/xpath.h>
#include <libxml/xpathInternals.h>
#include <sys/types.h>
#include <sys/stat.h>
#ifdef __linux__
#include <dirent.h>
#else
#include <sys/dirent.h>
#endif

#include <string.h>
#include <assert.h>
#include <errno.h>
Expand Down
32 changes: 32 additions & 0 deletions Example.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#include <stdio.h>
#include "EPUB3.h"

#define EPUB3ErrorNone 0



int main(void) {
EPUB3Error result;
EPUB3Ref epub = EPUB3CreateWithArchiveAtPath("example.epub", &result);
if (epub == NULL) {
fprintf(stderr, "Failed to open EPUB file\n");
return 1;
}

EPUB3Error extractResult = EPUB3ExtractArchiveToPath(epub, "output_directory");
if (extractResult != EPUB3ErrorNone) {
fprintf(stderr, "Failed to extract EPUB file\n");
EPUB3Release(epub);
return 1;
}

char *title = EPUB3CopyTitle(epub);
char *identifier = EPUB3CopyIdentifier(epub);

printf("Title: %s\n", title);
printf("Identifier: %s\n", identifier);

// Free or release resources as needed
EPUB3Release(epub);
return 0;
}
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,22 @@ EPUB3Processor is written in pure C language conforming to ANSI 99 standard. It

###Usage and Testing

#### Build for linux
``` shell
gcc -std=c99 -Wall $(xml2-config --cflags) -I. -I./support_libs/MiniZip/ -c EPUB3.c -o EPUB3.o
```

#### real-world usage:
```shell
$ gcc -std=c99 -Wall $(xml2-config --cflags) -I. -I./support_libs/MiniZip/ -c EPUB3.c -o EPUB3.o
$ gcc -std=c99 -Wall $(xml2-config --cflags) -I. -I./support_libs/MiniZip/ -c Example.c
$ gcc -std=c99 -Wall -I./support_libs/MiniZip/ -c support_libs/MiniZip/unzip.c -o unzip.o
$ gcc -std=c99 -Wall -I./support_libs/MiniZip/ -c support_libs/MiniZip/ioapi.c -o ioapi.o
$ gcc Example.o EPUB3.o unzip.o ioapi.o -o my_program $(xml2-config --libs) -lz
```


###
Current Xcode project for EPUB3Processor generates a static library named libEPUB3Processor.a. Link to this library in your client code or simply include and compile the code in your project.

**API - see EPUB3.h**
Expand Down