Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Maleclypse committed Apr 23, 2021
2 parents 6e836a9 + bc56e1b commit d1402eb
Show file tree
Hide file tree
Showing 259 changed files with 30,077 additions and 25,941 deletions.
7 changes: 4 additions & 3 deletions .flake8
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
[flake8]
exclude = .git,__pycache__,lang/json
ignore =
# The following errors were present when starting to use flake8; they need
# to be triaged to determine which we should fix and which we should leave
# permanently ignored
# E265 forces comments to have a space after the '#'. We have a bunch of
# optional debugging code commented out this way, and not having a space is
# a convenient way to distinguish it from proper comments. Maybe we should
# delete that code, but unless that happens leaving E265 disabled.
E265,
# W503 and W504 require line breaks after or before binary operators; you
# can only have one enabled
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/matrix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,10 @@ jobs:
sudo apt-get update
sudo apt-get install libncursesw5-dev libsdl2-dev libsdl2-ttf-dev libsdl2-image-dev \
libsdl2-mixer-dev libpulse-dev ccache gettext parallel
- name: install old GCC (ubuntu)
if: runner.os == 'Linux' && (matrix.compiler == 'g++-7' || matrix.compiler == 'g++-8')
run: |
sudo apt-get install g++-7 g++-8
- name: install dependencies (mac)
if: runner.os == 'macOS'
run: |
Expand Down
38 changes: 19 additions & 19 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ endif ()
if (${CMAKE_SYSTEM_NAME} MATCHES Darwin)
set(_OS_DARWIN_ 1)
set(LOCALIZE OFF)
message(STATUS "Disable internationalization on Darwin as it is not supported")
message(STATUS "Internationalization on Darwin is not supported")
endif ()

include(CheckCXXCompilerFlag)
Expand Down Expand Up @@ -198,7 +198,7 @@ message(STATUS "BACKTRACE : ${BACKTRACE}")
message(STATUS "LOCALIZE : ${LOCALIZE}")
message(STATUS "USE_HOME_DIR : ${USE_HOME_DIR}")
message(STATUS "LANGUAGES : ${LANGUAGES}")
message(STATUS "See INSTALL file for details and more info --")
message(STATUS "See doc/COMPILING/COMPILING-CMAKE.md for details and more info --")

if (MSVC)
if (CMAKE_SIZEOF_VOID_P EQUAL 8)
Expand Down Expand Up @@ -237,9 +237,9 @@ set(CMAKE_CXX_STANDARD 14)
if (${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
message(FATAL_ERROR
"This project requires an out of source build. \
Remove the file 'CMakeCache.txt' found in this directory before continuing, \
Remove the file 'CMakeCache.txt' found in this directory before continuing; \
create a separate build directory and run 'cmake [options] <srcs>' from there. \
See INSTALL file for details and more info.")
See doc/COMPILING/COMPILING-CMAKE.md for details and more info.")
endif ()

#set(THREADS_USE_PTHREADS_WIN32 True)
Expand All @@ -255,8 +255,8 @@ if (TILES)
message(FATAL_ERROR
"This project requires SDL2 to be installed to compile in graphical mode. \
Please install the SDL2 development libraries, \
or try compiling without the -DTILES=1 for a text only compilation. \
See INSTALL file for details and more info.")
or try compiling without -DTILES=1 for a text-only compilation. \
See doc/COMPILING/COMPILING-CMAKE.md for details and more info.")
endif ()

if (NOT DYNAMIC_LINKING)
Expand All @@ -275,8 +275,8 @@ if (TILES)
message(FATAL_ERROR
"This project requires SDL2_ttf to be installed to compile in graphical mode. \
Please install the SDL2_ttf development libraries, \
or try compiling without the -DTILES=1 for a text only compilation. \
See INSTALL file for details and more info.")
or try compiling without -DTILES=1 for a text-only compilation. \
See doc/COMPILING/COMPILING-CMAKE.md for details and more info.")
endif ()

message(STATUS "Searching for SDL2_image library --")
Expand All @@ -285,8 +285,8 @@ if (TILES)
message(FATAL_ERROR
"This project requires SDL2_image to be installed to compile in graphical mode. \
Please install the SDL2_image development libraries, \
or try compiling without the -DTILES=1 for a text only compilation. \
See INSTALL file for details and more info.")
or try compiling without -DTILES=1 for a text-only compilation. \
See doc/COMPILING/COMPILING-CMAKE.md for details and more info.")
endif ()
add_definitions(-DTILES)
endif ()
Expand All @@ -299,10 +299,10 @@ if (CURSES)
find_package(Curses)
if (NOT CURSES_FOUND)
message(FATAL_ERROR
"This project requires ncurses to be installed to be compiled in text only mode. \
"This project requires ncurses to be installed to be compiled in text-only mode. \
Please install the ncurses development libraries, \
or try compiling with the -DTILES=1 for a graphical compilation. \
See INSTALL file for details and more info")
or try compiling with -DTILES=1 for a graphical compilation. \
See doc/COMPILING/COMPILING-CMAKE.md for details and more info")
endif ()
endif ()

Expand All @@ -312,7 +312,7 @@ if (SOUND)
message(FATAL_ERROR
"You must enable graphical support with -DTILES=1 \
to be able to enable sound support. \
See INSTALL file for details and more info.")
See doc/COMPILING/COMPILING-CMAKE.md for details and more info.")
endif ()

# Sound requires SDL_mixer library
Expand All @@ -322,7 +322,7 @@ if (SOUND)
message(FATAL_ERROR
"You need the SDL2_mixer development library \
to be able to compile with sound enabled. \
See INSTALL file for details and more info.")
See doc/COMPILING/COMPILING-CMAKE.md for details and more info.")
endif ()
endif ()

Expand All @@ -340,15 +340,15 @@ if (LOCALIZE)
if (NOT LIBINTL_FOUND)
message(FATAL_ERROR
"You need the libintl development library \
to be able to compile with Localize support. \
See INSTALL file for details and more info.")
to be able to compile with LOCALIZE support. \
See doc/COMPILING/COMPILING-CMAKE.md for details and more info.")
endif ()
find_package(Iconv)
if (NOT ICONV_FOUND)
message(FATAL_ERROR
"You need the iconv development library \
to be able to compile with Localize support. \
See INSTALL file for details and more info.")
to be able to compile with LOCALIZE support. \
See doc/COMPILING/COMPILING-CMAKE.md for details and more info.")
endif ()
endif ()
add_subdirectory(lang)
Expand Down
2 changes: 2 additions & 0 deletions LICENSE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ PLF List and PLF Colony (src/list.h, src/colony.h) are licensed under the zLib l

getpost (tools/json_tools/format/getpost.h) is licensed under the MIT license, see file for text of license.

libintl-lite is licensed under Boost Software License 1.0. Visit https://www.boost.org/users/license.html to read the license.

libbacktrace is licensed under a BSD license (https://github.com/ianlancetaylor/libbacktrace/blob/master/LICENSE). The full license text is as follows:

# Copyright (C) 2012-2016 Free Software Foundation, Inc.
Expand Down
1 change: 0 additions & 1 deletion android/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
/app/jni/SDL2_mixer
/app/jni/SDL2_ttf
/app/jni/libhidapi
/app/jni/libintl-lite
/app/jni/lua
/app/jni/mpg-123
/app/build
Expand Down
Binary file modified android/app/deps.zip
Binary file not shown.
Binary file modified android/app/deps_debug.zip
Binary file not shown.
23 changes: 23 additions & 0 deletions android/app/jni/libintl-lite/Android.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
LOCAL_PATH := $(call my-dir)

###########################
#
# libintl-lite shared library
#
###########################

include $(CLEAR_VARS)

LOCAL_MODULE := libintl-lite

LOCAL_C_INCLUDES := $(LOCAL_PATH)

LOCAL_EXPORT_C_INCLUDES := $(LOCAL_C_INCLUDES)

LOCAL_SRC_FILES := libintl.cpp

LOCAL_CPP_FEATURES := exceptions rtti

LOCAL_LDLIBS := -llog

include $(BUILD_SHARED_LIBRARY)
23 changes: 23 additions & 0 deletions android/app/jni/libintl-lite/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
Boost Software License - Version 1.0 - August 17th, 2003

Permission is hereby granted, free of charge, to any person or organization
obtaining a copy of the software and accompanying documentation covered by
this license (the "Software") to use, reproduce, display, distribute,
execute, and transmit the Software, and to prepare derivative works of the
Software, and to permit third-parties to whom the Software is furnished to
do so, all subject to the following:

The copyright notices in the Software and this entire statement, including
the above license grant, this restriction and the following disclaimer,
must be included in all copies of the Software, in whole or in part, and
all derivative works of the Software, unless such copies or derivative
works are solely in the form of machine-executable object code generated by
a source language processor.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
98 changes: 98 additions & 0 deletions android/app/jni/libintl-lite/MessageCatalog.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
/*
Boost Software License - Version 1.0 - August 17th, 2003
Permission is hereby granted, free of charge, to any person or organization
obtaining a copy of the software and accompanying documentation covered by
this license (the "Software") to use, reproduce, display, distribute,
execute, and transmit the Software, and to prepare derivative works of the
Software, and to permit third-parties to whom the Software is furnished to
do so, all subject to the following:
The copyright notices in the Software and this entire statement, including
the above license grant, this restriction and the following disclaimer,
must be included in all copies of the Software, in whole or in part, and
all derivative works of the Software, unless such copies or derivative
works are solely in the form of machine-executable object code generated by
a source language processor.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
*/

#ifndef LIBINTL_INTERNAL_MESSAGECATALOG_HPP_
#define LIBINTL_INTERNAL_MESSAGECATALOG_HPP_

#include <algorithm>
#include <string>

namespace libintllite
{

namespace internal
{

class MessageCatalog
{
private:
MessageCatalog( const MessageCatalog & );
MessageCatalog &operator=( const MessageCatalog & );

uint32_t numberOfStrings;
const std::string *sortedOrigStringsArray;
const std::string *translatedStringsArray;

public:
// The ownership of these arrays is transfered to the created message
// catalog object!
// Does not throw exceptions!
MessageCatalog( uint32_t numberOfStrings,
const std::string *sortedOrigStringsArray,
const std::string *translatedStringsArray ) :
numberOfStrings( numberOfStrings ),
sortedOrigStringsArray( sortedOrigStringsArray ),
translatedStringsArray( translatedStringsArray ) {
}

~MessageCatalog() {
delete[] this->sortedOrigStringsArray;
delete[] this->translatedStringsArray;
}

// Returns NULL, if the original string was not found.
// Does not throw exceptions!
const std::string *getTranslatedStrPtr( const std::string &orig ) const {
const std::string *lastSortedOrigStringEndIter
= this->sortedOrigStringsArray + this->numberOfStrings;
const std::string *origStrPtr = std::lower_bound( this->sortedOrigStringsArray,
lastSortedOrigStringEndIter,
orig );
#ifdef __ANDROID__
// Bugfix from j-jorge's branch of libintl-lite: https://github.com/j-jorge/libintl-lite/commit/40e5a41e9b19e3252d348e0548f85e66fa44a79e
// However, libintl-lite does not seem to support plural form strings + translations properly, so I've had to modify the fix further.
// Plural strings are stored as "<singular>NUL<plural>NUL<plural>..." for as many plurals are in the language, eg. Russian has 4, French has 2, Japanese has 1.
// So we only compare the first singular string as per gettext MO files spec here: https://www.gnu.org/software/gettext/manual/html_node/MO-Files.html
// We do this via c_str() which clamps at the first NUL character.
// Later on once we have a match, we will dig out the proper plural translation from this megastring.
if( !origStrPtr || ( origStrPtr == lastSortedOrigStringEndIter ) ||
( std::string( ( *origStrPtr ).c_str() ) != std::string( orig.c_str() ) ) )
#else
if( !origStrPtr || ( origStrPtr == lastSortedOrigStringEndIter ) )
#endif
{
return NULL;
} else {
return &this->translatedStringsArray[origStrPtr - this->sortedOrigStringsArray];
}
}
};

} // namespace internal

} // namespace libintllite

#endif // LIBINTL_INTERNAL_MESSAGECATALOG_HPP_
Loading

0 comments on commit d1402eb

Please sign in to comment.