Skip to content

Commit f32f39e

Browse files
authored
Merge pull request #27 from mapcode-foundation/dev
Release 2.5.0
2 parents b5c28bf + 6ee3f95 commit f32f39e

40 files changed

+41973
-39601
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
unittest/gmon.out
2+
unittest/_*.txt
3+
14
# -----------------------------------------------------------------------------
25
# Compiled sources
36
# -----------------------------------------------------------------------------

CMakeLists.txt

Lines changed: 42 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (C) 2014-2015 Stichting Mapcode Foundation (http://www.mapcode.com)
1+
# Copyright (C) 2014-2016 Stichting Mapcode Foundation (http://www.mapcode.com)
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.
@@ -20,34 +20,56 @@ project(mapcode_cpp)
2020
#
2121
# export ASAN_OPTIONS=debug=true:strict_string_checks=1:detect_stack_use_after_return=true:detect_invalid_pointer_pairs=99999:
2222
# detect_container_overflow=true:detect_odr_violation=2:check_initialization_order=true
23+
#
24+
# Compiler directives (for internal use only):
25+
#
26+
# NO_POSIX_THREADS - No multi-threaded unit testing - only effective for unit test.
27+
# NO_FAST_ENCODE - Drop fast encoding support - only for internal use.
28+
29+
set(MAPCODE_OPTIONS "")
30+
set(MAPCODE_WARNING_OPTIONS "-Wall -Werror")
31+
set(MAPCODE_SANITIZER_COMPILER_OPTIONS "-fsanitize=address -fno-common -fno-optimize-sibling-calls -fno-omit-frame-pointer")
32+
set(MAPCODE_SANITIZER_LINKER_OPTIONS "-fsanitize=address")
33+
34+
set(CMAKE_C_FLAGS_DEBUG "${MAPCODE_OPTIONS} ${MAPCODE_WARNING_OPTIONS} ${MAPCODE_SANITIZER_COMPILER_OPTIONS} -O0 -g -DDEBUG")
35+
set(CMAKE_C_FLAGS_RELWITHDEBINFO "${MAPCODE_OPTIONS} ${MAPCODE_WARNING_OPTIONS} ${MAPCODE_SANITIZER_COMPILER_OPTIONS} -O2 -g -DNDEBUG")
36+
set(CMAKE_C_FLAGS_RELEASE "${MAPCODE_OPTIONS} ${MAPCODE_WARNING_OPTIONS} -O3 -DNDEBUG")
37+
38+
set(CMAKE_CXX_FLAGS_DEBUG "${MAPCODE_OPTIONS} ${MAPCODE_WARNING_OPTIONS} ${MAPCODE_SANITIZER_COMPILER_OPTIONS} -O0 -g -DDEBUG -std=c++11")
39+
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${MAPCODE_OPTIONS} ${MAPCODE_WARNING_OPTIONS} ${MAPCODE_SANITIZER_COMPILER_OPTIONS} -O2 -g -DNDEBUG -std=c++11")
40+
set(CMAKE_CXX_FLAGS_RELEASE "${MAPCODE_OPTIONS} ${MAPCODE_WARNING_OPTIONS} -O3 -DNDEBUG -std=c++11")
41+
42+
set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${MAPCODE_SANITIZER_LINKER_OPTIONS}")
43+
set(CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO "${MAPCODE_SANITIZER_LINKER_OPTIONS}")
44+
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "")
2345

24-
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Wall -Werror -fsanitize=address -fno-common -fno-optimize-sibling-calls -fno-omit-frame-pointer")
25-
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -std=c++11")
26-
set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} -fsanitize=address")
27-
28-
set(SOURCE_FILES
29-
mapcodelib/basics.h
30-
mapcodelib/mapcode_alphabets.h
31-
mapcodelib/mapcode_countrynames.h
32-
mapcodelib/mapcode_countrynames_short.h
33-
mapcodelib/mapcode_fast_encode.h
34-
mapcodelib/mapcode_fastalpha.h
35-
mapcodelib/mapcode_territory_alphabets.h
36-
mapcodelib/mapcoder.c
37-
mapcodelib/mapcoder.h
38-
unittest/decode_test.h
39-
unittest/test_territories.c
40-
unittest/unittest.c
41-
utility/mapcode.cpp)
46+
set(SOURCE_FILES_MAPCODELIB
47+
mapcodelib/internal_data.h
48+
mapcodelib/internal_alphabet_recognizer.h
49+
mapcodelib/internal_iso3166_data.h
50+
mapcodelib/internal_territory_alphabets.h
51+
mapcodelib/internal_territory_names_english.h
52+
mapcodelib/internal_territory_names_local.h
53+
mapcodelib/internal_territory_search.h
54+
mapcodelib/mapcode_alphabets.h
55+
mapcodelib/mapcode_legacy.c
56+
mapcodelib/mapcode_legacy.h
57+
mapcodelib/mapcode_territories.h
58+
mapcodelib/mapcoder.c
59+
mapcodelib/mapcoder.h)
4260

4361
set(SOURCE_FILES_UNITTEST
62+
unittest/decode_test.h
4463
unittest/unittest.c)
4564

4665
set(SOURCE_FILES_UTILITY
4766
utility/mapcode.cpp)
4867

49-
add_executable(fullset ${SOURCE_FILES})
68+
add_library(mapcodelib ${SOURCE_FILES_MAPCODELIB})
69+
target_include_directories(mapcodelib PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
5070

5171
add_executable(unittest ${SOURCE_FILES_UNITTEST})
72+
target_link_libraries(unittest LINK_PUBLIC mapcodelib)
5273

5374
add_executable(mapcode ${SOURCE_FILES_UTILITY})
75+
target_link_libraries(mapcode LINK_PUBLIC mapcodelib)

NOTICE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
Original C library created by Pieter Geelen. Work on Java version
22
of the Mapcode library by Rijn Buve (original port by Matthew Lowden).
33

4-
Copyright (C) 2014-2015 Stichting Mapcode Foundation (http://www.mapcode.com)
4+
Copyright (C) 2014-2016 Stichting Mapcode Foundation (http://www.mapcode.com)

README.md

Lines changed: 33 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
**Latest stable release: https://github.com/mapcode-foundation/mapcode-cpp/releases**
1111

12-
# The C/C++ Library: `mapcodelib/`
12+
## The C/C++ Library: `mapcodelib/`
1313

1414
The directory 'mapcodelib' contains the files:
1515

@@ -45,7 +45,7 @@ In that case, basics.h will state a version number of the for:
4545
where "xxx" states the geographical limitation.
4646

4747

48-
# A Real-Life Example, The 'mapcode' Codec Tool: `utility/`
48+
## A Real-Life Example, The 'mapcode' Codec Tool: `utility/`
4949

5050
The directory 'utility' contains a Mapcode encoding/decoding utility, as an example
5151
of how to use the library.
@@ -61,8 +61,8 @@ decode Mapcodes.
6161

6262
This produces the following help text:
6363

64-
MAPCODE (version 2.4.0)
65-
Copyright (C) 2014-2015 Stichting Mapcode Foundation
64+
MAPCODE (version 2.4.1)
65+
Copyright (C) 2014-2016 Stichting Mapcode Foundation
6666

6767
Usage:
6868
./mapcode [-d| --decode] <default-territory> <mapcode> [<mapcode> ...]
@@ -121,15 +121,38 @@ This produces the following help text:
121121
The result code is 0 when no error occurred, 1 if an input error occurred and 2
122122
if an internal error occurred.
123123

124-
If you use **Microsoft Visual C++**, you may need to add the following defines to your preprocessor
125-
settings:
124+
## Compile Options for Microsoft Visual C++
126125

127-
NO_POSIX_THREADS
128-
_CRT_SECURE_NO_WARNINGS
129-
_CRT_NONSTDC_NO_DEPRECATE
126+
If you use **Microsoft Visual C++**, you may need to add the following compiler directives to your build:
130127

128+
-DNO_POSIX_THREADS
129+
-D_CRT_SECURE_NO_WARNINGS
130+
-D_CRT_NONSTDC_NO_DEPRECATE
131131

132-
# Release Notes
132+
## Reducing the Footprint of the Mapcode Library
133+
134+
The Mapcode C/C++ Library has includes a number of fixed data tables, which increase its footprint.
135+
You may not require all of this data, so we've added some options for you to be able to reduce its
136+
footprint, for example for embedded applications.
137+
138+
## Release Notes
139+
140+
### 2.5.0
141+
142+
* Added support for getting territory names in English and local alphabets.
143+
144+
* Added much improved unit test scripts to run `gprof`, `valgrind`, the CLang address sanitize
145+
and compare the output of the new library with and older version.
146+
147+
### 2.4.1
148+
149+
* Renamed `.h` files to `internal_*.h` unless they are relevant to the interface.
150+
151+
* Turned territories, alphabets and error codes into enums.
152+
153+
* Split off legacy stuff into `mapcode_legacy.h`.
154+
155+
* Added `convertUtf8ToUtf16`, `convertUtf16ToUtf8`, `recognizeAlphabetUtf8`, `recogniseAlphabetUtf16`.
133156

134157
### 2.4.0
135158

docs/mapcode_library_c.docx

-366 Bytes
Binary file not shown.

docs/mapcode_library_c.pdf

39.7 KB
Binary file not shown.

0 commit comments

Comments
 (0)