Merge branch 'master' into lieu_api

This commit is contained in:
Al
2017-12-26 10:47:29 -05:00
6 changed files with 8090 additions and 8090 deletions

View File

@@ -1,30 +1,55 @@
version: 1.0.{build}
image: Visual Studio 2015
platform: x64
branches:
only:
- master
environment:
matrix:
- COMPILER: msys2
PLATFORM: x64
MSYS2_ARCH: x86_64
MSYS2_DIR: msys64
MSYSTEM: MINGW64
BIT: 64
build_script:
- '%APPVEYOR_BUILD_FOLDER%\win_build.bat'
test_script:
- '%APPVEYOR_BUILD_FOLDER%\test\test_libpostal.exe'
after_build:
- 7z a libpostal.zip %APPVEYOR_BUILD_FOLDER%\libpostal.dll %APPVEYOR_BUILD_FOLDER%\libpostal.def %APPVEYOR_BUILD_FOLDER%\libpostal.exp %APPVEYOR_BUILD_FOLDER%\libpostal.lib %APPVEYOR_BUILD_FOLDER%\src\libpostal.h
artifacts:
- path: libpostal.zip
name: libpostal
version: 1.0.{build}
image: Visual Studio 2015
skip_branch_with_pr: true
environment:
matrix:
- COMPILER: msys2
PLATFORM: x86
MSYS2_ARCH: x86
MSYS2_DIR: msys64
MSYSTEM: MINGW32
BIT: 32
- COMPILER: msys2
PLATFORM: x64
MSYS2_ARCH: x86_64
MSYS2_DIR: msys64
MSYSTEM: MINGW64
BIT: 64
build_script:
- cmd: cd %APPVEYOR_BUILD_FOLDER%
- ps: |
Write-Host "Compiler: $Env:COMPILER"
Write-Host "Architecture: $Env:MSYS2_ARCH"
Write-Host "Platform: $Env:PLATFORM"
Write-Host "MSYS2 Directory: $Env:MSYS2_DIR"
Write-Host "MSYS2 System: $Env:MSYSTEM"
if ($Env:COMPILER -eq "msys2") {
$Env:Path = "C:\$Env:MSYS2_DIR\$Env:MSYSTEM\bin;C:\$Env:MSYS2_DIR\usr\bin;$Env:Path"
$Env:WDIR = $Env:APPVEYOR_BUILD_FOLDER -replace "\\", "/"
bash -lc "cd $Env:WDIR && cp -rf ./windows/* ./"
bash -lc "cd $Env:WDIR && ./bootstrap.sh"
bash -lc "cd $Env:WDIR && ./configure --datadir=/c"
bash -lc "cd $Env:WDIR && make -j4"
bash -lc "cd $Env:WDIR && make check"
bash -lc "cd $Env:WDIR && cp src/.libs/libpostal-*.dll libpostal.dll"
& 'C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\lib.exe' /def:libpostal.def /out:libpostal.lib /machine:$Env:PLATFORM
if ($Env:BIT -eq "32") {
$Paths = @(
(Join-Path $Env:APPVEYOR_BUILD_FOLDER "src"),
(Join-Path $Env:APPVEYOR_BUILD_FOLDER "src\.libs"),
(Join-Path $Env:APPVEYOR_BUILD_FOLDER "test"),
(Join-Path $Env:APPVEYOR_BUILD_FOLDER "test\.libs"))
Get-ChildItem -Path $Paths | ?{ $_.Name -Match '\.(exe|dll)$' } | % { & 'C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\editbin.exe' /NOLOGO /LARGEADDRESSAWARE $_.FullName }
}
7z a libpostal.zip $Env:APPVEYOR_BUILD_FOLDER\libpostal.dll $Env:APPVEYOR_BUILD_FOLDER\libpostal.def $Env:APPVEYOR_BUILD_FOLDER\libpostal.exp $Env:APPVEYOR_BUILD_FOLDER\libpostal.lib $Env:APPVEYOR_BUILD_FOLDER\src\libpostal.h
}
test_script:
- '%APPVEYOR_BUILD_FOLDER%\test\test_libpostal.exe'
artifacts:
- path: libpostal.zip
name: libpostal

View File

@@ -30,6 +30,7 @@ maine|me
manitoba|mb
maryland|md
massachusetts|ma
melbourne|melb
michigan|mi
minnesota|mn
mississippi|ms
@@ -76,4 +77,4 @@ west virginia|wv
western australia|wa
wisconsin|wi
wyoming|wy
yukon|yt|the yukon|yukon territory
yukon|yt|the yukon|yukon territory

File diff suppressed because it is too large Load Diff

View File

@@ -1770,6 +1770,10 @@ libpostal_address_parser_response_t *address_parser_parse(char *address, char *l
token_array_destroy(tokens);
tokenized_string_destroy(tokenized_str);
if (is_normalized) {
free(normalized);
}
return response;
}
}

View File

@@ -17,48 +17,39 @@
#define __FILENAME__ (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__)
#if LOG_LEVEL > LOG_LEVEL_DEBUG
#define NO_DEBUG 1
#endif
#ifdef NO_DEBUG
/* compile with all debug messages removed */
#define log_debug(M, ...) do { if (0) fprintf(stderr, "\33[34mDEBUG\33[39m " M " \33[90m at %s (%s:%d) \33[39m\n", ##__VA_ARGS__, __func__, __FILE__, __LINE__); } while (0)
#else
#ifdef LOG_NO_COLORS
#define log_debug(M, ...) fprintf(stderr, "DEBUG " M " at %s (%s:%d) \n", ##__VA_ARGS__, __func__, __FILE__, __LINE__)
#else
#define log_debug(M, ...) fprintf(stderr, "\33[34mDEBUG\33[39m " M " \33[90m at %s (%s:%d) \33[39m\n", ##__VA_ARGS__, __func__, __FILE__, __LINE__)
#endif /* NOCOLORS */
#endif /* NDEBUG */
/* safe readable version of errno */
#define clean_errno() (errno == 0 ? "None" : strerror(errno))
#ifdef LOG_NO_COLORS
#define log_error(M, ...) fprintf(stderr, "ERR " M " at %s (%s:%d) errno:%s\n", ##__VA_ARGS__, __func__, __FILE__, __LINE__, clean_errno())
#define log_warn(M, ...) fprintf(stderr, "WARN " M " at %s (%s:%d) errno:%s\n", ##__VA_ARGS__, __func__, __FILE__, __LINE__, clean_errno())
#define log_info(M, ...) fprintf(stderr, "INFO " M " at %s (%s:%d)\n", ##__VA_ARGS__, __func__, __FILENAME__, __LINE__)
#if defined (LOG_NO_COLORS) || defined (_WIN32)
#define log_error(M, ...) fprintf(stderr, "ERR " M " at %s (%s:%d) errno:%s\n", ##__VA_ARGS__, __func__, __FILE__, __LINE__, clean_errno())
#define log_warn(M, ...) fprintf(stderr, "WARN " M " at %s (%s:%d) errno:%s\n", ##__VA_ARGS__, __func__, __FILE__, __LINE__, clean_errno())
#define log_info(M, ...) fprintf(stderr, "INFO " M " at %s (%s:%d)\n", ##__VA_ARGS__, __func__, __FILENAME__, __LINE__)
#define log_debug(M, ...) fprintf(stderr, "DEBUG " M " at %s (%s:%d)\n", ##__VA_ARGS__, __func__, __FILE__, __LINE__)
#else
#define log_error(M, ...) fprintf(stderr, "\33[31mERR\33[39m " M " \33[90m at %s (%s:%d) \33[94merrno: %s\33[39m\n", ##__VA_ARGS__, __func__, __FILE__, __LINE__, clean_errno())
#define log_warn(M, ...) fprintf(stderr, "\33[91mWARN\33[39m " M " \33[90m at %s (%s:%d) \33[94merrno: %s\33[39m\n", ##__VA_ARGS__, __func__, __FILE__, __LINE__, clean_errno())
#define log_info(M, ...) fprintf(stderr, "\33[32mINFO\33[39m " M " \33[90m at %s (%s:%d) \33[39m\n", ##__VA_ARGS__, __func__, __FILENAME__, __LINE__)
#define log_error(M, ...) fprintf(stderr, "\33[31mERR\33[39m " M " \33[90m at %s (%s:%d) \33[94merrno: %s\33[39m\n", ##__VA_ARGS__, __func__, __FILE__, __LINE__, clean_errno())
#define log_warn(M, ...) fprintf(stderr, "\33[91mWARN\33[39m " M " \33[90m at %s (%s:%d) \33[94merrno: %s\33[39m\n", ##__VA_ARGS__, __func__, __FILE__, __LINE__, clean_errno())
#define log_info(M, ...) fprintf(stderr, "\33[32mINFO\33[39m " M " \33[90m at %s (%s:%d) \33[39m\n", ##__VA_ARGS__, __func__, __FILENAME__, __LINE__)
#define log_debug(M, ...) fprintf(stderr, "\33[34mDEBUG\33[39m " M " \33[90m at %s (%s:%d) \33[39m\n", ##__VA_ARGS__, __func__, __FILE__, __LINE__)
#endif /* NOCOLORS */
#if LOG_LEVEL > LOG_LEVEL_INFO
#undef log_info
#define log_info(M, ...) do { if (0) fprintf(stderr, "\33[31mERR\33[39m " M " \33[90m at %s (%s:%d) \33[94merrno: %s\33[39m\n", ##__VA_ARGS__, __func__, __FILE__, __LINE__, clean_errno()); } while(0)
#if LOG_LEVEL > LOG_LEVEL_ERROR
#undef log_error
#define log_error(M, ...) do { if (0) fprintf(stderr, "\33[31mERR\33[39m " M " \33[90m at %s (%s:%d) \33[94merrno: %s\33[39m\n", ##__VA_ARGS__, __func__, __FILE__, __LINE__, clean_errno()); } while(0)
#endif
#if LOG_LEVEL > LOG_LEVEL_WARN
#undef log_warn
#define log_warn(M, ...) do { if (0) fprintf(stderr, "\33[91mWARN\33[39m " M " \33[90m at %s (%s:%d) \33[94merrno: %s\33[39m\n", ##__VA_ARGS__, __func__, __FILE__, __LINE__, clean_errno()); } while (0)
#define log_warn(M, ...) do { if (0) fprintf(stderr, "\33[91mWARN\33[39m " M " \33[90m at %s (%s:%d) \33[94merrno: %s\33[39m\n", ##__VA_ARGS__, __func__, __FILE__, __LINE__, clean_errno()); } while (0)
#endif
#if LOG_LEVEL > LOG_LEVEL_ERROR
#undef log_error
#define log_error(M, ...) do { if (0) fprintf(stderr, "\33[32mINFO\33[39m " M " \33[90m at %s (%s:%d) \33[39m\n", ##__VA_ARGS__, __func__, __FILENAME__, __LINE__); } while (0)
#if LOG_LEVEL > LOG_LEVEL_INFO
#undef log_info
#define log_info(M, ...) do { if (0) fprintf(stderr, "\33[32mINFO\33[39m " M " \33[90m at %s (%s:%d) \33[39m\n", ##__VA_ARGS__, __func__, __FILENAME__, __LINE__); } while (0)
#endif
#if LOG_LEVEL > LOG_LEVEL_DEBUG
#undef log_debug
#define log_debug(M, ...) do { if (0) fprintf(stderr, "\33[34mDEBUG\33[39m " M " \33[90m at %s (%s:%d) \33[39m\n", ##__VA_ARGS__, __func__, __FILE__, __LINE__); } while (0)
#endif
#endif //LOG_H

View File

@@ -1,24 +0,0 @@
@echo off
cd %APPVEYOR_BUILD_FOLDER%
echo Compiler: %COMPILER%
echo Architecture: %MSYS2_ARCH%
echo Platform: %PLATFORM%
echo MSYS2 directory: %MSYS2_DIR%
echo MSYS2 system: %MSYSTEM%
echo Configuration: %CONFIGURATION%
echo Bits: %BIT%
IF %COMPILER%==msys2 (
@echo on
SET "PATH=C:\%MSYS2_DIR%\%MSYSTEM%\bin;C:\%MSYS2_DIR%\usr\bin;%PATH%"
bash -lc "cd $APPVEYOR_BUILD_FOLDER && cp -rf windows/* ./"
bash -lc "cd $APPVEYOR_BUILD_FOLDER && ./bootstrap.sh"
bash -lc "cd $APPVEYOR_BUILD_FOLDER && ./configure --datadir=/c"
bash -lc "cd $APPVEYOR_BUILD_FOLDER && make -j4"
bash -lc "cd $APPVEYOR_BUILD_FOLDER && make install"
bash -lc "cd $APPVEYOR_BUILD_FOLDER && cp src/.libs/libpostal-*.dll libpostal.dll"
"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\lib.exe" /def:libpostal.def /out:libpostal.lib /machine:x64
)