Re: how can I commit the enchant code?

From: Kathiravelu Pradeeban <kk.pradeeban_at_gmail.com>
Date: Fri May 27 2011 - 20:21:55 CEST

Hi Chen,

On Fri, May 27, 2011 at 9:33 PM, chenxiajian1985
<chenxiajian1985@gmail.com> wrote:
> Hi, I have wrote some code about implementation of hyphenation in enchant level
> but I dont think that I have the commit right of enchant source code
>
> the enchant in libabiword is just an library provided in abiword2\msvc2008\Prefix\lib\enchant;

You can find the source code of enchant in its trunk
http://svn.abisource.com/enchant/trunk/

> but I need to change the code in enchant source..

Pls send the changes as patches to this list. I am pretty sure they
will get into the trunk of enchant, if they are going to improve
enchant as a whole. Pls also go through my reply to your other mail.

Have a great day!
Regards,
Pradeeban.

>
>
> chen xiajian
>
>
>
> 发件人: Kathiravelu Pradeeban
> 发送时间: 2011-05-18 23:55:45
> 收件人: abiword-dev
> 抄送: chenxiajian1985
> 主题: Re: chenxiajian1985 - r29747 - abiword/branches/gsoc2011hyphenation/src/af/xap/xp
>
> Hi Chen,
> Congratulations on your work on hyphenation.
> A typo in the class name 'HyphentorManager'. HyphentorManager should
> better be named as HyphenationManager. Pls check for the typos in the
> code, and fix the mistyped words like Hypenator. *Hyphenation* is
> relatively a complex word with a high possibility of typos. Running a
> spell checker on the code would help eliminate wasting some time on
> finding issues that may occur due to the mistyped words. Also make
> sure to be consistent in using the chosen words.
> Thank you.
> Regards,
> Pradeeban.
> On Thu, May 12, 2011 at 12:30 PM, <cvs@abisource.com> wrote:
>>
>> Author: chenxiajian1985
>> Date: 2011-05-12 09:00:48 +0200 (Thu, 12 May 2011)
>> New Revision: 29747
>>
>> Added:
>> abiword/branches/gsoc2011hyphenation/src/af/xap/xp/enchant_hyphenator.cpp
>> abiword/branches/gsoc2011hyphenation/src/af/xap/xp/enchant_hyphenator.h
>> abiword/branches/gsoc2011hyphenation/src/af/xap/xp/hyphenate_manager.cpp
>> abiword/branches/gsoc2011hyphenation/src/af/xap/xp/hyphenate_manager.h
>> Log:
>> add some simple code following the spellchecker. build the hyphenation low level code
>>
>> Added: abiword/branches/gsoc2011hyphenation/src/af/xap/xp/enchant_hyphenator.cpp
>> ===================================================================
>> --- abiword/branches/gsoc2011hyphenation/src/af/xap/xp/enchant_hyphenator.cpp (rev 0)
>> +++ abiword/branches/gsoc2011hyphenation/src/af/xap/xp/enchant_hyphenator.cpp 2011-05-12 07:00:48 UTC (rev 29747)
>> @@ -0,0 +1,55 @@
>> +/* AbiSuite
>> + * Copyright (C) 2003 Dom Lachowicz
>> + *
>> + * This program is free software; you can redistribute it and/or
>> + * modify it under the terms of the GNU General Public License
>> + * as published by the Free Software Foundation; either version 2
>> + * of the License, or (at your option) any later version.
>> + *
>> + * This program is distributed in the hope that it will be useful,
>> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
>> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
>> + * GNU General Public License for more details.
>> + *
>> + * You should have received a copy of the GNU General Public License
>> + * along with this program; if not, write to the Free Software
>> + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
>> + * 02111-1307, USA.
>> + */
>> +
>> +#include <stdio.h>
>> +#include <stdlib.h>
>> +#include <string.h>
>> +
>> +#include "xap_App.h"
>> +#include "xap_Frame.h"
>> +#include "xap_Strings.h"
>> +#include "enchant_hyphenator.h"
>> +#include "ut_string.h"
>> +#include "ut_string_class.h"
>> +#include "ut_assert.h"
>> +#include "ut_debugmsg.h"
>> +
>> +/*!
>> + * Convert a UTF-8 string to a UTF-32 string
>> + *
>> + * \param word8 The zero-terminated input string in UTF-8 format
>> + * \return A zero-terminated UTF-32 string
>> + */
>> +static UT_UCS4Char *
>> +utf8_to_utf32(const char *word8)
>> +{
>> + UT_UCS4Char * ucs4 = 0;
>> + UT_UCS4_cloneString (&ucs4, UT_UCS4String (word8).ucs4_str());
>> + return ucs4;
>> +}
>> +
>> +EnchantHypenator::EnchantHypenator()
>> +{
>> +
>> +}
>> +
>> +EnchantHypenator::~EnchantHypenator()
>> +{
>> +
>> +}
>>
>> Added: abiword/branches/gsoc2011hyphenation/src/af/xap/xp/enchant_hyphenator.h
>> ===================================================================
>> --- abiword/branches/gsoc2011hyphenation/src/af/xap/xp/enchant_hyphenator.h (rev 0)
>> +++ abiword/branches/gsoc2011hyphenation/src/af/xap/xp/enchant_hyphenator.h 2011-05-12 07:00:48 UTC (rev 29747)
>> @@ -0,0 +1,49 @@
>> +/* AbiSuite
>> + * Copyright (C) 2003 ChenXiajian
>> + *
>> + * This program is free software; you can redistribute it and/or
>> + * modify it under the terms of the GNU General Public License
>> + * as published by the Free Software Foundation; either version 2
>> + * of the License, or (at your option) any later version.
>> + *
>> + * This program is distributed in the hope that it will be useful,
>> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
>> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
>> + * GNU General Public License for more details.
>> + *
>> + * You should have received a copy of the GNU General Public License
>> + * along with this program; if not, write to the Free Software
>> + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
>> + * 02111-1307, USA.
>> + */
>> +
>> +#ifndef ENCHANT_HYPENATOR_H
>> +#define ENCHANT_HYPENATOR_H
>> +
>> +#include "hyphenate_manager.h"
>> +#ifdef _MSC_VER
>> +typedef long ssize_t;
>> +#endif
>> +#include <enchant.h>
>> +
>> +class ABI_EXPORT EnchantHypenator : public Hyphenator
>> +{
>> + friend class HypenatorManager;
>> +
>> +public:
>> +
>> + virtual ~EnchantHypenator();
>> + virtual bool addToCustomDict (const UT_UCSChar *word, size_t len){return true;}
>> +
>> +
>> +protected:
>> +
>> + EnchantHypenator();
>> +
>> +private:
>> +
>> + bool _requestDictionary (const char * szLang){return true;}
>> + EnchantDict *m_dict;
>> +};
>> +
>> +#endif
>>
>> Added: abiword/branches/gsoc2011hyphenation/src/af/xap/xp/hyphenate_manager.cpp
>> ===================================================================
>> --- abiword/branches/gsoc2011hyphenation/src/af/xap/xp/hyphenate_manager.cpp (rev 0)
>> +++ abiword/branches/gsoc2011hyphenation/src/af/xap/xp/hyphenate_manager.cpp 2011-05-12 07:00:48 UTC (rev 29747)
>> @@ -0,0 +1,53 @@
>> +/* AbiSuite
>> + * Copyright (C) 2001 ChenXiajian <chenxiajian1985@gmail.com>
>> + *
>> + * This program is free software; you can redistribute it and/or
>> + * modify it under the terms of the GNU General Public License
>> + * as published by the Free Software Foundation; either version 2
>> + * of the License, or (at your option) any later version.
>> + *
>> + * This program is distributed in the hope that it will be useful,
>> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
>> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
>> + * GNU General Public License for more details.
>> + *
>> + * You should have received a copy of the GNU General Public License
>> + * along with this program; if not, write to the Free Software
>> + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
>> + * 02111-1307, USA.
>> + */
>> +
>> +#ifdef HAVE_CONFIG_H
>> +#include "config.h"
>> +#endif
>> +
>> +#include "xap_App.h"
>> +#include "xap_Frame.h"
>> +#include "xap_Strings.h"
>> +#include "spell_manager.h"
>> +#include "ut_debugmsg.h"
>> +#include "ut_Language.h"
>> +
>> +#ifdef WITH_ENCHANT
>> +#include "enchant_hyphenator.h"
>> +typedef EnchantHypenator SpellCheckerClass;
>> +#else
>> +#include "ispell_checker.h"
>> +typedef ISpellChecker SpellCheckerClass;
>> +#endif
>> +
>> +/*!
>> + * Abstract constructor
>> + */
>> +/* protected */ Hyphenator::Hyphenator ()
>> +{
>> + // not used, abstract base class
>> +}
>> +
>> +/*!
>> + * Abstract destructor
>> + */
>> +/* protected */ Hyphenator::~Hyphenator ()
>> +{
>> + // not used, abstract base class
>> +}
>> \ No newline at end of file
>>
>> Added: abiword/branches/gsoc2011hyphenation/src/af/xap/xp/hyphenate_manager.h
>> ===================================================================
>> --- abiword/branches/gsoc2011hyphenation/src/af/xap/xp/hyphenate_manager.h (rev 0)
>> +++ abiword/branches/gsoc2011hyphenation/src/af/xap/xp/hyphenate_manager.h 2011-05-12 07:00:48 UTC (rev 29747)
>> @@ -0,0 +1,126 @@
>> +/* AbiSuite
>> + * Copyright (C) 2001 chenxiajian <chenxiajian1985@gmail.com>
>> + *
>> + * This program is free software; you can redistribute it and/or
>> + * modify it under the terms of the GNU General Public License
>> + * as published by the Free Software Foundation; either version 2
>> + * of the License, or (at your option) any later version.
>> + *
>> + * This program is distributed in the hope that it will be useful,
>> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
>> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
>> + * GNU General Public License for more details.
>> + *
>> + * You should have received a copy of the GNU General Public License
>> + * along with this program; if not, write to the Free Software
>> + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
>> + * 02111-1307, USA.
>> + */
>> +
>> +#ifndef HYPHENATE_MANAGER_H
>> +#define HYPHENATE_MANAGER_H
>> +
>> +/* pre-emptive dismissal; ut_types.h is needed by just about everything,
>> + * so even if it's commented out in-file that's still a lot of work for
>> + * the preprocessor to do...
>> + */
>> +#ifndef UT_TYPES_H
>> +#include "ut_types.h"
>> +#endif
>> +#include "ut_string_class.h"
>> +#include "ut_vector.h"
>> +#include "ut_hash.h"
>> +#include "barbarisms.h"
>> +
>> +// forward declaration
>> +class HyphentorManager;
>> +
>> +//struct DictionaryMapping
>> +//{
>> +// UT_String lang; // the language tag
>> +// UT_String dict; // the dictionary for the tag
>> +// UT_String enc; // the encoding of the dictionary
>> +//};
>> +
>> +
>> +
>> +class ABI_EXPORT Hyphenator
>> +{
>> + friend class HyphentorManager;
>> +public:
>> + enum HyphenatorResult
>> + {
>> + Hyphenator_SUCCEEDED = 0, // looking up the word succeeded
>> + Hyphenator_FAILED = 1, // could not find the word
>> + Hyphenator_ERROR = 2 // internal error
>> + };
>> +
>> +protected:
>> + Hyphenator();
>> +
>> + virtual ~Hyphenator();
>> +
>> + void setLanguage (const char * lang)
>> + {
>> + m_sLanguage = lang;
>> + }
>> +
>> + HyphenatorResult checkWord(const UT_UCSChar* word, size_t len);
>> + const UT_String& getLanguage () const
>> + {
>> + return m_sLanguage;
>> + }
>> +
>> + bool requestDictionary (const char * szLang);
>> + bool isDictionaryFound(void)
>> + { return m_bFoundDictionary;}
>> + void setDictionaryFound(bool b)
>> + { m_bFoundDictionary = b;}
>> +
>> +
>> + static void couldNotLoadDictionary ( const char * szLang );
>> +
>> +
>> + UT_String m_sLanguage;
>> + BarbarismChecker m_BarbarismChecker;
>> + UT_Vector m_vecEmpty;
>> +
>> + bool m_bIsBarbarism;
>> + bool m_bIsDictionaryWord;
>> + bool m_bFoundDictionary;
>> +
>> +private:
>> + Hyphenator(const Hyphenator&); // no impl
>> + void operator=(const Hyphenator&); // no impl
>> +
>> + virtual bool _requestDictionary (const char * szLang) = 0;
>> + virtual HyphenatorResult __hyphenate(const UT_UCSChar* word, size_t len) = 0;
>> +};
>> +
>> +class ABI_EXPORT HyphentorManager
>> +{
>> +public:
>> + static HyphentorManager & instance (void);
>> +
>> + virtual ~HyphentorManager ();
>> +
>> +
>> + virtual HyphentorManager * lastDictionary (void) const;
>> + virtual HyphentorManager * requestDictionary (const char * szLang);
>> + UT_uint32 numLoadedDicts () const { return m_nLoadedDicts; }
>> +
>> + Hyphenator * getInstance() const;
>> +
>> +private:
>> + HyphentorManager ();
>> + HyphentorManager ( const HyphentorManager & other );
>> + HyphentorManager & operator= ( const HyphentorManager & other );
>> +
>> +
>> + UT_StringPtrMap m_map;
>> + UT_String m_missingHashs;
>> + Hyphenator * m_lastDict;
>> + UT_uint32 m_nLoadedDicts;
>> +};
>> +
>> +#endif /* HYPHENATE_MANAGER_H */
>>
>> -----------------------------------------------
>> To unsubscribe from this list, send a message to
>> abisource-cvs-commit-request@abisource.com with the word
>> unsubscribe in the message body.
>>
> --
> Kathiravelu Pradeeban.
> Software Engineer.
> WSO2 Inc.
> Blog: [Llovizna] http://kkpradeeban.blogspot.com/
>

-- 
Kathiravelu Pradeeban.
Software Engineer.
WSO2 Inc.
Blog: [Llovizna] http://kkpradeeban.blogspot.com/
Received on Fri May 27 20:22:21 2011

This archive was generated by hypermail 2.1.8 : Fri May 27 2011 - 20:22:21 CEST