nyctergatis.com

Contact

Projects
Sysquake Remote Live
NME
PDF
Hike
Sudoku
GifBuilder
jpeglib for Palm OS
MySQL Client
Cross-GCC for Mac OS
NMEEPubMain.c File Reference

EPub creation based on NME. More...

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "zip.h"
#include "NME.h"
#include "NMEAutolink.h"
#include "NMEEPub.h"
#include "NE.h"

Go to the source code of this file.

Defines

#define SIZE   (8 * 1024 * 1024L)
 Fixed size allocated for source :-(.
#define kNMENEEndnoteError   kNMEErr1stUser

Functions

static void DisplayUsageAndExit (char const *progName, int status)
static NMEErr parHookTOC (NMEInt level, NMEInt item, NMEBoolean enter, NMEConstText markup, NMEInt srcIndex, NMEInt srcLineNumber, NMEContext *context, void *data)
 Paragraph hook to extract titles.
static NMEErr spanHookImg (NMEInt level, NMEInt item, NMEBoolean enter, NMEConstText markup, NMEInt srcIndex, NMEInt srcLineNumber, NMEContext *context, void *data)
 Span hook to extract image URLs (set a flag when inside image markup, so that the encodeURL callback knows when it's given an image URL).
static NMEErr encodeURL (NMEConstText link, NMEInt linkLen, NMEContext *context, void *data)
 Encode URL callback used to get an image list.
NMEErr PluginEndnote (NMEConstText name, NMEInt nameLen, NMEConstText data, NMEInt dataLen, NMEContext *context, void *userData)
 Plugin for NE endnotes.
NMEErr PluginMeta (NMEConstText name, NMEInt nameLen, NMEConstText data, NMEInt dataLen, NMEContext *context, void *userData)
 Plugin for NE metadata.
NMEErr PluginGuide (NMEConstText name, NMEInt nameLen, NMEConstText data, NMEInt dataLen, NMEContext *context, void *userData)
 Plugin for NE guide to structural components.
int main (int argc, char **argv)
 Application entry point.

Variables

static NMEBoolean debug = FALSE
static NMEAutoconvert autoconverts [16]
 Table of autoconvert functions.
static NMEInterwiki const interwikis []
 Table of interwiki definitions.

Detailed Description

EPub creation based on NME.

Author:
Yves Piguet.

Definition in file NMEEPubMain.c.


Function Documentation

static NMEErr encodeURL ( NMEConstText  link,
NMEInt  linkLen,
NMEContext context,
void *  data 
) [static]

Encode URL callback used to get an image list.

Parameters:
[in]linkinput characters
[in]linkLenlength of link
[in]destaddress of encoded text
[in]destSizesize of dest
[in,out]destIxindex in dest (should be updated by encoded character length)
[in,out]datavalue specific to the callback
Returns:
error code (kNMEErrOk for success)

Definition at line 169 of file NMEEPubMain.c.

static NMEErr parHookTOC ( NMEInt  level,
NMEInt  item,
NMEBoolean  enter,
NMEConstText  markup,
NMEInt  srcIndex,
NMEInt  srcLineNumber,
NMEContext context,
void *  data 
) [static]

Paragraph hook to extract titles.

Parameters:
[in]levelheading or list level (1 = topmost, par=kNMEHookLevelPar, span=kNMEHookLevelSpan)
[in]itemlist item or heading counter
[in]enterTRUE when entering construct, FALSE when exiting
[in]markupnull-terminated string for initial markup ("p" for par, "*" for unnumbered list of any level, "//" for italic, "{{{" for preformatted)
[in]srcIndexcurrent index in source code
[in]srcLineNumbercurrent line number in source code
[in,out]contextcurrent context
[in,out]datavalue specific to the callback
Returns:
error code (kNMEErrOk for success)

Definition at line 86 of file NMEEPubMain.c.

NMEErr PluginEndnote ( NMEConstText  name,
NMEInt  nameLen,
NMEConstText  data,
NMEInt  dataLen,
NMEContext context,
void *  userData 
)

Plugin for NE endnotes.

Contents is NME code.

Parameters:
[in]nameplugin name, such as "endnote"
[in]nameLenlength of name
[in]datadata text (NME code)
[in]dataLenlength of data
[in,out]contextcurrent context
[in]userDataNE (userdata specified when the plugin is installed)
Returns:
error code (kNMEErrOk for success)
Test:
    Some text<< endnote This is an endnote with **bold** and //italic//. >>.

Definition at line 192 of file NMEEPubMain.c.

NMEErr PluginGuide ( NMEConstText  name,
NMEInt  nameLen,
NMEConstText  data,
NMEInt  dataLen,
NMEContext context,
void *  userData 
)

Plugin for NE guide to structural components.

Parameters:
[in]nameplugin name ("guide")
[in]nameLenlength of name (5)
[in]datacomponent name as defined in OPF 2.0 ("cover", "title-page", "toc", "index", "glossary", "acknowldgements", "bibliography", "colophon", "copyright-page", "dedication", "epigraph", "foreword", "loi", "lot", "notes", "preface", "text")
[in]dataLenlength of data
[in,out]contextcurrent context
[in]userDataNE (userdata specified when the plugin is installed)
Returns:
error code (kNMEErrOk for success)
Test:
    << guide cover >>
    {cover.jpg}
    << guide preface >>
    = Preface
    ...
    << guide text >>
    = Chapter 1
    ...

Definition at line 299 of file NMEEPubMain.c.

NMEErr PluginMeta ( NMEConstText  name,
NMEInt  nameLen,
NMEConstText  data,
NMEInt  dataLen,
NMEContext context,
void *  userData 
)

Plugin for NE metadata.

Parameters:
[in]nameplugin name ("title", "author", "identifier", "language", "subject", "description", "publisher", "date", "source", or "rights")
[in]nameLenlength of name
[in]datametadata value
[in]dataLenlength of data
[in,out]contextcurrent context
[in]userDataNE (userdata specified when the plugin is installed)
Returns:
error code (kNMEErrOk for success)
Test:
    << title My Book >>
    << author Author Name >>
    << date 2010-08 >>
    << identifier com.example.book12345 >>

Definition at line 241 of file NMEEPubMain.c.

static NMEErr spanHookImg ( NMEInt  level,
NMEInt  item,
NMEBoolean  enter,
NMEConstText  markup,
NMEInt  srcIndex,
NMEInt  srcLineNumber,
NMEContext context,
void *  data 
) [static]

Span hook to extract image URLs (set a flag when inside image markup, so that the encodeURL callback knows when it's given an image URL).

Parameters:
[in]levelheading or list level (1 = topmost, par=kNMEHookLevelPar, span=kNMEHookLevelSpan)
[in]itemlist item or heading counter
[in]enterTRUE when entering construct, FALSE when exiting
[in]markupnull-terminated string for initial markup ("p" for par, "*" for unnumbered list of any level, "//" for italic, "{{{" for preformatted)
[in]srcIndexcurrent index in source code
[in]srcLineNumbercurrent line number in source code
[in,out]contextcurrent context
[in,out]datavalue specific to the callback
Returns:
error code (kNMEErrOk for success)

Definition at line 143 of file NMEEPubMain.c.


Variable Documentation

NMEInterwiki const interwikis[] [static]
Initial value:
{
    {"Dictionary:",
        "http://www.dict.org/bin/Dict?Database=*&Form=Dict1&Strategy=*&Query="},
    {"Foldoc:", "http://www.foldoc.org/foldoc/foldoc.cgi?"},
    {"Google:", "http://www.google.com/search?q="},
    {"WhoIs:", "http://www.whois.sc/"},
    {"WikiPedia:", "http://en.wikipedia.org/wiki/"},
    {NULL, NULL}
}

Table of interwiki definitions.

Definition at line 30 of file NMEEPubMain.c.

Generated by Doxygen.
Copyright 2007-2013, Yves Piguet.
All rights reserved.