mirror of
https://github.com/ashinn/chibi-scheme.git
synced 2025-05-21 22:59:16 +02:00
Merge pull request #443 from okuoku/win32-cmake
Win32: Visual Studio 2017 support using CMake
This commit is contained in:
commit
8111f17825
6 changed files with 320 additions and 225 deletions
251
CMakeLists.txt
Normal file
251
CMakeLists.txt
Normal file
|
@ -0,0 +1,251 @@
|
|||
#
|
||||
# FIXME: This CMakeLists.txt is only for Win32 platforms for now
|
||||
#
|
||||
|
||||
cmake_minimum_required(VERSION 2.8.7)
|
||||
project(chibi-scheme)
|
||||
|
||||
include(CheckIncludeFile)
|
||||
|
||||
if(APPLE)
|
||||
message(FATAL_ERROR
|
||||
"DYLD platforms are not supported with this CMakeLists.txt. Use Makefile instead.")
|
||||
endif()
|
||||
|
||||
if(UNIX)
|
||||
message(FATAL_ERROR
|
||||
"UNIX platforms are not supported with this CMakeLists.txt. Use Makefile instead.")
|
||||
endif()
|
||||
|
||||
#
|
||||
# Features
|
||||
#
|
||||
|
||||
check_include_file(poll.h HAVE_POLL_H)
|
||||
check_include_file(stdint.h HAVE_STDINT_H)
|
||||
# option(CHIBI_SCHEME_USE_DL "Use dynamic loading" ON)
|
||||
set(CHIBI_SCHEME_USE_DL OFF)
|
||||
|
||||
if(CHIBI_SCHEME_USE_DL)
|
||||
add_definitions(-DSEXP_USE_DL=1)
|
||||
else()
|
||||
add_definitions(-DSEXP_USE_DL=0)
|
||||
endif()
|
||||
|
||||
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
if(MSVC)
|
||||
# On MSVC, SEXP_64_BIT is not supported for now (#438)
|
||||
add_definitions(-DSEXP_64_BIT=0)
|
||||
else()
|
||||
add_definitions(-DSEXP_64_BIT=1)
|
||||
endif()
|
||||
elseif(CMAKE_SIZEOF_VOID_P EQUAL 4)
|
||||
add_definitions(-DSEXP_64_BIT=0)
|
||||
endif()
|
||||
|
||||
if(HAVE_STDINT_H)
|
||||
add_definitions(-DSEXP_USE_INTTYPES=1)
|
||||
endif()
|
||||
|
||||
if(NOT HAVE_POLL_H)
|
||||
# Disable green threads: It depends on non-blocking I/O
|
||||
add_definitions(-DSEXP_USE_GREEN_THREADS=0)
|
||||
endif()
|
||||
|
||||
set(chibi-scheme-exclude-modules)
|
||||
if(WIN32)
|
||||
add_definitions(-DBUILDING_DLL)
|
||||
set(chibi-scheme-exclude-modules
|
||||
# Following modules are not compatible with Win32
|
||||
lib/chibi/net.sld
|
||||
lib/chibi/process.sld
|
||||
lib/chibi/stty.sld
|
||||
lib/chibi/system.sld
|
||||
lib/chibi/time.sld)
|
||||
endif()
|
||||
|
||||
#
|
||||
# Sources
|
||||
#
|
||||
|
||||
set(chibi-scheme-srcs
|
||||
# SEXP
|
||||
gc.c
|
||||
sexp.c
|
||||
bignum.c
|
||||
gc_heap.c
|
||||
|
||||
# Eval
|
||||
opcodes.c
|
||||
vm.c
|
||||
eval.c
|
||||
simplify.c)
|
||||
|
||||
include_directories(
|
||||
include
|
||||
${CMAKE_CURRENT_BINARY_DIR}/include)
|
||||
|
||||
#
|
||||
# Bootstrap
|
||||
#
|
||||
|
||||
add_executable(chibi-scheme-bootstrap
|
||||
${chibi-scheme-srcs}
|
||||
main.c)
|
||||
|
||||
if(WIN32)
|
||||
target_link_libraries(chibi-scheme-bootstrap ws2_32)
|
||||
endif()
|
||||
|
||||
if(CYGWIN OR WIN32)
|
||||
set(soext ".dll")
|
||||
else()
|
||||
set(soext ".so")
|
||||
endif()
|
||||
|
||||
#
|
||||
# Generate modules
|
||||
#
|
||||
|
||||
# FIXME: Currently, it depends on GLOB thus we have to re-run CMake
|
||||
# when we've gotten additional/removed library
|
||||
|
||||
file(GLOB_RECURSE stubs RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}/lib
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/lib/*.stub)
|
||||
file(GLOB_RECURSE slds RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/lib/*.sld)
|
||||
list(REMOVE_ITEM slds ${chibi-scheme-exclude-modules})
|
||||
|
||||
set(chibi-ffi ${CMAKE_CURRENT_SOURCE_DIR}/tools/chibi-ffi)
|
||||
set(chibi-genstatic ${CMAKE_CURRENT_SOURCE_DIR}/tools/chibi-genstatic)
|
||||
|
||||
set(stuboutdir ${CMAKE_CURRENT_BINARY_DIR}/stubs/lib)
|
||||
foreach(e ${stubs})
|
||||
get_filename_component(stubdir ${e} PATH)
|
||||
get_filename_component(basename ${e} NAME_WE)
|
||||
set(stubfile ${CMAKE_CURRENT_SOURCE_DIR}/lib/${e})
|
||||
set(stubdir ${stuboutdir}/${stubdir})
|
||||
set(stubout ${stubdir}/${basename}.c)
|
||||
file(MAKE_DIRECTORY ${stubdir})
|
||||
add_custom_command(OUTPUT ${stubout}
|
||||
COMMAND chibi-scheme-bootstrap
|
||||
${chibi-ffi} ${stubfile} ${stubout}
|
||||
DEPENDS ${stubfile} ${chibi-ffi}
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
list(APPEND stubouts ${stubout})
|
||||
endforeach()
|
||||
add_custom_target(chibi-scheme-stubs DEPENDS ${stubouts})
|
||||
|
||||
#
|
||||
# Generate clib.c for SEXP_USE_STATIC_LIBS
|
||||
#
|
||||
|
||||
string(REPLACE ";" "\n" genstatic-input "${slds}")
|
||||
set(clibin ${CMAKE_CURRENT_BINARY_DIR}/clib-in.txt)
|
||||
set(clibout ${CMAKE_CURRENT_BINARY_DIR}/clib.c)
|
||||
set(genstatic-helper
|
||||
${CMAKE_CURRENT_LIST_DIR}/contrib/chibi-genstatic-helper.cmake)
|
||||
file(WRITE ${clibin} "${genstatic-input}")
|
||||
|
||||
add_custom_command(OUTPUT ${clibout}
|
||||
COMMAND
|
||||
${CMAKE_COMMAND}
|
||||
-DEXEC=$<TARGET_FILE:chibi-scheme-bootstrap>
|
||||
-DGENSTATIC=${chibi-genstatic}
|
||||
-DSTUBS=${clibin}
|
||||
-DOUT=${clibout}
|
||||
-P ${genstatic-helper}
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
DEPENDS
|
||||
chibi-scheme-bootstrap
|
||||
${chibi-genstatic}
|
||||
${genstatic-helper}
|
||||
${slds})
|
||||
|
||||
#
|
||||
# Interpreter
|
||||
#
|
||||
|
||||
include_directories(
|
||||
.
|
||||
${stuboutdir}/..)
|
||||
add_executable(chibi-scheme
|
||||
${chibi-scheme-srcs}
|
||||
${clibout}
|
||||
main.c)
|
||||
|
||||
set_target_properties(chibi-scheme
|
||||
PROPERTIES COMPILE_DEFINITIONS "SEXP_USE_STATIC_LIBS=1")
|
||||
|
||||
add_dependencies(chibi-scheme chibi-scheme-stubs)
|
||||
|
||||
if(WIN32)
|
||||
target_link_libraries(chibi-scheme ws2_32)
|
||||
endif()
|
||||
|
||||
#
|
||||
# Generate "chibi/install.h"
|
||||
#
|
||||
|
||||
if(CYGWIN OR WIN32)
|
||||
set(thePrefix "bin")
|
||||
else()
|
||||
set(thePrefix "lib")
|
||||
endif()
|
||||
|
||||
if(WIN32)
|
||||
set(pathsep "\\;")
|
||||
else()
|
||||
set(pathsep ":")
|
||||
endif()
|
||||
|
||||
if(WIN32)
|
||||
set(platform "windows")
|
||||
else()
|
||||
set(platform "unknown")
|
||||
endif()
|
||||
|
||||
file(READ ${CMAKE_CURRENT_SOURCE_DIR}/RELEASE release)
|
||||
string(STRIP ${release} release)
|
||||
|
||||
file(READ ${CMAKE_CURRENT_SOURCE_DIR}/VERSION version)
|
||||
string(STRIP ${version} version)
|
||||
set(version "${version}-cmake")
|
||||
|
||||
set(default_module_path
|
||||
""
|
||||
#"${CMAKE_INSTALL_PREFIX}/${thePrefix}${pathsep}${CMAKE_INSTALL_PREFIX}/bin"
|
||||
)
|
||||
|
||||
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/include/chibi)
|
||||
|
||||
file(WRITE
|
||||
${CMAKE_CURRENT_BINARY_DIR}/include/chibi/install.h
|
||||
"#define sexp_so_extension \"${soext}\"
|
||||
#define sexp_default_module_path \"${default_module_path}\"
|
||||
#define sexp_platform \"${platform}\"
|
||||
#define sexp_version \"\"
|
||||
#define sexp_release_name \"${release}\"")
|
||||
|
||||
#
|
||||
# Testing
|
||||
#
|
||||
|
||||
enable_testing()
|
||||
|
||||
set(chibi-scheme-tests
|
||||
r7rs-tests
|
||||
## Not connected
|
||||
#division-tests
|
||||
#r5rs-tests
|
||||
#syntax-tests
|
||||
#unicode-tests
|
||||
## Require threads
|
||||
# lib-tests
|
||||
)
|
||||
|
||||
foreach(e ${chibi-scheme-tests})
|
||||
add_test(NAME "${e}"
|
||||
COMMAND chibi-scheme tests/${e}.scm
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
endforeach()
|
51
appveyor.yml
51
appveyor.yml
|
@ -1,19 +1,46 @@
|
|||
image: Visual Studio 2017
|
||||
|
||||
environment:
|
||||
matrix:
|
||||
- ARCH: x64
|
||||
TOOLCHAIN: MinGW
|
||||
BUILDSYSTEM: MSYS2
|
||||
- ARCH: x64
|
||||
TOOLCHAIN: MSYS
|
||||
BUILDSYSTEM: MSYS2
|
||||
- ARCH: x86
|
||||
- ARCH: msys
|
||||
TOOLCHAIN: MinGW
|
||||
BUILDSYSTEM: MSYS2
|
||||
- ARCH: x86
|
||||
TOOLCHAIN: MinGW
|
||||
BUILDSYSTEM: CMAKE
|
||||
- ARCH: x86
|
||||
TOOLCHAIN: MSVC
|
||||
BUILDSYSTEM: CMAKE
|
||||
|
||||
install:
|
||||
- if %BUILDSYSTEM%.==CMAKE. cinst ninja
|
||||
- if %BUILDSYSTEM%.==CMAKE. set PATH=c:/tools/ninja;%PATH%
|
||||
- if %TOOLCHAIN%.==MSVC. call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars32.bat"
|
||||
|
||||
before_build:
|
||||
- set BUILDTYPE= %ARCH%%TOOLCHAIN%
|
||||
- if %BUILDTYPE%.==x64MinGW. set PATH=c:\msys64\usr\bin;c:\msys64\mingw64\bin;%PATH%
|
||||
- if %BUILDTYPE%.==x86MinGW. set PATH=c:\msys64\usr\bin;c:\msys64\mingw32\bin;%PATH%
|
||||
- if %BUILDTYPE%.==x64MSYS. set PATH=c:\msys64\usr\bin;%PATH%
|
||||
- if %BUILDTYPE%.==x64MinGW. set CC=c:/msys64/mingw64/bin/gcc
|
||||
- if %BUILDTYPE%.==x86MinGW. set CC=c:/msys64/mingw32/bin/gcc
|
||||
- if %BUILDTYPE%.==x64MSYS. set CC=gcc
|
||||
- if %TOOLCHAIN%.==MSVC. set CC=cl.exe
|
||||
- if %TOOLCHAIN%%BUILDSYSTEM%.==MinGWMSYS2. set EXARG=EXCLUDE_POSIX_LIBS=1
|
||||
- if %TOOLCHAIN%%BUILDSYSTEM%.==MSYSMSYS2. set EXARG=PLATFORM=msys
|
||||
- if %BUILDSYSTEM%.==CMAKE. cmake -G Ninja .
|
||||
|
||||
build_script:
|
||||
- if %ARCH%.==x64. set PATH=c:\msys64\usr\bin;c:\msys64\mingw64\bin;%PATH%
|
||||
- if %ARCH%.==x86. set PATH=c:\msys64\usr\bin;c:\msys64\mingw32\bin;%PATH%
|
||||
- if %ARCH%.==msys. set PATH=c:\msys64\usr\bin;%PATH%
|
||||
- if %ARCH%.==x64. set CC=c:/msys64/mingw64/bin/gcc
|
||||
- if %ARCH%.==x86. set CC=c:/msys64/mingw32/bin/gcc
|
||||
- if %ARCH%.==msys. set CC=gcc
|
||||
- if %ARCH%.==x64. set EXARG=EXCLUDE_POSIX_LIBS=1
|
||||
- if %ARCH%.==x86. set EXARG=EXCLUDE_POSIX_LIBS=1
|
||||
- if %ARCH%.==msys. set EXARG=PLATFORM=msys
|
||||
- make CC=%CC% %EXARG%
|
||||
- make CC=%CC% %EXARG% test
|
||||
- if %BUILDSYSTEM%.==MSYS2. make CC=%CC% %EXARG%
|
||||
- if %BUILDSYSTEM%.==CMAKE. ninja
|
||||
|
||||
test_script:
|
||||
- if %BUILDSYSTEM%.==MSYS2. make CC=%CC% %EXARG% test
|
||||
- if %BUILDSYSTEM%.==CMAKE. ctest --verbose .
|
||||
|
||||
|
|
|
@ -1,206 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="9.00"
|
||||
Name="chibi-scheme"
|
||||
ProjectGUID="{38DC39DA-5328-4FFE-84E2-E16FF1864945}"
|
||||
RootNamespace="chibi-scheme"
|
||||
Keyword="Win32Proj"
|
||||
TargetFrameworkVersion="0"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="Debug"
|
||||
IntermediateDirectory="Debug"
|
||||
ConfigurationType="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="include"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;CHIBISCHEME_EXPORTS"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="4"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
LinkIncremental="2"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="2"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="Release"
|
||||
IntermediateDirectory="Release"
|
||||
ConfigurationType="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;CHIBISCHEME_EXPORTS;"
|
||||
RuntimeLibrary="2"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
LinkIncremental="2"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="2"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
|
||||
>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Resource Files"
|
||||
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
|
||||
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
|
||||
>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\eval.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\main.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\sexp.c"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions="-DPLATFORM=mingw;-DSEXP_USE_STRING_STREAMS=0;-DSEXP_USE_DEBUG=0;-DSEXP_USE_DL=0;-DBUILDING_DLL"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
27
contrib/chibi-genstatic-helper.cmake
Normal file
27
contrib/chibi-genstatic-helper.cmake
Normal file
|
@ -0,0 +1,27 @@
|
|||
#
|
||||
# chibi-genstatic-helper.cmake
|
||||
#
|
||||
# INPUT:
|
||||
# ROOT=<DIR>
|
||||
# EXEC=<EXECUTABLE>
|
||||
# GENSTATIC=<FILE>
|
||||
# STUBS=<FILE>
|
||||
# OUT=<FILE>
|
||||
if(NOT EXEC)
|
||||
message(FATAL_ERROR "huh?")
|
||||
endif()
|
||||
|
||||
if(NOT OUT)
|
||||
message(FATAL_ERROR "huh?")
|
||||
endif()
|
||||
|
||||
execute_process(
|
||||
COMMAND ${EXEC} ${GENSTATIC} --no-inline
|
||||
INPUT_FILE ${STUBS}
|
||||
OUTPUT_FILE ${OUT}
|
||||
RESULT_VARIABLE rr
|
||||
)
|
||||
|
||||
if(rr)
|
||||
message(FATAL_ERROR "Error: ${rr}")
|
||||
endif()
|
|
@ -773,16 +773,12 @@
|
|||
#define SHUT_RD 0 /* SD_RECEIVE */
|
||||
#define SHUT_WR 1 /* SD_SEND */
|
||||
#define SHUT_RDWR 2 /* SD_BOTH */
|
||||
#if !defined(__MINGW32__) && !defined(__MINGW64__)
|
||||
#define strcasecmp lstrcmpi
|
||||
#define strncasecmp(s1, s2, n) lstrcmpi(s1, s2)
|
||||
#endif
|
||||
#include <shlwapi.h>
|
||||
#define strcasestr StrStrI
|
||||
#ifdef _MSC_VER
|
||||
#define _CRT_SECURE_NO_WARNINGS 1
|
||||
#define _CRT_NONSTDC_NO_DEPRECATE 1
|
||||
#define _USE_MATH_DEFINES /* For M_LN10 */
|
||||
#define strcasecmp _stricmp
|
||||
#define strncasecmp _strnicmp
|
||||
#pragma warning(disable:4146) /* unary minus operator to unsigned type */
|
||||
#if _MSC_VER < 1900
|
||||
#define snprintf(buf, len, fmt, val) sprintf(buf, fmt, val)
|
||||
|
|
2
sexp.c
2
sexp.c
|
@ -3226,7 +3226,7 @@ sexp sexp_read_raw (sexp ctx, sexp in, sexp *shares) {
|
|||
else if (strcasecmp(str+1, "nan.0") == 0)
|
||||
res = sexp_make_flonum(ctx, sexp_nan);
|
||||
#if SEXP_USE_COMPLEX
|
||||
else if (strcasestr(str+1, "inf.0") == str+1) {
|
||||
else if (strncasecmp(str+1, "inf.0", 5) == 0) {
|
||||
tmp = sexp_make_flonum(ctx, c1 == '+' ? sexp_pos_infinity : sexp_neg_infinity);
|
||||
if (str[6] == 0) {
|
||||
res = tmp;
|
||||
|
|
Loading…
Add table
Reference in a new issue