Skip to content

Commit

Permalink
Added SpellCheck plugin to OSX
Browse files Browse the repository at this point in the history
  • Loading branch information
eranif committed Jun 8, 2014
1 parent 1403d44 commit afbd469
Show file tree
Hide file tree
Showing 19 changed files with 1,435 additions and 1 deletion.
16 changes: 16 additions & 0 deletions Runtime/make_mac_bundle.sh
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,22 @@ cp ../lib/ZoomNavigator.dylib ./codelite.app/Contents/SharedSupport/plugins/
cp ../lib/SFTP.dylib ./codelite.app/Contents/SharedSupport/plugins/
cp ../lib/CMakePlugin.dylib ./codelite.app/Contents/SharedSupport/plugins/
cp ../lib/CodeLiteDiff.dylib ./codelite.app/Contents/SharedSupport/plugins/
cp ../lib/SpellCheck.dylib ./codelite.app/Contents/SharedSupport/plugins/

## Copy hunspell dylib to its proper location
echo cp ../../sdk/hunspell/lib/osx/libhunspell-1.3.dylib ./codelite.app/Contents/SharedSupport/
cp ../../sdk/hunspell/lib/osx/libhunspell-1.3.dylib ./codelite.app/Contents/SharedSupport/

## Fix hunspell dylib
hunspell_dylib_orig_path=`otool -L ./codelite.app/Contents/SharedSupport/plugins/SpellCheck.dylib |grep hunspell|awk '{print $1}'`
if [ ! -z ${hunspell_dylib_orig_path} ]; then
echo install_name_tool -change ${hunspell_dylib_orig_path} @executable_path/../SharedSupport/libhunspell-1.3.dylib ./codelite.app/Contents/SharedSupport/plugins/SpellCheck.dylib
install_name_tool -change ${hunspell_dylib_orig_path} @executable_path/../SharedSupport/libhunspell-1.3.dylib ./codelite.app/Contents/SharedSupport/plugins/SpellCheck.dylib
fi

## Copy hunspell default dictionaries
mkdir -p ./codelite.app/Contents/SharedSupport/dics
cp ../../SpellChecker/dics/* ./codelite.app/Contents/SharedSupport/dics

## Fix LLDB
echo "Installing LLDBDebugger..."
Expand Down
7 changes: 6 additions & 1 deletion SpellChecker/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,17 @@ find_path( HUNSPELL_H
NAMES hunspell.h
HINTS /usr/include /usr/local/include /usr/include/hunspell /usr/local/include/hunspell)

if ( LIBHUNSPELL STREQUAL "LIBHUNSPELL-NOTFOUND" OR HUNSPELL_H STREQUAL "HUNSPELL_H-NOTFOUND" )
if ( (LIBHUNSPELL STREQUAL "LIBHUNSPELL-NOTFOUND" OR HUNSPELL_H STREQUAL "HUNSPELL_H-NOTFOUND") AND NOT APPLE )
message(" **")
message(" ** NOTICE ** Could not locate libhunspell. SpellChecker plugin will not be build")
message(" ** NOTICE ** Try installing libhunspell-dev package")
message(" **")
else ()
if ( APPLE)
set(LIBHUNSPELL ${CL_SRC_ROOT}/sdk/hunspell/lib/osx/libhunspell-1.3.dylib)
set(HUNSPELL_H ${CL_SRC_ROOT}/sdk/hunspell/include/)
endif()

# set the plugin name here
set( PLUGIN_NAME "SpellCheck")
message("-- Found libhunspell: ${LIBHUNSPELL}, ${HUNSPELL_H}")
Expand Down
144 changes: 144 additions & 0 deletions sdk/hunspell/include/affentry.hxx
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
#ifndef _AFFIX_HXX_
#define _AFFIX_HXX_

#include "hunvisapi.h"

#include "atypes.hxx"
#include "baseaffix.hxx"
#include "affixmgr.hxx"

/* A Prefix Entry */

class LIBHUNSPELL_DLL_EXPORTED PfxEntry : protected AffEntry
{
private:
PfxEntry(const PfxEntry&);
PfxEntry& operator = (const PfxEntry&);
private:
AffixMgr* pmyMgr;

PfxEntry * next;
PfxEntry * nexteq;
PfxEntry * nextne;
PfxEntry * flgnxt;

public:

PfxEntry(AffixMgr* pmgr, affentry* dp );
~PfxEntry();

inline bool allowCross() { return ((opts & aeXPRODUCT) != 0); }
struct hentry * checkword(const char * word, int len, char in_compound,
const FLAG needflag = FLAG_NULL);

struct hentry * check_twosfx(const char * word, int len, char in_compound, const FLAG needflag = NULL);

char * check_morph(const char * word, int len, char in_compound,
const FLAG needflag = FLAG_NULL);

char * check_twosfx_morph(const char * word, int len,
char in_compound, const FLAG needflag = FLAG_NULL);

inline FLAG getFlag() { return aflag; }
inline const char * getKey() { return appnd; }
char * add(const char * word, int len);

inline short getKeyLen() { return appndl; }

inline const char * getMorph() { return morphcode; }

inline const unsigned short * getCont() { return contclass; }
inline short getContLen() { return contclasslen; }

inline PfxEntry * getNext() { return next; }
inline PfxEntry * getNextNE() { return nextne; }
inline PfxEntry * getNextEQ() { return nexteq; }
inline PfxEntry * getFlgNxt() { return flgnxt; }

inline void setNext(PfxEntry * ptr) { next = ptr; }
inline void setNextNE(PfxEntry * ptr) { nextne = ptr; }
inline void setNextEQ(PfxEntry * ptr) { nexteq = ptr; }
inline void setFlgNxt(PfxEntry * ptr) { flgnxt = ptr; }

inline char * nextchar(char * p);
inline int test_condition(const char * st);
};




/* A Suffix Entry */

class LIBHUNSPELL_DLL_EXPORTED SfxEntry : protected AffEntry
{
private:
SfxEntry(const SfxEntry&);
SfxEntry& operator = (const SfxEntry&);
private:
AffixMgr* pmyMgr;
char * rappnd;

SfxEntry * next;
SfxEntry * nexteq;
SfxEntry * nextne;
SfxEntry * flgnxt;

SfxEntry * l_morph;
SfxEntry * r_morph;
SfxEntry * eq_morph;

public:

SfxEntry(AffixMgr* pmgr, affentry* dp );
~SfxEntry();

inline bool allowCross() { return ((opts & aeXPRODUCT) != 0); }
struct hentry * checkword(const char * word, int len, int optflags,
PfxEntry* ppfx, char ** wlst, int maxSug, int * ns,
// const FLAG cclass = FLAG_NULL, const FLAG needflag = FLAG_NULL, char in_compound=IN_CPD_NOT);
const FLAG cclass = FLAG_NULL, const FLAG needflag = FLAG_NULL, const FLAG badflag = 0);

struct hentry * check_twosfx(const char * word, int len, int optflags, PfxEntry* ppfx, const FLAG needflag = NULL);

char * check_twosfx_morph(const char * word, int len, int optflags,
PfxEntry* ppfx, const FLAG needflag = FLAG_NULL);
struct hentry * get_next_homonym(struct hentry * he);
struct hentry * get_next_homonym(struct hentry * word, int optflags, PfxEntry* ppfx,
const FLAG cclass, const FLAG needflag);


inline FLAG getFlag() { return aflag; }
inline const char * getKey() { return rappnd; }
char * add(const char * word, int len);


inline const char * getMorph() { return morphcode; }

inline const unsigned short * getCont() { return contclass; }
inline short getContLen() { return contclasslen; }
inline const char * getAffix() { return appnd; }

inline short getKeyLen() { return appndl; }

inline SfxEntry * getNext() { return next; }
inline SfxEntry * getNextNE() { return nextne; }
inline SfxEntry * getNextEQ() { return nexteq; }

inline SfxEntry * getLM() { return l_morph; }
inline SfxEntry * getRM() { return r_morph; }
inline SfxEntry * getEQM() { return eq_morph; }
inline SfxEntry * getFlgNxt() { return flgnxt; }

inline void setNext(SfxEntry * ptr) { next = ptr; }
inline void setNextNE(SfxEntry * ptr) { nextne = ptr; }
inline void setNextEQ(SfxEntry * ptr) { nexteq = ptr; }
inline void setFlgNxt(SfxEntry * ptr) { flgnxt = ptr; }

inline char * nextchar(char * p);
inline int test_condition(const char * st, const char * begin);

};

#endif


Loading

0 comments on commit afbd469

Please sign in to comment.