From 08c2c256293e4e21f325d3e1dcef1b8df481c3ef Mon Sep 17 00:00:00 2001 From: =?utf8?q?Peter=20K=C3=BCmmel?= Date: Mon, 18 Sep 2006 18:08:29 +0000 Subject: [PATCH] add 0.60 branch support because it is more stablewin32-aspell-HEAD.patch git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15044 a592a061-630c-0410-9148-cb99ea01b6c8 --- development/Win32/aspell/CMakeLists.txt | 91 +++++++---- development/Win32/aspell/Readme.txt | 6 +- development/Win32/aspell/dirent.c | 150 ++++++++++++++++++ development/Win32/aspell/dirent.h | 97 +++++++++++ development/Win32/aspell/minwin.h | 49 ++++++ development/Win32/aspell/prog/CMakeLists.txt | 36 +++++ ...2-aspell.patch => win32-aspell-HEAD.patch} | 0 7 files changed, 394 insertions(+), 35 deletions(-) create mode 100755 development/Win32/aspell/dirent.c create mode 100755 development/Win32/aspell/dirent.h create mode 100755 development/Win32/aspell/minwin.h create mode 100755 development/Win32/aspell/prog/CMakeLists.txt rename development/Win32/aspell/{win32-aspell.patch => win32-aspell-HEAD.patch} (100%) diff --git a/development/Win32/aspell/CMakeLists.txt b/development/Win32/aspell/CMakeLists.txt index ce20c67838..1a74987fea 100644 --- a/development/Win32/aspell/CMakeLists.txt +++ b/development/Win32/aspell/CMakeLists.txt @@ -1,5 +1,11 @@ project(aspell) +# default: build rel_0_60-branch +# -DCVS_HEAD=1: build cvs HEAD version + + +set(ASPELL_LIB_NAME libaspell) +set(ASPELL_EXE_NAME aspell) if(${LINK} MATCHES "shared" OR ASPELL_LINK) set(ASPELL_SHARED_LIB 1) @@ -12,11 +18,15 @@ else(${LINK} MATCHES "shared" OR ASPELL_LINK) endif(${LINK} MATCHES "shared" OR ASPELL_LINK) + +set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin) + ######################################################################## # # Aspell Library # + set(libaspell_sources ../common/cache.cpp ../common/string.cpp @@ -34,9 +44,7 @@ set(libaspell_sources ../common/info.cpp ../common/can_have_error.cpp ../common/convert.cpp - ../common/convert_filter.cpp ../common/speller.cpp - ../common/checker.cpp ../common/filter.cpp ../common/objstack.cpp ../common/strtonum.cpp @@ -49,12 +57,10 @@ set(libaspell_sources ../modules/speller/default/phonetic.cpp ../modules/speller/default/writable.cpp ../modules/speller/default/speller_impl.cpp - ../modules/speller/default/checker_impl.cpp ../modules/speller/default/phonet.cpp ../modules/speller/default/typo_editdist.cpp ../modules/speller/default/editdist.cpp ../modules/speller/default/primes.cpp - ../modules/speller/default/lang_impl.cpp ../modules/speller/default/leditdist.cpp ../modules/speller/default/affix.cpp ../lib/word_list-c.cpp @@ -72,16 +78,8 @@ set(libaspell_sources ../lib/string_list-c.cpp ../lib/find_speller.cpp ../lib/speller-c.cpp - ../lib/speller-cm.cpp ../lib/string_pair_enumeration-c.cpp ../lib/new_checker.cpp - ../lib/checker-c.cpp - ../lib/document_checker-c.cpp - ../lib/convert-c.cpp - ../lib/language-c.cpp - ../lib/language_types-c.cpp - ../lib/language-cm.cpp - ../lib/munch_list.cpp # This is for filters which are ALWAYS static. @@ -91,11 +89,44 @@ set(libaspell_sources # is just a small wrapper. ../modules/filter/url.cpp - ../modules/filter/genconv.cpp - ) -file(GLOB commons_headers ../common/*.hpp) +if(NOT CVS_HEAD) + set(libaspell_sources ${libaspell_sources} + ../common/tokenizer.cpp + ../common/document_checker.cpp + ../modules/speller/default/language.cpp + ../modules/tokenizer/basic.cpp + ../lib/filter-c.cpp + ../lib/document_checker-c.cpp + # msvc win32 support + ../win32/dirent.c + ) +else(NOT CVS_HEAD) + set(libaspell_sources ${libaspell_sources} + ../common/convert_filter.cpp + ../common/checker.cpp + ../modules/speller/default/checker_impl.cpp + ../modules/speller/default/lang_impl.cpp + ../lib/speller-cm.cpp + ../lib/checker-c.cpp + ../lib/document_checker-c.cpp + ../lib/convert-c.cpp + ../lib/language-c.cpp + ../lib/language_types-c.cpp + ../lib/language-cm.cpp + ../lib/munch_list.cpp + ../modules/filter/genconv.cpp + # msvc win32 support + ../win32/libstub.cpp + ) + set(CVS_HEAD 1 CACHE TYPE STRING) +endif(NOT CVS_HEAD) + + +file(GLOB commons_headers ../common/*.hpp ) + +set(commons_headers ${commons_headers} ../interfaces/cc/aspell.h) if(COMPILE_IN_FILTERS) @@ -143,16 +174,18 @@ if(MSVC) endif(MSVC) if(WIN32) - ### msvc win32 support - set(libaspell_sources ${libaspell_sources} ../win32/libstub.cpp) add_definitions(-DWIN32PORT) endif(WIN32) -add_library(aspell ${ASPELL_LINK} ${libaspell_sources} ${commons_headers}) +if(ASPELL_SHARED_LIB) + add_definitions(-DASPELL_MAKE_LIB -DASPELL_USE_SHARED) +endif(ASPELL_SHARED_LIB) + +add_library(${ASPELL_LIB_NAME} ${ASPELL_LINK} ${libaspell_sources} ${commons_headers}) if(WIN32) - target_link_libraries(aspell ole32) + target_link_libraries(${ASPELL_LIB_NAME} ole32) endif(WIN32) @@ -161,17 +194,7 @@ endif(WIN32) # Aspell Program # -set(aspell_SOURCES - ../prog/aspell.cpp - ../prog/check_funs.cpp - ../prog/checker_string.cpp - ) - -add_executable(aspellexe ${aspell_SOURCES}) - -if(WIN32) - target_link_libraries(aspellexe aspell ole32) -endif(WIN32) +add_subdirectory(prog) ######################################################################## @@ -181,14 +204,16 @@ endif(WIN32) set(CMAKE_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX}/../gnuwin32) -install(TARGETS aspellexe aspell +install(TARGETS ${ASPELL_LIB_NAME} RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib) install(FILES ../interfaces/cc/aspell.h DESTINATION include) - - +if(ASPELL_SHARED_LIB) + install(FILES ../win32/aspellexport.h + DESTINATION include) +endif(ASPELL_SHARED_LIB) diff --git a/development/Win32/aspell/Readme.txt b/development/Win32/aspell/Readme.txt index bef876e047..2623f7bed2 100644 --- a/development/Win32/aspell/Readme.txt +++ b/development/Win32/aspell/Readme.txt @@ -1,9 +1,11 @@ Aspell on Windows -You need cmake and cygwin (with Unix line endings!!). +You need cmake and cygwin (cvs-HEAD:with Unix line endings!!). -- check out the latest CVS version: +- check out the rel_0_60-branch version of Aspell http://savannah.gnu.org/cvs/?group=aspell + cvs -z9 -d:pserver:anonymous@cvs.savannah.gnu.org:\ + /sources/aspell co -r rel_0_60-branch aspell - first build with cygwin to autogenerate all required files: diff --git a/development/Win32/aspell/dirent.c b/development/Win32/aspell/dirent.c new file mode 100755 index 0000000000..42be761476 --- /dev/null +++ b/development/Win32/aspell/dirent.c @@ -0,0 +1,150 @@ +/* ==================================================================== + * The Apache Software License, Version 1.1 + * + * Copyright (c) 2000-2002 The Apache Software Foundation. All rights + * reserved. + * + * 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. The end-user documentation included with the redistribution, + * if any, must include the following acknowledgment: + * "This product includes software developed by the + * Apache Software Foundation (http://www.apache.org/)." + * Alternately, this acknowledgment may appear in the software itself, + * if and wherever such third-party acknowledgments normally appear. + * + * 4. The names "Apache" and "Apache Software Foundation" must + * not be used to endorse or promote products derived from this + * software without prior written permission. For written + * permission, please contact apache@apache.org. + * + * 5. Products derived from this software may not be called "Apache", + * nor may "Apache" appear in their name, without prior written + * permission of the Apache Software Foundation. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 APACHE SOFTWARE FOUNDATION OR + * ITS 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. + * ==================================================================== + * + * This software consists of voluntary contributions made by many + * individuals on behalf of the Apache Software Foundation. For more + * information on the Apache Software Foundation, please see + * . + * + * Portions of this software are based upon public domain software + * originally written at the National Center for Supercomputing Applications, + * University of Illinois, Urbana-Champaign. + */ + +//#include +#include + +#include +#include +#include + +#include "dirent.h" + +/********************************************************************** + * Implement dirent-style opendir/readdir/closedir on Window 95/NT + * + * Functions defined are opendir(), readdir() and closedir() with the + * same prototypes as the normal dirent.h implementation. + * + * Does not implement telldir(), seekdir(), rewinddir() or scandir(). + * The dirent struct is compatible with Unix, except that d_ino is + * always 1 and d_off is made up as we go along. + * + * The DIR typedef is not compatible with Unix. + **********************************************************************/ + + +KDEWIN32_EXPORT DIR * opendir(const char *dir) +{ + DIR *dp; + char *filespec; + long handle; + int index; + + filespec = malloc(strlen(dir) + 2 + 1); + strcpy(filespec, dir); + index = strlen(filespec) - 1; + if (index >= 0 && (filespec[index] == '/' || filespec[index] == '\\')) + filespec[index] = '\0'; + strcat(filespec, "\\*"); + + dp = (DIR *)malloc(sizeof(DIR)); + dp->offset = 0; + dp->finished = 0; + dp->dir = strdup(dir); + + if ((handle = _findfirst(filespec, &(dp->fileinfo))) < 0) { + if (errno == ENOENT) + dp->finished = 1; + else + return NULL; + } + + dp->handle = handle; + free(filespec); + + return dp; +} + +KDEWIN32_EXPORT struct dirent * readdir(DIR *dp) +{ + if (!dp || dp->finished) return NULL; + + if (dp->offset != 0) { + if (_findnext(dp->handle, &(dp->fileinfo)) < 0) { + dp->finished = 1; + return NULL; + } + } + dp->offset++; + + strncpy(dp->dent.d_name, dp->fileinfo.name, _MAX_FNAME); + dp->dent.d_ino = 1; + dp->dent.d_reclen = strlen(dp->dent.d_name); + dp->dent.d_off = dp->offset; + + return &(dp->dent); +} + +KDEWIN32_EXPORT struct dirent* readdir_r(DIR *dirp, struct dirent *entry, struct dirent **result) +{ + //todo: remove this when readdir_r.c will be ported + result = 0; + return 0; +} + +KDEWIN32_EXPORT int closedir(DIR *dp) +{ + if (!dp) return 0; + _findclose(dp->handle); + if (dp->dir) free(dp->dir); + if (dp) free(dp); + + return 0; +} + diff --git a/development/Win32/aspell/dirent.h b/development/Win32/aspell/dirent.h new file mode 100755 index 0000000000..bfaf2c65fa --- /dev/null +++ b/development/Win32/aspell/dirent.h @@ -0,0 +1,97 @@ +/* This file is part of the KDE project + Copyright (C) 2000 Werner Almesberger + + libc/sys/linux/sys/dirent.h - Directory entry as returned by readdir + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU Library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this program; see the file COPYING. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef KDEWIN_SYS_DIRENT_H +#define KDEWIN_SYS_DIRENT_H + +// include everywhere +#include + +#include +#include +#include + +//#include + +# define F_OK 0 //does the file exist? + +#ifdef __cplusplus +extern "C" { +#endif + +#define HAVE_NO_D_NAMLEN /* no struct dirent->d_namlen */ +#define HAVE_DD_LOCK /* have locking mechanism */ + +#define MAXNAMLEN 255 /* sizeof(struct dirent.d_name)-1 */ + +#define __dirfd(dir) (dir)->dd_fd + +/* struct dirent - same as Unix */ +struct dirent { + long d_ino; /* inode (always 1 in WIN32) */ + off_t d_off; /* offset to this dirent */ + unsigned short d_reclen; /* length of d_name */ + char d_name[_MAX_FNAME+1]; /* filename (null terminated) */ +}; + +/* typedef DIR - not the same as Unix */ +typedef struct { + long handle; /* _findfirst/_findnext handle */ + short offset; /* offset into directory */ + short finished; /* 1 if there are not more files */ + struct _finddata_t fileinfo; /* from _findfirst/_findnext */ + char *dir; /* the dir we are reading */ + struct dirent dent; /* the dirent to return */ +} DIR; + +/* --- redundant --- */ + +//DIR *opendir(const char *); +//struct dirent *readdir(DIR *); +//void rewinddir(DIR *); +//int closedir(DIR *); + +/* internal prototype */ +void _seekdir(DIR *dir,off_t offset); + +//#ifndef _POSIX_SOURCE +//long telldir (DIR *); +//void seekdir (DIR *, off_t loc); + +#define KDEWIN32_EXPORT + +KDEWIN32_EXPORT int scandir (const char *__dir, + struct dirent ***__namelist, + int (*select) (const struct dirent *), + int (*compar) (const struct dirent **, const struct dirent **)); + +KDEWIN32_EXPORT DIR * opendir(const char *); +KDEWIN32_EXPORT int closedir(DIR *); +KDEWIN32_EXPORT struct dirent* readdir(DIR *); +KDEWIN32_EXPORT struct dirent* readdir_r(DIR *dirp, struct dirent *entry, struct dirent **result); + +int alphasort (const struct dirent **__a, const struct dirent **__b); + +#ifdef __cplusplus +} +#endif + +#endif // KDEWIN_SYS_DIRENT_H diff --git a/development/Win32/aspell/minwin.h b/development/Win32/aspell/minwin.h new file mode 100755 index 0000000000..f9ed7a5bbd --- /dev/null +++ b/development/Win32/aspell/minwin.h @@ -0,0 +1,49 @@ +#ifndef minimum_windows_declarations_h +#define minimum_windows_declarations_h + +//Tell windows.h not to make declarations that we do not use +//See windows.h for descriptions of what is turned off by what. + +#define NOGDICAPMASKS +#define NOVIRTUALKEYCODES +#define NOWINMESSAGES +#define NOWINSTYLES +#define NOSYSMETRICS +#define NOMENUS +#define NOICONS +#define NOKEYSTATES +#define NOSYSCOMMANDS +#define NORASTEROPS +#define NOSHOWWINDOW +#define OEMRESOURCE +#define NOATOM +#define NOCLIPBOARD +#define NOCOLOR +#define NOCTLMGR +#define NODRAWTEXT +#define NOGDI +#define NOKERNEL +#define NOUSER +#define NONLS +#define NOMB +#define NOMEMMGR +#define NOMETAFILE +#define NOMINMAX +#define NOMSG +#define NOOPENFILE +#define NOSCROLL +#define NOSERVICE +#define NOSOUND +#define NOTEXTMETRIC +#define NOWH +#define NOWINOFFSETS +#define NOCOMM +#define NOKANJI +#define NOHELP +#define NOPROFILER +#define NODEFERWINDOWPOS +#define NOCRYPT +#define NOMCX + +# include +#endif diff --git a/development/Win32/aspell/prog/CMakeLists.txt b/development/Win32/aspell/prog/CMakeLists.txt new file mode 100755 index 0000000000..43c7d49235 --- /dev/null +++ b/development/Win32/aspell/prog/CMakeLists.txt @@ -0,0 +1,36 @@ +project(aspell) + + +######################################################################## +# +# Aspell Program +# + +set(aspell_SOURCES + ../../prog/aspell.cpp + ../../prog/check_funs.cpp + ../../prog/checker_string.cpp + ) + +add_executable(${ASPELL_EXE_NAME} ${aspell_SOURCES}) + +if(WIN32) + target_link_libraries(${ASPELL_EXE_NAME} ${ASPELL_LIB_NAME} ole32) +endif(WIN32) + +######################################################################## +# +# Install +# + +set(CMAKE_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX}/../gnuwin32) + +install(TARGETS ${ASPELL_EXE_NAME} + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib) + +install(FILES ../interfaces/cc/aspell.h + DESTINATION include) + + diff --git a/development/Win32/aspell/win32-aspell.patch b/development/Win32/aspell/win32-aspell-HEAD.patch similarity index 100% rename from development/Win32/aspell/win32-aspell.patch rename to development/Win32/aspell/win32-aspell-HEAD.patch -- 2.39.2