mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-23 20:14:05 +00:00
Add support for Epwing dictionaries
This commit is contained in:
parent
47f1803c60
commit
d9169bd45b
|
@ -19,7 +19,7 @@ This code has been run and tested on Windows XP/Vista/7, Ubuntu Linux, Mac OS X.
|
|||
sudo apt-get install git pkg-config build-essential qt4-qmake \
|
||||
libvorbis-dev zlib1g-dev libhunspell-dev x11proto-record-dev \
|
||||
libqt4-dev libqtwebkit-dev libxtst-dev liblzo2-dev libbz2-dev \
|
||||
libao-dev libavutil-dev libavformat-dev libtiff5-dev
|
||||
libao-dev libavutil-dev libavformat-dev libtiff5-dev libeb-dev
|
||||
|
||||
## How to build
|
||||
|
||||
|
@ -52,6 +52,13 @@ If you have problem building with libtiff5-dev package, you can pass
|
|||
|
||||
qmake "CONFIG+=no_extra_tiff_handler"
|
||||
|
||||
### Building without Epwing format support
|
||||
|
||||
If you have problem building with libeb-dev package, you can pass
|
||||
`"CONFIG+=no_epwing_support"` to `qmake` in order to disable Epwing format support
|
||||
|
||||
qmake "CONFIG+=no_epwing_support"
|
||||
|
||||
### Building without internal audio player
|
||||
|
||||
If you have problem building with FFmpeg/libao (for example, Ubuntu older than 12.04), you can pass
|
||||
|
|
|
@ -568,6 +568,25 @@ div.xdxf
|
|||
font-weight: 600;
|
||||
}
|
||||
|
||||
/************* Epwing dictionaries *****************/
|
||||
|
||||
.epwing_image
|
||||
{
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.epwing_narrow_font
|
||||
{
|
||||
width: 7px;
|
||||
height: 13px;
|
||||
}
|
||||
|
||||
.epwing_wide_font
|
||||
{
|
||||
width: 13px;
|
||||
height: 13px;
|
||||
}
|
||||
|
||||
/************* Websites *****************/
|
||||
|
||||
.website_padding
|
||||
|
|
|
@ -432,6 +432,9 @@ bool needToRebuildIndex( vector< string > const & dictionaryFiles,
|
|||
{
|
||||
QFileInfo fileInfo( FsEncoding::decode( i->c_str() ) );
|
||||
|
||||
if( fileInfo.isDir() )
|
||||
continue;
|
||||
|
||||
if ( !fileInfo.exists() )
|
||||
return true;
|
||||
|
||||
|
|
3
dsl.cc
3
dsl.cc
|
@ -1211,9 +1211,6 @@ void DslDictionary::getArticleText( uint32_t articleAddress, QString & headword,
|
|||
char * articleProps;
|
||||
wstring articleData;
|
||||
|
||||
headword.clear();
|
||||
text.clear();
|
||||
|
||||
{
|
||||
Mutex::Lock _( idxMutex );
|
||||
articleProps = chunks->getBlock( articleAddress, chunk );
|
||||
|
|
851
epwing.cc
Normal file
851
epwing.cc
Normal file
|
@ -0,0 +1,851 @@
|
|||
/* This file is (c) 2014 Abs62
|
||||
* Part of GoldenDict. Licensed under GPLv3 or later, see the LICENSE file */
|
||||
|
||||
#include "epwing_book.hh"
|
||||
#include "epwing.hh"
|
||||
|
||||
#include <QByteArray>
|
||||
#include <QDir>
|
||||
|
||||
#include <map>
|
||||
#include <set>
|
||||
#include <string>
|
||||
|
||||
#include "btreeidx.hh"
|
||||
#include "folding.hh"
|
||||
#include "gddebug.hh"
|
||||
#include "fsencoding.hh"
|
||||
#include "chunkedstorage.hh"
|
||||
#include "wstring.hh"
|
||||
#include "wstring_qt.hh"
|
||||
#include "utf8.hh"
|
||||
#include "filetype.hh"
|
||||
#include "ftshelpers.hh"
|
||||
|
||||
namespace Epwing {
|
||||
|
||||
using BtreeIndexing::WordArticleLink;
|
||||
using BtreeIndexing::IndexedWords;
|
||||
using BtreeIndexing::IndexInfo;
|
||||
|
||||
using std::map;
|
||||
using std::multimap;
|
||||
using std::vector;
|
||||
using std::set;
|
||||
using std::pair;
|
||||
using gd::wstring;
|
||||
|
||||
namespace {
|
||||
|
||||
#pragma pack( push, 1 )
|
||||
|
||||
enum
|
||||
{
|
||||
Signature = 0x58575045, // EPWX on little-endian, XWPE on big-endian
|
||||
CurrentFormatVersion = 1 + BtreeIndexing::FormatVersion + Folding::Version
|
||||
};
|
||||
|
||||
struct IdxHeader
|
||||
{
|
||||
quint32 signature; // First comes the signature, EPWX
|
||||
quint32 formatVersion; // File format version (CurrentFormatVersion)
|
||||
quint32 chunksOffset; // The offset to chunks' storage
|
||||
quint32 indexBtreeMaxElements; // Two fields from IndexInfo
|
||||
quint32 indexRootOffset;
|
||||
quint32 wordCount;
|
||||
quint32 articleCount;
|
||||
quint32 nameSize;
|
||||
quint32 langFrom; // Source language
|
||||
quint32 langTo; // Target language
|
||||
}
|
||||
#ifndef _MSC_VER
|
||||
__attribute__((packed))
|
||||
#endif
|
||||
;
|
||||
|
||||
#pragma pack( pop )
|
||||
|
||||
bool indexIsOldOrBad( string const & indexFile )
|
||||
{
|
||||
File::Class idx( indexFile, "rb" );
|
||||
|
||||
IdxHeader header;
|
||||
|
||||
return idx.readRecords( &header, sizeof( header ), 1 ) != 1 ||
|
||||
header.signature != Signature ||
|
||||
header.formatVersion != CurrentFormatVersion;
|
||||
}
|
||||
|
||||
class EpwingDictionary: public BtreeIndexing::BtreeDictionary
|
||||
{
|
||||
Mutex idxMutex;
|
||||
File::Class idx;
|
||||
IdxHeader idxHeader;
|
||||
string bookName;
|
||||
ChunkedStorage::Reader chunks;
|
||||
Epwing::Book::EpwingBook eBook;
|
||||
QString cacheDirectory;
|
||||
|
||||
public:
|
||||
|
||||
EpwingDictionary( string const & id, string const & indexFile,
|
||||
vector< string > const & dictionaryFiles,
|
||||
int subBook );
|
||||
|
||||
~EpwingDictionary();
|
||||
|
||||
virtual string getName() throw()
|
||||
{ return bookName; }
|
||||
|
||||
virtual map< Dictionary::Property, string > getProperties() throw()
|
||||
{ return map< Dictionary::Property, string >(); }
|
||||
|
||||
virtual unsigned long getArticleCount() throw()
|
||||
{ return idxHeader.articleCount; }
|
||||
|
||||
virtual unsigned long getWordCount() throw()
|
||||
{ return idxHeader.wordCount; }
|
||||
|
||||
inline virtual quint32 getLangFrom() const
|
||||
{ return idxHeader.langFrom; }
|
||||
|
||||
inline virtual quint32 getLangTo() const
|
||||
{ return idxHeader.langTo; }
|
||||
|
||||
virtual QString const& getDescription();
|
||||
|
||||
virtual sptr< Dictionary::DataRequest > getArticle( wstring const &,
|
||||
vector< wstring > const & alts,
|
||||
wstring const & )
|
||||
throw( std::exception );
|
||||
|
||||
virtual sptr< Dictionary::DataRequest > getResource( string const & name )
|
||||
throw( std::exception );
|
||||
|
||||
virtual sptr< Dictionary::DataRequest > getSearchResults( QString const & searchString,
|
||||
int searchMode, bool matchCase,
|
||||
int distanceBetweenWords,
|
||||
int maxResults );
|
||||
virtual void getArticleText( uint32_t articleAddress, QString & headword, QString & text );
|
||||
|
||||
virtual void makeFTSIndex(QAtomicInt & isCancelled, bool firstIteration );
|
||||
|
||||
virtual void setFTSParameters( Config::FullTextSearch const & fts )
|
||||
{
|
||||
if( ensureInitDone().size() )
|
||||
return;
|
||||
|
||||
can_FTS = fts.enabled
|
||||
&& !fts.disabledTypes.contains( "EPWING", Qt::CaseInsensitive )
|
||||
&& ( fts.maxDictionarySize == 0 || getArticleCount() <= fts.maxDictionarySize );
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
void loadIcon() throw();
|
||||
|
||||
private:
|
||||
|
||||
/// Loads the article.
|
||||
void loadArticle( quint32 address, string & articleHeadword,
|
||||
string & articleText );
|
||||
|
||||
void createCacheDirectory();
|
||||
|
||||
void removeDirectory( QString const & directory );
|
||||
|
||||
QString const & getImagesCacheDir()
|
||||
{ return eBook.getImagesCacheDir(); }
|
||||
|
||||
QString const & getSoundsCacheDir()
|
||||
{ return eBook.getSoundsCacheDir(); }
|
||||
|
||||
QString const & getMoviesCacheDir()
|
||||
{ return eBook.getMoviesCacheDir(); }
|
||||
|
||||
friend class EpwingArticleRequest;
|
||||
friend class EpwingResourceRequest;
|
||||
};
|
||||
|
||||
|
||||
EpwingDictionary::EpwingDictionary( string const & id,
|
||||
string const & indexFile,
|
||||
vector< string > const & dictionaryFiles,
|
||||
int subBook ):
|
||||
BtreeDictionary( id, dictionaryFiles ),
|
||||
idx( indexFile, "rb" ),
|
||||
idxHeader( idx.read< IdxHeader >() ),
|
||||
chunks( idx, idxHeader.chunksOffset )
|
||||
{
|
||||
vector< char > data( idxHeader.nameSize );
|
||||
idx.seek( sizeof( idxHeader ) );
|
||||
idx.read( &data.front(), idxHeader.nameSize );
|
||||
bookName = string( &data.front(), idxHeader.nameSize );
|
||||
|
||||
// Initialize eBook
|
||||
|
||||
eBook.setBook( dictionaryFiles[ 0 ] );
|
||||
eBook.setSubBook( subBook );
|
||||
|
||||
// Initialize the index
|
||||
|
||||
openIndex( IndexInfo( idxHeader.indexBtreeMaxElements,
|
||||
idxHeader.indexRootOffset ),
|
||||
idx, idxMutex );
|
||||
|
||||
eBook.setDictID( getId() );
|
||||
|
||||
cacheDirectory = QDir::tempPath() + QDir::separator()
|
||||
+ QString::fromUtf8( getId().c_str() )
|
||||
+ ".cache";
|
||||
eBook.setCacheDirectory( cacheDirectory );
|
||||
|
||||
// Full-text search parameters
|
||||
|
||||
can_FTS = true;
|
||||
|
||||
ftsIdxName = indexFile + "_FTS";
|
||||
|
||||
if( !Dictionary::needToRebuildIndex( dictionaryFiles, ftsIdxName )
|
||||
&& !FtsHelpers::ftsIndexIsOldOrBad( ftsIdxName ) )
|
||||
FTS_index_completed.ref();
|
||||
}
|
||||
|
||||
EpwingDictionary::~EpwingDictionary()
|
||||
{
|
||||
removeDirectory( cacheDirectory );
|
||||
}
|
||||
|
||||
void EpwingDictionary::loadIcon() throw()
|
||||
{
|
||||
if ( dictionaryIconLoaded )
|
||||
return;
|
||||
|
||||
QString dirName =
|
||||
QDir::fromNativeSeparators( FsEncoding::decode( getDictionaryFilenames()[ 0 ].c_str() ) );
|
||||
QString fileName =
|
||||
QDir::fromNativeSeparators( FsEncoding::decode( getDictionaryFilenames()[ 1 ].c_str() ) );
|
||||
|
||||
int pos = fileName.indexOf( '/', dirName.size(), Qt::CaseSensitive );
|
||||
|
||||
if( pos > 0 )
|
||||
{
|
||||
fileName = fileName.left( pos );
|
||||
loadIconFromFile( fileName );
|
||||
}
|
||||
|
||||
if( dictionaryIcon.isNull() )
|
||||
{
|
||||
// Load failed -- use default icons
|
||||
dictionaryNativeIcon = dictionaryIcon = QIcon(":/icons/icon32_epwing.png");
|
||||
}
|
||||
|
||||
dictionaryIconLoaded = true;
|
||||
}
|
||||
|
||||
void EpwingDictionary::removeDirectory( QString const & directory )
|
||||
{
|
||||
QDir dir( directory );
|
||||
Q_FOREACH( QFileInfo info, dir.entryInfoList( QDir::NoDotAndDotDot
|
||||
| QDir::AllDirs
|
||||
| QDir::Files,
|
||||
QDir::DirsFirst))
|
||||
{
|
||||
if( info.isDir() )
|
||||
removeDirectory( info.absoluteFilePath() );
|
||||
else
|
||||
QFile::remove( info.absoluteFilePath() );
|
||||
}
|
||||
|
||||
dir.rmdir( directory );
|
||||
}
|
||||
|
||||
void EpwingDictionary::loadArticle( quint32 address,
|
||||
string & articleHeadword,
|
||||
string & articleText )
|
||||
{
|
||||
vector< char > chunk;
|
||||
|
||||
char * articleProps;
|
||||
|
||||
{
|
||||
Mutex::Lock _( idxMutex );
|
||||
articleProps = chunks.getBlock( address, chunk );
|
||||
}
|
||||
|
||||
uint32_t articlePage, articleOffset;
|
||||
|
||||
memcpy( &articlePage, articleProps, sizeof( articlePage ) );
|
||||
memcpy( &articleOffset, articleProps + sizeof( articlePage ),
|
||||
sizeof( articleOffset ) );
|
||||
|
||||
QString headword, text;
|
||||
|
||||
try
|
||||
{
|
||||
Mutex::Lock _( eBook.getLibMutex() );
|
||||
eBook.getArticle( headword, text, articlePage, articleOffset, false );
|
||||
}
|
||||
catch( std::exception & e )
|
||||
{
|
||||
text = QString( "Article reading error: %1")
|
||||
.arg( QString::fromUtf8( e.what() ) );
|
||||
}
|
||||
|
||||
articleHeadword = string( headword.toUtf8().data() );
|
||||
articleText = string( text.toUtf8().data() );
|
||||
|
||||
string prefix( "<div class=\"epwing_text\">" );
|
||||
|
||||
articleText = prefix + articleText + "</div>";
|
||||
}
|
||||
|
||||
QString const& EpwingDictionary::getDescription()
|
||||
{
|
||||
if( !dictionaryDescription.isEmpty() )
|
||||
return dictionaryDescription;
|
||||
|
||||
dictionaryDescription = "NONE";
|
||||
|
||||
QString str;
|
||||
{
|
||||
Mutex::Lock _( eBook.getLibMutex() );
|
||||
str = eBook.copyright();
|
||||
}
|
||||
|
||||
if( !str.isEmpty() )
|
||||
dictionaryDescription = str;
|
||||
|
||||
return dictionaryDescription;
|
||||
}
|
||||
|
||||
void EpwingDictionary::makeFTSIndex( QAtomicInt & isCancelled, bool firstIteration )
|
||||
{
|
||||
if( !( Dictionary::needToRebuildIndex( getDictionaryFilenames(), ftsIdxName )
|
||||
|| FtsHelpers::ftsIndexIsOldOrBad( ftsIdxName ) ) )
|
||||
FTS_index_completed.ref();
|
||||
|
||||
|
||||
if( haveFTSIndex() )
|
||||
return;
|
||||
|
||||
if( firstIteration && getArticleCount() > FTS::MaxDictionarySizeForFastSearch )
|
||||
return;
|
||||
|
||||
gdDebug( "Epwing: Building the full-text index for dictionary: %s\n",
|
||||
getName().c_str() );
|
||||
|
||||
try
|
||||
{
|
||||
FtsHelpers::makeFTSIndex( this, isCancelled );
|
||||
FTS_index_completed.ref();
|
||||
}
|
||||
catch( std::exception &ex )
|
||||
{
|
||||
gdWarning( "DSL: Failed building full-text search index for \"%s\", reason: %s\n", getName().c_str(), ex.what() );
|
||||
QFile::remove( FsEncoding::decode( ftsIdxName.c_str() ) );
|
||||
}
|
||||
}
|
||||
|
||||
void EpwingDictionary::getArticleText( uint32_t articleAddress, QString & headword, QString & text )
|
||||
{
|
||||
headword.clear();
|
||||
text.clear();
|
||||
|
||||
vector< char > chunk;
|
||||
char * articleProps;
|
||||
|
||||
{
|
||||
Mutex::Lock _( idxMutex );
|
||||
articleProps = chunks.getBlock( articleAddress, chunk );
|
||||
}
|
||||
|
||||
uint32_t articlePage, articleOffset;
|
||||
|
||||
memcpy( &articlePage, articleProps, sizeof( articlePage ) );
|
||||
memcpy( &articleOffset, articleProps + sizeof( articlePage ),
|
||||
sizeof( articleOffset ) );
|
||||
|
||||
try
|
||||
{
|
||||
Mutex::Lock _( eBook.getLibMutex() );
|
||||
eBook.getArticle( headword, text, articlePage, articleOffset, true );
|
||||
}
|
||||
catch( std::exception & e )
|
||||
{
|
||||
text = QString( "Article reading error: %1")
|
||||
.arg( QString::fromUtf8( e.what() ) );
|
||||
}
|
||||
}
|
||||
|
||||
/// EpwingDictionary::getArticle()
|
||||
|
||||
class EpwingArticleRequest;
|
||||
|
||||
class EpwingArticleRequestRunnable: public QRunnable
|
||||
{
|
||||
EpwingArticleRequest & r;
|
||||
QSemaphore & hasExited;
|
||||
|
||||
public:
|
||||
|
||||
EpwingArticleRequestRunnable( EpwingArticleRequest & r_,
|
||||
QSemaphore & hasExited_ ): r( r_ ),
|
||||
hasExited( hasExited_ )
|
||||
{}
|
||||
|
||||
~EpwingArticleRequestRunnable()
|
||||
{
|
||||
hasExited.release();
|
||||
}
|
||||
|
||||
virtual void run();
|
||||
};
|
||||
|
||||
class EpwingArticleRequest: public Dictionary::DataRequest
|
||||
{
|
||||
friend class EpwingArticleRequestRunnable;
|
||||
|
||||
wstring word;
|
||||
vector< wstring > alts;
|
||||
EpwingDictionary & dict;
|
||||
|
||||
QAtomicInt isCancelled;
|
||||
QSemaphore hasExited;
|
||||
|
||||
public:
|
||||
|
||||
EpwingArticleRequest( wstring const & word_,
|
||||
vector< wstring > const & alts_,
|
||||
EpwingDictionary & dict_ ):
|
||||
word( word_ ), alts( alts_ ), dict( dict_ )
|
||||
{
|
||||
QThreadPool::globalInstance()->start(
|
||||
new EpwingArticleRequestRunnable( *this, hasExited ) );
|
||||
}
|
||||
|
||||
void run(); // Run from another thread by EpwingArticleRequestRunnable
|
||||
|
||||
virtual void cancel()
|
||||
{
|
||||
isCancelled.ref();
|
||||
}
|
||||
|
||||
~EpwingArticleRequest()
|
||||
{
|
||||
isCancelled.ref();
|
||||
hasExited.acquire();
|
||||
}
|
||||
};
|
||||
|
||||
void EpwingArticleRequestRunnable::run()
|
||||
{
|
||||
r.run();
|
||||
}
|
||||
|
||||
void EpwingArticleRequest::run()
|
||||
{
|
||||
if ( isCancelled )
|
||||
{
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
|
||||
vector< WordArticleLink > chain = dict.findArticles( word );
|
||||
|
||||
for( unsigned x = 0; x < alts.size(); ++x )
|
||||
{
|
||||
/// Make an additional query for each alt
|
||||
|
||||
vector< WordArticleLink > altChain = dict.findArticles( alts[ x ] );
|
||||
|
||||
chain.insert( chain.end(), altChain.begin(), altChain.end() );
|
||||
}
|
||||
|
||||
multimap< wstring, pair< string, string > > mainArticles, alternateArticles;
|
||||
|
||||
set< quint32 > articlesIncluded; // Some synonims make it that the articles
|
||||
// appear several times. We combat this
|
||||
// by only allowing them to appear once.
|
||||
|
||||
wstring wordCaseFolded = Folding::applySimpleCaseOnly( word );
|
||||
|
||||
for( unsigned x = 0; x < chain.size(); ++x )
|
||||
{
|
||||
if ( isCancelled )
|
||||
{
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
|
||||
if ( articlesIncluded.find( chain[ x ].articleOffset ) != articlesIncluded.end() )
|
||||
continue; // We already have this article in the body.
|
||||
|
||||
// Now grab that article
|
||||
|
||||
string headword, articleText;
|
||||
|
||||
try
|
||||
{
|
||||
dict.loadArticle( chain[ x ].articleOffset, headword, articleText );
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
}
|
||||
|
||||
// Ok. Now, does it go to main articles, or to alternate ones? We list
|
||||
// main ones first, and alternates after.
|
||||
|
||||
// We do the case-folded comparison here.
|
||||
|
||||
wstring headwordStripped =
|
||||
Folding::applySimpleCaseOnly( Utf8::decode( headword ) );
|
||||
|
||||
multimap< wstring, pair< string, string > > & mapToUse =
|
||||
( wordCaseFolded == headwordStripped ) ?
|
||||
mainArticles : alternateArticles;
|
||||
|
||||
mapToUse.insert( pair< wstring, pair< string, string > >(
|
||||
Folding::applySimpleCaseOnly( Utf8::decode( headword ) ),
|
||||
pair< string, string >( headword, articleText ) ) );
|
||||
|
||||
articlesIncluded.insert( chain[ x ].articleOffset );
|
||||
}
|
||||
|
||||
if ( mainArticles.empty() && alternateArticles.empty() )
|
||||
{
|
||||
// No such word
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
|
||||
string result = "<span class=\"epwing_article\">";
|
||||
|
||||
multimap< wstring, pair< string, string > >::const_iterator i;
|
||||
|
||||
for( i = mainArticles.begin(); i != mainArticles.end(); ++i )
|
||||
{
|
||||
result += "<h3>";
|
||||
result += i->second.first;
|
||||
result += "</h3>";
|
||||
result += i->second.second;
|
||||
}
|
||||
|
||||
for( i = alternateArticles.begin(); i != alternateArticles.end(); ++i )
|
||||
{
|
||||
result += "<h3>";
|
||||
result += i->second.first;
|
||||
result += "</h3>";
|
||||
result += i->second.second;
|
||||
}
|
||||
|
||||
result += "</span>";
|
||||
|
||||
Mutex::Lock _( dataMutex );
|
||||
|
||||
data.resize( result.size() );
|
||||
|
||||
memcpy( &data.front(), result.data(), result.size() );
|
||||
|
||||
hasAnyData = true;
|
||||
|
||||
finish();
|
||||
}
|
||||
|
||||
sptr< Dictionary::DataRequest > EpwingDictionary::getArticle( wstring const & word,
|
||||
vector< wstring > const & alts,
|
||||
wstring const & )
|
||||
throw( std::exception )
|
||||
{
|
||||
return new EpwingArticleRequest( word, alts, *this );
|
||||
}
|
||||
|
||||
//// EpwingDictionary::getResource()
|
||||
|
||||
class EpwingResourceRequest;
|
||||
|
||||
class EpwingResourceRequestRunnable: public QRunnable
|
||||
{
|
||||
EpwingResourceRequest & r;
|
||||
QSemaphore & hasExited;
|
||||
|
||||
public:
|
||||
|
||||
EpwingResourceRequestRunnable( EpwingResourceRequest & r_,
|
||||
QSemaphore & hasExited_ ): r( r_ ),
|
||||
hasExited( hasExited_ )
|
||||
{}
|
||||
|
||||
~EpwingResourceRequestRunnable()
|
||||
{
|
||||
hasExited.release();
|
||||
}
|
||||
|
||||
virtual void run();
|
||||
};
|
||||
|
||||
class EpwingResourceRequest: public Dictionary::DataRequest
|
||||
{
|
||||
friend class EpwingResourceRequestRunnable;
|
||||
|
||||
EpwingDictionary & dict;
|
||||
|
||||
string resourceName;
|
||||
|
||||
QAtomicInt isCancelled;
|
||||
QSemaphore hasExited;
|
||||
|
||||
public:
|
||||
|
||||
EpwingResourceRequest( EpwingDictionary & dict_,
|
||||
string const & resourceName_ ):
|
||||
dict( dict_ ),
|
||||
resourceName( resourceName_ )
|
||||
{
|
||||
QThreadPool::globalInstance()->start(
|
||||
new EpwingResourceRequestRunnable( *this, hasExited ) );
|
||||
}
|
||||
|
||||
void run(); // Run from another thread by EpwingResourceRequestRunnable
|
||||
|
||||
virtual void cancel()
|
||||
{
|
||||
isCancelled.ref();
|
||||
}
|
||||
|
||||
~EpwingResourceRequest()
|
||||
{
|
||||
isCancelled.ref();
|
||||
hasExited.acquire();
|
||||
}
|
||||
};
|
||||
|
||||
void EpwingResourceRequestRunnable::run()
|
||||
{
|
||||
r.run();
|
||||
}
|
||||
|
||||
void EpwingResourceRequest::run()
|
||||
{
|
||||
// Some runnables linger enough that they are cancelled before they start
|
||||
if ( isCancelled )
|
||||
{
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
|
||||
QString cacheDir;
|
||||
{
|
||||
Mutex::Lock _( dict.eBook.getLibMutex() );
|
||||
if( Filetype::isNameOfPicture( resourceName ) )
|
||||
cacheDir = dict.getImagesCacheDir();
|
||||
else
|
||||
if( Filetype::isNameOfSound( resourceName ) )
|
||||
cacheDir = dict.getSoundsCacheDir();
|
||||
else
|
||||
if( Filetype::isNameOfVideo( resourceName ) )
|
||||
cacheDir = dict.getMoviesCacheDir();
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
if( cacheDir.isEmpty() )
|
||||
{
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
|
||||
QString fullName = cacheDir + QDir::separator()
|
||||
+ FsEncoding::decode( resourceName.c_str() );
|
||||
|
||||
QFile f( fullName );
|
||||
if( f.open( QFile::ReadOnly ) )
|
||||
{
|
||||
QByteArray buffer = f.readAll();
|
||||
|
||||
Mutex::Lock _( dataMutex );
|
||||
|
||||
data.resize( buffer.size() );
|
||||
|
||||
memcpy( &data.front(), buffer.data(), data.size() );
|
||||
|
||||
hasAnyData = true;
|
||||
}
|
||||
}
|
||||
catch( std::exception &ex )
|
||||
{
|
||||
gdWarning( "Epwing: Failed loading resource \"%s\" for \"%s\", reason: %s\n",
|
||||
resourceName.c_str(), dict.getName().c_str(), ex.what() );
|
||||
// Resource not loaded -- we don't set the hasAnyData flag then
|
||||
}
|
||||
|
||||
finish();
|
||||
}
|
||||
|
||||
sptr< Dictionary::DataRequest > EpwingDictionary::getResource( string const & name )
|
||||
throw( std::exception )
|
||||
{
|
||||
return new EpwingResourceRequest( *this, name );
|
||||
}
|
||||
|
||||
|
||||
sptr< Dictionary::DataRequest > EpwingDictionary::getSearchResults( QString const & searchString,
|
||||
int searchMode, bool matchCase,
|
||||
int distanceBetweenWords,
|
||||
int maxResults )
|
||||
{
|
||||
return new FtsHelpers::FTSResultsRequest( *this, searchString,searchMode, matchCase, distanceBetweenWords, maxResults );
|
||||
}
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
vector< sptr< Dictionary::Class > > makeDictionaries(
|
||||
vector< string > const & fileNames,
|
||||
string const & indicesDir,
|
||||
Dictionary::Initializing & initializing )
|
||||
throw( std::exception )
|
||||
{
|
||||
vector< sptr< Dictionary::Class > > dictionaries;
|
||||
|
||||
vector< string > dictFiles;
|
||||
QByteArray catName;
|
||||
catName += QDir::separator();
|
||||
catName += "catalogs";
|
||||
|
||||
for( vector< string >::const_iterator i = fileNames.begin(); i != fileNames.end();
|
||||
++i )
|
||||
{
|
||||
// Skip files other than "catalogs" to speed up the scanning
|
||||
|
||||
if ( i->size() < (unsigned)catName.size() ||
|
||||
strcasecmp( i->c_str() + ( i->size() - catName.size() ), catName.data() ) != 0 )
|
||||
continue;
|
||||
|
||||
int ndir = i->size() - catName.size();
|
||||
if( ndir < 1 )
|
||||
ndir = 1;
|
||||
|
||||
string mainDirectory = i->substr( 0, ndir );
|
||||
|
||||
Epwing::Book::EpwingBook dict;
|
||||
|
||||
int subBooksNumber = dict.setBook( mainDirectory );
|
||||
|
||||
for( int sb = 0; sb < subBooksNumber; sb++ )
|
||||
{
|
||||
QString dir;
|
||||
|
||||
try
|
||||
{
|
||||
dictFiles.clear();
|
||||
dictFiles.push_back( mainDirectory );
|
||||
dictFiles.push_back( *i );
|
||||
|
||||
dict.setSubBook( sb );
|
||||
|
||||
dir = FsEncoding::decode( mainDirectory.c_str() )
|
||||
+ FsEncoding::separator()
|
||||
+ dict.getCurrentSubBookDirectory();
|
||||
|
||||
Epwing::Book::EpwingBook::collectFilenames( dir, dictFiles );
|
||||
|
||||
// Check if we need to rebuid the index
|
||||
|
||||
string dictId = Dictionary::makeDictionaryId( dictFiles );
|
||||
|
||||
string indexFile = indicesDir + dictId;
|
||||
|
||||
if ( Dictionary::needToRebuildIndex( dictFiles, indexFile ) ||
|
||||
indexIsOldOrBad( indexFile ) )
|
||||
{
|
||||
gdDebug( "Epwing: Building the index for dictionary in directory %s\n", dir.toUtf8().data() );
|
||||
|
||||
QString str = dict.title();
|
||||
// QByteArray nameData = dict.title().toUtf8();
|
||||
QByteArray nameData = str.toUtf8();
|
||||
initializing.indexingDictionary( nameData.data() );
|
||||
|
||||
File::Class idx( indexFile, "wb" );
|
||||
|
||||
IdxHeader idxHeader;
|
||||
|
||||
memset( &idxHeader, 0, sizeof( idxHeader ) );
|
||||
|
||||
// We write a dummy header first. At the end of the process the header
|
||||
// will be rewritten with the right values.
|
||||
|
||||
idx.write( idxHeader );
|
||||
|
||||
idx.write( nameData.data(), nameData.size() );
|
||||
idxHeader.nameSize = nameData.size();
|
||||
|
||||
IndexedWords indexedWords;
|
||||
|
||||
ChunkedStorage::Writer chunks( idx );
|
||||
|
||||
Epwing::Book::EpwingHeadword head;
|
||||
|
||||
dict.getFirstHeadword( head );
|
||||
|
||||
int wordCount = 0;
|
||||
|
||||
for( ; ; )
|
||||
{
|
||||
uint32_t offset = chunks.startNewBlock();
|
||||
chunks.addToBlock( &head.page, sizeof( head.page ) );
|
||||
chunks.addToBlock( &head.offset, sizeof( head.offset ) );
|
||||
|
||||
indexedWords.addWord( gd::toWString( head.headword ), offset );
|
||||
|
||||
wordCount++;
|
||||
|
||||
if( !dict.getNextHeadword( head ) )
|
||||
break;
|
||||
}
|
||||
|
||||
// Finish with the chunks
|
||||
|
||||
idxHeader.chunksOffset = chunks.finish();
|
||||
|
||||
// Build index
|
||||
|
||||
IndexInfo idxInfo = BtreeIndexing::buildIndex( indexedWords, idx );
|
||||
|
||||
idxHeader.indexBtreeMaxElements = idxInfo.btreeMaxElements;
|
||||
idxHeader.indexRootOffset = idxInfo.rootOffset;
|
||||
|
||||
indexedWords.clear(); // Release memory -- no need for this data
|
||||
|
||||
// That concludes it. Update the header.
|
||||
|
||||
idxHeader.signature = Signature;
|
||||
idxHeader.formatVersion = CurrentFormatVersion;
|
||||
|
||||
idxHeader.wordCount = wordCount;
|
||||
idxHeader.articleCount = wordCount;
|
||||
|
||||
idx.rewind();
|
||||
|
||||
idx.write( &idxHeader, sizeof( idxHeader ) );
|
||||
|
||||
|
||||
} // If need to rebuild
|
||||
|
||||
dictionaries.push_back( new EpwingDictionary( dictId,
|
||||
indexFile,
|
||||
dictFiles,
|
||||
sb ) );
|
||||
}
|
||||
catch( std::exception & e )
|
||||
{
|
||||
gdWarning( "Epwing dictionary initializing failed: %s, error: %s\n",
|
||||
dir.toUtf8().data(), e.what() );
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return dictionaries;
|
||||
}
|
||||
|
||||
} // namespace Epwing
|
19
epwing.hh
Normal file
19
epwing.hh
Normal file
|
@ -0,0 +1,19 @@
|
|||
#ifndef __EPWING_HH__INCLUDED__
|
||||
#define __EPWING_HH__INCLUDED__
|
||||
|
||||
#include "dictionary.hh"
|
||||
|
||||
/// Support for the Epwing dictionaries.
|
||||
namespace Epwing {
|
||||
|
||||
using std::vector;
|
||||
using std::string;
|
||||
|
||||
vector< sptr< Dictionary::Class > > makeDictionaries(
|
||||
vector< string > const & fileNames,
|
||||
string const & indicesDir,
|
||||
Dictionary::Initializing & )
|
||||
throw( std::exception );
|
||||
}
|
||||
|
||||
#endif // __EPWING_HH__INCLUDED__
|
1502
epwing_book.cc
Normal file
1502
epwing_book.cc
Normal file
File diff suppressed because it is too large
Load diff
207
epwing_book.hh
Normal file
207
epwing_book.hh
Normal file
|
@ -0,0 +1,207 @@
|
|||
#ifndef __EPWING_BOOK_HH_INCLUDED__
|
||||
#define __EPWING_BOOK_HH_INCLUDED__
|
||||
|
||||
#include <qglobal.h>
|
||||
|
||||
#if defined( Q_OS_WIN32 ) || defined( Q_OS_MAC )
|
||||
#define _FILE_OFFSET_BITS 64
|
||||
#endif
|
||||
|
||||
#include "dictionary.hh"
|
||||
#include "ex.hh"
|
||||
#include "mutex.hh"
|
||||
|
||||
#include <QString>
|
||||
#include <QTextCodec>
|
||||
#include <QStack>
|
||||
#include <QMap>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
#include <eb/eb.h>
|
||||
|
||||
namespace Epwing {
|
||||
|
||||
DEF_EX_STR( exEbLibrary, "EB library report error", Dictionary::Ex )
|
||||
DEF_EX_STR( exEpwing, "Epwing parsing error:", Dictionary::Ex )
|
||||
|
||||
void initialize();
|
||||
void finalize();
|
||||
|
||||
namespace Book {
|
||||
|
||||
using std::vector;
|
||||
using std::string;
|
||||
|
||||
enum {
|
||||
TextBufferSize = 4095,
|
||||
BinaryBufferSize = 50000,
|
||||
TextSizeLimit = 2800000
|
||||
};
|
||||
|
||||
struct EpwingHeadword
|
||||
{
|
||||
QString headword;
|
||||
quint32 page;
|
||||
quint32 offset;
|
||||
};
|
||||
|
||||
class EpwingBook
|
||||
{
|
||||
void setErrorString( QString const & func, EB_Error_Code code );
|
||||
|
||||
EB_Book book;
|
||||
EB_Appendix appendix;
|
||||
EB_Hookset hookSet;
|
||||
EB_Subbook_Code subBookList[ EB_MAX_SUBBOOKS ];
|
||||
EB_Subbook_Code subAppendixList[ EB_MAX_SUBBOOKS ];
|
||||
EB_Position currentPosition;
|
||||
int subBookCount, subAppendixCount;
|
||||
int currentSubBook;
|
||||
QString error_string;
|
||||
QString mainCacheDir, rootDir;
|
||||
QString cacheImagesDir, cacheSoundsDir, cacheMoviesDir, cacheFontsDir;
|
||||
QString dictID;
|
||||
QTextCodec * codec_ISO, * codec_GB, * codec_Euc;
|
||||
QStack< unsigned int > decorationStack;
|
||||
int monoWidth, monoHeight;
|
||||
QStringList imageCacheList, soundsCacheList, moviesCacheList, fontsCacheList;
|
||||
QMap< QString, QString > fontsList;
|
||||
QVector< int > refPages, refOffsets;
|
||||
int refOpenCount, refCloseCount;
|
||||
static Mutex libMutex;
|
||||
|
||||
QString createCacheDir( QString const & dir);
|
||||
|
||||
// Close unslosed tags
|
||||
void finalizeText( QString & text );
|
||||
|
||||
// Reset internal variables
|
||||
void prepareToRead();
|
||||
|
||||
public:
|
||||
|
||||
enum DecorationCodes {
|
||||
UNKNOWN = 0,
|
||||
ITALIC = 1,
|
||||
BOLD = 3,
|
||||
EMPHASIS = 4,
|
||||
SUBSCRIPT = 5,
|
||||
SUPERSCRIPT = 6
|
||||
};
|
||||
|
||||
EpwingBook();
|
||||
~EpwingBook();
|
||||
|
||||
Mutex & getLibMutex()
|
||||
{ return libMutex; }
|
||||
|
||||
QString const &errorString() const
|
||||
{ return error_string; }
|
||||
|
||||
QTextCodec * codecISO()
|
||||
{ return codec_ISO; }
|
||||
|
||||
QTextCodec * codecGB()
|
||||
{ return codec_GB; }
|
||||
|
||||
QTextCodec *codecEuc()
|
||||
{ return codec_Euc; }
|
||||
|
||||
int getSubBookCount()
|
||||
{ return subBookCount; }
|
||||
|
||||
void setDictID( const string & id )
|
||||
{ dictID = QString::fromUtf8( id.c_str() ); }
|
||||
|
||||
QString const & getImagesCacheDir()
|
||||
{ return cacheImagesDir; }
|
||||
|
||||
QString const & getSoundsCacheDir()
|
||||
{ return cacheSoundsDir; }
|
||||
|
||||
QString const & getMoviesCacheDir()
|
||||
{ return cacheMoviesDir; }
|
||||
|
||||
// Make name for resource
|
||||
QString makeFName( QString const & ext, int page, int offset ) const;
|
||||
|
||||
// Store all files in Epwing folder
|
||||
static void collectFilenames( QString const & directory,
|
||||
vector< string > & files );
|
||||
|
||||
// Initialize dictionary book
|
||||
int setBook( string const & directory );
|
||||
|
||||
// Set subbook inside dictionary
|
||||
bool setSubBook( int book_nom );
|
||||
|
||||
void setCacheDirectory( QString const & cacheDir );
|
||||
|
||||
QString getCurrentSubBookDirectory();
|
||||
|
||||
QString copyright();
|
||||
QString title();
|
||||
|
||||
// Retrieve article text from dictionary
|
||||
QString getText( int page, int offset, bool text_only );
|
||||
|
||||
// Move to next article
|
||||
EB_Error_Code forwardText( EB_Position & startPos );
|
||||
|
||||
// Seek to first article
|
||||
void getFirstHeadword( EpwingHeadword & head );
|
||||
|
||||
// Find next headword and article position
|
||||
bool getNextHeadword( EpwingHeadword & head );
|
||||
|
||||
// Retrieve article from dictionary
|
||||
void getArticle( QString & headword, QString & articleText,
|
||||
int page, int offset, bool text_only );
|
||||
|
||||
const char * beginDecoration( unsigned int code );
|
||||
const char * endDecoration( unsigned int code );
|
||||
|
||||
QByteArray handleColorImage( EB_Hook_Code code,
|
||||
const unsigned int * argv );
|
||||
|
||||
QByteArray handleMonoImage( EB_Hook_Code code,
|
||||
const unsigned int * argv );
|
||||
|
||||
QByteArray handleWave( EB_Hook_Code code,
|
||||
const unsigned int * argv );
|
||||
|
||||
QByteArray handleMpeg( EB_Hook_Code code,
|
||||
const unsigned int * argv );
|
||||
|
||||
QByteArray handleNarrowFont( const unsigned int * argv );
|
||||
|
||||
QByteArray handleWideFont( const unsigned int * argv );
|
||||
|
||||
QByteArray handleReference( EB_Hook_Code code,
|
||||
const unsigned int * argv );
|
||||
};
|
||||
|
||||
struct EContainer
|
||||
{
|
||||
EpwingBook * book;
|
||||
bool textOnly;
|
||||
|
||||
EContainer( EpwingBook * book_ ) :
|
||||
book( book_ ),
|
||||
textOnly( false )
|
||||
{}
|
||||
|
||||
EContainer( EpwingBook * book_, bool text_only ) :
|
||||
book( book_ ),
|
||||
textOnly( text_only )
|
||||
{}
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif // __EPWING_BOOK_HH_INCLUDED__
|
|
@ -445,6 +445,18 @@ CONFIG( zim_support ) {
|
|||
LIBS += -ltiff
|
||||
}
|
||||
|
||||
CONFIG( no_epwing_support ) {
|
||||
DEFINES += NO_EPWING_SUPPORT
|
||||
}
|
||||
|
||||
!CONFIG( no_epwing_support ) {
|
||||
HEADERS += epwing.hh \
|
||||
epwing_book.hh
|
||||
SOURCES += epwing.cc \
|
||||
epwing_book.cc
|
||||
LIBS += -leb
|
||||
}
|
||||
|
||||
RESOURCES += resources.qrc \
|
||||
flags.qrc
|
||||
TRANSLATIONS += locale/ru_RU.ts \
|
||||
|
|
BIN
icons/icon32_epwing.png
Normal file
BIN
icons/icon32_epwing.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.1 KiB |
|
@ -30,6 +30,10 @@
|
|||
#include "zim.hh"
|
||||
#include "dictserver.hh"
|
||||
|
||||
#ifndef NO_EPWING_SUPPORT
|
||||
#include "epwing.hh"
|
||||
#endif
|
||||
|
||||
#include <QMessageBox>
|
||||
#include <QDir>
|
||||
|
||||
|
@ -56,6 +60,9 @@ LoadDictionaries::LoadDictionaries( Config::Class const & cfg ):
|
|||
#ifdef MAKE_ZIM_SUPPORT
|
||||
<< "*.zim" << "*.zimaa"
|
||||
#endif
|
||||
#ifndef NO_EPWING_SUPPORT
|
||||
<< "*catalogs"
|
||||
#endif
|
||||
;
|
||||
}
|
||||
|
||||
|
@ -201,6 +208,15 @@ void LoadDictionaries::handlePath( Config::Path const & path )
|
|||
zimDictionaries.end() );
|
||||
}
|
||||
#endif
|
||||
#ifndef NO_EPWING_SUPPORT
|
||||
{
|
||||
vector< sptr< Dictionary::Class > > epwingDictionaries =
|
||||
Epwing::makeDictionaries( allFiles, FsEncoding::encode( Config::getIndexDir() ), *this );
|
||||
|
||||
dictionaries.insert( dictionaries.end(), epwingDictionaries.begin(),
|
||||
epwingDictionaries.end() );
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void LoadDictionaries::indexingDictionary( string const & dictionaryName ) throw()
|
||||
|
|
100
maclibs/include/eb/appendix.h
Normal file
100
maclibs/include/eb/appendix.h
Normal file
|
@ -0,0 +1,100 @@
|
|||
/* -*- C -*-
|
||||
* Copyright (c) 1997-2006 Motoyuki Kasahara
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the project nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef EB_APPENDIX_H
|
||||
#define EB_APPENDIX_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef EB_BUILD_LIBRARY
|
||||
#include "eb.h"
|
||||
#else
|
||||
#include <eb/eb.h>
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Function declarations.
|
||||
*/
|
||||
/* appendix.c */
|
||||
void eb_initialize_appendix(EB_Appendix *appendix);
|
||||
void eb_finalize_appendix(EB_Appendix *appendix);
|
||||
EB_Error_Code eb_bind_appendix(EB_Appendix *appendix, const char *path);
|
||||
int eb_is_appendix_bound(EB_Appendix *appendix);
|
||||
EB_Error_Code eb_appendix_path(EB_Appendix *appendix, char *path);
|
||||
|
||||
/* appsub.c */
|
||||
EB_Error_Code eb_load_all_appendix_subbooks(EB_Appendix *appendix);
|
||||
EB_Error_Code eb_appendix_subbook_list(EB_Appendix *appendix,
|
||||
EB_Subbook_Code *subbook_list, int *subbook_count);
|
||||
EB_Error_Code eb_appendix_subbook(EB_Appendix *appendix,
|
||||
EB_Subbook_Code *subbook_code);
|
||||
EB_Error_Code eb_appendix_subbook_directory(EB_Appendix *appendix,
|
||||
char *directory);
|
||||
EB_Error_Code eb_appendix_subbook_directory2(EB_Appendix *appendix,
|
||||
EB_Subbook_Code subbook_code, char *directory);
|
||||
EB_Error_Code eb_set_appendix_subbook(EB_Appendix *appendix,
|
||||
EB_Subbook_Code subbook_code);
|
||||
void eb_unset_appendix_subbook(EB_Appendix *appendix);
|
||||
|
||||
/* narwalt.c */
|
||||
int eb_have_narrow_alt(EB_Appendix *appendix);
|
||||
EB_Error_Code eb_narrow_alt_start(EB_Appendix *appendix, int *start);
|
||||
EB_Error_Code eb_narrow_alt_end(EB_Appendix *appendix, int *end);
|
||||
EB_Error_Code eb_narrow_alt_character_text(EB_Appendix *appendix,
|
||||
int character_number, char *text);
|
||||
EB_Error_Code eb_forward_narrow_alt_character(EB_Appendix *appendix,
|
||||
int n, int *character_number);
|
||||
EB_Error_Code eb_backward_narrow_alt_character(EB_Appendix *appendix,
|
||||
int n, int *character_number);
|
||||
|
||||
/* stopcode.c */
|
||||
int eb_have_stop_code(EB_Appendix *appendix);
|
||||
EB_Error_Code eb_stop_code(EB_Appendix *appendix, int *);
|
||||
|
||||
/* widealt.c */
|
||||
int eb_have_wide_alt(EB_Appendix *appendix);
|
||||
EB_Error_Code eb_wide_alt_start(EB_Appendix *appendix, int *start);
|
||||
EB_Error_Code eb_wide_alt_end(EB_Appendix *appendix, int *end);
|
||||
EB_Error_Code eb_wide_alt_character_text(EB_Appendix *appendix,
|
||||
int character_number, char *text);
|
||||
EB_Error_Code eb_forward_wide_alt_character(EB_Appendix *appendix, int n,
|
||||
int *character_number);
|
||||
EB_Error_Code eb_backward_wide_alt_character(EB_Appendix *appendix, int n,
|
||||
int *character_number);
|
||||
|
||||
/* for backward compatibility */
|
||||
#define eb_suspend_appendix eb_unset_appendix_subbook
|
||||
#define eb_initialize_all_appendix_subbooks eb_load_all_appendix_subbooks
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* not EB_APPENDIX_H */
|
73
maclibs/include/eb/binary.h
Normal file
73
maclibs/include/eb/binary.h
Normal file
|
@ -0,0 +1,73 @@
|
|||
/* -*- C -*-
|
||||
* Copyright (c) 2001-2006 Motoyuki Kasahara
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the project nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef EB_BINARY_H
|
||||
#define EB_BINARY_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#ifdef EB_BUILD_LIBRARY
|
||||
#include "defs.h"
|
||||
#else
|
||||
#include <eb/defs.h>
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Function declarations.
|
||||
*/
|
||||
/* binary.c */
|
||||
EB_Error_Code eb_set_binary_mono_graphic(EB_Book *book,
|
||||
const EB_Position *position, int width, int height);
|
||||
EB_Error_Code eb_set_binary_gray_graphic(EB_Book *book,
|
||||
const EB_Position *position, int width, int height);
|
||||
EB_Error_Code eb_set_binary_wave(EB_Book *book,
|
||||
const EB_Position *start_position, const EB_Position *end_position);
|
||||
EB_Error_Code eb_set_binary_color_graphic(EB_Book *book,
|
||||
const EB_Position *position);
|
||||
EB_Error_Code eb_set_binary_mpeg(EB_Book *book, const unsigned int *argv);
|
||||
EB_Error_Code eb_read_binary(EB_Book *book, size_t binary_max_length,
|
||||
char *binary, ssize_t *binary_length);
|
||||
void eb_unset_binary(EB_Book *book);
|
||||
|
||||
/* filename.c */
|
||||
EB_Error_Code eb_compose_movie_file_name(const unsigned int *argv,
|
||||
char *composed_file_name);
|
||||
EB_Error_Code eb_compose_movie_path_name(EB_Book *book,
|
||||
const unsigned int *argv, char *composed_path_name);
|
||||
EB_Error_Code eb_decompose_movie_file_name(unsigned int *argv,
|
||||
const char *composed_file_name);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* not EB_BINARY_H */
|
60
maclibs/include/eb/booklist.h
Normal file
60
maclibs/include/eb/booklist.h
Normal file
|
@ -0,0 +1,60 @@
|
|||
/* -*- C -*-
|
||||
* Copyright (c) 1997-2006 Motoyuki Kasahara
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the project nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef EB_BOOKLIST_H
|
||||
#define EB_BOOKLIST_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef EB_BUILD_LIBRARY
|
||||
#include "eb.h"
|
||||
#else
|
||||
#include <eb/eb.h>
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Function declarations.
|
||||
*/
|
||||
/* booklist.c */
|
||||
void eb_initialize_booklist(EB_BookList *booklist);
|
||||
void eb_finalize_booklist(EB_BookList *booklist);
|
||||
EB_Error_Code eb_bind_booklist(EB_BookList *booklist, const char *path);
|
||||
EB_Error_Code eb_booklist_book_count(EB_BookList *booklist, int *book_count);
|
||||
EB_Error_Code eb_booklist_book_name(EB_BookList *booklist, int book_index,
|
||||
char **book_name);
|
||||
EB_Error_Code eb_booklist_book_title(EB_BookList *booklist, int book_index,
|
||||
char **book_title);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* not EB_BOOKLIST_H */
|
1040
maclibs/include/eb/defs.h
Normal file
1040
maclibs/include/eb/defs.h
Normal file
File diff suppressed because it is too large
Load diff
155
maclibs/include/eb/eb.h
Normal file
155
maclibs/include/eb/eb.h
Normal file
|
@ -0,0 +1,155 @@
|
|||
/* -*- C -*-
|
||||
* Copyright (c) 1997-2006 Motoyuki Kasahara
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the project nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef EB_EB_H
|
||||
#define EB_EB_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef EB_BUILD_LIBRARY
|
||||
#include "defs.h"
|
||||
#else
|
||||
#include <eb/defs.h>
|
||||
#endif
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
/*
|
||||
* Function declarations.
|
||||
*/
|
||||
/* book.c */
|
||||
void eb_initialize_book(EB_Book *book);
|
||||
EB_Error_Code eb_bind(EB_Book *book, const char *path);
|
||||
void eb_finalize_book(EB_Book *book);
|
||||
int eb_is_bound(EB_Book *book);
|
||||
EB_Error_Code eb_path(EB_Book *book, char *path);
|
||||
EB_Error_Code eb_disc_type(EB_Book *book, EB_Disc_Code *disc_code);
|
||||
EB_Error_Code eb_character_code(EB_Book *book,
|
||||
EB_Character_Code *character_code);
|
||||
|
||||
/* copyright.h */
|
||||
int eb_have_copyright(EB_Book *book);
|
||||
EB_Error_Code eb_copyright(EB_Book *book, EB_Position *position);
|
||||
EB_Error_Code eb_search_cross(EB_Book *book,
|
||||
const char * const input_words[]);
|
||||
|
||||
/* cross.c */
|
||||
int eb_have_cross_search(EB_Book *book);
|
||||
|
||||
/* eb.c */
|
||||
EB_Error_Code eb_initialize_library(void);
|
||||
void eb_finalize_library(void);
|
||||
|
||||
/* endword.c */
|
||||
int eb_have_endword_search(EB_Book *book);
|
||||
EB_Error_Code eb_search_endword(EB_Book *book, const char *input_word);
|
||||
|
||||
/* exactword.c */
|
||||
int eb_have_exactword_search(EB_Book *book);
|
||||
EB_Error_Code eb_search_exactword(EB_Book *book, const char *input_word);
|
||||
|
||||
/* graphic.c */
|
||||
int eb_have_graphic_search(EB_Book *book);
|
||||
|
||||
/* keyword.c */
|
||||
int eb_have_keyword_search(EB_Book *book);
|
||||
EB_Error_Code eb_search_keyword(EB_Book *book,
|
||||
const char * const input_words[]);
|
||||
|
||||
/* lock.c */
|
||||
int eb_pthread_enabled(void);
|
||||
|
||||
/* log.c */
|
||||
void eb_set_log_function(void (*function)(const char *message, va_list ap));
|
||||
void eb_enable_log(void);
|
||||
void eb_disable_log(void);
|
||||
void eb_log(const char *message, ...);
|
||||
void eb_log_stderr(const char *message, va_list ap);
|
||||
|
||||
/* menu.c */
|
||||
int eb_have_menu(EB_Book *book);
|
||||
EB_Error_Code eb_menu(EB_Book *book, EB_Position *position);
|
||||
int eb_have_image_menu(EB_Book *book);
|
||||
EB_Error_Code eb_image_menu(EB_Book *book, EB_Position *position);
|
||||
|
||||
/* multi.c */
|
||||
int eb_have_multi_search(EB_Book *book);
|
||||
EB_Error_Code eb_multi_title(EB_Book *book, EB_Multi_Search_Code multi_id,
|
||||
char *title);
|
||||
EB_Error_Code eb_multi_search_list(EB_Book *book,
|
||||
EB_Multi_Search_Code *search_list, int *search_count);
|
||||
EB_Error_Code eb_multi_entry_count(EB_Book *book,
|
||||
EB_Multi_Search_Code multi_id, int *entry_count);
|
||||
EB_Error_Code eb_multi_entry_list(EB_Book *book,
|
||||
EB_Multi_Search_Code multi_id, int *entry_list, int *entry_count);
|
||||
EB_Error_Code eb_multi_entry_label(EB_Book *book,
|
||||
EB_Multi_Search_Code multi_id, int entry_index, char *label);
|
||||
int eb_multi_entry_have_candidates(EB_Book *book,
|
||||
EB_Multi_Search_Code multi_id, int entry_index);
|
||||
EB_Error_Code eb_multi_entry_candidates(EB_Book *book,
|
||||
EB_Multi_Search_Code multi_id, int entry_index, EB_Position *position);
|
||||
EB_Error_Code eb_search_multi(EB_Book *book, EB_Multi_Search_Code multi_id,
|
||||
const char * const input_words[]);
|
||||
|
||||
/* text.c */
|
||||
int eb_have_text(EB_Book *book);
|
||||
EB_Error_Code eb_text(EB_Book *book, EB_Position *position);
|
||||
|
||||
/* search.c */
|
||||
EB_Error_Code eb_hit_list(EB_Book *book, int max_hit_count, EB_Hit *hit_list,
|
||||
int *hit_count);
|
||||
|
||||
/* subbook.c */
|
||||
EB_Error_Code eb_load_all_subbooks(EB_Book *book);
|
||||
EB_Error_Code eb_subbook_list(EB_Book *book, EB_Subbook_Code *subbook_list,
|
||||
int *subbook_count);
|
||||
EB_Error_Code eb_subbook(EB_Book *book, EB_Subbook_Code *subbook_code);
|
||||
EB_Error_Code eb_subbook_title(EB_Book *book, char *title);
|
||||
EB_Error_Code eb_subbook_title2(EB_Book *book, EB_Subbook_Code subbook_code,
|
||||
char *title);
|
||||
EB_Error_Code eb_subbook_directory(EB_Book *book, char *directory);
|
||||
EB_Error_Code eb_subbook_directory2(EB_Book *book,
|
||||
EB_Subbook_Code subbook_code, char *directory);
|
||||
EB_Error_Code eb_set_subbook(EB_Book *book, EB_Subbook_Code subbook_code);
|
||||
void eb_unset_subbook(EB_Book *book);
|
||||
|
||||
/* word.c */
|
||||
int eb_have_word_search(EB_Book *book);
|
||||
EB_Error_Code eb_search_word(EB_Book *book, const char *input_word);
|
||||
|
||||
/* for backward compatibility */
|
||||
#define eb_suspend eb_unset_subbook
|
||||
#define eb_initialize_all_subbooks eb_load_all_subbooks
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* not EB_EB_H */
|
150
maclibs/include/eb/error.h
Normal file
150
maclibs/include/eb/error.h
Normal file
|
@ -0,0 +1,150 @@
|
|||
/* -*- C -*-
|
||||
* Copyright (c) 1997-2006 Motoyuki Kasahara
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the project nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef EB_ERROR_H
|
||||
#define EB_ERROR_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef EB_BUILD_LIBRARY
|
||||
#include "defs.h"
|
||||
#else
|
||||
#include <eb/defs.h>
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Error codes.
|
||||
*/
|
||||
#define EB_SUCCESS 0
|
||||
#define EB_ERR_MEMORY_EXHAUSTED 1
|
||||
#define EB_ERR_EMPTY_FILE_NAME 2
|
||||
#define EB_ERR_TOO_LONG_FILE_NAME 3
|
||||
#define EB_ERR_BAD_FILE_NAME 4
|
||||
|
||||
#define EB_ERR_BAD_DIR_NAME 5
|
||||
#define EB_ERR_TOO_LONG_WORD 6
|
||||
#define EB_ERR_BAD_WORD 7
|
||||
#define EB_ERR_EMPTY_WORD 8
|
||||
#define EB_ERR_FAIL_GETCWD 9
|
||||
|
||||
#define EB_ERR_FAIL_OPEN_CAT 10
|
||||
#define EB_ERR_FAIL_OPEN_CATAPP 11
|
||||
#define EB_ERR_FAIL_OPEN_TEXT 12
|
||||
#define EB_ERR_FAIL_OPEN_FONT 13
|
||||
#define EB_ERR_FAIL_OPEN_APP 14
|
||||
|
||||
#define EB_ERR_FAIL_OPEN_BINARY 15
|
||||
#define EB_ERR_FAIL_READ_CAT 16
|
||||
#define EB_ERR_FAIL_READ_CATAPP 17
|
||||
#define EB_ERR_FAIL_READ_TEXT 18
|
||||
#define EB_ERR_FAIL_READ_FONT 19
|
||||
|
||||
#define EB_ERR_FAIL_READ_APP 20
|
||||
#define EB_ERR_FAIL_READ_BINARY 21
|
||||
#define EB_ERR_FAIL_SEEK_CAT 22
|
||||
#define EB_ERR_FAIL_SEEK_CATAPP 23
|
||||
#define EB_ERR_FAIL_SEEK_TEXT 24
|
||||
|
||||
#define EB_ERR_FAIL_SEEK_FONT 25
|
||||
#define EB_ERR_FAIL_SEEK_APP 26
|
||||
#define EB_ERR_FAIL_SEEK_BINARY 27
|
||||
#define EB_ERR_UNEXP_CAT 28
|
||||
#define EB_ERR_UNEXP_CATAPP 29
|
||||
|
||||
#define EB_ERR_UNEXP_TEXT 30
|
||||
#define EB_ERR_UNEXP_FONT 31
|
||||
#define EB_ERR_UNEXP_APP 32
|
||||
#define EB_ERR_UNEXP_BINARY 33
|
||||
#define EB_ERR_UNBOUND_BOOK 34
|
||||
|
||||
#define EB_ERR_UNBOUND_APP 35
|
||||
#define EB_ERR_NO_SUB 36
|
||||
#define EB_ERR_NO_APPSUB 37
|
||||
#define EB_ERR_NO_FONT 38
|
||||
#define EB_ERR_NO_TEXT 39
|
||||
|
||||
#define EB_ERR_NO_STOPCODE 40
|
||||
#define EB_ERR_NO_ALT 41
|
||||
#define EB_ERR_NO_CUR_SUB 42
|
||||
#define EB_ERR_NO_CUR_APPSUB 43
|
||||
#define EB_ERR_NO_CUR_FONT 44
|
||||
|
||||
#define EB_ERR_NO_CUR_BINARY 45
|
||||
#define EB_ERR_NO_SUCH_SUB 46
|
||||
#define EB_ERR_NO_SUCH_APPSUB 47
|
||||
#define EB_ERR_NO_SUCH_FONT 48
|
||||
#define EB_ERR_NO_SUCH_CHAR_BMP 49
|
||||
|
||||
#define EB_ERR_NO_SUCH_CHAR_TEXT 50
|
||||
#define EB_ERR_NO_SUCH_SEARCH 51
|
||||
#define EB_ERR_NO_SUCH_HOOK 52
|
||||
#define EB_ERR_NO_SUCH_BINARY 53
|
||||
#define EB_ERR_DIFF_CONTENT 54
|
||||
|
||||
#define EB_ERR_NO_PREV_SEARCH 55
|
||||
#define EB_ERR_NO_SUCH_MULTI_ID 56
|
||||
#define EB_ERR_NO_SUCH_ENTRY_ID 57
|
||||
#define EB_ERR_TOO_MANY_WORDS 58
|
||||
#define EB_ERR_NO_WORD 59
|
||||
|
||||
#define EB_ERR_NO_CANDIDATES 60
|
||||
#define EB_ERR_END_OF_CONTENT 61
|
||||
#define EB_ERR_NO_PREV_SEEK 62
|
||||
#define EB_ERR_EBNET_UNSUPPORTED 63
|
||||
#define EB_ERR_EBNET_FAIL_CONNECT 64
|
||||
|
||||
#define EB_ERR_EBNET_SERVER_BUSY 65
|
||||
#define EB_ERR_EBNET_NO_PERMISSION 66
|
||||
#define EB_ERR_UNBOUND_BOOKLIST 67
|
||||
#define EB_ERR_NO_SUCH_BOOK 68
|
||||
|
||||
|
||||
/*
|
||||
* The number of error codes.
|
||||
*/
|
||||
#define EB_NUMBER_OF_ERRORS 69
|
||||
|
||||
/*
|
||||
* The maximum length of an error message.
|
||||
*/
|
||||
#define EB_MAX_ERROR_MESSAGE_LENGTH 127
|
||||
|
||||
/*
|
||||
* Function declarations.
|
||||
*/
|
||||
/* error.c */
|
||||
const char *eb_error_string(EB_Error_Code error_code);
|
||||
const char *eb_error_message(EB_Error_Code error_code);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* not EB_ERROR_H */
|
200
maclibs/include/eb/font.h
Normal file
200
maclibs/include/eb/font.h
Normal file
|
@ -0,0 +1,200 @@
|
|||
/* -*- C -*-
|
||||
* Copyright (c) 1997-2006 Motoyuki Kasahara
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the project nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef EB_FONT_H
|
||||
#define EB_FONT_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#ifdef EB_BUILD_LIBRARY
|
||||
#include "defs.h"
|
||||
#else
|
||||
#include <eb/defs.h>
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Font types.
|
||||
*/
|
||||
#define EB_FONT_16 0
|
||||
#define EB_FONT_24 1
|
||||
#define EB_FONT_30 2
|
||||
#define EB_FONT_48 3
|
||||
#define EB_FONT_INVALID -1
|
||||
|
||||
/*
|
||||
* Font sizes.
|
||||
*/
|
||||
#define EB_SIZE_NARROW_FONT_16 16
|
||||
#define EB_SIZE_WIDE_FONT_16 32
|
||||
#define EB_SIZE_NARROW_FONT_24 48
|
||||
#define EB_SIZE_WIDE_FONT_24 72
|
||||
#define EB_SIZE_NARROW_FONT_30 60
|
||||
#define EB_SIZE_WIDE_FONT_30 120
|
||||
#define EB_SIZE_NARROW_FONT_48 144
|
||||
#define EB_SIZE_WIDE_FONT_48 288
|
||||
|
||||
/*
|
||||
* Font width.
|
||||
*/
|
||||
#define EB_WIDTH_NARROW_FONT_16 8
|
||||
#define EB_WIDTH_WIDE_FONT_16 16
|
||||
#define EB_WIDTH_NARROW_FONT_24 16
|
||||
#define EB_WIDTH_WIDE_FONT_24 24
|
||||
#define EB_WIDTH_NARROW_FONT_30 16
|
||||
#define EB_WIDTH_WIDE_FONT_30 32
|
||||
#define EB_WIDTH_NARROW_FONT_48 24
|
||||
#define EB_WIDTH_WIDE_FONT_48 48
|
||||
|
||||
/*
|
||||
* Font height.
|
||||
*/
|
||||
#define EB_HEIGHT_FONT_16 16
|
||||
#define EB_HEIGHT_FONT_24 24
|
||||
#define EB_HEIGHT_FONT_30 30
|
||||
#define EB_HEIGHT_FONT_48 48
|
||||
|
||||
/*
|
||||
* Bitmap image sizes.
|
||||
*/
|
||||
#define EB_SIZE_NARROW_FONT_16_XBM 184
|
||||
#define EB_SIZE_WIDE_FONT_16_XBM 284
|
||||
#define EB_SIZE_NARROW_FONT_16_XPM 266
|
||||
#define EB_SIZE_WIDE_FONT_16_XPM 395
|
||||
#define EB_SIZE_NARROW_FONT_16_GIF 186
|
||||
#define EB_SIZE_WIDE_FONT_16_GIF 314
|
||||
#define EB_SIZE_NARROW_FONT_16_BMP 126
|
||||
#define EB_SIZE_WIDE_FONT_16_BMP 126
|
||||
#define EB_SIZE_NARROW_FONT_16_PNG 131
|
||||
#define EB_SIZE_WIDE_FONT_16_PNG 147
|
||||
|
||||
#define EB_SIZE_NARROW_FONT_24_XBM 383
|
||||
#define EB_SIZE_WIDE_FONT_24_XBM 533
|
||||
#define EB_SIZE_NARROW_FONT_24_XPM 555
|
||||
#define EB_SIZE_WIDE_FONT_24_XPM 747
|
||||
#define EB_SIZE_NARROW_FONT_24_GIF 450
|
||||
#define EB_SIZE_WIDE_FONT_24_GIF 642
|
||||
#define EB_SIZE_NARROW_FONT_24_BMP 158
|
||||
#define EB_SIZE_WIDE_FONT_24_BMP 158
|
||||
#define EB_SIZE_NARROW_FONT_24_PNG 171
|
||||
#define EB_SIZE_WIDE_FONT_24_PNG 195
|
||||
|
||||
#define EB_SIZE_NARROW_FONT_30_XBM 458
|
||||
#define EB_SIZE_WIDE_FONT_30_XBM 833
|
||||
#define EB_SIZE_NARROW_FONT_30_XPM 675
|
||||
#define EB_SIZE_WIDE_FONT_30_XPM 1155
|
||||
#define EB_SIZE_NARROW_FONT_30_GIF 552
|
||||
#define EB_SIZE_WIDE_FONT_30_GIF 1032
|
||||
#define EB_SIZE_NARROW_FONT_30_BMP 182
|
||||
#define EB_SIZE_WIDE_FONT_30_BMP 182
|
||||
#define EB_SIZE_NARROW_FONT_30_PNG 189
|
||||
#define EB_SIZE_WIDE_FONT_30_PNG 249
|
||||
|
||||
#define EB_SIZE_NARROW_FONT_48_XBM 983
|
||||
#define EB_SIZE_WIDE_FONT_48_XBM 1883
|
||||
#define EB_SIZE_NARROW_FONT_48_XPM 1419
|
||||
#define EB_SIZE_WIDE_FONT_48_XPM 2571
|
||||
#define EB_SIZE_NARROW_FONT_48_GIF 1242
|
||||
#define EB_SIZE_WIDE_FONT_48_GIF 2394
|
||||
#define EB_SIZE_NARROW_FONT_48_BMP 254
|
||||
#define EB_SIZE_WIDE_FONT_48_BMP 446
|
||||
#define EB_SIZE_NARROW_FONT_48_PNG 291
|
||||
#define EB_SIZE_WIDE_FONT_48_PNG 435
|
||||
|
||||
#define EB_SIZE_FONT_IMAGE EB_SIZE_WIDE_FONT_48_XPM
|
||||
|
||||
/*
|
||||
* Function declarations.
|
||||
*/
|
||||
/* bitmap.c */
|
||||
EB_Error_Code eb_narrow_font_xbm_size(EB_Font_Code font_code, size_t *size);
|
||||
EB_Error_Code eb_narrow_font_xpm_size(EB_Font_Code font_code, size_t *size);
|
||||
EB_Error_Code eb_narrow_font_gif_size(EB_Font_Code font_code, size_t *size);
|
||||
EB_Error_Code eb_narrow_font_bmp_size(EB_Font_Code font_code, size_t *size);
|
||||
EB_Error_Code eb_narrow_font_png_size(EB_Font_Code font_code, size_t *size);
|
||||
EB_Error_Code eb_wide_font_xbm_size(EB_Font_Code font_code, size_t *size);
|
||||
EB_Error_Code eb_wide_font_xpm_size(EB_Font_Code font_code, size_t *size);
|
||||
EB_Error_Code eb_wide_font_gif_size(EB_Font_Code font_code, size_t *size);
|
||||
EB_Error_Code eb_wide_font_bmp_size(EB_Font_Code font_code, size_t *size);
|
||||
EB_Error_Code eb_wide_font_png_size(EB_Font_Code font_code, size_t *size);
|
||||
EB_Error_Code eb_bitmap_to_xbm(const char *bitmap, int width, int height,
|
||||
char *xbm, size_t *xbm_length);
|
||||
EB_Error_Code eb_bitmap_to_xpm(const char *bitmap, int width, int height,
|
||||
char *xpm, size_t *xpm_length);
|
||||
EB_Error_Code eb_bitmap_to_gif(const char *bitmap, int width, int height,
|
||||
char *gif, size_t *gif_length);
|
||||
EB_Error_Code eb_bitmap_to_bmp(const char *bitmap, int width, int height,
|
||||
char *bmp, size_t *bmp_length);
|
||||
EB_Error_Code eb_bitmap_to_png(const char *bitmap, int width, int height,
|
||||
char *png, size_t *png_length);
|
||||
|
||||
/* font.c */
|
||||
EB_Error_Code eb_font(EB_Book *book, EB_Font_Code *font_code);
|
||||
EB_Error_Code eb_set_font(EB_Book *book, EB_Font_Code font_code);
|
||||
void eb_unset_font(EB_Book *book);
|
||||
EB_Error_Code eb_font_list(EB_Book *book, EB_Font_Code *font_list,
|
||||
int *font_count);
|
||||
int eb_have_font(EB_Book *book, EB_Font_Code font_code);
|
||||
EB_Error_Code eb_font_height(EB_Book *book, int *height);
|
||||
EB_Error_Code eb_font_height2(EB_Font_Code font_code, int *height);
|
||||
|
||||
/* narwfont.c */
|
||||
int eb_have_narrow_font(EB_Book *book);
|
||||
EB_Error_Code eb_narrow_font_width(EB_Book *book, int *width);
|
||||
EB_Error_Code eb_narrow_font_width2(EB_Font_Code font_code, int *width);
|
||||
EB_Error_Code eb_narrow_font_size(EB_Book *book, size_t *size);
|
||||
EB_Error_Code eb_narrow_font_size2(EB_Font_Code font_code, size_t *size);
|
||||
EB_Error_Code eb_narrow_font_start(EB_Book *book, int *start);
|
||||
EB_Error_Code eb_narrow_font_end(EB_Book *book, int *end);
|
||||
EB_Error_Code eb_narrow_font_character_bitmap(EB_Book *book, int, char *);
|
||||
EB_Error_Code eb_forward_narrow_font_character(EB_Book *book, int, int *);
|
||||
EB_Error_Code eb_backward_narrow_font_character(EB_Book *book, int, int *);
|
||||
|
||||
/* widefont.c */
|
||||
int eb_have_wide_font(EB_Book *book);
|
||||
EB_Error_Code eb_wide_font_width(EB_Book *book, int *width);
|
||||
EB_Error_Code eb_wide_font_width2(EB_Font_Code font_code, int *width);
|
||||
EB_Error_Code eb_wide_font_size(EB_Book *book, size_t *size);
|
||||
EB_Error_Code eb_wide_font_size2(EB_Font_Code font_code, size_t *size);
|
||||
EB_Error_Code eb_wide_font_start(EB_Book *book, int *start);
|
||||
EB_Error_Code eb_wide_font_end(EB_Book *book, int *end);
|
||||
EB_Error_Code eb_wide_font_character_bitmap(EB_Book *book,
|
||||
int character_number, char *bitmap);
|
||||
EB_Error_Code eb_forward_wide_font_character(EB_Book *book, int n,
|
||||
int *character_number);
|
||||
EB_Error_Code eb_backward_wide_font_character(EB_Book *book, int n,
|
||||
int *character_number);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* not EB_FONT_H */
|
4
maclibs/include/eb/sysdefs.h
Normal file
4
maclibs/include/eb/sysdefs.h
Normal file
|
@ -0,0 +1,4 @@
|
|||
/* automatically generated by Makefile. */
|
||||
#define EB_VERSION_STRING "4.4.3"
|
||||
#define EB_VERSION_MAJOR 4
|
||||
#define EB_VERSION_MINOR 4
|
166
maclibs/include/eb/text.h
Normal file
166
maclibs/include/eb/text.h
Normal file
|
@ -0,0 +1,166 @@
|
|||
/* -*- C -*-
|
||||
* Copyright (c) 1997-2006 Motoyuki Kasahara
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the project nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef EB_TEXT_H
|
||||
#define EB_TEXT_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#ifdef EB_BUILD_LIBRARY
|
||||
#include "defs.h"
|
||||
#else
|
||||
#include <eb/defs.h>
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Hook codes.
|
||||
* (When you add or remove a hook, update EB_NUMER_OF_HOOKS in defs.h.)
|
||||
*/
|
||||
#define EB_HOOK_NULL -1
|
||||
#define EB_HOOK_INITIALIZE 0
|
||||
#define EB_HOOK_BEGIN_NARROW 1
|
||||
#define EB_HOOK_END_NARROW 2
|
||||
#define EB_HOOK_BEGIN_SUBSCRIPT 3
|
||||
#define EB_HOOK_END_SUBSCRIPT 4
|
||||
|
||||
#define EB_HOOK_SET_INDENT 5
|
||||
#define EB_HOOK_NEWLINE 6
|
||||
#define EB_HOOK_BEGIN_SUPERSCRIPT 7
|
||||
#define EB_HOOK_END_SUPERSCRIPT 8
|
||||
#define EB_HOOK_BEGIN_NO_NEWLINE 9
|
||||
|
||||
#define EB_HOOK_END_NO_NEWLINE 10
|
||||
#define EB_HOOK_BEGIN_EMPHASIS 11
|
||||
#define EB_HOOK_END_EMPHASIS 12
|
||||
#define EB_HOOK_BEGIN_CANDIDATE 13
|
||||
#define EB_HOOK_END_CANDIDATE_GROUP 14
|
||||
|
||||
#define EB_HOOK_END_CANDIDATE_LEAF 15
|
||||
#define EB_HOOK_BEGIN_REFERENCE 16
|
||||
#define EB_HOOK_END_REFERENCE 17
|
||||
#define EB_HOOK_BEGIN_KEYWORD 18
|
||||
#define EB_HOOK_END_KEYWORD 19
|
||||
|
||||
#define EB_HOOK_NARROW_FONT 20
|
||||
#define EB_HOOK_WIDE_FONT 21
|
||||
#define EB_HOOK_ISO8859_1 22
|
||||
#define EB_HOOK_NARROW_JISX0208 23
|
||||
#define EB_HOOK_WIDE_JISX0208 24
|
||||
|
||||
#define EB_HOOK_GB2312 25
|
||||
#define EB_HOOK_BEGIN_MONO_GRAPHIC 26
|
||||
#define EB_HOOK_END_MONO_GRAPHIC 27
|
||||
#define EB_HOOK_BEGIN_GRAY_GRAPHIC 28
|
||||
#define EB_HOOK_END_GRAY_GRAPHIC 29
|
||||
|
||||
#define EB_HOOK_BEGIN_COLOR_BMP 30
|
||||
#define EB_HOOK_BEGIN_COLOR_JPEG 31
|
||||
#define EB_HOOK_BEGIN_IN_COLOR_BMP 32
|
||||
#define EB_HOOK_BEGIN_IN_COLOR_JPEG 33
|
||||
#define EB_HOOK_END_COLOR_GRAPHIC 34
|
||||
|
||||
#define EB_HOOK_END_IN_COLOR_GRAPHIC 35
|
||||
#define EB_HOOK_BEGIN_WAVE 36
|
||||
#define EB_HOOK_END_WAVE 37
|
||||
#define EB_HOOK_BEGIN_MPEG 38
|
||||
#define EB_HOOK_END_MPEG 39
|
||||
|
||||
#define EB_HOOK_BEGIN_GRAPHIC_REFERENCE 40
|
||||
#define EB_HOOK_END_GRAPHIC_REFERENCE 41
|
||||
#define EB_HOOK_GRAPHIC_REFERENCE 42
|
||||
#define EB_HOOK_BEGIN_DECORATION 43
|
||||
#define EB_HOOK_END_DECORATION 44
|
||||
|
||||
#define EB_HOOK_BEGIN_IMAGE_PAGE 45
|
||||
#define EB_HOOK_END_IMAGE_PAGE 46
|
||||
#define EB_HOOK_BEGIN_CLICKABLE_AREA 47
|
||||
#define EB_HOOK_END_CLICKABLE_AREA 48
|
||||
|
||||
#define EB_HOOK_BEGIN_UNICODE 49
|
||||
#define EB_HOOK_END_UNICODE 50
|
||||
#define EB_HOOK_BEGIN_EBXAC_GAIJI 51
|
||||
#define EB_HOOK_END_EBXAC_GAIJI 52
|
||||
#define EB_HOOK_EBXAC_GAIJI 53
|
||||
|
||||
/*
|
||||
* Function declarations.
|
||||
*/
|
||||
/* hook.c */
|
||||
void eb_initialize_hookset(EB_Hookset *hookset);
|
||||
void eb_finalize_hookset(EB_Hookset *hookset);
|
||||
EB_Error_Code eb_set_hook(EB_Hookset *hookset, const EB_Hook *hook);
|
||||
EB_Error_Code eb_set_hooks(EB_Hookset *hookset, const EB_Hook *hook);
|
||||
EB_Error_Code eb_hook_euc_to_ascii(EB_Book *book, EB_Appendix *appendix,
|
||||
void *container, EB_Hook_Code hook_code, int argc,
|
||||
const unsigned int *argv);
|
||||
EB_Error_Code eb_hook_stop_code(EB_Book *book, EB_Appendix *appendix,
|
||||
void *container, EB_Hook_Code hook_code, int argc,
|
||||
const unsigned int *argv);
|
||||
EB_Error_Code eb_hook_narrow_character_text(EB_Book *book,
|
||||
EB_Appendix *appendix, void *container, EB_Hook_Code hook_code, int argc,
|
||||
const unsigned int *argv);
|
||||
EB_Error_Code eb_hook_wide_character_text(EB_Book *book,
|
||||
EB_Appendix *appendix, void *container, EB_Hook_Code hook_code, int argc,
|
||||
const unsigned int *argv);
|
||||
EB_Error_Code eb_hook_newline(EB_Book *book, EB_Appendix *appendix,
|
||||
void *container, EB_Hook_Code hook_code, int argc,
|
||||
const unsigned int *argv);
|
||||
EB_Error_Code eb_hook_empty(EB_Book *book, EB_Appendix *appendix,
|
||||
void *container, EB_Hook_Code hook_code, int argc,
|
||||
const unsigned int *argv);
|
||||
|
||||
/* readtext.c */
|
||||
EB_Error_Code eb_seek_text(EB_Book *book, const EB_Position *position);
|
||||
EB_Error_Code eb_tell_text(EB_Book *book, EB_Position *position);
|
||||
EB_Error_Code eb_read_text(EB_Book *book, EB_Appendix *appendix,
|
||||
EB_Hookset *hookset, void *container, size_t text_max_length, char *text,
|
||||
ssize_t *text_length);
|
||||
EB_Error_Code eb_read_heading(EB_Book *book, EB_Appendix *appendix,
|
||||
EB_Hookset *hookset, void *container, size_t text_max_length, char *text,
|
||||
ssize_t *text_length);
|
||||
EB_Error_Code eb_read_rawtext(EB_Book *book, size_t text_max_length,
|
||||
char *text, ssize_t *text_length);
|
||||
int eb_is_text_stopped(EB_Book *book);
|
||||
EB_Error_Code eb_write_text_byte1(EB_Book *book, int byte1);
|
||||
EB_Error_Code eb_write_text_byte2(EB_Book *book, int byte1, int byte2);
|
||||
EB_Error_Code eb_write_text_string(EB_Book *book, const char *string);
|
||||
EB_Error_Code eb_write_text(EB_Book *book, const char * stream,
|
||||
size_t stream_length);
|
||||
const char *eb_current_candidate(EB_Book *book);
|
||||
EB_Error_Code eb_forward_text(EB_Book *book, EB_Appendix *appendix);
|
||||
EB_Error_Code eb_backward_text(EB_Book *book, EB_Appendix *appendix);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* not EB_TEXT_H */
|
237
maclibs/include/eb/zio.h
Normal file
237
maclibs/include/eb/zio.h
Normal file
|
@ -0,0 +1,237 @@
|
|||
/* -*- C -*-
|
||||
* Copyright (c) 2001-2006 Motoyuki Kasahara
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the project nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef ZIO_H
|
||||
#define ZIO_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <time.h>
|
||||
|
||||
/*
|
||||
* Header size of the ebzip compression file.
|
||||
*/
|
||||
#define ZIO_SIZE_EBZIP_HEADER 22
|
||||
|
||||
/*
|
||||
* Margin size for ebzip compression buffer.
|
||||
* (Since compressed data is larger than original in the worst case,
|
||||
* we must add margin to a compression buffer.)
|
||||
*/
|
||||
#define ZIO_SIZE_EBZIP_MARGIN 1024
|
||||
|
||||
/*
|
||||
* Maximum ebzio compression level.
|
||||
*/
|
||||
#define ZIO_MAX_EBZIP_LEVEL 5
|
||||
|
||||
/*
|
||||
* Huffman node types.
|
||||
*/
|
||||
#define ZIO_HUFFMAN_NODE_INTERMEDIATE 0
|
||||
#define ZIO_HUFFMAN_NODE_EOF 1
|
||||
#define ZIO_HUFFMAN_NODE_LEAF8 2
|
||||
#define ZIO_HUFFMAN_NODE_LEAF16 3
|
||||
#define ZIO_HUFFMAN_NODE_LEAF32 4
|
||||
|
||||
/*
|
||||
* Compression type codes.
|
||||
*/
|
||||
#define ZIO_PLAIN 0
|
||||
#define ZIO_EBZIP1 1
|
||||
#define ZIO_EPWING 2
|
||||
#define ZIO_EPWING6 3
|
||||
#define ZIO_SEBXA 4
|
||||
#define ZIO_INVALID -1
|
||||
#define ZIO_REOPEN -2
|
||||
|
||||
/*
|
||||
* Compression type.
|
||||
*/
|
||||
typedef int Zio_Code;
|
||||
|
||||
/*
|
||||
* A node of static Huffman tree.
|
||||
*/
|
||||
typedef struct Zio_Huffman_Node_Struct Zio_Huffman_Node;
|
||||
|
||||
struct Zio_Huffman_Node_Struct {
|
||||
/*
|
||||
* node type (ITNERMEDIATE, LEAF8, LEAF16, LEAF32 or EOF).
|
||||
*/
|
||||
int type;
|
||||
|
||||
/*
|
||||
* Value of a leaf node.
|
||||
*/
|
||||
unsigned int value;
|
||||
|
||||
/*
|
||||
* Frequency of a node.
|
||||
*/
|
||||
int frequency;
|
||||
|
||||
/*
|
||||
* Left child.
|
||||
*/
|
||||
Zio_Huffman_Node *left;
|
||||
|
||||
/*
|
||||
* Right child.
|
||||
*/
|
||||
Zio_Huffman_Node *right;
|
||||
};
|
||||
|
||||
/*
|
||||
* Compression information of a book.
|
||||
*/
|
||||
typedef struct Zio_Struct Zio;
|
||||
|
||||
struct Zio_Struct {
|
||||
/*
|
||||
* ID.
|
||||
*/
|
||||
int id;
|
||||
|
||||
/*
|
||||
* Zio type. (PLAIN, EBZIP, EPWING, EPWING6 or SEBXA)
|
||||
*/
|
||||
Zio_Code code;
|
||||
|
||||
/*
|
||||
* File descriptor.
|
||||
*/
|
||||
int file;
|
||||
|
||||
/*
|
||||
* Current location.
|
||||
*/
|
||||
off_t location;
|
||||
|
||||
/*
|
||||
* Size of an uncompressed file.
|
||||
*/
|
||||
off_t file_size;
|
||||
|
||||
/*
|
||||
* Slice size of an EBZIP compressed file.
|
||||
*/
|
||||
size_t slice_size;
|
||||
|
||||
/*
|
||||
* Compression level. (EBZIP compression only)
|
||||
*/
|
||||
int zip_level;
|
||||
|
||||
/*
|
||||
* Length of an index. (EBZIP compression only)
|
||||
*/
|
||||
int index_width;
|
||||
|
||||
/*
|
||||
* Adler-32 check sum of an uncompressed file. (EBZIP compression only)
|
||||
*/
|
||||
unsigned int crc;
|
||||
|
||||
/*
|
||||
* mtime of an uncompressed file. (EBZIP compression only)
|
||||
*/
|
||||
time_t mtime;
|
||||
|
||||
/*
|
||||
* Location of an index table. (EPWING and S-EBXA compression only)
|
||||
*/
|
||||
off_t index_location;
|
||||
|
||||
/*
|
||||
* Length of an index table. (EPWING and S-EBXA compression only)
|
||||
*/
|
||||
size_t index_length;
|
||||
|
||||
/*
|
||||
* Location of a frequency table. (EPWING compression only)
|
||||
*/
|
||||
off_t frequencies_location;
|
||||
|
||||
/*
|
||||
* Length of a frequency table. (EPWING compression only)
|
||||
*/
|
||||
size_t frequencies_length;
|
||||
|
||||
/*
|
||||
* Huffman tree nodes. (EPWING compression only)
|
||||
*/
|
||||
Zio_Huffman_Node *huffman_nodes;
|
||||
|
||||
/*
|
||||
* Root node of a Huffman tree. (EPWING compression only)
|
||||
*/
|
||||
Zio_Huffman_Node *huffman_root;
|
||||
|
||||
/*
|
||||
* Region of compressed pages. (S-EBXA compression only)
|
||||
*/
|
||||
off_t zio_start_location;
|
||||
off_t zio_end_location;
|
||||
|
||||
/*
|
||||
* Add this value to offset written in index. (S-EBXA compression only)
|
||||
*/
|
||||
off_t index_base;
|
||||
|
||||
/*
|
||||
* ebnet mode flag.
|
||||
*/
|
||||
int is_ebnet;
|
||||
};
|
||||
|
||||
/*
|
||||
* Function declarations.
|
||||
*/
|
||||
/* zio.c */
|
||||
int zio_initialize_library(void);
|
||||
void zio_finalize_library(void);
|
||||
void zio_initialize(Zio *zio);
|
||||
void zio_finalize(Zio *zio);
|
||||
int zio_set_sebxa_mode(Zio *zio, off_t index_location, off_t index_base,
|
||||
off_t zio_start_location, off_t zio_end_location);
|
||||
int zio_open(Zio *zio, const char *file_name, Zio_Code zio_code);
|
||||
void zio_close(Zio *zio);
|
||||
int zio_file(Zio *zio);
|
||||
Zio_Code zio_mode(Zio *zio);
|
||||
off_t zio_lseek(Zio *zio, off_t offset, int whence);
|
||||
ssize_t zio_read(Zio *zio, char *buffer, size_t length);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* not ZIO_H */
|
BIN
maclibs/lib/libeb.dylib
Normal file
BIN
maclibs/lib/libeb.dylib
Normal file
Binary file not shown.
|
@ -1,6 +1,10 @@
|
|||
/* This file is (c) 2008-2012 Konstantin Isakov <ikm@goldendict.org>
|
||||
* Part of GoldenDict. Licensed under GPLv3 or later, see the LICENSE file */
|
||||
|
||||
#ifndef NO_EPWING_SUPPORT
|
||||
#include "epwing_book.hh"
|
||||
#endif
|
||||
|
||||
#include "mainwindow.hh"
|
||||
#include "editdictionaries.hh"
|
||||
#include "loaddictionaries.hh"
|
||||
|
@ -123,6 +127,10 @@ MainWindow::MainWindow( Config::Class & cfg_ ):
|
|||
QThreadPool::globalInstance()->start( new InitSSLRunnable );
|
||||
#endif
|
||||
|
||||
#ifndef NO_EPWING_SUPPORT
|
||||
Epwing::initialize();
|
||||
#endif
|
||||
|
||||
applyQtStyleSheet( cfg.preferences.displayStyle, cfg.preferences.addonStyle );
|
||||
|
||||
ui.setupUi( this );
|
||||
|
@ -934,6 +942,10 @@ MainWindow::~MainWindow()
|
|||
delete w;
|
||||
}
|
||||
|
||||
#ifndef NO_EPWING_SUPPORT
|
||||
Epwing::finalize();
|
||||
#endif
|
||||
|
||||
commitData();
|
||||
}
|
||||
|
||||
|
|
|
@ -238,8 +238,12 @@ Preferences::Preferences( QWidget * parent, Config::Preferences const & p ):
|
|||
ui.allowStardict->setChecked( !p.fts.disabledTypes.contains( "STARDICT", Qt::CaseInsensitive ) );
|
||||
ui.allowXDXF->setChecked( !p.fts.disabledTypes.contains( "XDXF", Qt::CaseInsensitive ) );
|
||||
ui.allowZim->setChecked( !p.fts.disabledTypes.contains( "ZIM", Qt::CaseInsensitive ) );
|
||||
ui.allowEpwing->setChecked( !p.fts.disabledTypes.contains( "EPWING", Qt::CaseInsensitive ) );
|
||||
#ifndef MAKE_ZIM_SUPPORT
|
||||
ui.allowZim->hide();
|
||||
#endif
|
||||
#ifdef NO_EPWING_SUPPORT
|
||||
ui.allowEpwing->hide();
|
||||
#endif
|
||||
ui.maxDictionarySize->setValue( p.fts.maxDictionarySize );
|
||||
}
|
||||
|
@ -395,6 +399,13 @@ Config::Preferences Preferences::getPreferences()
|
|||
p.fts.disabledTypes += "ZIM";
|
||||
}
|
||||
|
||||
if( !ui.allowEpwing->isChecked() )
|
||||
{
|
||||
if( !p.fts.disabledTypes.isEmpty() )
|
||||
p.fts.disabledTypes += ',';
|
||||
p.fts.disabledTypes += "EPWING";
|
||||
}
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
|
|
|
@ -1286,6 +1286,13 @@ download page.</string>
|
|||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QCheckBox" name="allowEpwing">
|
||||
<property name="text">
|
||||
<string>Epwing</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
|
|
@ -76,5 +76,6 @@
|
|||
<file>icons/playsound_color.png</file>
|
||||
<file>icons/playsound_full.png</file>
|
||||
<file>icons/icon32_zim.png</file>
|
||||
<file>icons/icon32_epwing.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
|
100
winlibs/include/eb/appendix.h
Normal file
100
winlibs/include/eb/appendix.h
Normal file
|
@ -0,0 +1,100 @@
|
|||
/* -*- C -*-
|
||||
* Copyright (c) 1997-2006 Motoyuki Kasahara
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the project nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef EB_APPENDIX_H
|
||||
#define EB_APPENDIX_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef EB_BUILD_LIBRARY
|
||||
#include "eb.h"
|
||||
#else
|
||||
#include <eb/eb.h>
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Function declarations.
|
||||
*/
|
||||
/* appendix.c */
|
||||
void eb_initialize_appendix(EB_Appendix *appendix);
|
||||
void eb_finalize_appendix(EB_Appendix *appendix);
|
||||
EB_Error_Code eb_bind_appendix(EB_Appendix *appendix, const char *path);
|
||||
int eb_is_appendix_bound(EB_Appendix *appendix);
|
||||
EB_Error_Code eb_appendix_path(EB_Appendix *appendix, char *path);
|
||||
|
||||
/* appsub.c */
|
||||
EB_Error_Code eb_load_all_appendix_subbooks(EB_Appendix *appendix);
|
||||
EB_Error_Code eb_appendix_subbook_list(EB_Appendix *appendix,
|
||||
EB_Subbook_Code *subbook_list, int *subbook_count);
|
||||
EB_Error_Code eb_appendix_subbook(EB_Appendix *appendix,
|
||||
EB_Subbook_Code *subbook_code);
|
||||
EB_Error_Code eb_appendix_subbook_directory(EB_Appendix *appendix,
|
||||
char *directory);
|
||||
EB_Error_Code eb_appendix_subbook_directory2(EB_Appendix *appendix,
|
||||
EB_Subbook_Code subbook_code, char *directory);
|
||||
EB_Error_Code eb_set_appendix_subbook(EB_Appendix *appendix,
|
||||
EB_Subbook_Code subbook_code);
|
||||
void eb_unset_appendix_subbook(EB_Appendix *appendix);
|
||||
|
||||
/* narwalt.c */
|
||||
int eb_have_narrow_alt(EB_Appendix *appendix);
|
||||
EB_Error_Code eb_narrow_alt_start(EB_Appendix *appendix, int *start);
|
||||
EB_Error_Code eb_narrow_alt_end(EB_Appendix *appendix, int *end);
|
||||
EB_Error_Code eb_narrow_alt_character_text(EB_Appendix *appendix,
|
||||
int character_number, char *text);
|
||||
EB_Error_Code eb_forward_narrow_alt_character(EB_Appendix *appendix,
|
||||
int n, int *character_number);
|
||||
EB_Error_Code eb_backward_narrow_alt_character(EB_Appendix *appendix,
|
||||
int n, int *character_number);
|
||||
|
||||
/* stopcode.c */
|
||||
int eb_have_stop_code(EB_Appendix *appendix);
|
||||
EB_Error_Code eb_stop_code(EB_Appendix *appendix, int *);
|
||||
|
||||
/* widealt.c */
|
||||
int eb_have_wide_alt(EB_Appendix *appendix);
|
||||
EB_Error_Code eb_wide_alt_start(EB_Appendix *appendix, int *start);
|
||||
EB_Error_Code eb_wide_alt_end(EB_Appendix *appendix, int *end);
|
||||
EB_Error_Code eb_wide_alt_character_text(EB_Appendix *appendix,
|
||||
int character_number, char *text);
|
||||
EB_Error_Code eb_forward_wide_alt_character(EB_Appendix *appendix, int n,
|
||||
int *character_number);
|
||||
EB_Error_Code eb_backward_wide_alt_character(EB_Appendix *appendix, int n,
|
||||
int *character_number);
|
||||
|
||||
/* for backward compatibility */
|
||||
#define eb_suspend_appendix eb_unset_appendix_subbook
|
||||
#define eb_initialize_all_appendix_subbooks eb_load_all_appendix_subbooks
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* not EB_APPENDIX_H */
|
73
winlibs/include/eb/binary.h
Normal file
73
winlibs/include/eb/binary.h
Normal file
|
@ -0,0 +1,73 @@
|
|||
/* -*- C -*-
|
||||
* Copyright (c) 2001-2006 Motoyuki Kasahara
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the project nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef EB_BINARY_H
|
||||
#define EB_BINARY_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#ifdef EB_BUILD_LIBRARY
|
||||
#include "defs.h"
|
||||
#else
|
||||
#include <eb/defs.h>
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Function declarations.
|
||||
*/
|
||||
/* binary.c */
|
||||
EB_Error_Code eb_set_binary_mono_graphic(EB_Book *book,
|
||||
const EB_Position *position, int width, int height);
|
||||
EB_Error_Code eb_set_binary_gray_graphic(EB_Book *book,
|
||||
const EB_Position *position, int width, int height);
|
||||
EB_Error_Code eb_set_binary_wave(EB_Book *book,
|
||||
const EB_Position *start_position, const EB_Position *end_position);
|
||||
EB_Error_Code eb_set_binary_color_graphic(EB_Book *book,
|
||||
const EB_Position *position);
|
||||
EB_Error_Code eb_set_binary_mpeg(EB_Book *book, const unsigned int *argv);
|
||||
EB_Error_Code eb_read_binary(EB_Book *book, size_t binary_max_length,
|
||||
char *binary, ssize_t *binary_length);
|
||||
void eb_unset_binary(EB_Book *book);
|
||||
|
||||
/* filename.c */
|
||||
EB_Error_Code eb_compose_movie_file_name(const unsigned int *argv,
|
||||
char *composed_file_name);
|
||||
EB_Error_Code eb_compose_movie_path_name(EB_Book *book,
|
||||
const unsigned int *argv, char *composed_path_name);
|
||||
EB_Error_Code eb_decompose_movie_file_name(unsigned int *argv,
|
||||
const char *composed_file_name);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* not EB_BINARY_H */
|
60
winlibs/include/eb/booklist.h
Normal file
60
winlibs/include/eb/booklist.h
Normal file
|
@ -0,0 +1,60 @@
|
|||
/* -*- C -*-
|
||||
* Copyright (c) 1997-2006 Motoyuki Kasahara
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the project nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef EB_BOOKLIST_H
|
||||
#define EB_BOOKLIST_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef EB_BUILD_LIBRARY
|
||||
#include "eb.h"
|
||||
#else
|
||||
#include <eb/eb.h>
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Function declarations.
|
||||
*/
|
||||
/* booklist.c */
|
||||
void eb_initialize_booklist(EB_BookList *booklist);
|
||||
void eb_finalize_booklist(EB_BookList *booklist);
|
||||
EB_Error_Code eb_bind_booklist(EB_BookList *booklist, const char *path);
|
||||
EB_Error_Code eb_booklist_book_count(EB_BookList *booklist, int *book_count);
|
||||
EB_Error_Code eb_booklist_book_name(EB_BookList *booklist, int book_index,
|
||||
char **book_name);
|
||||
EB_Error_Code eb_booklist_book_title(EB_BookList *booklist, int book_index,
|
||||
char **book_title);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* not EB_BOOKLIST_H */
|
1040
winlibs/include/eb/defs.h
Normal file
1040
winlibs/include/eb/defs.h
Normal file
File diff suppressed because it is too large
Load diff
155
winlibs/include/eb/eb.h
Normal file
155
winlibs/include/eb/eb.h
Normal file
|
@ -0,0 +1,155 @@
|
|||
/* -*- C -*-
|
||||
* Copyright (c) 1997-2006 Motoyuki Kasahara
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the project nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef EB_EB_H
|
||||
#define EB_EB_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef EB_BUILD_LIBRARY
|
||||
#include "defs.h"
|
||||
#else
|
||||
#include <eb/defs.h>
|
||||
#endif
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
/*
|
||||
* Function declarations.
|
||||
*/
|
||||
/* book.c */
|
||||
void eb_initialize_book(EB_Book *book);
|
||||
EB_Error_Code eb_bind(EB_Book *book, const char *path);
|
||||
void eb_finalize_book(EB_Book *book);
|
||||
int eb_is_bound(EB_Book *book);
|
||||
EB_Error_Code eb_path(EB_Book *book, char *path);
|
||||
EB_Error_Code eb_disc_type(EB_Book *book, EB_Disc_Code *disc_code);
|
||||
EB_Error_Code eb_character_code(EB_Book *book,
|
||||
EB_Character_Code *character_code);
|
||||
|
||||
/* copyright.h */
|
||||
int eb_have_copyright(EB_Book *book);
|
||||
EB_Error_Code eb_copyright(EB_Book *book, EB_Position *position);
|
||||
EB_Error_Code eb_search_cross(EB_Book *book,
|
||||
const char * const input_words[]);
|
||||
|
||||
/* cross.c */
|
||||
int eb_have_cross_search(EB_Book *book);
|
||||
|
||||
/* eb.c */
|
||||
EB_Error_Code eb_initialize_library(void);
|
||||
void eb_finalize_library(void);
|
||||
|
||||
/* endword.c */
|
||||
int eb_have_endword_search(EB_Book *book);
|
||||
EB_Error_Code eb_search_endword(EB_Book *book, const char *input_word);
|
||||
|
||||
/* exactword.c */
|
||||
int eb_have_exactword_search(EB_Book *book);
|
||||
EB_Error_Code eb_search_exactword(EB_Book *book, const char *input_word);
|
||||
|
||||
/* graphic.c */
|
||||
int eb_have_graphic_search(EB_Book *book);
|
||||
|
||||
/* keyword.c */
|
||||
int eb_have_keyword_search(EB_Book *book);
|
||||
EB_Error_Code eb_search_keyword(EB_Book *book,
|
||||
const char * const input_words[]);
|
||||
|
||||
/* lock.c */
|
||||
int eb_pthread_enabled(void);
|
||||
|
||||
/* log.c */
|
||||
void eb_set_log_function(void (*function)(const char *message, va_list ap));
|
||||
void eb_enable_log(void);
|
||||
void eb_disable_log(void);
|
||||
void eb_log(const char *message, ...);
|
||||
void eb_log_stderr(const char *message, va_list ap);
|
||||
|
||||
/* menu.c */
|
||||
int eb_have_menu(EB_Book *book);
|
||||
EB_Error_Code eb_menu(EB_Book *book, EB_Position *position);
|
||||
int eb_have_image_menu(EB_Book *book);
|
||||
EB_Error_Code eb_image_menu(EB_Book *book, EB_Position *position);
|
||||
|
||||
/* multi.c */
|
||||
int eb_have_multi_search(EB_Book *book);
|
||||
EB_Error_Code eb_multi_title(EB_Book *book, EB_Multi_Search_Code multi_id,
|
||||
char *title);
|
||||
EB_Error_Code eb_multi_search_list(EB_Book *book,
|
||||
EB_Multi_Search_Code *search_list, int *search_count);
|
||||
EB_Error_Code eb_multi_entry_count(EB_Book *book,
|
||||
EB_Multi_Search_Code multi_id, int *entry_count);
|
||||
EB_Error_Code eb_multi_entry_list(EB_Book *book,
|
||||
EB_Multi_Search_Code multi_id, int *entry_list, int *entry_count);
|
||||
EB_Error_Code eb_multi_entry_label(EB_Book *book,
|
||||
EB_Multi_Search_Code multi_id, int entry_index, char *label);
|
||||
int eb_multi_entry_have_candidates(EB_Book *book,
|
||||
EB_Multi_Search_Code multi_id, int entry_index);
|
||||
EB_Error_Code eb_multi_entry_candidates(EB_Book *book,
|
||||
EB_Multi_Search_Code multi_id, int entry_index, EB_Position *position);
|
||||
EB_Error_Code eb_search_multi(EB_Book *book, EB_Multi_Search_Code multi_id,
|
||||
const char * const input_words[]);
|
||||
|
||||
/* text.c */
|
||||
int eb_have_text(EB_Book *book);
|
||||
EB_Error_Code eb_text(EB_Book *book, EB_Position *position);
|
||||
|
||||
/* search.c */
|
||||
EB_Error_Code eb_hit_list(EB_Book *book, int max_hit_count, EB_Hit *hit_list,
|
||||
int *hit_count);
|
||||
|
||||
/* subbook.c */
|
||||
EB_Error_Code eb_load_all_subbooks(EB_Book *book);
|
||||
EB_Error_Code eb_subbook_list(EB_Book *book, EB_Subbook_Code *subbook_list,
|
||||
int *subbook_count);
|
||||
EB_Error_Code eb_subbook(EB_Book *book, EB_Subbook_Code *subbook_code);
|
||||
EB_Error_Code eb_subbook_title(EB_Book *book, char *title);
|
||||
EB_Error_Code eb_subbook_title2(EB_Book *book, EB_Subbook_Code subbook_code,
|
||||
char *title);
|
||||
EB_Error_Code eb_subbook_directory(EB_Book *book, char *directory);
|
||||
EB_Error_Code eb_subbook_directory2(EB_Book *book,
|
||||
EB_Subbook_Code subbook_code, char *directory);
|
||||
EB_Error_Code eb_set_subbook(EB_Book *book, EB_Subbook_Code subbook_code);
|
||||
void eb_unset_subbook(EB_Book *book);
|
||||
|
||||
/* word.c */
|
||||
int eb_have_word_search(EB_Book *book);
|
||||
EB_Error_Code eb_search_word(EB_Book *book, const char *input_word);
|
||||
|
||||
/* for backward compatibility */
|
||||
#define eb_suspend eb_unset_subbook
|
||||
#define eb_initialize_all_subbooks eb_load_all_subbooks
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* not EB_EB_H */
|
150
winlibs/include/eb/error.h
Normal file
150
winlibs/include/eb/error.h
Normal file
|
@ -0,0 +1,150 @@
|
|||
/* -*- C -*-
|
||||
* Copyright (c) 1997-2006 Motoyuki Kasahara
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the project nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef EB_ERROR_H
|
||||
#define EB_ERROR_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef EB_BUILD_LIBRARY
|
||||
#include "defs.h"
|
||||
#else
|
||||
#include <eb/defs.h>
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Error codes.
|
||||
*/
|
||||
#define EB_SUCCESS 0
|
||||
#define EB_ERR_MEMORY_EXHAUSTED 1
|
||||
#define EB_ERR_EMPTY_FILE_NAME 2
|
||||
#define EB_ERR_TOO_LONG_FILE_NAME 3
|
||||
#define EB_ERR_BAD_FILE_NAME 4
|
||||
|
||||
#define EB_ERR_BAD_DIR_NAME 5
|
||||
#define EB_ERR_TOO_LONG_WORD 6
|
||||
#define EB_ERR_BAD_WORD 7
|
||||
#define EB_ERR_EMPTY_WORD 8
|
||||
#define EB_ERR_FAIL_GETCWD 9
|
||||
|
||||
#define EB_ERR_FAIL_OPEN_CAT 10
|
||||
#define EB_ERR_FAIL_OPEN_CATAPP 11
|
||||
#define EB_ERR_FAIL_OPEN_TEXT 12
|
||||
#define EB_ERR_FAIL_OPEN_FONT 13
|
||||
#define EB_ERR_FAIL_OPEN_APP 14
|
||||
|
||||
#define EB_ERR_FAIL_OPEN_BINARY 15
|
||||
#define EB_ERR_FAIL_READ_CAT 16
|
||||
#define EB_ERR_FAIL_READ_CATAPP 17
|
||||
#define EB_ERR_FAIL_READ_TEXT 18
|
||||
#define EB_ERR_FAIL_READ_FONT 19
|
||||
|
||||
#define EB_ERR_FAIL_READ_APP 20
|
||||
#define EB_ERR_FAIL_READ_BINARY 21
|
||||
#define EB_ERR_FAIL_SEEK_CAT 22
|
||||
#define EB_ERR_FAIL_SEEK_CATAPP 23
|
||||
#define EB_ERR_FAIL_SEEK_TEXT 24
|
||||
|
||||
#define EB_ERR_FAIL_SEEK_FONT 25
|
||||
#define EB_ERR_FAIL_SEEK_APP 26
|
||||
#define EB_ERR_FAIL_SEEK_BINARY 27
|
||||
#define EB_ERR_UNEXP_CAT 28
|
||||
#define EB_ERR_UNEXP_CATAPP 29
|
||||
|
||||
#define EB_ERR_UNEXP_TEXT 30
|
||||
#define EB_ERR_UNEXP_FONT 31
|
||||
#define EB_ERR_UNEXP_APP 32
|
||||
#define EB_ERR_UNEXP_BINARY 33
|
||||
#define EB_ERR_UNBOUND_BOOK 34
|
||||
|
||||
#define EB_ERR_UNBOUND_APP 35
|
||||
#define EB_ERR_NO_SUB 36
|
||||
#define EB_ERR_NO_APPSUB 37
|
||||
#define EB_ERR_NO_FONT 38
|
||||
#define EB_ERR_NO_TEXT 39
|
||||
|
||||
#define EB_ERR_NO_STOPCODE 40
|
||||
#define EB_ERR_NO_ALT 41
|
||||
#define EB_ERR_NO_CUR_SUB 42
|
||||
#define EB_ERR_NO_CUR_APPSUB 43
|
||||
#define EB_ERR_NO_CUR_FONT 44
|
||||
|
||||
#define EB_ERR_NO_CUR_BINARY 45
|
||||
#define EB_ERR_NO_SUCH_SUB 46
|
||||
#define EB_ERR_NO_SUCH_APPSUB 47
|
||||
#define EB_ERR_NO_SUCH_FONT 48
|
||||
#define EB_ERR_NO_SUCH_CHAR_BMP 49
|
||||
|
||||
#define EB_ERR_NO_SUCH_CHAR_TEXT 50
|
||||
#define EB_ERR_NO_SUCH_SEARCH 51
|
||||
#define EB_ERR_NO_SUCH_HOOK 52
|
||||
#define EB_ERR_NO_SUCH_BINARY 53
|
||||
#define EB_ERR_DIFF_CONTENT 54
|
||||
|
||||
#define EB_ERR_NO_PREV_SEARCH 55
|
||||
#define EB_ERR_NO_SUCH_MULTI_ID 56
|
||||
#define EB_ERR_NO_SUCH_ENTRY_ID 57
|
||||
#define EB_ERR_TOO_MANY_WORDS 58
|
||||
#define EB_ERR_NO_WORD 59
|
||||
|
||||
#define EB_ERR_NO_CANDIDATES 60
|
||||
#define EB_ERR_END_OF_CONTENT 61
|
||||
#define EB_ERR_NO_PREV_SEEK 62
|
||||
#define EB_ERR_EBNET_UNSUPPORTED 63
|
||||
#define EB_ERR_EBNET_FAIL_CONNECT 64
|
||||
|
||||
#define EB_ERR_EBNET_SERVER_BUSY 65
|
||||
#define EB_ERR_EBNET_NO_PERMISSION 66
|
||||
#define EB_ERR_UNBOUND_BOOKLIST 67
|
||||
#define EB_ERR_NO_SUCH_BOOK 68
|
||||
|
||||
|
||||
/*
|
||||
* The number of error codes.
|
||||
*/
|
||||
#define EB_NUMBER_OF_ERRORS 69
|
||||
|
||||
/*
|
||||
* The maximum length of an error message.
|
||||
*/
|
||||
#define EB_MAX_ERROR_MESSAGE_LENGTH 127
|
||||
|
||||
/*
|
||||
* Function declarations.
|
||||
*/
|
||||
/* error.c */
|
||||
const char *eb_error_string(EB_Error_Code error_code);
|
||||
const char *eb_error_message(EB_Error_Code error_code);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* not EB_ERROR_H */
|
200
winlibs/include/eb/font.h
Normal file
200
winlibs/include/eb/font.h
Normal file
|
@ -0,0 +1,200 @@
|
|||
/* -*- C -*-
|
||||
* Copyright (c) 1997-2006 Motoyuki Kasahara
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the project nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef EB_FONT_H
|
||||
#define EB_FONT_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#ifdef EB_BUILD_LIBRARY
|
||||
#include "defs.h"
|
||||
#else
|
||||
#include <eb/defs.h>
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Font types.
|
||||
*/
|
||||
#define EB_FONT_16 0
|
||||
#define EB_FONT_24 1
|
||||
#define EB_FONT_30 2
|
||||
#define EB_FONT_48 3
|
||||
#define EB_FONT_INVALID -1
|
||||
|
||||
/*
|
||||
* Font sizes.
|
||||
*/
|
||||
#define EB_SIZE_NARROW_FONT_16 16
|
||||
#define EB_SIZE_WIDE_FONT_16 32
|
||||
#define EB_SIZE_NARROW_FONT_24 48
|
||||
#define EB_SIZE_WIDE_FONT_24 72
|
||||
#define EB_SIZE_NARROW_FONT_30 60
|
||||
#define EB_SIZE_WIDE_FONT_30 120
|
||||
#define EB_SIZE_NARROW_FONT_48 144
|
||||
#define EB_SIZE_WIDE_FONT_48 288
|
||||
|
||||
/*
|
||||
* Font width.
|
||||
*/
|
||||
#define EB_WIDTH_NARROW_FONT_16 8
|
||||
#define EB_WIDTH_WIDE_FONT_16 16
|
||||
#define EB_WIDTH_NARROW_FONT_24 16
|
||||
#define EB_WIDTH_WIDE_FONT_24 24
|
||||
#define EB_WIDTH_NARROW_FONT_30 16
|
||||
#define EB_WIDTH_WIDE_FONT_30 32
|
||||
#define EB_WIDTH_NARROW_FONT_48 24
|
||||
#define EB_WIDTH_WIDE_FONT_48 48
|
||||
|
||||
/*
|
||||
* Font height.
|
||||
*/
|
||||
#define EB_HEIGHT_FONT_16 16
|
||||
#define EB_HEIGHT_FONT_24 24
|
||||
#define EB_HEIGHT_FONT_30 30
|
||||
#define EB_HEIGHT_FONT_48 48
|
||||
|
||||
/*
|
||||
* Bitmap image sizes.
|
||||
*/
|
||||
#define EB_SIZE_NARROW_FONT_16_XBM 184
|
||||
#define EB_SIZE_WIDE_FONT_16_XBM 284
|
||||
#define EB_SIZE_NARROW_FONT_16_XPM 266
|
||||
#define EB_SIZE_WIDE_FONT_16_XPM 395
|
||||
#define EB_SIZE_NARROW_FONT_16_GIF 186
|
||||
#define EB_SIZE_WIDE_FONT_16_GIF 314
|
||||
#define EB_SIZE_NARROW_FONT_16_BMP 126
|
||||
#define EB_SIZE_WIDE_FONT_16_BMP 126
|
||||
#define EB_SIZE_NARROW_FONT_16_PNG 131
|
||||
#define EB_SIZE_WIDE_FONT_16_PNG 147
|
||||
|
||||
#define EB_SIZE_NARROW_FONT_24_XBM 383
|
||||
#define EB_SIZE_WIDE_FONT_24_XBM 533
|
||||
#define EB_SIZE_NARROW_FONT_24_XPM 555
|
||||
#define EB_SIZE_WIDE_FONT_24_XPM 747
|
||||
#define EB_SIZE_NARROW_FONT_24_GIF 450
|
||||
#define EB_SIZE_WIDE_FONT_24_GIF 642
|
||||
#define EB_SIZE_NARROW_FONT_24_BMP 158
|
||||
#define EB_SIZE_WIDE_FONT_24_BMP 158
|
||||
#define EB_SIZE_NARROW_FONT_24_PNG 171
|
||||
#define EB_SIZE_WIDE_FONT_24_PNG 195
|
||||
|
||||
#define EB_SIZE_NARROW_FONT_30_XBM 458
|
||||
#define EB_SIZE_WIDE_FONT_30_XBM 833
|
||||
#define EB_SIZE_NARROW_FONT_30_XPM 675
|
||||
#define EB_SIZE_WIDE_FONT_30_XPM 1155
|
||||
#define EB_SIZE_NARROW_FONT_30_GIF 552
|
||||
#define EB_SIZE_WIDE_FONT_30_GIF 1032
|
||||
#define EB_SIZE_NARROW_FONT_30_BMP 182
|
||||
#define EB_SIZE_WIDE_FONT_30_BMP 182
|
||||
#define EB_SIZE_NARROW_FONT_30_PNG 189
|
||||
#define EB_SIZE_WIDE_FONT_30_PNG 249
|
||||
|
||||
#define EB_SIZE_NARROW_FONT_48_XBM 983
|
||||
#define EB_SIZE_WIDE_FONT_48_XBM 1883
|
||||
#define EB_SIZE_NARROW_FONT_48_XPM 1419
|
||||
#define EB_SIZE_WIDE_FONT_48_XPM 2571
|
||||
#define EB_SIZE_NARROW_FONT_48_GIF 1242
|
||||
#define EB_SIZE_WIDE_FONT_48_GIF 2394
|
||||
#define EB_SIZE_NARROW_FONT_48_BMP 254
|
||||
#define EB_SIZE_WIDE_FONT_48_BMP 446
|
||||
#define EB_SIZE_NARROW_FONT_48_PNG 291
|
||||
#define EB_SIZE_WIDE_FONT_48_PNG 435
|
||||
|
||||
#define EB_SIZE_FONT_IMAGE EB_SIZE_WIDE_FONT_48_XPM
|
||||
|
||||
/*
|
||||
* Function declarations.
|
||||
*/
|
||||
/* bitmap.c */
|
||||
EB_Error_Code eb_narrow_font_xbm_size(EB_Font_Code font_code, size_t *size);
|
||||
EB_Error_Code eb_narrow_font_xpm_size(EB_Font_Code font_code, size_t *size);
|
||||
EB_Error_Code eb_narrow_font_gif_size(EB_Font_Code font_code, size_t *size);
|
||||
EB_Error_Code eb_narrow_font_bmp_size(EB_Font_Code font_code, size_t *size);
|
||||
EB_Error_Code eb_narrow_font_png_size(EB_Font_Code font_code, size_t *size);
|
||||
EB_Error_Code eb_wide_font_xbm_size(EB_Font_Code font_code, size_t *size);
|
||||
EB_Error_Code eb_wide_font_xpm_size(EB_Font_Code font_code, size_t *size);
|
||||
EB_Error_Code eb_wide_font_gif_size(EB_Font_Code font_code, size_t *size);
|
||||
EB_Error_Code eb_wide_font_bmp_size(EB_Font_Code font_code, size_t *size);
|
||||
EB_Error_Code eb_wide_font_png_size(EB_Font_Code font_code, size_t *size);
|
||||
EB_Error_Code eb_bitmap_to_xbm(const char *bitmap, int width, int height,
|
||||
char *xbm, size_t *xbm_length);
|
||||
EB_Error_Code eb_bitmap_to_xpm(const char *bitmap, int width, int height,
|
||||
char *xpm, size_t *xpm_length);
|
||||
EB_Error_Code eb_bitmap_to_gif(const char *bitmap, int width, int height,
|
||||
char *gif, size_t *gif_length);
|
||||
EB_Error_Code eb_bitmap_to_bmp(const char *bitmap, int width, int height,
|
||||
char *bmp, size_t *bmp_length);
|
||||
EB_Error_Code eb_bitmap_to_png(const char *bitmap, int width, int height,
|
||||
char *png, size_t *png_length);
|
||||
|
||||
/* font.c */
|
||||
EB_Error_Code eb_font(EB_Book *book, EB_Font_Code *font_code);
|
||||
EB_Error_Code eb_set_font(EB_Book *book, EB_Font_Code font_code);
|
||||
void eb_unset_font(EB_Book *book);
|
||||
EB_Error_Code eb_font_list(EB_Book *book, EB_Font_Code *font_list,
|
||||
int *font_count);
|
||||
int eb_have_font(EB_Book *book, EB_Font_Code font_code);
|
||||
EB_Error_Code eb_font_height(EB_Book *book, int *height);
|
||||
EB_Error_Code eb_font_height2(EB_Font_Code font_code, int *height);
|
||||
|
||||
/* narwfont.c */
|
||||
int eb_have_narrow_font(EB_Book *book);
|
||||
EB_Error_Code eb_narrow_font_width(EB_Book *book, int *width);
|
||||
EB_Error_Code eb_narrow_font_width2(EB_Font_Code font_code, int *width);
|
||||
EB_Error_Code eb_narrow_font_size(EB_Book *book, size_t *size);
|
||||
EB_Error_Code eb_narrow_font_size2(EB_Font_Code font_code, size_t *size);
|
||||
EB_Error_Code eb_narrow_font_start(EB_Book *book, int *start);
|
||||
EB_Error_Code eb_narrow_font_end(EB_Book *book, int *end);
|
||||
EB_Error_Code eb_narrow_font_character_bitmap(EB_Book *book, int, char *);
|
||||
EB_Error_Code eb_forward_narrow_font_character(EB_Book *book, int, int *);
|
||||
EB_Error_Code eb_backward_narrow_font_character(EB_Book *book, int, int *);
|
||||
|
||||
/* widefont.c */
|
||||
int eb_have_wide_font(EB_Book *book);
|
||||
EB_Error_Code eb_wide_font_width(EB_Book *book, int *width);
|
||||
EB_Error_Code eb_wide_font_width2(EB_Font_Code font_code, int *width);
|
||||
EB_Error_Code eb_wide_font_size(EB_Book *book, size_t *size);
|
||||
EB_Error_Code eb_wide_font_size2(EB_Font_Code font_code, size_t *size);
|
||||
EB_Error_Code eb_wide_font_start(EB_Book *book, int *start);
|
||||
EB_Error_Code eb_wide_font_end(EB_Book *book, int *end);
|
||||
EB_Error_Code eb_wide_font_character_bitmap(EB_Book *book,
|
||||
int character_number, char *bitmap);
|
||||
EB_Error_Code eb_forward_wide_font_character(EB_Book *book, int n,
|
||||
int *character_number);
|
||||
EB_Error_Code eb_backward_wide_font_character(EB_Book *book, int n,
|
||||
int *character_number);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* not EB_FONT_H */
|
4
winlibs/include/eb/sysdefs.h
Normal file
4
winlibs/include/eb/sysdefs.h
Normal file
|
@ -0,0 +1,4 @@
|
|||
/* automatically generated by Makefile. */
|
||||
#define EB_VERSION_STRING "4.4.3"
|
||||
#define EB_VERSION_MAJOR 4
|
||||
#define EB_VERSION_MINOR 4
|
166
winlibs/include/eb/text.h
Normal file
166
winlibs/include/eb/text.h
Normal file
|
@ -0,0 +1,166 @@
|
|||
/* -*- C -*-
|
||||
* Copyright (c) 1997-2006 Motoyuki Kasahara
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the project nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef EB_TEXT_H
|
||||
#define EB_TEXT_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#ifdef EB_BUILD_LIBRARY
|
||||
#include "defs.h"
|
||||
#else
|
||||
#include <eb/defs.h>
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Hook codes.
|
||||
* (When you add or remove a hook, update EB_NUMER_OF_HOOKS in defs.h.)
|
||||
*/
|
||||
#define EB_HOOK_NULL -1
|
||||
#define EB_HOOK_INITIALIZE 0
|
||||
#define EB_HOOK_BEGIN_NARROW 1
|
||||
#define EB_HOOK_END_NARROW 2
|
||||
#define EB_HOOK_BEGIN_SUBSCRIPT 3
|
||||
#define EB_HOOK_END_SUBSCRIPT 4
|
||||
|
||||
#define EB_HOOK_SET_INDENT 5
|
||||
#define EB_HOOK_NEWLINE 6
|
||||
#define EB_HOOK_BEGIN_SUPERSCRIPT 7
|
||||
#define EB_HOOK_END_SUPERSCRIPT 8
|
||||
#define EB_HOOK_BEGIN_NO_NEWLINE 9
|
||||
|
||||
#define EB_HOOK_END_NO_NEWLINE 10
|
||||
#define EB_HOOK_BEGIN_EMPHASIS 11
|
||||
#define EB_HOOK_END_EMPHASIS 12
|
||||
#define EB_HOOK_BEGIN_CANDIDATE 13
|
||||
#define EB_HOOK_END_CANDIDATE_GROUP 14
|
||||
|
||||
#define EB_HOOK_END_CANDIDATE_LEAF 15
|
||||
#define EB_HOOK_BEGIN_REFERENCE 16
|
||||
#define EB_HOOK_END_REFERENCE 17
|
||||
#define EB_HOOK_BEGIN_KEYWORD 18
|
||||
#define EB_HOOK_END_KEYWORD 19
|
||||
|
||||
#define EB_HOOK_NARROW_FONT 20
|
||||
#define EB_HOOK_WIDE_FONT 21
|
||||
#define EB_HOOK_ISO8859_1 22
|
||||
#define EB_HOOK_NARROW_JISX0208 23
|
||||
#define EB_HOOK_WIDE_JISX0208 24
|
||||
|
||||
#define EB_HOOK_GB2312 25
|
||||
#define EB_HOOK_BEGIN_MONO_GRAPHIC 26
|
||||
#define EB_HOOK_END_MONO_GRAPHIC 27
|
||||
#define EB_HOOK_BEGIN_GRAY_GRAPHIC 28
|
||||
#define EB_HOOK_END_GRAY_GRAPHIC 29
|
||||
|
||||
#define EB_HOOK_BEGIN_COLOR_BMP 30
|
||||
#define EB_HOOK_BEGIN_COLOR_JPEG 31
|
||||
#define EB_HOOK_BEGIN_IN_COLOR_BMP 32
|
||||
#define EB_HOOK_BEGIN_IN_COLOR_JPEG 33
|
||||
#define EB_HOOK_END_COLOR_GRAPHIC 34
|
||||
|
||||
#define EB_HOOK_END_IN_COLOR_GRAPHIC 35
|
||||
#define EB_HOOK_BEGIN_WAVE 36
|
||||
#define EB_HOOK_END_WAVE 37
|
||||
#define EB_HOOK_BEGIN_MPEG 38
|
||||
#define EB_HOOK_END_MPEG 39
|
||||
|
||||
#define EB_HOOK_BEGIN_GRAPHIC_REFERENCE 40
|
||||
#define EB_HOOK_END_GRAPHIC_REFERENCE 41
|
||||
#define EB_HOOK_GRAPHIC_REFERENCE 42
|
||||
#define EB_HOOK_BEGIN_DECORATION 43
|
||||
#define EB_HOOK_END_DECORATION 44
|
||||
|
||||
#define EB_HOOK_BEGIN_IMAGE_PAGE 45
|
||||
#define EB_HOOK_END_IMAGE_PAGE 46
|
||||
#define EB_HOOK_BEGIN_CLICKABLE_AREA 47
|
||||
#define EB_HOOK_END_CLICKABLE_AREA 48
|
||||
|
||||
#define EB_HOOK_BEGIN_UNICODE 49
|
||||
#define EB_HOOK_END_UNICODE 50
|
||||
#define EB_HOOK_BEGIN_EBXAC_GAIJI 51
|
||||
#define EB_HOOK_END_EBXAC_GAIJI 52
|
||||
#define EB_HOOK_EBXAC_GAIJI 53
|
||||
|
||||
/*
|
||||
* Function declarations.
|
||||
*/
|
||||
/* hook.c */
|
||||
void eb_initialize_hookset(EB_Hookset *hookset);
|
||||
void eb_finalize_hookset(EB_Hookset *hookset);
|
||||
EB_Error_Code eb_set_hook(EB_Hookset *hookset, const EB_Hook *hook);
|
||||
EB_Error_Code eb_set_hooks(EB_Hookset *hookset, const EB_Hook *hook);
|
||||
EB_Error_Code eb_hook_euc_to_ascii(EB_Book *book, EB_Appendix *appendix,
|
||||
void *container, EB_Hook_Code hook_code, int argc,
|
||||
const unsigned int *argv);
|
||||
EB_Error_Code eb_hook_stop_code(EB_Book *book, EB_Appendix *appendix,
|
||||
void *container, EB_Hook_Code hook_code, int argc,
|
||||
const unsigned int *argv);
|
||||
EB_Error_Code eb_hook_narrow_character_text(EB_Book *book,
|
||||
EB_Appendix *appendix, void *container, EB_Hook_Code hook_code, int argc,
|
||||
const unsigned int *argv);
|
||||
EB_Error_Code eb_hook_wide_character_text(EB_Book *book,
|
||||
EB_Appendix *appendix, void *container, EB_Hook_Code hook_code, int argc,
|
||||
const unsigned int *argv);
|
||||
EB_Error_Code eb_hook_newline(EB_Book *book, EB_Appendix *appendix,
|
||||
void *container, EB_Hook_Code hook_code, int argc,
|
||||
const unsigned int *argv);
|
||||
EB_Error_Code eb_hook_empty(EB_Book *book, EB_Appendix *appendix,
|
||||
void *container, EB_Hook_Code hook_code, int argc,
|
||||
const unsigned int *argv);
|
||||
|
||||
/* readtext.c */
|
||||
EB_Error_Code eb_seek_text(EB_Book *book, const EB_Position *position);
|
||||
EB_Error_Code eb_tell_text(EB_Book *book, EB_Position *position);
|
||||
EB_Error_Code eb_read_text(EB_Book *book, EB_Appendix *appendix,
|
||||
EB_Hookset *hookset, void *container, size_t text_max_length, char *text,
|
||||
ssize_t *text_length);
|
||||
EB_Error_Code eb_read_heading(EB_Book *book, EB_Appendix *appendix,
|
||||
EB_Hookset *hookset, void *container, size_t text_max_length, char *text,
|
||||
ssize_t *text_length);
|
||||
EB_Error_Code eb_read_rawtext(EB_Book *book, size_t text_max_length,
|
||||
char *text, ssize_t *text_length);
|
||||
int eb_is_text_stopped(EB_Book *book);
|
||||
EB_Error_Code eb_write_text_byte1(EB_Book *book, int byte1);
|
||||
EB_Error_Code eb_write_text_byte2(EB_Book *book, int byte1, int byte2);
|
||||
EB_Error_Code eb_write_text_string(EB_Book *book, const char *string);
|
||||
EB_Error_Code eb_write_text(EB_Book *book, const char * stream,
|
||||
size_t stream_length);
|
||||
const char *eb_current_candidate(EB_Book *book);
|
||||
EB_Error_Code eb_forward_text(EB_Book *book, EB_Appendix *appendix);
|
||||
EB_Error_Code eb_backward_text(EB_Book *book, EB_Appendix *appendix);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* not EB_TEXT_H */
|
237
winlibs/include/eb/zio.h
Normal file
237
winlibs/include/eb/zio.h
Normal file
|
@ -0,0 +1,237 @@
|
|||
/* -*- C -*-
|
||||
* Copyright (c) 2001-2006 Motoyuki Kasahara
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the project nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef ZIO_H
|
||||
#define ZIO_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <time.h>
|
||||
|
||||
/*
|
||||
* Header size of the ebzip compression file.
|
||||
*/
|
||||
#define ZIO_SIZE_EBZIP_HEADER 22
|
||||
|
||||
/*
|
||||
* Margin size for ebzip compression buffer.
|
||||
* (Since compressed data is larger than original in the worst case,
|
||||
* we must add margin to a compression buffer.)
|
||||
*/
|
||||
#define ZIO_SIZE_EBZIP_MARGIN 1024
|
||||
|
||||
/*
|
||||
* Maximum ebzio compression level.
|
||||
*/
|
||||
#define ZIO_MAX_EBZIP_LEVEL 5
|
||||
|
||||
/*
|
||||
* Huffman node types.
|
||||
*/
|
||||
#define ZIO_HUFFMAN_NODE_INTERMEDIATE 0
|
||||
#define ZIO_HUFFMAN_NODE_EOF 1
|
||||
#define ZIO_HUFFMAN_NODE_LEAF8 2
|
||||
#define ZIO_HUFFMAN_NODE_LEAF16 3
|
||||
#define ZIO_HUFFMAN_NODE_LEAF32 4
|
||||
|
||||
/*
|
||||
* Compression type codes.
|
||||
*/
|
||||
#define ZIO_PLAIN 0
|
||||
#define ZIO_EBZIP1 1
|
||||
#define ZIO_EPWING 2
|
||||
#define ZIO_EPWING6 3
|
||||
#define ZIO_SEBXA 4
|
||||
#define ZIO_INVALID -1
|
||||
#define ZIO_REOPEN -2
|
||||
|
||||
/*
|
||||
* Compression type.
|
||||
*/
|
||||
typedef int Zio_Code;
|
||||
|
||||
/*
|
||||
* A node of static Huffman tree.
|
||||
*/
|
||||
typedef struct Zio_Huffman_Node_Struct Zio_Huffman_Node;
|
||||
|
||||
struct Zio_Huffman_Node_Struct {
|
||||
/*
|
||||
* node type (ITNERMEDIATE, LEAF8, LEAF16, LEAF32 or EOF).
|
||||
*/
|
||||
int type;
|
||||
|
||||
/*
|
||||
* Value of a leaf node.
|
||||
*/
|
||||
unsigned int value;
|
||||
|
||||
/*
|
||||
* Frequency of a node.
|
||||
*/
|
||||
int frequency;
|
||||
|
||||
/*
|
||||
* Left child.
|
||||
*/
|
||||
Zio_Huffman_Node *left;
|
||||
|
||||
/*
|
||||
* Right child.
|
||||
*/
|
||||
Zio_Huffman_Node *right;
|
||||
};
|
||||
|
||||
/*
|
||||
* Compression information of a book.
|
||||
*/
|
||||
typedef struct Zio_Struct Zio;
|
||||
|
||||
struct Zio_Struct {
|
||||
/*
|
||||
* ID.
|
||||
*/
|
||||
int id;
|
||||
|
||||
/*
|
||||
* Zio type. (PLAIN, EBZIP, EPWING, EPWING6 or SEBXA)
|
||||
*/
|
||||
Zio_Code code;
|
||||
|
||||
/*
|
||||
* File descriptor.
|
||||
*/
|
||||
int file;
|
||||
|
||||
/*
|
||||
* Current location.
|
||||
*/
|
||||
off_t location;
|
||||
|
||||
/*
|
||||
* Size of an uncompressed file.
|
||||
*/
|
||||
off_t file_size;
|
||||
|
||||
/*
|
||||
* Slice size of an EBZIP compressed file.
|
||||
*/
|
||||
size_t slice_size;
|
||||
|
||||
/*
|
||||
* Compression level. (EBZIP compression only)
|
||||
*/
|
||||
int zip_level;
|
||||
|
||||
/*
|
||||
* Length of an index. (EBZIP compression only)
|
||||
*/
|
||||
int index_width;
|
||||
|
||||
/*
|
||||
* Adler-32 check sum of an uncompressed file. (EBZIP compression only)
|
||||
*/
|
||||
unsigned int crc;
|
||||
|
||||
/*
|
||||
* mtime of an uncompressed file. (EBZIP compression only)
|
||||
*/
|
||||
time_t mtime;
|
||||
|
||||
/*
|
||||
* Location of an index table. (EPWING and S-EBXA compression only)
|
||||
*/
|
||||
off_t index_location;
|
||||
|
||||
/*
|
||||
* Length of an index table. (EPWING and S-EBXA compression only)
|
||||
*/
|
||||
size_t index_length;
|
||||
|
||||
/*
|
||||
* Location of a frequency table. (EPWING compression only)
|
||||
*/
|
||||
off_t frequencies_location;
|
||||
|
||||
/*
|
||||
* Length of a frequency table. (EPWING compression only)
|
||||
*/
|
||||
size_t frequencies_length;
|
||||
|
||||
/*
|
||||
* Huffman tree nodes. (EPWING compression only)
|
||||
*/
|
||||
Zio_Huffman_Node *huffman_nodes;
|
||||
|
||||
/*
|
||||
* Root node of a Huffman tree. (EPWING compression only)
|
||||
*/
|
||||
Zio_Huffman_Node *huffman_root;
|
||||
|
||||
/*
|
||||
* Region of compressed pages. (S-EBXA compression only)
|
||||
*/
|
||||
off_t zio_start_location;
|
||||
off_t zio_end_location;
|
||||
|
||||
/*
|
||||
* Add this value to offset written in index. (S-EBXA compression only)
|
||||
*/
|
||||
off_t index_base;
|
||||
|
||||
/*
|
||||
* ebnet mode flag.
|
||||
*/
|
||||
int is_ebnet;
|
||||
};
|
||||
|
||||
/*
|
||||
* Function declarations.
|
||||
*/
|
||||
/* zio.c */
|
||||
int zio_initialize_library(void);
|
||||
void zio_finalize_library(void);
|
||||
void zio_initialize(Zio *zio);
|
||||
void zio_finalize(Zio *zio);
|
||||
int zio_set_sebxa_mode(Zio *zio, off_t index_location, off_t index_base,
|
||||
off_t zio_start_location, off_t zio_end_location);
|
||||
int zio_open(Zio *zio, const char *file_name, Zio_Code zio_code);
|
||||
void zio_close(Zio *zio);
|
||||
int zio_file(Zio *zio);
|
||||
Zio_Code zio_mode(Zio *zio);
|
||||
off_t zio_lseek(Zio *zio, off_t offset, int whence);
|
||||
ssize_t zio_read(Zio *zio, char *buffer, size_t length);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* not ZIO_H */
|
BIN
winlibs/lib/libeb-16.dll
Normal file
BIN
winlibs/lib/libeb-16.dll
Normal file
Binary file not shown.
BIN
winlibs/lib/libeb.dll.a
Normal file
BIN
winlibs/lib/libeb.dll.a
Normal file
Binary file not shown.
Loading…
Reference in a new issue