🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: pl.comp.lang.c
Article #309844

Re: Słownik do edytora

#309844
From: Szyk Cech
Date: Wed, 13 Mar 2019 15:25
131 lines
5196 bytes
> https://github.com/hunspell/hunspell

> https://github.com/nuspell/nuspell

Tego nie znam, ale na tej stronie pisze:
"Nuspell is a pure C++ reimplementation of Hunspell."

> pierwsza wygląda na bardziej rozbudowaną, druga może bardziej pasować do 
> programów z Qt?

Trochę się chyba zagalopowałeś... Qt jest biblioteką napisaną w C++. Tak 
więc wszystkie biblioteki w C, C++ i w Asemblerze są równie dobre. 
Zwłaszcza, że najwyraźniej Nuspell nie ma żadnych usprawnień 
algorytmicznych. Choć może działać szybciej z uwagi na wydajniejsze 
struktury i wydajniejszą implementację w sensie takich spraw jak 
standardowe kontenery, funkcje inline, szablony i inne triki 
poprawiające wydajność C++.

Może trochę Ci podpowiem jak włączać biblioteki zewnętrzne do projektu Qt:
1. Ja utworzyłem specjalny plik projektu Qt dla Hunspell - jego 
zasadniczą część wygenerowałem skryptem: 
http://szyk.jcom.pl/QtSourceList.html . Natomiast reszta pliku jest taka 
sama jak w przypadku standardowego pliku projektu Qt dla biblioteki 
współdzielonej. Trzeba tylko pamiętać by dodać zmienną DESTDIR. Może on 
wyglądać tak:

TARGET = HunSpell
CONFIG(debug, debug|release) {
     win32:      TARGET = $$join(TARGET,,,D)
     mac:        TARGET = $$join(TARGET,,,_debug)
     unix:!mac:  TARGET = $$join(TARGET,,,.debug)
}
VERSION = 1.3.4
TEMPLATE = lib
DESTDIR = $$PWD/../../../../../../Textprofan2-work/Libs
QT += core
QT -= gui

HEADERS +=  hunspell/affentry.hxx \
     hunspell/affixmgr.hxx \
     hunspell/atypes.hxx \
     hunspell/baseaffix.hxx \
     hunspell/csutil.hxx \
     hunspell/filemgr.hxx \
     hunspell/hashmgr.hxx \
     hunspell/htypes.hxx \
     hunspell/hunspell.h \
     hunspell/hunspell.hxx \
     hunspell/hunvisapi.h \
     hunspell/hunvisapi.h.in \
     hunspell/hunzip.hxx \
     hunspell/langnum.hxx \
     hunspell/phonet.hxx \
     hunspell/replist.hxx \
     hunspell/suggestmgr.hxx \
     hunspell/w_char.hxx

SOURCES += hunspell/affentry.cxx \
     hunspell/affixmgr.cxx \
     hunspell/csutil.cxx \
     hunspell/filemgr.cxx \
     hunspell/hashmgr.cxx \
     hunspell/hunspell.cxx \
     hunspell/hunzip.cxx \
     hunspell/phonet.cxx \
     hunspell/replist.cxx \
     hunspell/suggestmgr.cxx \
     hunspell/utf_info.cxx

DEFINES += BUILDING_LIBHUNSPELL

win32:CONFIG += dll

#DISTFILES += \
#    hunspell/Makefile.am


2. W pliku projektu jaki ma używać biblioteki Hunspell (czyli w twoim 
przypadku jest to edytor) tworzysz takie coś:

ROOT_PROJECT = $$PWD/../..	# Zmienna pomocnicza dla wygody
DESTDIR=$$ROOT_PROJECT/../Textprofan2-work	# To katalog docelowy, do testów

# Trzeba obsłużyć 2 przypadki linkowania biblioteki w wersji debug i release
CONFIG(release, debug|release): LIBS += -lHunSpell
CONFIG(debug, debug|release): LIBS += -lHunSpell.debug

LIBS += -L$$ROOT_PROJECT/../Textprofan2-work/Libs	# Katalog linkowania

INCLUDEPATH += $$ROOT_PROJECT/Src/Libs/3rdparty/Hunspell/src/hunspell

3. Aby miało to ręce i nogi ja mam taką strukturę katalogów projektu:
Textprofan2.pro
|-Src
	|-Libs
		|-3rdparty
			|-Hunspell
				|-src
					|-hunspell.pro
			|-inne obce biblioteki...
		|-moja biblioteka1
		|-moja bibliotekaN
	|-Textprofan (program głowny)
		|-Textprofan.pro

4. Plik Textprofan2.pro ma taką treść:
TEMPLATE = subdirs

# W SUBDIRS są same aliasy
SUBDIRS = \
     QtCsv \
     Hunspell \
#    KSyntaxhighligting \
     Common \
     Editor \
     Textprofan

# Pierszy rodzaj aliasu: podkatalogi
Common.subdir = Src/Libs/Common
Editor.subdir  = Src/Libs/Editor
Textprofan.subdir  = Src/Textprofan

# Drugi rodzaj aliasu ścieżki do plików pro
QtCsv.file = Src/Libs/3rdparty/qtcsv-1.5/qtcsv.pro
Hunspell.file = Src/Libs/3rdparty/Hunspell/src/hunspell.pro
#KSyntaxhighligting.file = 
Src/Libs/3rdparty/KSyntaxHighlighter/syntax-highlighting/CMakeLists.txt

# what subproject depends on others
Editor.depends = Common Hunspell QtCsv
Textprofan.depends = Common Editor QtCsv
Technical Details
Message-ID: <9i9iE.168598$Ci5.74162@fx26.fr7>
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.icm.edu.pl!news.nask.pl!news.nask.org.pl!news.unit0.net!newsreader4.netcologne.de!news.netcologne.de!peer03.ams1!peer.ams1.xlned.com!news.xlned.com!peer03.fr7!futter-mich.highwinds-media.com!news.highwinds-media.com!fx26.fr7.POSTED!not-for-mail
References: <q69blh$u2e$1@node2.news.atman.pl> <_c5iE.120475$mm6.110881@fx10.fr7> <q6avrd$6qr$1@node1.news.atman.pl>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.icm.edu.pl!news.nask.pl!news.nask.org.pl!news.unit0.net!newsreader4.netcologne.de!news.netcologne.de!peer03.ams1!peer.ams1.xlned.com!news.xlned.com!peer03.fr7!futter-mich.highwinds-media.com!news.highwinds-media.com!fx26.fr7.POSTED!not-for-mail
Subject: Re: Słownik do edytora
Newsgroups: pl.comp.lang.c
References: <q69blh$u2e$1@node2.news.atman.pl> <_c5iE.120475$mm6.110881@fx10.fr7> <q6avrd$6qr$1@node1.news.atman.pl>
From: Szyk Cech <szykcech@spoko.pl>
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.5.1
MIME-Version: 1.0
In-Reply-To: <q6avrd$6qr$1@node1.news.atman.pl>
Lines: 131
Message-ID: <9i9iE.168598$Ci5.74162@fx26.fr7>
X-Complaints-To: abuse(at)newshosting.com
NNTP-Posting-Date: Wed, 13 Mar 2019 15:25:57 UTC
Organization: Newshosting.com - Highest quality at a great price! www.newshosting.com
Date: Wed, 13 Mar 2019 16:25:57 +0100
X-Received-Bytes: 5081
X-Received-Body-CRC: 3854601916
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit