-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix BOM markers and carriage returns
- Loading branch information
1 parent
da4a76a
commit c1c5449
Showing
23 changed files
with
824 additions
and
824 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,94 +1,94 @@ | ||
cmake_minimum_required(VERSION 3.13) | ||
project(endplay) | ||
|
||
# Global settings | ||
# =============== | ||
|
||
if (NOT CMAKE_BUILD_TYPE) | ||
message(WARNING "CMAKE_BUILD_TYPE not specified; defaulting to 'Release'") | ||
set(CMAKE_BUILD_TYPE Release) | ||
endif() | ||
set(CMAKE_CXX_STANDARD 17) | ||
|
||
set(ENDPLAY_ROOT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/src/endplay") | ||
file(READ "${CMAKE_CURRENT_SOURCE_DIR}/VERSION" ENDPLAY_VERSION) | ||
string(REGEX REPLACE "\n$" "" ENDPLAY_VERSION "${ENDPLAY_VERSION}") | ||
string(TIMESTAMP ENDPLAY_BUILD_TIME) | ||
|
||
# Detect compiler | ||
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang") | ||
set(CC_CLANG 1) | ||
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") | ||
set(CC_GCC 1) | ||
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") | ||
set(CC_MSVC 1) | ||
else() | ||
message(WARNING "The compiler you are using hasn't been tested for building this library.") | ||
endif() | ||
|
||
# Pretend to use SETUPTOOLS_BUILD variable to stop it complaining | ||
if (SETUPTOOLS_BUILD) | ||
message(STATUS "Call to CMake was invocated by setuptools") | ||
endif() | ||
|
||
if (COMPILE_32_BITS) | ||
add_compile_options("-m32") | ||
add_link_options("-m32") | ||
endif() | ||
|
||
# Configure config.py with version number | ||
# ======================================= | ||
configure_file("${ENDPLAY_ROOT_DIR}/config.py.in" "config.py" @ONLY) | ||
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/config.py" DESTINATION "endplay") | ||
|
||
|
||
# _dds library | ||
# ============ | ||
|
||
# Compile the source files for the DDS library together into a shared library file | ||
set(DDS_ROOT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/libs/dds/") | ||
set(DDS_SOURCE | ||
dds.cpp dump.cpp ABsearch.cpp | ||
ABstats.cpp CalcTables.cpp DealerPar.cpp | ||
File.cpp Init.cpp LaterTricks.cpp | ||
Memory.cpp Moves.cpp Par.cpp | ||
PlayAnalyser.cpp PBN.cpp QuickTricks.cpp | ||
Scheduler.cpp SolveBoard.cpp SolverIF.cpp | ||
System.cpp ThreadMgr.cpp Timer.cpp | ||
TimerGroup.cpp TimerList.cpp TimeStat.cpp | ||
TimeStatList.cpp TransTableS.cpp TransTableL.cpp) | ||
if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") | ||
set(DDS_SOURCE ${DDS_SOURCE} exports.def dds.rc) | ||
endif() | ||
list(TRANSFORM DDS_SOURCE PREPEND "${DDS_ROOT_DIR}/src/") | ||
|
||
add_library(dds SHARED ${DDS_SOURCE}) | ||
target_compile_definitions(dds PRIVATE "DDS_THREADS_STL") | ||
target_include_directories(dds PRIVATE "${DDS_ROOT_DIR}/src") | ||
# Compiler specific flags | ||
if (CC_GCC) | ||
target_compile_options(dds PRIVATE "-Wno-format-overflow") | ||
elseif (CC_MSVC) | ||
target_compile_definitions(dds PRIVATE "_CRT_SECURE_NO_WARNINGS") | ||
target_compile_options(dds PRIVATE "/wd4267") | ||
endif() | ||
|
||
# Copy some macro definitions from the c header file into the | ||
# __init__.py for the package | ||
file(READ "${DDS_ROOT_DIR}/include/dll.h" DDS_DLL_H) | ||
string(REGEX MATCH "#define MAXNOOFBOARDS [0-9]+" DDS_MAXNOOFBOARDS "${DDS_DLL_H}") | ||
string(REGEX MATCH "[0-9]+" DDS_MAXNOOFBOARDS "${DDS_MAXNOOFBOARDS}") | ||
string(REGEX MATCH "#define MAXNOOFTABLES [0-9]+" DDS_MAXNOOFTABLES "${DDS_DLL_H}") | ||
string(REGEX MATCH "[0-9]+" DDS_MAXNOOFTABLES "${DDS_MAXNOOFTABLES}") | ||
set(DDS_LIBRARY_NAME "${CMAKE_SHARED_LIBRARY_PREFIX}dds${CMAKE_SHARED_LIBRARY_SUFFIX}") | ||
configure_file("${ENDPLAY_ROOT_DIR}/_dds/__init__.py.in" "_dds/__init__.py" @ONLY) | ||
|
||
# Install both bits into the right places in the package | ||
if (CC_MSVC) | ||
# .dll is a runtime component | ||
install(TARGETS dds RUNTIME DESTINATION "endplay/_dds") | ||
else() | ||
install(TARGETS dds DESTINATION "endplay/_dds") | ||
endif() | ||
|
||
cmake_minimum_required(VERSION 3.13) | ||
project(endplay) | ||
|
||
# Global settings | ||
# =============== | ||
|
||
if (NOT CMAKE_BUILD_TYPE) | ||
message(WARNING "CMAKE_BUILD_TYPE not specified; defaulting to 'Release'") | ||
set(CMAKE_BUILD_TYPE Release) | ||
endif() | ||
set(CMAKE_CXX_STANDARD 17) | ||
|
||
set(ENDPLAY_ROOT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/src/endplay") | ||
file(READ "${CMAKE_CURRENT_SOURCE_DIR}/VERSION" ENDPLAY_VERSION) | ||
string(REGEX REPLACE "\n$" "" ENDPLAY_VERSION "${ENDPLAY_VERSION}") | ||
string(TIMESTAMP ENDPLAY_BUILD_TIME) | ||
|
||
# Detect compiler | ||
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang") | ||
set(CC_CLANG 1) | ||
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") | ||
set(CC_GCC 1) | ||
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") | ||
set(CC_MSVC 1) | ||
else() | ||
message(WARNING "The compiler you are using hasn't been tested for building this library.") | ||
endif() | ||
|
||
# Pretend to use SETUPTOOLS_BUILD variable to stop it complaining | ||
if (SETUPTOOLS_BUILD) | ||
message(STATUS "Call to CMake was invocated by setuptools") | ||
endif() | ||
|
||
if (COMPILE_32_BITS) | ||
add_compile_options("-m32") | ||
add_link_options("-m32") | ||
endif() | ||
|
||
# Configure config.py with version number | ||
# ======================================= | ||
configure_file("${ENDPLAY_ROOT_DIR}/config.py.in" "config.py" @ONLY) | ||
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/config.py" DESTINATION "endplay") | ||
|
||
|
||
# _dds library | ||
# ============ | ||
|
||
# Compile the source files for the DDS library together into a shared library file | ||
set(DDS_ROOT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/libs/dds/") | ||
set(DDS_SOURCE | ||
dds.cpp dump.cpp ABsearch.cpp | ||
ABstats.cpp CalcTables.cpp DealerPar.cpp | ||
File.cpp Init.cpp LaterTricks.cpp | ||
Memory.cpp Moves.cpp Par.cpp | ||
PlayAnalyser.cpp PBN.cpp QuickTricks.cpp | ||
Scheduler.cpp SolveBoard.cpp SolverIF.cpp | ||
System.cpp ThreadMgr.cpp Timer.cpp | ||
TimerGroup.cpp TimerList.cpp TimeStat.cpp | ||
TimeStatList.cpp TransTableS.cpp TransTableL.cpp) | ||
if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") | ||
set(DDS_SOURCE ${DDS_SOURCE} exports.def dds.rc) | ||
endif() | ||
list(TRANSFORM DDS_SOURCE PREPEND "${DDS_ROOT_DIR}/src/") | ||
|
||
add_library(dds SHARED ${DDS_SOURCE}) | ||
target_compile_definitions(dds PRIVATE "DDS_THREADS_STL") | ||
target_include_directories(dds PRIVATE "${DDS_ROOT_DIR}/src") | ||
# Compiler specific flags | ||
if (CC_GCC) | ||
target_compile_options(dds PRIVATE "-Wno-format-overflow") | ||
elseif (CC_MSVC) | ||
target_compile_definitions(dds PRIVATE "_CRT_SECURE_NO_WARNINGS") | ||
target_compile_options(dds PRIVATE "/wd4267") | ||
endif() | ||
|
||
# Copy some macro definitions from the c header file into the | ||
# __init__.py for the package | ||
file(READ "${DDS_ROOT_DIR}/include/dll.h" DDS_DLL_H) | ||
string(REGEX MATCH "#define MAXNOOFBOARDS [0-9]+" DDS_MAXNOOFBOARDS "${DDS_DLL_H}") | ||
string(REGEX MATCH "[0-9]+" DDS_MAXNOOFBOARDS "${DDS_MAXNOOFBOARDS}") | ||
string(REGEX MATCH "#define MAXNOOFTABLES [0-9]+" DDS_MAXNOOFTABLES "${DDS_DLL_H}") | ||
string(REGEX MATCH "[0-9]+" DDS_MAXNOOFTABLES "${DDS_MAXNOOFTABLES}") | ||
set(DDS_LIBRARY_NAME "${CMAKE_SHARED_LIBRARY_PREFIX}dds${CMAKE_SHARED_LIBRARY_SUFFIX}") | ||
configure_file("${ENDPLAY_ROOT_DIR}/_dds/__init__.py.in" "_dds/__init__.py" @ONLY) | ||
|
||
# Install both bits into the right places in the package | ||
if (CC_MSVC) | ||
# .dll is a runtime component | ||
install(TARGETS dds RUNTIME DESTINATION "endplay/_dds") | ||
else() | ||
install(TARGETS dds DESTINATION "endplay/_dds") | ||
endif() | ||
|
||
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/_dds/__init__.py" DESTINATION "endplay/_dds/") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,15 @@ | ||
""" | ||
Endplay - A bridge tools library with generating, analysing and scoring. | ||
Released under the MIT licence (see the LICENCE file provided with this distribution) | ||
""" | ||
|
||
import endplay._dds as _dds | ||
from endplay.dds import * | ||
from endplay.dealer import * | ||
from endplay.interact import * | ||
from endplay.parsers import * | ||
from endplay.evaluate import * | ||
from endplay.types import * | ||
from endplay.config import \ | ||
__version__, __version_info__, __author__, \ | ||
""" | ||
Endplay - A bridge tools library with generating, analysing and scoring. | ||
Released under the MIT licence (see the LICENCE file provided with this distribution) | ||
""" | ||
|
||
import endplay._dds as _dds | ||
from endplay.dds import * | ||
from endplay.dealer import * | ||
from endplay.interact import * | ||
from endplay.parsers import * | ||
from endplay.evaluate import * | ||
from endplay.types import * | ||
from endplay.config import \ | ||
__version__, __version_info__, __author__, \ | ||
__buildtime__, suppress_unicode |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,46 @@ | ||
""" | ||
Configuration and versioning information | ||
""" | ||
__all__ = ["__version__", "__version_info__", "__author__", "use_unicode", "suppress_unicode"] | ||
from contextlib import ContextDecorator | ||
# Packages metadata, used by setuptools etc | ||
__version__ = """@ENDPLAY_VERSION@""".strip() | ||
"""Version of the library as a string""" | ||
__version_info__ = tuple(int(i) if i.isdigit() else i for i in __version__.replace("-", ".").split(".")) | ||
"""Version of the library as a tuple of integers""" | ||
__author__ = "Dominic Price" | ||
"""Author of the library""" | ||
__buildtime__ = """@ENDPLAY_BUILD_TIME@""".strip() | ||
use_unicode = True | ||
"""If set to False, the library will only print characters in the ASCII range""" | ||
class suppress_unicode(ContextDecorator): | ||
""" | ||
Context manager to temporarily ensure that unicode output is turned off, | ||
for example when writing to a file which expects suit symbols to be | ||
SDHC. | ||
Example usage:: | ||
print(Denom.hearts.abbr) # prints ♥ (assuming config.use_unicode=True) | ||
with suppress_unicode(): | ||
print(Denom.hearts.abbr) # prints H | ||
print(Denom.hearts.abbr) # prints ♥ | ||
""" | ||
def __enter__(self): | ||
global use_unicode | ||
self.use_unicode = use_unicode | ||
use_unicode = False | ||
return self | ||
def __exit__(self, *exc): | ||
global use_unicode | ||
use_unicode = self.use_unicode | ||
return False | ||
""" | ||
Configuration and versioning information | ||
""" | ||
|
||
__all__ = ["__version__", "__version_info__", "__author__", "use_unicode", "suppress_unicode"] | ||
|
||
from contextlib import ContextDecorator | ||
|
||
# Packages metadata, used by setuptools etc | ||
__version__ = """@ENDPLAY_VERSION@""".strip() | ||
"""Version of the library as a string""" | ||
|
||
__version_info__ = tuple(int(i) if i.isdigit() else i for i in __version__.replace("-", ".").split(".")) | ||
"""Version of the library as a tuple of integers""" | ||
|
||
__author__ = "Dominic Price" | ||
"""Author of the library""" | ||
|
||
__buildtime__ = """@ENDPLAY_BUILD_TIME@""".strip() | ||
|
||
use_unicode = True | ||
"""If set to False, the library will only print characters in the ASCII range""" | ||
|
||
class suppress_unicode(ContextDecorator): | ||
""" | ||
Context manager to temporarily ensure that unicode output is turned off, | ||
for example when writing to a file which expects suit symbols to be | ||
SDHC. | ||
|
||
Example usage:: | ||
|
||
print(Denom.hearts.abbr) # prints ♥ (assuming config.use_unicode=True) | ||
with suppress_unicode(): | ||
print(Denom.hearts.abbr) # prints H | ||
print(Denom.hearts.abbr) # prints ♥ | ||
""" | ||
def __enter__(self): | ||
global use_unicode | ||
self.use_unicode = use_unicode | ||
use_unicode = False | ||
return self | ||
|
||
def __exit__(self, *exc): | ||
global use_unicode | ||
use_unicode = self.use_unicode | ||
return False |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,17 @@ | ||
""" | ||
Higher-level wrappers around Bo Haglund's dds wrapper, using the | ||
Python types defined in `endplay.types` and which use sensible | ||
defaults for the internal state such as threading indexes. | ||
""" | ||
|
||
__all__ = [ | ||
'solve_board', 'solve_all_boards', 'calc_dd_table', | ||
'calc_all_tables', 'analyse_play', 'analyse_all_plays', 'par', | ||
'analyse_start', 'analyse_all_starts' | ||
] | ||
|
||
import endplay._dds as _dds | ||
from endplay.dds.solve import solve_board, solve_all_boards | ||
from endplay.dds.ddtable import calc_dd_table, calc_all_tables | ||
from endplay.dds.analyse import analyse_play, analyse_all_plays, analyse_start, analyse_all_starts | ||
from endplay.dds.parscore import par | ||
""" | ||
Higher-level wrappers around Bo Haglund's dds wrapper, using the | ||
Python types defined in `endplay.types` and which use sensible | ||
defaults for the internal state such as threading indexes. | ||
""" | ||
|
||
__all__ = [ | ||
'solve_board', 'solve_all_boards', 'calc_dd_table', | ||
'calc_all_tables', 'analyse_play', 'analyse_all_plays', 'par', | ||
'analyse_start', 'analyse_all_starts' | ||
] | ||
|
||
import endplay._dds as _dds | ||
from endplay.dds.solve import solve_board, solve_all_boards | ||
from endplay.dds.ddtable import calc_dd_table, calc_all_tables | ||
from endplay.dds.analyse import analyse_play, analyse_all_plays, analyse_start, analyse_all_starts | ||
from endplay.dds.parscore import par |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
""" | ||
""" | ||
Par contract and scoring function | ||
""" | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
""" | ||
""" | ||
Actions class for producing LaTeX output. | ||
""" | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
""" | ||
""" | ||
Actions class for producing plaintext output. | ||
""" | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.