Merge with hotfix

This commit is contained in:
kervala 2015-02-14 14:32:44 +01:00
commit 2dc4804c22
44 changed files with 611 additions and 383 deletions

View file

@ -26,63 +26,46 @@ IF(TARGET_CPU STREQUAL "armv7")
SET(LIBRARY_ARCHITECTURE "armeabi-v7a") SET(LIBRARY_ARCHITECTURE "armeabi-v7a")
SET(CMAKE_SYSTEM_PROCESSOR "armv7") SET(CMAKE_SYSTEM_PROCESSOR "armv7")
SET(TOOLCHAIN_ARCH "arm") SET(TOOLCHAIN_ARCH "arm")
SET(TOOLCHAIN_PREFIX "arm-linux-androideabi") SET(GCC_TOOLCHAIN_PREFIX "arm-linux-androideabi")
SET(TOOLCHAIN_BIN_PREFIX "arm") SET(TOOLCHAIN_BIN_PREFIX "arm")
SET(MINIMUM_NDK_TARGET 4) SET(MINIMUM_NDK_TARGET 4)
ELSEIF(TARGET_CPU STREQUAL "armv5") ELSEIF(TARGET_CPU STREQUAL "armv5")
SET(LIBRARY_ARCHITECTURE "armeabi") SET(LIBRARY_ARCHITECTURE "armeabi")
SET(CMAKE_SYSTEM_PROCESSOR "armv5") SET(CMAKE_SYSTEM_PROCESSOR "armv5")
SET(TOOLCHAIN_ARCH "arm") SET(TOOLCHAIN_ARCH "arm")
SET(TOOLCHAIN_PREFIX "arm-linux-androideabi") SET(GCC_TOOLCHAIN_PREFIX "arm-linux-androideabi")
SET(TOOLCHAIN_BIN_PREFIX "arm") SET(TOOLCHAIN_BIN_PREFIX "arm")
SET(MINIMUM_NDK_TARGET 4) SET(MINIMUM_NDK_TARGET 4)
ELSEIF(TARGET_CPU STREQUAL "x86") ELSEIF(TARGET_CPU STREQUAL "x86")
SET(LIBRARY_ARCHITECTURE "x86") SET(LIBRARY_ARCHITECTURE "x86")
SET(CMAKE_SYSTEM_PROCESSOR "x86") SET(CMAKE_SYSTEM_PROCESSOR "x86")
SET(TOOLCHAIN_ARCH "x86") SET(TOOLCHAIN_ARCH "x86")
SET(TOOLCHAIN_PREFIX "x86") SET(GCC_TOOLCHAIN_PREFIX "x86")
SET(TOOLCHAIN_BIN_PREFIX "i686") SET(TOOLCHAIN_BIN_PREFIX "i686")
SET(MINIMUM_NDK_TARGET 9) SET(MINIMUM_NDK_TARGET 9)
ELSEIF(TARGET_CPU STREQUAL "mips") ELSEIF(TARGET_CPU STREQUAL "mips")
SET(LIBRARY_ARCHITECTURE "mips") SET(LIBRARY_ARCHITECTURE "mips")
SET(CMAKE_SYSTEM_PROCESSOR "mips") SET(CMAKE_SYSTEM_PROCESSOR "mips")
SET(TOOLCHAIN_ARCH "mips") SET(TOOLCHAIN_ARCH "mips")
SET(TOOLCHAIN_PREFIX "mipsel-linux-android") SET(GCC_TOOLCHAIN_PREFIX "mipsel-linux-android")
SET(TOOLCHAIN_BIN_PREFIX "mipsel") SET(TOOLCHAIN_BIN_PREFIX "mipsel")
SET(MINIMUM_NDK_TARGET 9) SET(MINIMUM_NDK_TARGET 9)
ENDIF(TARGET_CPU STREQUAL "armv7") ENDIF(TARGET_CPU STREQUAL "armv7")
SET(ANDROID_COMPILER "GCC")
IF(NDK_TOOLCHAIN_VERSION STREQUAL "clang")
SET(ANDROID_COMPILER "clang")
SET(CLANG_TOOLCHAIN_PREFIX "llvm")
SET(CLANG ON)
ELSE()
SET(GCC_TOOLCHAIN_VERSION ${NDK_TOOLCHAIN_VERSION})
ENDIF()
IF(NOT NDK_TARGET) IF(NOT NDK_TARGET)
SET(NDK_TARGET ${MINIMUM_NDK_TARGET}) SET(NDK_TARGET ${MINIMUM_NDK_TARGET})
ENDIF(NOT NDK_TARGET) ENDIF(NOT NDK_TARGET)
FILE(GLOB _TOOLCHAIN_VERSIONS "${NDK_ROOT}/toolchains/${TOOLCHAIN_PREFIX}-*")
IF(_TOOLCHAIN_VERSIONS)
LIST(SORT _TOOLCHAIN_VERSIONS)
LIST(REVERSE _TOOLCHAIN_VERSIONS)
FOREACH(_TOOLCHAIN_VERSION ${_TOOLCHAIN_VERSIONS})
STRING(REGEX REPLACE ".+${TOOLCHAIN_PREFIX}-([0-9.]+)" "\\1" _TOOLCHAIN_VERSION "${_TOOLCHAIN_VERSION}")
IF(_TOOLCHAIN_VERSION MATCHES "^([0-9.]+)$")
LIST(APPEND NDK_TOOLCHAIN_VERSIONS ${_TOOLCHAIN_VERSION})
ENDIF(_TOOLCHAIN_VERSION MATCHES "^([0-9.]+)$")
ENDFOREACH(_TOOLCHAIN_VERSION)
ENDIF(_TOOLCHAIN_VERSIONS)
IF(NOT NDK_TOOLCHAIN_VERSIONS)
MESSAGE(FATAL_ERROR "No Android toolchain found in default search path ${NDK_ROOT}/toolchains")
ENDIF(NOT NDK_TOOLCHAIN_VERSIONS)
IF(NDK_TOOLCHAIN_VERSION)
LIST(FIND NDK_TOOLCHAIN_VERSIONS "${NDK_TOOLCHAIN_VERSION}" _INDEX)
IF(_INDEX EQUAL -1)
LIST(GET NDK_TOOLCHAIN_VERSIONS 0 NDK_TOOLCHAIN_VERSION)
ENDIF(_INDEX EQUAL -1)
ELSE(NDK_TOOLCHAIN_VERSION)
LIST(GET NDK_TOOLCHAIN_VERSIONS 0 NDK_TOOLCHAIN_VERSION)
ENDIF(NDK_TOOLCHAIN_VERSION)
MESSAGE(STATUS "Target Android NDK ${NDK_TARGET} and use GCC ${NDK_TOOLCHAIN_VERSION}")
IF(CMAKE_HOST_WIN32) IF(CMAKE_HOST_WIN32)
SET(TOOLCHAIN_HOST "windows") SET(TOOLCHAIN_HOST "windows")
SET(TOOLCHAIN_BIN_SUFFIX ".exe") SET(TOOLCHAIN_BIN_SUFFIX ".exe")
@ -94,33 +77,73 @@ ELSEIF(CMAKE_HOST_UNIX)
SET(TOOLCHAIN_BIN_SUFFIX "") SET(TOOLCHAIN_BIN_SUFFIX "")
ENDIF(CMAKE_HOST_WIN32) ENDIF(CMAKE_HOST_WIN32)
SET(TOOLCHAIN_ROOT "${NDK_ROOT}/toolchains/${TOOLCHAIN_PREFIX}-${NDK_TOOLCHAIN_VERSION}/prebuilt/${TOOLCHAIN_HOST}") MACRO(SEARCH_TOOLCHAIN _COMPILER)
SET(${_COMPILER}_TOOLCHAIN_VERSIONS)
FILE(GLOB _TOOLCHAIN_VERSIONS "${NDK_ROOT}/toolchains/${${_COMPILER}_TOOLCHAIN_PREFIX}-*")
IF(_TOOLCHAIN_VERSIONS)
LIST(SORT _TOOLCHAIN_VERSIONS)
LIST(REVERSE _TOOLCHAIN_VERSIONS)
FOREACH(_TOOLCHAIN_VERSION ${_TOOLCHAIN_VERSIONS})
STRING(REGEX REPLACE ".+${_PREFIX}-([0-9.]+)" "\\1" _TOOLCHAIN_VERSION "${_TOOLCHAIN_VERSION}")
IF(_TOOLCHAIN_VERSION MATCHES "^([0-9.]+)$")
LIST(APPEND ${_COMPILER}_TOOLCHAIN_VERSIONS ${_TOOLCHAIN_VERSION})
ENDIF()
ENDFOREACH()
ENDIF()
IF(NOT ${_COMPILER}_TOOLCHAIN_VERSIONS)
MESSAGE(FATAL_ERROR "No Android ${_COMPILER} toolchain found in default search path ${NDK_ROOT}/toolchains")
ENDIF()
IF(${_COMPILER}_TOOLCHAIN_VERSIONS)
LIST(FIND ${_COMPILER}_TOOLCHAIN_VERSIONS "${${_COMPILER}_TOOLCHAIN_VERSION}" _INDEX)
IF(_INDEX EQUAL -1)
LIST(GET ${_COMPILER}_TOOLCHAIN_VERSIONS 0 ${_COMPILER}_TOOLCHAIN_VERSION)
ENDIF()
ELSE()
LIST(GET ${_COMPILER}_TOOLCHAIN_VERSIONS 0 ${_COMPILER}_TOOLCHAIN_VERSION)
ENDIF()
SET(${_COMPILER}_TOOLCHAIN_ROOT "${NDK_ROOT}/toolchains/${${_COMPILER}_TOOLCHAIN_PREFIX}-${${_COMPILER}_TOOLCHAIN_VERSION}/prebuilt/${TOOLCHAIN_HOST}")
IF(NOT EXISTS "${${_COMPILER}_TOOLCHAIN_ROOT}")
FILE(GLOB _TOOLCHAIN_PREFIXES "${${_COMPILER}_TOOLCHAIN_ROOT}*")
IF(_TOOLCHAIN_PREFIXES)
LIST(GET _TOOLCHAIN_PREFIXES 0 ${_COMPILER}_TOOLCHAIN_ROOT)
ENDIF(_TOOLCHAIN_PREFIXES)
ENDIF()
ENDMACRO()
IF(CLANG)
SEARCH_TOOLCHAIN(CLANG)
MESSAGE(STATUS "Target Android NDK ${NDK_TARGET} and use clang ${CLANG_TOOLCHAIN_VERSION}")
ENDIF()
SEARCH_TOOLCHAIN(GCC)
MESSAGE(STATUS "Target Android NDK ${NDK_TARGET} and use GCC ${GCC_TOOLCHAIN_VERSION}")
MESSAGE(STATUS "Found Android LLVM toolchain in ${CLANG_TOOLCHAIN_ROOT}")
MESSAGE(STATUS "Found Android GCC toolchain in ${GCC_TOOLCHAIN_ROOT}")
SET(PLATFORM_ROOT "${NDK_ROOT}/platforms/android-${NDK_TARGET}/arch-${TOOLCHAIN_ARCH}") SET(PLATFORM_ROOT "${NDK_ROOT}/platforms/android-${NDK_TARGET}/arch-${TOOLCHAIN_ARCH}")
IF(NOT EXISTS "${TOOLCHAIN_ROOT}")
FILE(GLOB _TOOLCHAIN_PREFIXES "${TOOLCHAIN_ROOT}*")
IF(_TOOLCHAIN_PREFIXES)
LIST(GET _TOOLCHAIN_PREFIXES 0 TOOLCHAIN_ROOT)
ENDIF(_TOOLCHAIN_PREFIXES)
ENDIF(NOT EXISTS "${TOOLCHAIN_ROOT}")
MESSAGE(STATUS "Found Android toolchain in ${TOOLCHAIN_ROOT}")
MESSAGE(STATUS "Found Android platform in ${PLATFORM_ROOT}") MESSAGE(STATUS "Found Android platform in ${PLATFORM_ROOT}")
# include dirs # include dirs
SET(PLATFORM_INCLUDE_DIR "${PLATFORM_ROOT}/usr/include") SET(PLATFORM_INCLUDE_DIR "${PLATFORM_ROOT}/usr/include")
SET(STL_DIR "${NDK_ROOT}/sources/cxx-stl/gnu-libstdc++") SET(STL_DIR "${NDK_ROOT}/sources/cxx-stl/gnu-libstdc++")
IF(EXISTS "${STL_DIR}/${NDK_TOOLCHAIN_VERSION}") IF(EXISTS "${STL_DIR}/${GCC_TOOLCHAIN_VERSION}")
# NDK version >= 8b # NDK version >= 8b
SET(STL_DIR "${STL_DIR}/${NDK_TOOLCHAIN_VERSION}") SET(STL_DIR "${STL_DIR}/${GCC_TOOLCHAIN_VERSION}")
ENDIF(EXISTS "${STL_DIR}/${NDK_TOOLCHAIN_VERSION}") ENDIF(EXISTS "${STL_DIR}/${GCC_TOOLCHAIN_VERSION}")
# Determine bin prefix for toolchain # Determine bin prefix for toolchain
FILE(GLOB _TOOLCHAIN_BIN_PREFIXES "${TOOLCHAIN_ROOT}/bin/${TOOLCHAIN_BIN_PREFIX}-*-gcc${TOOLCHAIN_BIN_SUFFIX}") FILE(GLOB _TOOLCHAIN_BIN_PREFIXES "${GCC_TOOLCHAIN_ROOT}/bin/${TOOLCHAIN_BIN_PREFIX}-*-gcc${TOOLCHAIN_BIN_SUFFIX}")
IF(_TOOLCHAIN_BIN_PREFIXES) IF(_TOOLCHAIN_BIN_PREFIXES)
LIST(GET _TOOLCHAIN_BIN_PREFIXES 0 _TOOLCHAIN_BIN_PREFIX) LIST(GET _TOOLCHAIN_BIN_PREFIXES 0 _TOOLCHAIN_BIN_PREFIX)
STRING(REGEX REPLACE "${TOOLCHAIN_ROOT}/bin/([a-z0-9-]+)-gcc${TOOLCHAIN_BIN_SUFFIX}" "\\1" TOOLCHAIN_BIN_PREFIX "${_TOOLCHAIN_BIN_PREFIX}") STRING(REGEX REPLACE "${GCC_TOOLCHAIN_ROOT}/bin/([a-z0-9-]+)-gcc${TOOLCHAIN_BIN_SUFFIX}" "\\1" TOOLCHAIN_BIN_PREFIX "${_TOOLCHAIN_BIN_PREFIX}")
ENDIF(_TOOLCHAIN_BIN_PREFIXES) ENDIF(_TOOLCHAIN_BIN_PREFIXES)
SET(STL_INCLUDE_DIR "${STL_DIR}/include") SET(STL_INCLUDE_DIR "${STL_DIR}/include")
@ -128,22 +151,48 @@ SET(STL_LIBRARY_DIR "${STL_DIR}/libs/${LIBRARY_ARCHITECTURE}")
SET(STL_INCLUDE_CPU_DIR "${STL_LIBRARY_DIR}/include") SET(STL_INCLUDE_CPU_DIR "${STL_LIBRARY_DIR}/include")
SET(STL_LIBRARY "${STL_LIBRARY_DIR}/libgnustl_static.a") SET(STL_LIBRARY "${STL_LIBRARY_DIR}/libgnustl_static.a")
SET(CMAKE_FIND_ROOT_PATH ${TOOLCHAIN_ROOT} ${PLATFORM_ROOT}/usr ${CMAKE_PREFIX_PATH} ${CMAKE_INSTALL_PREFIX} $ENV{EXTERNAL_ANDROID_PATH} CACHE string "Android find search path root") MESSAGE(STATUS "STL include dir: ${STL_INCLUDE_DIR}")
MESSAGE(STATUS "STL library dir: ${STL_LIBRARY_DIR}")
SET(CMAKE_FIND_ROOT_PATH ${CLANG_TOOLCHAIN_ROOT} ${GCC_TOOLCHAIN_ROOT} ${PLATFORM_ROOT}/usr ${CMAKE_PREFIX_PATH} ${CMAKE_INSTALL_PREFIX} $ENV{EXTERNAL_ANDROID_PATH} CACHE string "Android find search path root")
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM ONLY) SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
INCLUDE_DIRECTORIES(${STL_INCLUDE_DIR} ${STL_INCLUDE_CPU_DIR})
MACRO(SET_TOOLCHAIN_BINARY _NAME _BINARY) MACRO(SET_TOOLCHAIN_BINARY _NAME _BINARY)
SET(${_NAME} ${TOOLCHAIN_ROOT}/bin/${TOOLCHAIN_BIN_PREFIX}-${_BINARY}${TOOLCHAIN_BIN_SUFFIX}) IF("${_BINARY}" MATCHES "clang")
SET(${_NAME} ${CLANG_TOOLCHAIN_ROOT}/bin/${_BINARY}${TOOLCHAIN_BIN_SUFFIX} CACHE PATH "" FORCE )
ELSE()
SET(${_NAME} ${GCC_TOOLCHAIN_ROOT}/bin/${TOOLCHAIN_BIN_PREFIX}-${_BINARY}${TOOLCHAIN_BIN_SUFFIX} CACHE PATH "" FORCE)
ENDIF()
ENDMACRO(SET_TOOLCHAIN_BINARY) ENDMACRO(SET_TOOLCHAIN_BINARY)
SET_TOOLCHAIN_BINARY(CMAKE_C_COMPILER gcc)
SET_TOOLCHAIN_BINARY(CMAKE_CXX_COMPILER g++)
# Force the compilers to GCC for Android # Force the compilers to GCC for Android
include (CMakeForceCompiler) include (CMakeForceCompiler)
IF(CLANG)
SET_TOOLCHAIN_BINARY(CMAKE_C_COMPILER clang)
SET_TOOLCHAIN_BINARY(CMAKE_CXX_COMPILER clang++)
CMAKE_FORCE_C_COMPILER(${CMAKE_C_COMPILER} clang)
CMAKE_FORCE_CXX_COMPILER(${CMAKE_CXX_COMPILER} clang)
MESSAGE(STATUS "Using clang compiler")
ELSE()
SET_TOOLCHAIN_BINARY(CMAKE_C_COMPILER gcc)
SET_TOOLCHAIN_BINARY(CMAKE_CXX_COMPILER g++)
CMAKE_FORCE_C_COMPILER(${CMAKE_C_COMPILER} GNU) CMAKE_FORCE_C_COMPILER(${CMAKE_C_COMPILER} GNU)
CMAKE_FORCE_CXX_COMPILER(${CMAKE_CXX_COMPILER} GNU) CMAKE_FORCE_CXX_COMPILER(${CMAKE_CXX_COMPILER} GNU)
MESSAGE(STATUS "Using GCC compiler")
ENDIF()
SET_TOOLCHAIN_BINARY(CMAKE_STRIP strip)
SET_TOOLCHAIN_BINARY(CMAKE_AR ar)
SET_TOOLCHAIN_BINARY(CMAKE_LINKER ld)
SET_TOOLCHAIN_BINARY(CMAKE_NM nm)
SET_TOOLCHAIN_BINARY(CMAKE_OBJCOPY objcopy)
SET_TOOLCHAIN_BINARY(CMAKE_OBJDUMP objdump)
SET_TOOLCHAIN_BINARY(CMAKE_RANLIB ranlib)

View file

@ -57,6 +57,7 @@ ENDMACRO(DETECT_EXPRESS_VERSION)
IF(MSVC12) IF(MSVC12)
DETECT_VC_VERSION("12.0") DETECT_VC_VERSION("12.0")
SET(MSVC_TOOLSET "120")
IF(NOT MSVC12_REDIST_DIR) IF(NOT MSVC12_REDIST_DIR)
# If you have VC++ 2013 Express, put x64/Microsoft.VC120.CRT/*.dll in ${EXTERNAL_PATH}/redist # If you have VC++ 2013 Express, put x64/Microsoft.VC120.CRT/*.dll in ${EXTERNAL_PATH}/redist
@ -64,6 +65,7 @@ IF(MSVC12)
ENDIF(NOT MSVC11_REDIST_DIR) ENDIF(NOT MSVC11_REDIST_DIR)
ELSEIF(MSVC11) ELSEIF(MSVC11)
DETECT_VC_VERSION("11.0") DETECT_VC_VERSION("11.0")
SET(MSVC_TOOLSET "110")
IF(NOT MSVC11_REDIST_DIR) IF(NOT MSVC11_REDIST_DIR)
# If you have VC++ 2012 Express, put x64/Microsoft.VC110.CRT/*.dll in ${EXTERNAL_PATH}/redist # If you have VC++ 2012 Express, put x64/Microsoft.VC110.CRT/*.dll in ${EXTERNAL_PATH}/redist
@ -71,6 +73,7 @@ ELSEIF(MSVC11)
ENDIF(NOT MSVC11_REDIST_DIR) ENDIF(NOT MSVC11_REDIST_DIR)
ELSEIF(MSVC10) ELSEIF(MSVC10)
DETECT_VC_VERSION("10.0") DETECT_VC_VERSION("10.0")
SET(MSVC_TOOLSET "100")
IF(NOT MSVC10_REDIST_DIR) IF(NOT MSVC10_REDIST_DIR)
# If you have VC++ 2010 Express, put x64/Microsoft.VC100.CRT/*.dll in ${EXTERNAL_PATH}/redist # If you have VC++ 2010 Express, put x64/Microsoft.VC100.CRT/*.dll in ${EXTERNAL_PATH}/redist
@ -78,8 +81,10 @@ ELSEIF(MSVC10)
ENDIF(NOT MSVC10_REDIST_DIR) ENDIF(NOT MSVC10_REDIST_DIR)
ELSEIF(MSVC90) ELSEIF(MSVC90)
DETECT_VC_VERSION("9.0") DETECT_VC_VERSION("9.0")
SET(MSVC_TOOLSET "90")
ELSEIF(MSVC80) ELSEIF(MSVC80)
DETECT_VC_VERSION("8.0") DETECT_VC_VERSION("8.0")
SET(MSVC_TOOLSET "80")
ENDIF(MSVC12) ENDIF(MSVC12)
# If you plan to use VC++ compilers with WINE, set VC_DIR environment variable # If you plan to use VC++ compilers with WINE, set VC_DIR environment variable

View file

@ -13,7 +13,7 @@
IF(MYSQL_INCLUDE_DIR AND MYSQL_LIBRARIES) IF(MYSQL_INCLUDE_DIR AND MYSQL_LIBRARIES)
SET(MYSQL_FOUND TRUE) SET(MYSQL_FOUND TRUE)
ELSE(MYSQL_INCLUDE_DIR AND MYSQL_LIBRARIES) ELSE()
FIND_PATH(MYSQL_INCLUDE_DIR mysql.h FIND_PATH(MYSQL_INCLUDE_DIR mysql.h
PATH_SUFFIXES mysql PATH_SUFFIXES mysql
@ -33,7 +33,7 @@ ELSE(MYSQL_INCLUDE_DIR AND MYSQL_LIBRARIES)
PATHS PATHS
$ENV{ProgramFiles}/MySQL/*/lib/opt $ENV{ProgramFiles}/MySQL/*/lib/opt
$ENV{SystemDrive}/MySQL/*/lib/opt) $ENV{SystemDrive}/MySQL/*/lib/opt)
ELSE(WIN32 AND MSVC) ELSE()
FIND_LIBRARY(MYSQL_LIBRARY_RELEASE NAMES mysqlclient FIND_LIBRARY(MYSQL_LIBRARY_RELEASE NAMES mysqlclient
PATHS PATHS
/usr/lib /usr/lib
@ -51,31 +51,30 @@ ELSE(MYSQL_INCLUDE_DIR AND MYSQL_LIBRARIES)
/usr/local/lib/mysql /usr/local/lib/mysql
/opt/local/lib/mysql5/mysql /opt/local/lib/mysql5/mysql
) )
ENDIF(WIN32 AND MSVC) ENDIF()
IF(MYSQL_INCLUDE_DIR) IF(MYSQL_INCLUDE_DIR)
IF(MYSQL_LIBRARY_RELEASE) IF(MYSQL_LIBRARY_RELEASE)
SET(MYSQL_LIBRARIES optimized ${MYSQL_LIBRARY_RELEASE})
IF(MYSQL_LIBRARY_DEBUG) IF(MYSQL_LIBRARY_DEBUG)
SET(MYSQL_LIBRARIES ${MYSQL_LIBRARIES} debug ${MYSQL_LIBRARY_DEBUG}) SET(MYSQL_LIBRARIES optimized ${MYSQL_LIBRARY_RELEASE} debug ${MYSQL_LIBRARY_DEBUG})
ELSE(MYSQL_LIBRARY_DEBUG) ELSE()
SET(MYSQL_LIBRARIES ${MYSQL_LIBRARIES} debug ${MYSQL_LIBRARY_RELEASE}) SET(MYSQL_LIBRARIES ${MYSQL_LIBRARY_RELEASE})
ENDIF(MYSQL_LIBRARY_DEBUG) ENDIF()
FIND_PACKAGE(OpenSSL) FIND_PACKAGE(OpenSSL)
IF(OPENSSL_FOUND) IF(OPENSSL_FOUND)
SET(MYSQL_LIBRARIES ${MYSQL_LIBRARIES} ${OPENSSL_LIBRARIES}) SET(MYSQL_LIBRARIES ${MYSQL_LIBRARIES} ${OPENSSL_LIBRARIES})
ENDIF(OPENSSL_FOUND) ENDIF()
ENDIF(MYSQL_LIBRARY_RELEASE) ENDIF()
ENDIF(MYSQL_INCLUDE_DIR) ENDIF()
IF(MYSQL_INCLUDE_DIR AND MYSQL_LIBRARIES) IF(MYSQL_INCLUDE_DIR AND MYSQL_LIBRARIES)
SET(MYSQL_FOUND TRUE) SET(MYSQL_FOUND TRUE)
MESSAGE(STATUS "Found MySQL: ${MYSQL_INCLUDE_DIR}, ${MYSQL_LIBRARIES}") MESSAGE(STATUS "Found MySQL: ${MYSQL_INCLUDE_DIR}, ${MYSQL_LIBRARIES}")
ELSE(MYSQL_INCLUDE_DIR AND MYSQL_LIBRARIES) ELSE()
SET(MYSQL_FOUND FALSE) SET(MYSQL_FOUND FALSE)
MESSAGE(STATUS "MySQL not found.") MESSAGE(STATUS "MySQL not found.")
ENDIF(MYSQL_INCLUDE_DIR AND MYSQL_LIBRARIES) ENDIF()
MARK_AS_ADVANCED(MYSQL_LIBRARY_RELEASE MYSQL_LIBRARY_DEBUG) MARK_AS_ADVANCED(MYSQL_LIBRARY_RELEASE MYSQL_LIBRARY_DEBUG)
ENDIF(MYSQL_INCLUDE_DIR AND MYSQL_LIBRARIES) ENDIF()

View file

@ -68,6 +68,10 @@ ENDIF(WINSDKCURRENT_VERSION_INCLUDE)
SET(WINSDKENV_DIR $ENV{WINSDK_DIR}) SET(WINSDKENV_DIR $ENV{WINSDK_DIR})
IF(NOT WINSDKENV_DIR)
SET(WINSDKENV_DIR $ENV{WindowsSDKDir})
ENDIF(NOT WINSDKENV_DIR)
MACRO(FIND_WINSDK_VERSION_HEADERS) MACRO(FIND_WINSDK_VERSION_HEADERS)
IF(WINSDK_DIR AND NOT WINSDK_VERSION) IF(WINSDK_DIR AND NOT WINSDK_VERSION)
# Search version in headers # Search version in headers
@ -78,7 +82,6 @@ MACRO(FIND_WINSDK_VERSION_HEADERS)
) )
IF(_MSI_FILE) IF(_MSI_FILE)
# Look for Windows SDK 8.0 # Look for Windows SDK 8.0
FILE(STRINGS ${_MSI_FILE} _CONTENT REGEX "^#ifndef NTDDI_WIN8") FILE(STRINGS ${_MSI_FILE} _CONTENT REGEX "^#ifndef NTDDI_WIN8")
@ -181,7 +184,7 @@ MACRO(USE_CURRENT_WINSDK)
# Look for Windows.h because there are several paths # Look for Windows.h because there are several paths
IF(EXISTS ${_INCLUDE}/Windows.h) IF(EXISTS ${_INCLUDE}/Windows.h)
STRING(REGEX REPLACE "/(include|INCLUDE|Include)(.*)" "" WINSDK_DIR ${_INCLUDE}) STRING(REGEX REPLACE "/(include|INCLUDE|Include)(.*)" "" WINSDK_DIR ${_INCLUDE})
MESSAGE(STATUS "Found Windows SDK from include environment variable in ${WINSDK_DIR}") MESSAGE(STATUS "Found Windows SDK in INCLUDE environment variable: ${WINSDK_DIR}")
BREAK() BREAK()
ENDIF(EXISTS ${_INCLUDE}/Windows.h) ENDIF(EXISTS ${_INCLUDE}/Windows.h)
ENDFOREACH(_INCLUDE) ENDFOREACH(_INCLUDE)
@ -280,6 +283,13 @@ FIND_PATH(WINSDK_SHARED_INCLUDE_DIR d3d9.h
${WINSDK_DIR}/Include ${WINSDK_DIR}/Include
) )
# directory where OpenGL headers are found
FIND_PATH(WINSDK_OPENGL_INCLUDE_DIR GL.h
HINTS
${WINSDK_DIR}/Include/gl
${WINSDK_DIR}/Include
)
# directory where all libraries are found # directory where all libraries are found
FIND_PATH(WINSDK_LIBRARY_DIR ComCtl32.lib FIND_PATH(WINSDK_LIBRARY_DIR ComCtl32.lib
HINTS HINTS
@ -303,7 +313,7 @@ FIND_PROGRAM(WINSDK_MIDL midl
IF(WINSDK_INCLUDE_DIR) IF(WINSDK_INCLUDE_DIR)
SET(WINSDK_FOUND ON) SET(WINSDK_FOUND ON)
SET(WINSDK_INCLUDE_DIRS ${WINSDK_INCLUDE_DIR} ${WINSDK_SHARED_INCLUDE_DIR}) SET(WINSDK_INCLUDE_DIRS ${WINSDK_INCLUDE_DIR} ${WINSDK_SHARED_INCLUDE_DIR} ${WINSDK_OPENGL_INCLUDE_DIR})
SET(CMAKE_LIBRARY_PATH ${WINSDK_LIBRARY_DIR} ${CMAKE_LIBRARY_PATH}) SET(CMAKE_LIBRARY_PATH ${WINSDK_LIBRARY_DIR} ${CMAKE_LIBRARY_PATH})
INCLUDE_DIRECTORIES(${WINSDK_INCLUDE_DIRS}) INCLUDE_DIRECTORIES(${WINSDK_INCLUDE_DIRS})

View file

@ -13,38 +13,44 @@ IF(SOURCE_DIR)
IF(NOT ROOT_DIR AND SOURCE_DIR) IF(NOT ROOT_DIR AND SOURCE_DIR)
SET(ROOT_DIR ${SOURCE_DIR}) SET(ROOT_DIR ${SOURCE_DIR})
ENDIF(NOT ROOT_DIR AND SOURCE_DIR) ENDIF()
IF(NOT SOURCE_DIR AND ROOT_DIR) IF(NOT SOURCE_DIR AND ROOT_DIR)
SET(SOURCE_DIR ${ROOT_DIR}) SET(SOURCE_DIR ${ROOT_DIR})
ENDIF(NOT SOURCE_DIR AND ROOT_DIR) ENDIF()
ELSE(SOURCE_DIR) ELSE()
SET(SOURCE_DIR ${CMAKE_SOURCE_DIR}) SET(SOURCE_DIR ${CMAKE_SOURCE_DIR})
SET(ROOT_DIR ${CMAKE_SOURCE_DIR}) SET(ROOT_DIR ${CMAKE_SOURCE_DIR})
ENDIF(SOURCE_DIR) ENDIF()
MACRO(NOW RESULT) MACRO(NOW RESULT)
IF (WIN32) IF (WIN32)
EXECUTE_PROCESS(COMMAND "wmic" "os" "get" "localdatetime" OUTPUT_VARIABLE DATETIME) EXECUTE_PROCESS(COMMAND "wmic" "os" "get" "localdatetime" OUTPUT_VARIABLE DATETIME)
IF(NOT DATETIME MATCHES "ERROR") IF(NOT DATETIME MATCHES "ERROR")
STRING(REGEX REPLACE ".*\n([0-9][0-9][0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9]).*" "\\1-\\2-\\3 \\4:\\5:\\6" ${RESULT} "${DATETIME}") STRING(REGEX REPLACE ".*\n([0-9][0-9][0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9]).*" "\\1-\\2-\\3 \\4:\\5:\\6" ${RESULT} "${DATETIME}")
ENDIF(NOT DATETIME MATCHES "ERROR") ENDIF()
ELSEIF(UNIX) ELSEIF(UNIX)
EXECUTE_PROCESS(COMMAND "date" "+%Y-%m-%d %H:%M:%S" OUTPUT_VARIABLE DATETIME) EXECUTE_PROCESS(COMMAND "date" "+%Y-%m-%d %H:%M:%S" OUTPUT_VARIABLE DATETIME)
STRING(REGEX REPLACE "([0-9: -]+).*" "\\1" ${RESULT} "${DATETIME}") STRING(REGEX REPLACE "([0-9: -]+).*" "\\1" ${RESULT} "${DATETIME}")
ELSE (WIN32) ELSE()
MESSAGE(SEND_ERROR "date not implemented") MESSAGE(SEND_ERROR "date not implemented")
SET(${RESULT} "0000-00-00 00:00:00") SET(${RESULT} "0000-00-00 00:00:00")
ENDIF (WIN32) ENDIF()
ENDMACRO(NOW) ENDMACRO(NOW)
IF(EXISTS "${ROOT_DIR}/.svn/") IF(EXISTS "${ROOT_DIR}/.svn/")
FIND_PACKAGE(Subversion) FIND_PACKAGE(Subversion QUIET)
IF(SUBVERSION_FOUND) IF(SUBVERSION_FOUND)
Subversion_WC_INFO(${ROOT_DIR} ER) Subversion_WC_INFO(${ROOT_DIR} ER)
SET(REVISION ${ER_WC_REVISION}) SET(REVISION ${ER_WC_REVISION})
ENDIF(SUBVERSION_FOUND) ENDIF(SUBVERSION_FOUND)
FIND_PACKAGE(TortoiseSVN QUIET)
IF(TORTOISESVN_FOUND)
TORTOISESVN_GET_REVISION(${ROOT_DIR} REVISION)
ENDIF(TORTOISESVN_FOUND)
ENDIF(EXISTS "${ROOT_DIR}/.svn/") ENDIF(EXISTS "${ROOT_DIR}/.svn/")
IF(EXISTS "${ROOT_DIR}/.hg/") IF(EXISTS "${ROOT_DIR}/.hg/")
@ -55,8 +61,8 @@ IF(EXISTS "${ROOT_DIR}/.hg/")
SET(REVISION ${ER_WC_REVISION}) SET(REVISION ${ER_WC_REVISION})
SET(CHANGESET ${ER_WC_CHANGESET}) SET(CHANGESET ${ER_WC_CHANGESET})
SET(BRANCH ${ER_WC_BRANCH}) SET(BRANCH ${ER_WC_BRANCH})
ENDIF(MERCURIAL_FOUND) ENDIF()
ENDIF(EXISTS "${ROOT_DIR}/.hg/") ENDIF()
# if processing exported sources, use "revision" file if exists # if processing exported sources, use "revision" file if exists
IF(SOURCE_DIR AND NOT DEFINED REVISION) IF(SOURCE_DIR AND NOT DEFINED REVISION)
@ -64,8 +70,8 @@ IF(SOURCE_DIR AND NOT DEFINED REVISION)
IF(EXISTS ${REVISION_FILE}) IF(EXISTS ${REVISION_FILE})
FILE(STRINGS ${REVISION_FILE} REVISION LIMIT_COUNT 1) FILE(STRINGS ${REVISION_FILE} REVISION LIMIT_COUNT 1)
MESSAGE(STATUS "Read revision ${REVISION} from file") MESSAGE(STATUS "Read revision ${REVISION} from file")
ENDIF(EXISTS ${REVISION_FILE}) ENDIF()
ENDIF(SOURCE_DIR AND NOT DEFINED REVISION) ENDIF()
IF(SOURCE_DIR AND DEFINED REVISION) IF(SOURCE_DIR AND DEFINED REVISION)
IF(EXISTS ${SOURCE_DIR}/revision.h.in) IF(EXISTS ${SOURCE_DIR}/revision.h.in)
@ -73,5 +79,5 @@ IF(SOURCE_DIR AND DEFINED REVISION)
NOW(BUILD_DATE) NOW(BUILD_DATE)
CONFIGURE_FILE(${SOURCE_DIR}/revision.h.in revision.h.txt) CONFIGURE_FILE(${SOURCE_DIR}/revision.h.in revision.h.txt)
EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E copy revision.h.txt revision.h) # copy_if_different EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E copy revision.h.txt revision.h) # copy_if_different
ENDIF(EXISTS ${SOURCE_DIR}/revision.h.in) ENDIF()
ENDIF(SOURCE_DIR AND DEFINED REVISION) ENDIF()

View file

@ -6,6 +6,9 @@ IF(NOT CMAKE_BUILD_TYPE)
SET(CMAKE_BUILD_TYPE "Release" CACHE STRING "" FORCE) SET(CMAKE_BUILD_TYPE "Release" CACHE STRING "" FORCE)
ENDIF(NOT CMAKE_BUILD_TYPE) ENDIF(NOT CMAKE_BUILD_TYPE)
# Declare CMAKE_CONFIGURATION_TYPES before PROJECT
SET(CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING "" FORCE)
### ###
# Helper macro that generates .pc and installs it. # Helper macro that generates .pc and installs it.
# Argument: name - the name of the .pc package, e.g. "nel-pacs.pc" # Argument: name - the name of the .pc package, e.g. "nel-pacs.pc"
@ -384,8 +387,6 @@ MACRO(NL_SETUP_BUILD)
# Debug = NL_DEBUG # Debug = NL_DEBUG
# Release = NL_RELEASE # Release = NL_RELEASE
SET(CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING "" FORCE)
IF(CMAKE_BUILD_TYPE MATCHES "Debug") IF(CMAKE_BUILD_TYPE MATCHES "Debug")
SET(NL_BUILD_MODE "NL_DEBUG") SET(NL_BUILD_MODE "NL_DEBUG")
ELSE(CMAKE_BUILD_TYPE MATCHES "Debug") ELSE(CMAKE_BUILD_TYPE MATCHES "Debug")

View file

@ -218,7 +218,7 @@ protected:
date*= previous->OODeltaTime; date*= previous->OODeltaTime;
NLMISC::clamp(date, 0,1); NLMISC::clamp(date, 0,1);
date = this->ease(previous, date); date = this->ease(previous, (float)date);
float hb[4]; float hb[4];
this->computeHermiteBasis(date, hb); this->computeHermiteBasis(date, hb);

View file

@ -17,7 +17,86 @@
#include "std3d.h" #include "std3d.h"
#include "nel/3d/vertex_program_parse.h" #include "nel/3d/vertex_program_parse.h"
enum TArguments
{
#ifdef NL_LITTLE_ENDIAN
ADD = 1094992928,
ARL = 1095912480,
BFC0 = 1111900976,
BFC1 = 1111900977,
COL0 = 1129270320,
COL1 = 1129270321,
DP3 = 1146106656,
DP4 = 1146106912,
DST = 1146311712,
END = 1162757152,
EXP = 1163415584,
EXPP = 1163415632,
FOGC = 1179600707,
HPOS = 1213222739,
LIT = 1279874080,
LOG = 1280263968,
MAD = 1296122912,
MAX = 1296128032,
MIN = 1296649760,
MOV = 1297045024,
MUL = 1297435680,
NRML = 1314016588,
OPOS = 1330663251,
PSIZ = 1347635546,
RCP = 1380143136,
RSQ = 1381191968,
SGE = 1397179680,
SLT = 1397511200,
TEX0 = 1413830704,
TEX1 = 1413830705,
TEX2 = 1413830706,
TEX3 = 1413830707,
TEX4 = 1413830708,
TEX5 = 1413830709,
TEX6 = 1413830710,
TEX7 = 1413830711,
WGHT = 1464289364,
#else
ADD = 541344833,
ARL = 541872705,
BFC0 = 809715266,
BFC1 = 826492482,
COL0 = 810307395,
COL1 = 827084611,
DP3 = 540233796,
DP4 = 540299332,
DST = 542397252,
END = 541347397,
EXP = 542136389,
EXPP = 1347442757,
FOGC = 1128746822,
HPOS = 1397706824,
LIT = 542394700,
LOG = 541544268,
MAD = 541344077,
MAX = 542654797,
MIN = 542001485,
MOV = 542527309,
MUL = 541873485,
NRML = 1280135758,
OPOS = 1397706831,
PSIZ = 1514754896,
RCP = 542131026,
RSQ = 542200658,
SGE = 541411155,
SLT = 542395475,
TEX0 = 811091284,
TEX1 = 827868500,
TEX2 = 844645716,
TEX3 = 861422932,
TEX4 = 878200148,
TEX5 = 894977364,
TEX6 = 911754580,
TEX7 = 928531796,
WGHT = 1414022999,
#endif
};
//===================================== //=====================================
bool CVPParser::parseWriteMask(uint &mask, std::string &errorOutput) bool CVPParser::parseWriteMask(uint &mask, std::string &errorOutput)
@ -256,23 +335,23 @@ bool CVPParser::parseInputRegister(CVPOperand &operand, std::string &errorOutput
strValue |= ((uint32) *_CurrChar) << (8 * (3 - k)); strValue |= ((uint32) *_CurrChar) << (8 * (3 - k));
++_CurrChar; ++_CurrChar;
} }
switch (strValue) switch ((TArguments)strValue)
{ {
case 'OPOS': operand.Value.InputRegisterValue = CVPOperand::IPosition; break; case OPOS: operand.Value.InputRegisterValue = CVPOperand::IPosition; break;
case 'WGHT': operand.Value.InputRegisterValue = CVPOperand::IWeight; break; case WGHT: operand.Value.InputRegisterValue = CVPOperand::IWeight; break;
case 'NRML': operand.Value.InputRegisterValue = CVPOperand::INormal; break; case NRML: operand.Value.InputRegisterValue = CVPOperand::INormal; break;
case 'COL0': operand.Value.InputRegisterValue = CVPOperand::IPrimaryColor; break; case COL0: operand.Value.InputRegisterValue = CVPOperand::IPrimaryColor; break;
case 'COL1': operand.Value.InputRegisterValue = CVPOperand::ISecondaryColor; break; case COL1: operand.Value.InputRegisterValue = CVPOperand::ISecondaryColor; break;
case 'FOGC': operand.Value.InputRegisterValue = CVPOperand::IFogCoord; break; case FOGC: operand.Value.InputRegisterValue = CVPOperand::IFogCoord; break;
// texture argument // texture argument
case 'TEX0': case TEX0:
case 'TEX1': case TEX1:
case 'TEX2': case TEX2:
case 'TEX3': case TEX3:
case 'TEX4': case TEX4:
case 'TEX5': case TEX5:
case 'TEX6': case TEX6:
case 'TEX7': case TEX7:
operand.Value.InputRegisterValue = (CVPOperand::EInputRegister) (((CVPOperand::ITex0 + strValue) & 0xff) - '0'); operand.Value.InputRegisterValue = (CVPOperand::EInputRegister) (((CVPOperand::ITex0 + strValue) & 0xff) - '0');
break; break;
default: default:
@ -384,23 +463,23 @@ bool CVPParser::parseOutputRegister(CVPOperand &operand, std::string &errorOutpu
++_CurrChar; ++_CurrChar;
} }
// convert to enum // convert to enum
switch(strValue) switch((TArguments)strValue)
{ {
case 'HPOS': operand.Value.OutputRegisterValue = CVPOperand::OHPosition; break; case HPOS: operand.Value.OutputRegisterValue = CVPOperand::OHPosition; break;
case 'COL0': operand.Value.OutputRegisterValue = CVPOperand::OPrimaryColor; break; case COL0: operand.Value.OutputRegisterValue = CVPOperand::OPrimaryColor; break;
case 'COL1': operand.Value.OutputRegisterValue = CVPOperand::OSecondaryColor; break; case COL1: operand.Value.OutputRegisterValue = CVPOperand::OSecondaryColor; break;
case 'BFC0': operand.Value.OutputRegisterValue = CVPOperand::OBackFacePrimaryColor; break; case BFC0: operand.Value.OutputRegisterValue = CVPOperand::OBackFacePrimaryColor; break;
case 'BFC1': operand.Value.OutputRegisterValue = CVPOperand::OBackFaceSecondaryColor; break; case BFC1: operand.Value.OutputRegisterValue = CVPOperand::OBackFaceSecondaryColor; break;
case 'FOGC': operand.Value.OutputRegisterValue = CVPOperand::OFogCoord; break; case FOGC: operand.Value.OutputRegisterValue = CVPOperand::OFogCoord; break;
case 'PSIZ': operand.Value.OutputRegisterValue = CVPOperand::OPointSize; break; case PSIZ: operand.Value.OutputRegisterValue = CVPOperand::OPointSize; break;
case 'TEX0': operand.Value.OutputRegisterValue = CVPOperand::OTex0; break; case TEX0: operand.Value.OutputRegisterValue = CVPOperand::OTex0; break;
case 'TEX1': operand.Value.OutputRegisterValue = CVPOperand::OTex1; break; case TEX1: operand.Value.OutputRegisterValue = CVPOperand::OTex1; break;
case 'TEX2': operand.Value.OutputRegisterValue = CVPOperand::OTex2; break; case TEX2: operand.Value.OutputRegisterValue = CVPOperand::OTex2; break;
case 'TEX3': operand.Value.OutputRegisterValue = CVPOperand::OTex3; break; case TEX3: operand.Value.OutputRegisterValue = CVPOperand::OTex3; break;
case 'TEX4': operand.Value.OutputRegisterValue = CVPOperand::OTex4; break; case TEX4: operand.Value.OutputRegisterValue = CVPOperand::OTex4; break;
case 'TEX5': operand.Value.OutputRegisterValue = CVPOperand::OTex5; break; case TEX5: operand.Value.OutputRegisterValue = CVPOperand::OTex5; break;
case 'TEX6': operand.Value.OutputRegisterValue = CVPOperand::OTex6; break; case TEX6: operand.Value.OutputRegisterValue = CVPOperand::OTex6; break;
case 'TEX7': operand.Value.OutputRegisterValue = CVPOperand::OTex7; break; case TEX7: operand.Value.OutputRegisterValue = CVPOperand::OTex7; break;
default: default:
errorOutput = "Can't read index for output register."; errorOutput = "Can't read index for output register.";
return false; return false;
@ -753,9 +832,9 @@ bool CVPParser::parseInstruction(CVPInstruction &instr, std::string &errorOutput
{ {
instrStr |= (uint32) ' '; instrStr |= (uint32) ' ';
} }
switch (instrStr) switch ((TArguments)instrStr)
{ {
case 'ARL ': case ARL:
instr.Opcode = CVPInstruction::ARL; instr.Opcode = CVPInstruction::ARL;
if (!parseOp2(instr, errorOutput)) return false; if (!parseOp2(instr, errorOutput)) return false;
if (!instr.Src1.Swizzle.isScalar()) if (!instr.Src1.Swizzle.isScalar())
@ -764,7 +843,7 @@ bool CVPParser::parseInstruction(CVPInstruction &instr, std::string &errorOutput
return false; return false;
} }
break; break;
case 'RSQ ': case RSQ:
instr.Opcode = CVPInstruction::RSQ; instr.Opcode = CVPInstruction::RSQ;
if (!parseOp2(instr, errorOutput)) return false; if (!parseOp2(instr, errorOutput)) return false;
if (!instr.Src1.Swizzle.isScalar()) if (!instr.Src1.Swizzle.isScalar())
@ -773,8 +852,8 @@ bool CVPParser::parseInstruction(CVPInstruction &instr, std::string &errorOutput
return false; return false;
} }
break; break;
case 'EXP ': case EXP:
case 'EXPP': case EXPP:
instr.Opcode = CVPInstruction::EXPP; instr.Opcode = CVPInstruction::EXPP;
if (!parseOp2(instr, errorOutput)) return false; if (!parseOp2(instr, errorOutput)) return false;
if (!instr.Src1.Swizzle.isScalar()) if (!instr.Src1.Swizzle.isScalar())
@ -789,7 +868,7 @@ bool CVPParser::parseInstruction(CVPInstruction &instr, std::string &errorOutput
return false; return false;
}*/ }*/
break; break;
case 'LOG ': case LOG:
instr.Opcode = CVPInstruction::LOG; instr.Opcode = CVPInstruction::LOG;
if (!parseOp2(instr, errorOutput)) return false; if (!parseOp2(instr, errorOutput)) return false;
if (!instr.Src1.Swizzle.isScalar()) if (!instr.Src1.Swizzle.isScalar())
@ -805,7 +884,7 @@ bool CVPParser::parseInstruction(CVPInstruction &instr, std::string &errorOutput
} }
*/ */
break; break;
case 'RCP ': case RCP:
instr.Opcode = CVPInstruction::RCP; instr.Opcode = CVPInstruction::RCP;
if (!parseOp2(instr, errorOutput)) return false; if (!parseOp2(instr, errorOutput)) return false;
if (!instr.Src1.Swizzle.isScalar()) if (!instr.Src1.Swizzle.isScalar())
@ -815,60 +894,60 @@ bool CVPParser::parseInstruction(CVPInstruction &instr, std::string &errorOutput
} }
break; break;
///////////////// /////////////////
case 'MOV ': case MOV:
instr.Opcode = CVPInstruction::MOV; instr.Opcode = CVPInstruction::MOV;
if (!parseOp2(instr, errorOutput)) return false; if (!parseOp2(instr, errorOutput)) return false;
break; break;
case 'LIT ': case LIT:
instr.Opcode = CVPInstruction::LIT; instr.Opcode = CVPInstruction::LIT;
if (!parseOp2(instr, errorOutput)) return false; if (!parseOp2(instr, errorOutput)) return false;
break; break;
///////////////// /////////////////
case 'MAD ': case MAD:
instr.Opcode = CVPInstruction::MAD; instr.Opcode = CVPInstruction::MAD;
if (!parseOp4(instr, errorOutput)) return false; if (!parseOp4(instr, errorOutput)) return false;
break; break;
///////////////// /////////////////
case 'ADD ': case ADD:
instr.Opcode = CVPInstruction::ADD; instr.Opcode = CVPInstruction::ADD;
if (!parseOp3(instr, errorOutput)) return false; if (!parseOp3(instr, errorOutput)) return false;
break; break;
///////////////// /////////////////
case 'MUL ': case MUL:
instr.Opcode = CVPInstruction::MUL; instr.Opcode = CVPInstruction::MUL;
if (!parseOp3(instr, errorOutput)) return false; if (!parseOp3(instr, errorOutput)) return false;
break; break;
case 'DP3 ': case DP3:
instr.Opcode = CVPInstruction::DP3; instr.Opcode = CVPInstruction::DP3;
if (!parseOp3(instr, errorOutput)) return false; if (!parseOp3(instr, errorOutput)) return false;
break; break;
case 'DP4 ': case DP4:
instr.Opcode = CVPInstruction::DP4; instr.Opcode = CVPInstruction::DP4;
if (!parseOp3(instr, errorOutput)) return false; if (!parseOp3(instr, errorOutput)) return false;
break; break;
case 'DST ': case DST:
instr.Opcode = CVPInstruction::DST; instr.Opcode = CVPInstruction::DST;
if (!parseOp3(instr, errorOutput)) return false; if (!parseOp3(instr, errorOutput)) return false;
break; break;
case 'MIN ': case MIN:
instr.Opcode = CVPInstruction::MIN; instr.Opcode = CVPInstruction::MIN;
if (!parseOp3(instr, errorOutput)) return false; if (!parseOp3(instr, errorOutput)) return false;
break; break;
case 'MAX ': case MAX:
instr.Opcode = CVPInstruction::MAX; instr.Opcode = CVPInstruction::MAX;
if (!parseOp3(instr, errorOutput)) return false; if (!parseOp3(instr, errorOutput)) return false;
break; break;
case 'SLT ': case SLT:
instr.Opcode = CVPInstruction::SLT; instr.Opcode = CVPInstruction::SLT;
if (!parseOp3(instr, errorOutput)) return false; if (!parseOp3(instr, errorOutput)) return false;
break; break;
case 'SGE ': case SGE:
instr.Opcode = CVPInstruction::SGE; instr.Opcode = CVPInstruction::SGE;
if (!parseOp3(instr, errorOutput)) return false; if (!parseOp3(instr, errorOutput)) return false;
break; break;
///////////////// /////////////////
case 'END ': case END:
endEncountered = true; endEncountered = true;
return true; return true;
break; break;

View file

@ -231,7 +231,7 @@ bool CFormElm::isAtom () const
const CType* CFormElm::getType () const CType* CFormElm::getType ()
{ {
warning (false, "getType", "This node is not an atom."); warning (false, "getType", "This node is not an atom.");
return 0; return NULL;
} }
// *************************************************************************** // ***************************************************************************

View file

@ -42,7 +42,8 @@ extern "C"
{ {
/* Final states have negative value */ /* Final states have negative value */
typedef enum _FileState { typedef enum _FileState
{
FS_RETRY = -4, FS_RETRY = -4,
FS_ERROR = -3, FS_ERROR = -3,
FS_NO_DATA = -2, FS_NO_DATA = -2,
@ -57,7 +58,8 @@ typedef enum _FileState {
} FileState; } FileState;
/* This is the context structure for the this module */ /* This is the context structure for the this module */
typedef struct _file_info { typedef struct _file_info
{
FileState state; /* Current state of the connection */ FileState state; /* Current state of the connection */
char * local; /* Local representation of file name */ char * local; /* Local representation of file name */
struct stat stat_info; /* Contains actual file chosen */ struct stat stat_info; /* Contains actual file chosen */
@ -65,11 +67,13 @@ typedef struct _file_info {
HTTimer * timer; HTTimer * timer;
} file_info; } file_info;
struct _HTStream { struct _HTStream
{
const HTStreamClass * isa; const HTStreamClass * isa;
}; };
struct _HTInputStream { struct _HTInputStream
{
const HTInputStreamClass * isa; const HTInputStreamClass * isa;
HTChannel * ch; HTChannel * ch;
HTHost * host; HTHost * host;
@ -123,10 +127,8 @@ PUBLIC int HTLoadNeLFile (SOCKET soc, HTRequest * request)
HTNet * net = HTRequest_net(request); HTNet * net = HTRequest_net(request);
HTParentAnchor * anchor = HTRequest_anchor(request); HTParentAnchor * anchor = HTRequest_anchor(request);
HTTRACE(PROT_TRACE, "HTLoadFile.. Looking for `%s\'\n" _ HTTRACE(PROT_TRACE, "HTLoadFile.. Looking for `%s\'\n" _ HTAnchor_physical(anchor));
HTAnchor_physical(anchor)); if ((file = (file_info *) HT_CALLOC(1, sizeof(file_info))) == NULL) HT_OUTOFMEM("HTLoadFILE");
if ((file = (file_info *) HT_CALLOC(1, sizeof(file_info))) == NULL)
HT_OUTOFMEM((char*)"HTLoadFILE");
file->state = FS_BEGIN; file->state = FS_BEGIN;
file->net = net; file->net = net;
HTNet_setContext(net, file); HTNet_setContext(net, file);
@ -139,8 +141,8 @@ PUBLIC int HTLoadNeLFile (SOCKET soc, HTRequest * request)
PRIVATE int ReturnEvent (HTTimer * timer, void * param, HTEventType /* type */) PRIVATE int ReturnEvent (HTTimer * timer, void * param, HTEventType /* type */)
{ {
file_info * file = (file_info *) param; file_info * file = (file_info *) param;
if (timer != file->timer) if (timer != file->timer) HTDEBUGBREAK("File timer %p not in sync\n" _ timer);
HTDEBUGBREAK((char*)"File timer %p not in sync\n" _ timer);
HTTRACE(PROT_TRACE, "HTLoadFile.. Continuing %p with timer %p\n" _ file _ timer); HTTRACE(PROT_TRACE, "HTLoadFile.. Continuing %p with timer %p\n" _ file _ timer);
/* /*
@ -163,7 +165,7 @@ PUBLIC int HTNeLFileOpen (HTNet * net, char * local, HTLocalMode /* mode */)
if (!fp->open (local)) if (!fp->open (local))
{ {
HTRequest_addSystemError(request, ERR_FATAL, errno, NO, (char*)"CIFile::open"); HTRequest_addSystemError(request, ERR_FATAL, errno, NO, "CIFile::open");
return HT_ERROR; return HT_ERROR;
} }
@ -186,7 +188,7 @@ PRIVATE int FileEvent (SOCKET /* soc */, void * pVoid, HTEventType type)
{ {
/* Interrupted */ /* Interrupted */
HTRequest_addError(request, ERR_FATAL, NO, HTERR_INTERRUPTED, HTRequest_addError(request, ERR_FATAL, NO, HTERR_INTERRUPTED,
NULL, 0, (char*)"HTLoadFile"); NULL, 0, "HTLoadFile");
FileCleanup(request, HT_INTERRUPTED); FileCleanup(request, HT_INTERRUPTED);
return HT_OK; return HT_OK;
} }
@ -202,7 +204,7 @@ PRIVATE int FileEvent (SOCKET /* soc */, void * pVoid, HTEventType type)
/* We only support safe (GET, HEAD, etc) methods for the moment */ /* We only support safe (GET, HEAD, etc) methods for the moment */
if (!HTMethod_isSafe(HTRequest_method(request))) { if (!HTMethod_isSafe(HTRequest_method(request))) {
HTRequest_addError(request, ERR_FATAL, NO, HTERR_NOT_ALLOWED, HTRequest_addError(request, ERR_FATAL, NO, HTERR_NOT_ALLOWED,
NULL, 0, (char*)"HTLoadFile"); NULL, 0, "HTLoadFile");
file->state = FS_ERROR; file->state = FS_ERROR;
break; break;
} }
@ -235,9 +237,10 @@ PRIVATE int FileEvent (SOCKET /* soc */, void * pVoid, HTEventType type)
/* Create a new host object and link it to the net object */ /* Create a new host object and link it to the net object */
{ {
HTHost * host = NULL; HTHost * host = NULL;
if ((host = HTHost_new((char*)"localhost", 0)) == NULL) return HT_ERROR; if ((host = HTHost_new("localhost", 0)) == NULL) return HT_ERROR;
HTNet_setHost(net, host); HTNet_setHost(net, host);
if (HTHost_addNet(host, net) == HT_PENDING) { if (HTHost_addNet(host, net) == HT_PENDING)
{
HTTRACE(PROT_TRACE, "HTLoadFile.. Pending...\n"); HTTRACE(PROT_TRACE, "HTLoadFile.. Pending...\n");
/* move to the hack state */ /* move to the hack state */
file->state = FS_PENDING; file->state = FS_PENDING;
@ -252,7 +255,8 @@ PRIVATE int FileEvent (SOCKET /* soc */, void * pVoid, HTEventType type)
HTHost * host = NULL; HTHost * host = NULL;
if ((host = HTHost_new((char*)"localhost", 0)) == NULL) return HT_ERROR; if ((host = HTHost_new((char*)"localhost", 0)) == NULL) return HT_ERROR;
HTNet_setHost(net, host); HTNet_setHost(net, host);
if (HTHost_addNet(host, net) == HT_PENDING) { if (HTHost_addNet(host, net) == HT_PENDING)
{
HTTRACE(PROT_TRACE, "HTLoadFile.. Pending...\n"); HTTRACE(PROT_TRACE, "HTLoadFile.. Pending...\n");
file->state = FS_PENDING; file->state = FS_PENDING;
return HT_OK; return HT_OK;
@ -263,27 +267,31 @@ PRIVATE int FileEvent (SOCKET /* soc */, void * pVoid, HTEventType type)
case FS_DO_CN: case FS_DO_CN:
if (HTRequest_negotiation(request) && if (HTRequest_negotiation(request) &&
HTMethod_isSafe(HTRequest_method(request))) { HTMethod_isSafe(HTRequest_method(request)))
{
HTAnchor_setPhysical(anchor, file->local); HTAnchor_setPhysical(anchor, file->local);
HTTRACE(PROT_TRACE, "Load File... Found `%s\'\n" _ file->local); HTTRACE(PROT_TRACE, "Load File... Found `%s\'\n" _ file->local);
}
} else { else
if (HT_STAT(file->local, &file->stat_info) == -1) { {
if (HT_STAT(file->local, &file->stat_info) == -1)
{
HTTRACE(PROT_TRACE, "Load File... Not found `%s\'\n" _ file->local); HTTRACE(PROT_TRACE, "Load File... Not found `%s\'\n" _ file->local);
HTRequest_addError(request, ERR_FATAL, NO, HTERR_NOT_FOUND, HTRequest_addError(request, ERR_FATAL, NO, HTERR_NOT_FOUND, NULL, 0, "HTLoadFile");
NULL, 0, (char*)"HTLoadFile");
file->state = FS_ERROR; file->state = FS_ERROR;
break; break;
} }
} }
if (((file->stat_info.st_mode) & S_IFMT) == S_IFDIR) { if (((file->stat_info.st_mode) & S_IFMT) == S_IFDIR)
{
if (HTRequest_method(request) == METHOD_GET) if (HTRequest_method(request) == METHOD_GET)
{
file->state = FS_PARSE_DIR; file->state = FS_PARSE_DIR;
else { }
HTRequest_addError(request, ERR_INFO, NO, HTERR_NO_CONTENT, else
NULL, 0, (char*)"HTLoadFile"); {
HTRequest_addError(request, ERR_INFO, NO, HTERR_NO_CONTENT, NULL, 0, "HTLoadFile");
file->state = FS_NO_DATA; file->state = FS_NO_DATA;
} }
break; break;
@ -310,20 +318,22 @@ PRIVATE int FileEvent (SOCKET /* soc */, void * pVoid, HTEventType type)
HTAnchor_setLastModified(anchor, file->stat_info.st_mtime); HTAnchor_setLastModified(anchor, file->stat_info.st_mtime);
/* Check to see if we can edit it */ /* Check to see if we can edit it */
if (!editable && !file->stat_info.st_size) { if (!editable && !file->stat_info.st_size)
HTRequest_addError(request, ERR_INFO, NO, HTERR_NO_CONTENT, {
NULL, 0, (char*)"HTLoadFile"); HTRequest_addError(request, ERR_INFO, NO, HTERR_NO_CONTENT, NULL, 0, "HTLoadFile");
file->state = FS_NO_DATA; file->state = FS_NO_DATA;
} else { }
file->state = (HTRequest_method(request)==METHOD_GET) ? else
FS_NEED_OPEN_FILE : FS_GOT_DATA; {
file->state = (HTRequest_method(request)==METHOD_GET) ? FS_NEED_OPEN_FILE : FS_GOT_DATA;
} }
} }
break; break;
case FS_NEED_OPEN_FILE: case FS_NEED_OPEN_FILE:
status = HTNeLFileOpen(net, file->local, HT_FB_RDONLY); status = HTNeLFileOpen(net, file->local, HT_FB_RDONLY);
if (status == HT_OK) { if (status == HT_OK)
{
{ {
HTStream * rstream = HTStreamStack(HTAnchor_format(anchor), HTStream * rstream = HTStreamStack(HTAnchor_format(anchor),
HTRequest_outputFormat(request), HTRequest_outputFormat(request),
@ -338,30 +348,36 @@ PRIVATE int FileEvent (SOCKET /* soc */, void * pVoid, HTEventType type)
HTRequest_setInputStream(request, (HTStream *) output); HTRequest_setInputStream(request, (HTStream *) output);
} }
if (HTRequest_isSource(request) && !HTRequest_destinationsReady(request)) if (HTRequest_isSource(request) && !HTRequest_destinationsReady(request)) return HT_OK;
return HT_OK;
HTRequest_addError(request, ERR_INFO, NO, HTERR_OK, NULL, 0, HTRequest_addError(request, ERR_INFO, NO, HTERR_OK, NULL, 0, "HTLoadFile");
(char*)"HTLoadFile");
file->state = FS_NEED_BODY; file->state = FS_NEED_BODY;
if (HTEvent_isCallbacksRegistered()) { if (HTEvent_isCallbacksRegistered())
if (!HTRequest_preemptive(request)) { {
if (!HTNet_preemptive(net)) { if (!HTRequest_preemptive(request))
{
if (!HTNet_preemptive(net))
{
HTTRACE(PROT_TRACE, "HTLoadFile.. Returning\n"); HTTRACE(PROT_TRACE, "HTLoadFile.. Returning\n");
HTHost_register(HTNet_host(net), net, HTEvent_READ); HTHost_register(HTNet_host(net), net, HTEvent_READ);
} else if (!file->timer) { }
else if (!file->timer)
{
HTTRACE(PROT_TRACE, "HTLoadFile.. Returning\n"); HTTRACE(PROT_TRACE, "HTLoadFile.. Returning\n");
file->timer = file->timer = HTTimer_new(NULL, ReturnEvent, file, 1, YES, NO);
HTTimer_new(NULL, ReturnEvent, file, 1, YES, NO);
} }
return HT_OK; return HT_OK;
} }
} }
} else if (status == HT_WOULD_BLOCK || status == HT_PENDING) }
else if (status == HT_WOULD_BLOCK || status == HT_PENDING)
{
return HT_OK; return HT_OK;
else { }
HTRequest_addError(request, ERR_INFO, NO, HTERR_INTERNAL, else
NULL, 0, (char*)"HTLoadFile"); {
HTRequest_addError(request, ERR_INFO, NO, HTERR_INTERNAL, NULL, 0, "HTLoadFile");
file->state = FS_ERROR; /* Error or interrupt */ file->state = FS_ERROR; /* Error or interrupt */
} }
break; break;
@ -369,12 +385,16 @@ PRIVATE int FileEvent (SOCKET /* soc */, void * pVoid, HTEventType type)
case FS_NEED_BODY: case FS_NEED_BODY:
status = HTHost_read(HTNet_host(net), net); status = HTHost_read(HTNet_host(net), net);
if (status == HT_WOULD_BLOCK) if (status == HT_WOULD_BLOCK)
{
return HT_OK; return HT_OK;
else if (status == HT_LOADED || status == HT_CLOSED) { }
else if (status == HT_LOADED || status == HT_CLOSED)
{
file->state = FS_GOT_DATA; file->state = FS_GOT_DATA;
} else { }
HTRequest_addError(request, ERR_INFO, NO, HTERR_FORBIDDEN, else
NULL, 0, (char*)"HTLoadFile"); {
HTRequest_addError(request, ERR_INFO, NO, HTERR_FORBIDDEN, NULL, 0, "HTLoadFile");
file->state = FS_ERROR; file->state = FS_ERROR;
} }
break; break;
@ -386,9 +406,13 @@ PRIVATE int FileEvent (SOCKET /* soc */, void * pVoid, HTEventType type)
char *newname = NULL; char *newname = NULL;
StrAllocCopy(newname, "ftp:"); StrAllocCopy(newname, "ftp:");
if (!strncmp(url, "file:", 5)) if (!strncmp(url, "file:", 5))
{
StrAllocCat(newname, url+5); StrAllocCat(newname, url+5);
}
else else
{
StrAllocCat(newname, url); StrAllocCat(newname, url);
}
anchor = HTAnchor_findAddress(newname); anchor = HTAnchor_findAddress(newname);
HTRequest_setAnchor(request, anchor); HTRequest_setAnchor(request, anchor);
HT_FREE(newname); HT_FREE(newname);
@ -461,7 +485,8 @@ PRIVATE int HTNeLReader_read (HTInputStream * me)
{ {
HTAlertCallback * cbf = HTAlert_find(HT_PROG_READ); HTAlertCallback * cbf = HTAlert_find(HT_PROG_READ);
HTNet_addBytesRead(net, me->b_read); HTNet_addBytesRead(net, me->b_read);
if (cbf) { if (cbf)
{
int tr = HTNet_bytesRead(net); int tr = HTNet_bytesRead(net);
(*cbf)(net->request, HT_PROG_READ, HT_MSG_NULL, NULL, &tr, NULL); (*cbf)(net->request, HT_PROG_READ, HT_MSG_NULL, NULL, &tr, NULL);
} }
@ -472,18 +497,28 @@ PRIVATE int HTNeLReader_read (HTInputStream * me)
/* Now push the data down the stream */ /* Now push the data down the stream */
if ((status = (*net->readStream->isa->put_block) if ((status = (*net->readStream->isa->put_block)
(net->readStream, me->data, me->b_read)) != HT_OK) { (net->readStream, me->data, me->b_read)) != HT_OK)
if (status == HT_WOULD_BLOCK) { {
if (status == HT_WOULD_BLOCK)
{
HTTRACE(PROT_TRACE, "ANSI read... Target WOULD BLOCK\n"); HTTRACE(PROT_TRACE, "ANSI read... Target WOULD BLOCK\n");
return HT_WOULD_BLOCK; return HT_WOULD_BLOCK;
} else if (status == HT_PAUSE) { }
else if (status == HT_PAUSE)
{
HTTRACE(PROT_TRACE, "ANSI read... Target PAUSED\n"); HTTRACE(PROT_TRACE, "ANSI read... Target PAUSED\n");
return HT_PAUSE; return HT_PAUSE;
} else if (status > 0) { /* Stream specific return code */ }
else if (status > 0)
{
/* Stream specific return code */
HTTRACE(PROT_TRACE, "ANSI read... Target returns %d\n" _ status); HTTRACE(PROT_TRACE, "ANSI read... Target returns %d\n" _ status);
me->write = me->data + me->b_read; me->write = me->data + me->b_read;
return status; return status;
} else { /* We have a real error */ }
else
{
/* We have a real error */
HTTRACE(PROT_TRACE, "ANSI read... Target ERROR\n"); HTTRACE(PROT_TRACE, "ANSI read... Target ERROR\n");
return status; return status;
} }
@ -506,13 +541,15 @@ PRIVATE int HTNeLReader_close (HTInputStream * me)
HTNet * net = HTHost_getReadNet(me->host); HTNet * net = HTHost_getReadNet(me->host);
if (net && net->readStream) { if (net && net->readStream)
if ((status = (*net->readStream->isa->_free)(net->readStream))==HT_WOULD_BLOCK) {
return HT_WOULD_BLOCK; if ((status = (*net->readStream->isa->_free)(net->readStream))==HT_WOULD_BLOCK) return HT_WOULD_BLOCK;
net->readStream = NULL; net->readStream = NULL;
} }
HTTRACE(STREAM_TRACE, "Socket read. FREEING....\n"); HTTRACE(STREAM_TRACE, "Socket read. FREEING....\n");
HT_FREE(me); HT_FREE(me);
return status; return status;
} }
@ -540,7 +577,8 @@ PRIVATE int HTNeLReader_free (HTInputStream * me)
} }
HTNet * net = HTHost_getReadNet(me->host); HTNet * net = HTHost_getReadNet(me->host);
if (net && net->readStream) { if (net && net->readStream)
{
int status = (*net->readStream->isa->_free)(net->readStream); int status = (*net->readStream->isa->_free)(net->readStream);
if (status == HT_OK) net->readStream = NULL; if (status == HT_OK) net->readStream = NULL;
return status; return status;
@ -551,7 +589,8 @@ PRIVATE int HTNeLReader_free (HTInputStream * me)
PRIVATE int HTNeLReader_abort (HTInputStream * me, HTList * /* e */) PRIVATE int HTNeLReader_abort (HTInputStream * me, HTList * /* e */)
{ {
HTNet * net = HTHost_getReadNet(me->host); HTNet * net = HTHost_getReadNet(me->host);
if (net && net->readStream) { if (net && net->readStream)
{
int status = (*net->readStream->isa->abort)(net->readStream, NULL); int status = (*net->readStream->isa->abort)(net->readStream, NULL);
if (status != HT_IGNORE) net->readStream = NULL; if (status != HT_IGNORE) net->readStream = NULL;
} }
@ -560,7 +599,7 @@ PRIVATE int HTNeLReader_abort (HTInputStream * me, HTList * /* e */)
PRIVATE const HTInputStreamClass HTNeLReader = PRIVATE const HTInputStreamClass HTNeLReader =
{ {
(char*)"SocketReader", "SocketReader",
HTNeLReader_flush, HTNeLReader_flush,
HTNeLReader_free, HTNeLReader_free,
HTNeLReader_abort, HTNeLReader_abort,
@ -569,14 +608,14 @@ PRIVATE const HTInputStreamClass HTNeLReader =
HTNeLReader_consumed HTNeLReader_consumed
}; };
PUBLIC HTInputStream * HTNeLReader_new (HTHost * host, HTChannel * ch, PUBLIC HTInputStream * HTNeLReader_new (HTHost * host, HTChannel * ch, void * /* param */, int /* mode */)
void * /* param */, int /* mode */) {
if (host && ch)
{ {
if (host && ch) {
HTInputStream * me = HTChannel_input(ch); HTInputStream * me = HTChannel_input(ch);
if (me == NULL) { if (me == NULL)
if ((me=(HTInputStream *) HT_CALLOC(1, sizeof(HTInputStream))) == NULL) {
HT_OUTOFMEM((char*)"HTNeLReader_new"); if ((me=(HTInputStream *) HT_CALLOC(1, sizeof(HTInputStream))) == NULL) HT_OUTOFMEM("HTNeLReader_new");
me->isa = &HTNeLReader; me->isa = &HTNeLReader;
me->ch = ch; me->ch = ch;
me->host = host; me->host = host;

View file

@ -1499,7 +1499,7 @@ void cf_setVar (NLMISC::CConfigFile::CVar &Var, cf_value Val)
switch (Val.Type) switch (Val.Type)
{ {
case NLMISC::CConfigFile::CVar::T_REAL: Var.IntValues.push_back ((int)Val.Real); break; case NLMISC::CConfigFile::CVar::T_REAL: Var.IntValues.push_back ((int)Val.Real); break;
case NLMISC::CConfigFile::CVar::T_STRING: Var.IntValues.push_back (atoi(Val.String)); break; case NLMISC::CConfigFile::CVar::T_STRING: { int val = 0; NLMISC::fromString(Val.String, val); Var.IntValues.push_back(val); break; }
default: break; default: break;
} }
break; break;
@ -1507,7 +1507,7 @@ void cf_setVar (NLMISC::CConfigFile::CVar &Var, cf_value Val)
switch (Val.Type) switch (Val.Type)
{ {
case NLMISC::CConfigFile::CVar::T_INT: Var.RealValues.push_back ((double)Val.Int); break; case NLMISC::CConfigFile::CVar::T_INT: Var.RealValues.push_back ((double)Val.Int); break;
case NLMISC::CConfigFile::CVar::T_STRING: Var.RealValues.push_back (atof(Val.String)); break; case NLMISC::CConfigFile::CVar::T_STRING: { double val = 0.0; NLMISC::fromString(Val.String, val); Var.RealValues.push_back(val); break; }
default: break; default: break;
} }
break; break;

View file

@ -517,7 +517,7 @@ void cf_setVar (NLMISC::CConfigFile::CVar &Var, cf_value Val)
switch (Val.Type) switch (Val.Type)
{ {
case NLMISC::CConfigFile::CVar::T_REAL: Var.IntValues.push_back ((int)Val.Real); break; case NLMISC::CConfigFile::CVar::T_REAL: Var.IntValues.push_back ((int)Val.Real); break;
case NLMISC::CConfigFile::CVar::T_STRING: Var.IntValues.push_back (atoi(Val.String)); break; case NLMISC::CConfigFile::CVar::T_STRING: { int val = 0; NLMISC::fromString(Val.String, val); Var.RealValues.push_back(val); break; }
default: break; default: break;
} }
break; break;
@ -525,7 +525,7 @@ void cf_setVar (NLMISC::CConfigFile::CVar &Var, cf_value Val)
switch (Val.Type) switch (Val.Type)
{ {
case NLMISC::CConfigFile::CVar::T_INT: Var.RealValues.push_back ((double)Val.Int); break; case NLMISC::CConfigFile::CVar::T_INT: Var.RealValues.push_back ((double)Val.Int); break;
case NLMISC::CConfigFile::CVar::T_STRING: Var.RealValues.push_back (atof(Val.String)); break; case NLMISC::CConfigFile::CVar::T_STRING: { double val = 0.0; NLMISC::fromString(Val.String, val); Var.RealValues.push_back(val); break; }
default: break; default: break;
} }
break; break;

View file

@ -2337,7 +2337,7 @@ YY_RULE_SETUP
if (!cf_Ignore) if (!cf_Ignore)
{ {
cflval.Val.Type = T_REAL; cflval.Val.Type = T_REAL;
cflval.Val.Real = atof (yytext); NLMISC::fromString(yytext, cflval.Val.Real);
DEBUG_PRINTF("lex: real '%s' '%f\n", yytext, cflval.Val.Real); DEBUG_PRINTF("lex: real '%s' '%f\n", yytext, cflval.Val.Real);
return REAL; return REAL;
} }

View file

@ -85,8 +85,12 @@ double CConfigFile::CVar::asDouble (int index) const
if (index >= (int)IntValues.size () || index < 0) throw EBadSize (Name, (int)IntValues.size (), index); if (index >= (int)IntValues.size () || index < 0) throw EBadSize (Name, (int)IntValues.size (), index);
return (double)IntValues[index]; return (double)IntValues[index];
case T_STRING: case T_STRING:
{
if (index >= (int)StrValues.size () || index < 0) throw EBadSize (Name, (int)StrValues.size (), index); if (index >= (int)StrValues.size () || index < 0) throw EBadSize (Name, (int)StrValues.size (), index);
return atof(StrValues[index].c_str()); double val;
NLMISC::fromString(StrValues[index], val);
return val;
}
default: default:
if (index >= (int)RealValues.size () || index < 0) throw EBadSize (Name, (int)RealValues.size (), index); if (index >= (int)RealValues.size () || index < 0) throw EBadSize (Name, (int)RealValues.size (), index);
return RealValues[index]; return RealValues[index];

View file

@ -71,14 +71,12 @@ void CColorModifier::convertBitmap(NLMISC::CBitmap &destBitmap, const NLMISC::CB
// blend to the destination by using the mask alpha // blend to the destination by using the mask alpha
result.blendFromui(*dest, result, mask->R); result.blendFromui(*dest, result, mask->R);
/// keep alpha from the source /// keep alpha from the source
dest->R = result.R; dest->R = result.R;
dest->G = result.G; dest->G = result.G;
dest->B = result.B; dest->B = result.B;
dest->A = src->A; dest->A = src->A;
++ mask; ++ mask;
++ src; ++ src;
++ dest; ++ dest;

View file

@ -556,10 +556,9 @@ void checkDriverDepth ()
static std::string replaceApplicationDirToken(const std::string &dir) static std::string replaceApplicationDirToken(const std::string &dir)
{ {
#ifdef NL_OS_MAC #ifdef NL_OS_MAC
// if client_default.cfg is not in current directory, and it's not an absolute path, use application default directory // if client_default.cfg is not in current directory, and it's not an absolute path, use application default directory
if (!CFile::isExists("client_default.cfg") && dir.size()>0 && dir[0]!='/') if (!CFile::isExists("client_default.cfg") && !dir.empty() && dir[0]!='/')
{ {
return getAppBundlePath() + "/Contents/Resources/" + dir; return getAppBundlePath() + "/Contents/Resources/" + dir;
} }

View file

@ -604,6 +604,10 @@ void CChatGroupWindow::displayMessage(const ucstring &msg, NLMISC::CRGBA col, CC
pos = newmsg.find(ucstring("}"));; pos = newmsg.find(ucstring("}"));;
prefix += " "; prefix += " ";
} }
if (pos == ucstring::npos)
newmsg = prefix + newmsg;
else
newmsg = newmsg.substr(0, pos + 1) + prefix + newmsg.substr(pos + 1); newmsg = newmsg.substr(0, pos + 1) + prefix + newmsg.substr(pos + 1);
// Add dynchannel number and optionally name before text if user channel // Add dynchannel number and optionally name before text if user channel
@ -615,6 +619,10 @@ void CChatGroupWindow::displayMessage(const ucstring &msg, NLMISC::CRGBA col, CC
STRING_MANAGER::CStringManagerClient::instance()->getDynString(textId, title); STRING_MANAGER::CStringManagerClient::instance()->getDynString(textId, title);
prefix = title.empty() ? ucstring("") : ucstring(" ") + title; prefix = title.empty() ? ucstring("") : ucstring(" ") + title;
pos = newmsg.find(ucstring("] ")); pos = newmsg.find(ucstring("] "));
if (pos == ucstring::npos)
newmsg = prefix + newmsg;
else
newmsg = newmsg.substr(0, pos) + prefix + newmsg.substr(pos); newmsg = newmsg.substr(0, pos) + prefix + newmsg.substr(pos);
} }
} }

View file

@ -22,6 +22,7 @@
#include "../user_entity.h" #include "../user_entity.h"
#include "../entities.h" #include "../entities.h"
#include "interface_manager.h" #include "interface_manager.h"
#include "user_agent.h"
// used for login cookie to be sent to the web server // used for login cookie to be sent to the web server
#include "../net_manager.h" #include "../net_manager.h"
@ -157,7 +158,7 @@ struct CWebigNotificationThread : public NLMISC::IRunnable
if(!Curl) return; if(!Curl) return;
curl_easy_setopt(Curl, CURLOPT_COOKIEFILE, ""); curl_easy_setopt(Curl, CURLOPT_COOKIEFILE, "");
curl_easy_setopt(Curl, CURLOPT_NOPROGRESS, 1); curl_easy_setopt(Curl, CURLOPT_NOPROGRESS, 1);
curl_easy_setopt(Curl, CURLOPT_USERAGENT, "Ryzom"); curl_easy_setopt(Curl, CURLOPT_USERAGENT, getUserAgent().c_str());
curl_easy_setopt(Curl, CURLOPT_FOLLOWLOCATION, 1); curl_easy_setopt(Curl, CURLOPT_FOLLOWLOCATION, 1);
curl_easy_setopt(Curl, CURLOPT_WRITEFUNCTION, writeDataFromCurl); curl_easy_setopt(Curl, CURLOPT_WRITEFUNCTION, writeDataFromCurl);
//nlinfo("ctor CWebigNotificationThread"); //nlinfo("ctor CWebigNotificationThread");

View file

@ -2925,7 +2925,7 @@ void CInterfaceManager::initEmotes()
CSkillManager *pSM = CSkillManager::getInstance(); CSkillManager *pSM = CSkillManager::getInstance();
betaTester = pSM->isTitleUnblocked(CHARACTER_TITLE::FBT); betaTester = pSM->isTitleUnblocked(CHARACTER_TITLE::FBT);
string previousMind = ""; string previousMind;
CGroupSubMenu *pFirstMenu = 0; CGroupSubMenu *pFirstMenu = 0;
for (list<CEmoteEntry>::const_iterator it = entries.begin(); it != entries.end(); it++) for (list<CEmoteEntry>::const_iterator it = entries.begin(); it != entries.end(); it++)

View file

@ -1068,12 +1068,12 @@ float CPatchManager::getCurrentFileProgress() const
} }
// **************************************************************************** // ****************************************************************************
void CPatchManager::setRWAccess (const string &filename) void CPatchManager::setRWAccess (const string &filename, bool bThrowException)
{ {
ucstring s = CI18N::get("uiSetAttrib") + " " + filename; ucstring s = CI18N::get("uiSetAttrib") + " " + filename;
setState(true, s); setState(true, s);
if (!NLMISC::CFile::setRWAccess(filename)) if (!NLMISC::CFile::setRWAccess(filename) && bThrowException)
{ {
s = CI18N::get("uiAttribErr") + " " + filename + " (" + toString(errno) + "," + strerror(errno) + ")"; s = CI18N::get("uiAttribErr") + " " + filename + " (" + toString(errno) + "," + strerror(errno) + ")";
setState(true, s); setState(true, s);
@ -1351,7 +1351,7 @@ void CPatchManager::downloadFileWithCurl (const string &source, const string &de
// create the local file // create the local file
if (NLMISC::CFile::fileExists(dest)) if (NLMISC::CFile::fileExists(dest))
{ {
setRWAccess(dest); setRWAccess(dest, false);
NLMISC::CFile::deleteFile(dest.c_str()); NLMISC::CFile::deleteFile(dest.c_str());
} }
FILE *fp = fopen (dest.c_str(), "wb"); FILE *fp = fopen (dest.c_str(), "wb");
@ -1492,7 +1492,7 @@ void CPatchManager::decompressFile (const string &filename)
} }
string dest = filename.substr(0, filename.size ()-4); string dest = filename.substr(0, filename.size ()-4);
setRWAccess(dest); setRWAccess(dest, false);
//if(isVerboseLog()) nlinfo("Calling fopen('%s','wb')", dest.c_str()); //if(isVerboseLog()) nlinfo("Calling fopen('%s','wb')", dest.c_str());
FILE *fp = fopen (dest.c_str(), "wb"); FILE *fp = fopen (dest.c_str(), "wb");
if (fp == NULL) if (fp == NULL)
@ -1566,7 +1566,7 @@ void CPatchManager::applyDate (const string &sFilename, uint32 nDate)
{ {
// _utimbuf utb; // _utimbuf utb;
// utb.actime = utb.modtime = nDate; // utb.actime = utb.modtime = nDate;
setRWAccess(sFilename); setRWAccess(sFilename, false);
ucstring s = CI18N::get("uiChangeDate") + " " + NLMISC::CFile::getFilename(sFilename) + " " + toString(NLMISC::CFile::getFileModificationDate (sFilename)) + ucstring s = CI18N::get("uiChangeDate") + " " + NLMISC::CFile::getFilename(sFilename) + " " + toString(NLMISC::CFile::getFileModificationDate (sFilename)) +
" -> " + toString(nDate); " -> " + toString(nDate);
setState(true,s); setState(true,s);
@ -3398,6 +3398,7 @@ bool CPatchManager::extract(const std::string& patchPath,
ok = true; ok = true;
} }
} }
if (!ok) if (!ok)
{ {
// nothing to extract // nothing to extract
@ -3407,15 +3408,21 @@ bool CPatchManager::extract(const std::string& patchPath,
// extract // extract
uint nblab = 0; uint nblab = 0;
pPM->deleteFile(updateBatchFilename, false, false); pPM->deleteFile(updateBatchFilename, false, false);
FILE *fp = fopen (updateBatchFilename.c_str(), "wt"); FILE *fp = fopen (updateBatchFilename.c_str(), "wt");
if (fp == 0) if (fp == 0)
{ {
string err = toString("Can't open file '%s' for writing: code=%d %s (error code 29)", updateBatchFilename.c_str(), errno, strerror(errno)); string err = toString("Can't open file '%s' for writing: code=%d %s (error code 29)", updateBatchFilename.c_str(), errno, strerror(errno));
throw Exception (err); throw Exception (err);
} }
#ifdef NL_OS_WINDOWS
fprintf(fp, "@echo off\n"); fprintf(fp, "@echo off\n");
fprintf(fp, "ping 127.0.0.1 -n 7 -w 1000 > nul\n"); // wait fprintf(fp, "ping 127.0.0.1 -n 7 -w 1000 > nul\n"); // wait
#else
// TODO: for Linux and OS X
#endif
// Unpack files with category ExtractPath non empty // Unpack files with category ExtractPath non empty
for (uint32 j = 0; j < sourceFilename.size(); ++j) for (uint32 j = 0; j < sourceFilename.size(); ++j)
@ -3442,21 +3449,32 @@ bool CPatchManager::extract(const std::string& patchPath,
string DstPath = CPath::standardizeDosPath(extractPath[j]); string DstPath = CPath::standardizeDosPath(extractPath[j]);
string DstName = DstPath + vFilenames[fff]; string DstName = DstPath + vFilenames[fff];
NLMISC::CFile::createDirectoryTree(extractPath[j]); NLMISC::CFile::createDirectoryTree(extractPath[j]);
// this file must be moved
// this file must be moved
#ifdef NL_OS_WINDOWS
fprintf(fp, ":loop%u\n", nblab); fprintf(fp, ":loop%u\n", nblab);
fprintf(fp, "attrib -r -a -s -h %s\n", DstName.c_str()); fprintf(fp, "attrib -r -a -s -h %s\n", DstName.c_str());
fprintf(fp, "del %s\n", DstName.c_str()); fprintf(fp, "del %s\n", DstName.c_str());
fprintf(fp, "if exist %s goto loop%u\n", DstName.c_str(), nblab); fprintf(fp, "if exist %s goto loop%u\n", DstName.c_str(), nblab);
fprintf(fp, "move %s %s\n", SrcName.c_str(), DstPath.c_str()); fprintf(fp, "move %s %s\n", SrcName.c_str(), DstPath.c_str());
#else
// TODO: for Linux and OS X
#endif
nblab++; nblab++;
} }
} }
} }
} }
#ifdef NL_OS_WINDOWS
fprintf(fp, "start %s %%1 %%2 %%3\n", execName.c_str()); fprintf(fp, "start %s %%1 %%2 %%3\n", execName.c_str());
#else
// TODO: for Linux and OS X
#endif
fclose(fp); fclose(fp);
if (stopFun) if (stopFun)

View file

@ -302,7 +302,7 @@ private:
/// Read the description of the highest client version file found /// Read the description of the highest client version file found
void readClientVersionAndDescFile(); void readClientVersionAndDescFile();
void setRWAccess (const std::string &filename); void setRWAccess (const std::string &filename, bool bThrowException=true);
std::string deleteFile (const std::string &filename, bool bThrowException=true, bool bWarning=true); std::string deleteFile (const std::string &filename, bool bThrowException=true, bool bWarning=true);

View file

@ -85,7 +85,7 @@ static std::string sizeToHumanStd(uint64 size)
static std::string getVideoInfoDeviceName() static std::string getVideoInfoDeviceName()
{ {
uint64 version; uint64 version;
std::string ret = ""; std::string ret;
bool ok = CSystemInfo::getVideoInfo(ret, version); bool ok = CSystemInfo::getVideoInfo(ret, version);
if (ok) if (ok)
{ {

View file

@ -920,7 +920,7 @@ std::string getStringCategory(const ucstring &src, ucstring &dest, bool alwaysAd
std::string getStringCategoryIfAny(const ucstring &src, ucstring &dest) std::string getStringCategoryIfAny(const ucstring &src, ucstring &dest)
{ {
std::string colorCode = ""; std::string colorCode;
if (src.size() >= 3) if (src.size() >= 3)
{ {
uint startPos = 0; uint startPos = 0;

View file

@ -4109,7 +4109,7 @@ void CNetManagerMulti::init( const std::string& cookie, const std::string& addr
// //
uint32 ShardId = 0; uint32 ShardId = 0;
std::string WebServer = ""; std::string WebServer;

View file

@ -564,7 +564,7 @@ void CDisplayerVisualEntity::updateWorldMapPresence()
_MapDeco.setDisplayedInstance(getDisplayedInstance(), true); _MapDeco.setDisplayedInstance(getDisplayedInstance(), true);
// retrieve icon from the displayed object (lua code) // retrieve icon from the displayed object (lua code)
CLuaState &ls = getEditor().getLua(); CLuaState &ls = getEditor().getLua();
std::string texName = ""; std::string texName;
{ {
CLuaStackChecker lsc(&ls); CLuaStackChecker lsc(&ls);
if (getDisplayedInstance()->getLuaProjection().callMethodByNameNoThrow("getSelectBarIcon", 0, 1)) if (getDisplayedInstance()->getLuaProjection().callMethodByNameNoThrow("getSelectBarIcon", 0, 1))
@ -984,7 +984,7 @@ void CDisplayerVisualEntity::updateName()
break; break;
} }
} }
std::string firstPart = ""; std::string firstPart;
if(actNb>0) if(actNb>0)
firstPart = CI18N::get("uiR2EDDefaultActTitle").toString() + " " + NLMISC::toString(actNb); firstPart = CI18N::get("uiR2EDDefaultActTitle").toString() + " " + NLMISC::toString(actNb);

View file

@ -1116,12 +1116,12 @@ void CClientEditionModule::startingScenario(class NLNET::IModuleProxy * /* serve
uint32 myUserId = NetMngr.getUserId(); uint32 myUserId = NetMngr.getUserId();
std::string connectionState = ""; std::string connectionState;
if (myUserId == (charId>>4) || ClientCfg.Local) if (myUserId == (charId>>4) || ClientCfg.Local)
{ {
std::string errorMsg = ""; std::string errorMsg;
CObject* hlScenario = _Scenario->getHighLevel(); CObject* hlScenario = _Scenario->getHighLevel();
hlData.setData(hlScenario); // clone before modify by translateFeatures hlData.setData(hlScenario); // clone before modify by translateFeatures
@ -2425,10 +2425,10 @@ bool CClientEditionModule::addToLoadList( const std::string& filename, CScenario
void CClientEditionModule::loadScenarioSucceded(const std::string& filename, const std::string& body, const CScenarioValidator::TValues& values) void CClientEditionModule::loadScenarioSucceded(const std::string& filename, const std::string& body, const CScenarioValidator::TValues& values)
{ {
//H_AUTO(R2_CClientEditionModule_loadScenarioSucceded) //H_AUTO(R2_CClientEditionModule_loadScenarioSucceded)
string initialIsland="", initialEntryPoint="", initialSeason = ""; string initialIsland, initialEntryPoint, initialSeason;
string creatorMD5 = "", modifiedByMD5=""; string creatorMD5, modifiedByMD5;
string name = ""; string name;
string locked = ""; string locked;
for(uint i=0; i<values.size(); i++) for(uint i=0; i<values.size(); i++)
{ {
const std::pair<std::string, std::string>& pair = values[i]; const std::pair<std::string, std::string>& pair = values[i];

View file

@ -834,7 +834,7 @@ sint CComLuaModule::luaRequestEraseNode(lua_State* state)
if (args>2) { luaL_checknumber(state, 3); } if (args>2) { luaL_checknumber(state, 3); }
std::string instanceId(lua_tostring(state, 1)); std::string instanceId(lua_tostring(state, 1));
std::string attrName = ""; std::string attrName;
sint position = -1; sint position = -1;
if (args>1){ attrName = lua_tostring(state, 2);} if (args>1){ attrName = lua_tostring(state, 2);}
if (args>2){ position = static_cast<sint>(lua_tonumber(state, 3));} if (args>2){ position = static_cast<sint>(lua_tonumber(state, 3));}
@ -1255,7 +1255,7 @@ CObject* CComLuaModule::getObjectFromLua(lua_State* state, sint idx)
lua_pushnil(state); lua_pushnil(state);
while (lua_next(state, -2) != 0) while (lua_next(state, -2) != 0)
{ {
std::string key = ""; std::string key;
if ( lua_type(state, -2) == LUA_TSTRING) if ( lua_type(state, -2) == LUA_TSTRING)
{ {
key = lua_tostring(state, -2); key = lua_tostring(state, -2);
@ -1285,7 +1285,7 @@ CObject* CComLuaModule::getObjectFromLua(lua_State* state, sint idx)
CObject* CComLuaModule::loadLocal(const std::string& filename, const CScenarioValidator::TValues& values) CObject* CComLuaModule::loadLocal(const std::string& filename, const CScenarioValidator::TValues& values)
{ {
CScenarioValidator::TValues::const_iterator first(values.begin()), last(values.end()); CScenarioValidator::TValues::const_iterator first(values.begin()), last(values.end());
std::string name = ""; std::string name;
for (; first != last; ++first) for (; first != last; ++first)
{ {
if (first->first == "Name" ) { name = first->second; } if (first->first == "Name" ) { name = first->second; }
@ -1347,7 +1347,7 @@ bool CComLuaModule::loadUserComponent(const std::string& filename)
CObject* CComLuaModule::loadFromBuffer(const std::string& data, const std::string& filename, const CScenarioValidator::TValues& values) CObject* CComLuaModule::loadFromBuffer(const std::string& data, const std::string& filename, const CScenarioValidator::TValues& values)
{ {
CScenarioValidator::TValues::const_iterator first(values.begin()), last(values.end()); CScenarioValidator::TValues::const_iterator first(values.begin()), last(values.end());
std::string name = ""; std::string name;
for (; first != last; ++first) for (; first != last; ++first)
{ {
if (first->first == "Name" ) { name = first->second; } if (first->first == "Name" ) { name = first->second; }

View file

@ -267,7 +267,7 @@ void CDynamicMapClient::save(const std::string& /* filename */)
void CDynamicMapClient::saveRtData(const std::string& filename) void CDynamicMapClient::saveRtData(const std::string& filename)
{ {
//H_AUTO(R2_CDynamicMapClient_saveRtData) //H_AUTO(R2_CDynamicMapClient_saveRtData)
std::string name = ""; std::string name;
name += filename; name += filename;
//std::ostringstream out2; //std::ostringstream out2;
std::string out2; std::string out2;

View file

@ -21,7 +21,6 @@
#include "session_browser.h" #include "session_browser.h"
#include "game_share/ring_session_manager_itf.h" #include "game_share/ring_session_manager_itf.h"
#include "nel/gui/lua_helper.h" #include "nel/gui/lua_helper.h"
using namespace NLGUI;
#include "far_tp.h" #include "far_tp.h"
class CSessionBrowserImpl : public CSessionBrowser, class CSessionBrowserImpl : public CSessionBrowser,
@ -37,7 +36,7 @@ public:
* - RingAccessPoint:onConnectionClosed() * - RingAccessPoint:onConnectionClosed()
* - RingAccessPoint:onConnectionFailed() * - RingAccessPoint:onConnectionFailed()
*/ */
void init(CLuaState *ls); void init(NLGUI::CLuaState *ls);
// from CSessionBrowser // from CSessionBrowser
virtual void on_connectionFailed(); virtual void on_connectionFailed();
virtual void on_connectionClosed(); virtual void on_connectionClosed();
@ -99,17 +98,17 @@ public:
static const std::string &getFrontEndAddress(); static const std::string &getFrontEndAddress();
private: private:
CLuaState::TRefPtr _Lua; NLGUI::CLuaState::TRefPtr _Lua;
static int luaGetRingSessionList(CLuaState &ls); static int luaGetRingSessionList(NLGUI::CLuaState &ls);
static int luaGetRingCharList(CLuaState &ls); static int luaGetRingCharList(NLGUI::CLuaState &ls);
static int luaJoinRingSession(CLuaState &ls); static int luaJoinRingSession(NLGUI::CLuaState &ls);
static int luaCheckRingAccess(CLuaState &ls); static int luaCheckRingAccess(NLGUI::CLuaState &ls);
static int luaGetFileHeader(CLuaState &ls); static int luaGetFileHeader(NLGUI::CLuaState &ls);
static int luaGetRingStats(CLuaState &ls); static int luaGetRingStats(NLGUI::CLuaState &ls);
static int luaGetScenarioScores(CLuaState &ls); static int luaGetScenarioScores(NLGUI::CLuaState &ls);
static int luaUpdateScenarioScores(CLuaState &ls); static int luaUpdateScenarioScores(NLGUI::CLuaState &ls);
static int luaGetSessionAverageScores(CLuaState &ls); static int luaGetSessionAverageScores(NLGUI::CLuaState &ls);
static int luaGetScenarioAverageScores(CLuaState &ls); static int luaGetScenarioAverageScores(NLGUI::CLuaState &ls);
// Call a method inside the 'RingAccessPoint' lua table // Call a method inside the 'RingAccessPoint' lua table
void callRingAccessPointMethod(const char *name, int numArg, int numResult); void callRingAccessPointMethod(const char *name, int numArg, int numResult);
void callRingCharTrackingMethod(const char *name, int numArg, int numResult); void callRingCharTrackingMethod(const char *name, int numArg, int numResult);

View file

@ -11,4 +11,8 @@ NL_ADD_LIB_SUFFIX(ryzom_adminmodules)
ADD_DEFINITIONS(${LIBXML2_DEFINITIONS}) ADD_DEFINITIONS(${LIBXML2_DEFINITIONS})
IF(WITH_PCH)
ADD_NATIVE_PRECOMPILED_HEADER(ryzom_adminmodules ${CMAKE_CURRENT_SOURCE_DIR}/stdpch.h ${CMAKE_CURRENT_SOURCE_DIR}/stdpch.cpp)
ENDIF(WITH_PCH)
INSTALL(TARGETS ryzom_adminmodules LIBRARY DESTINATION ${RYZOM_LIB_PREFIX} ARCHIVE DESTINATION ${RYZOM_LIB_PREFIX} COMPONENT libraries) INSTALL(TARGETS ryzom_adminmodules LIBRARY DESTINATION ${RYZOM_LIB_PREFIX} ARCHIVE DESTINATION ${RYZOM_LIB_PREFIX} COMPONENT libraries)

View file

@ -18,6 +18,7 @@
// WARNING : this is a generated file, don't change it ! // WARNING : this is a generated file, don't change it !
///////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////
#include "stdpch.h"
#include "admin_modules_itf.h" #include "admin_modules_itf.h"
namespace ADMIN namespace ADMIN

View file

@ -15,6 +15,7 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "stdpch.h"
#include "nel/misc/singleton.h" #include "nel/misc/singleton.h"
#include "nel/net/module.h" #include "nel/net/module.h"
#include "nel/net/module_builder_parts.h" #include "nel/net/module_builder_parts.h"

View file

@ -15,6 +15,7 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "stdpch.h"
#include "nel/misc/singleton.h" #include "nel/misc/singleton.h"
#include <time.h> #include <time.h>
#include "nel/misc/path.h" #include "nel/misc/path.h"
@ -573,7 +574,7 @@ namespace ADMIN
time_t t = now; time_t t = now;
fprintf(fp, "AESReportDate=%s", ::ctime(&t)); fprintf(fp, "AESReportDate=%s", ::ctime(&t));
fprintf(fp, "NBService=%u\n", _ServiceStates.size()); fprintf(fp, "NBService=%u\n", (uint)_ServiceStates.size());
// output state of each service // output state of each service
TServiceStates::iterator first(_ServiceStates.begin()), last(_ServiceStates.end()); TServiceStates::iterator first(_ServiceStates.begin()), last(_ServiceStates.end());
for (; first != last; ++first) for (; first != last; ++first)

View file

@ -14,6 +14,7 @@
// You should have received a copy of the GNU Affero General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "stdpch.h"
#include "nel/misc/types_nl.h" #include "nel/misc/types_nl.h"
#include <time.h> #include <time.h>
#include "nel/misc/file.h" #include "nel/misc/file.h"

View file

@ -713,11 +713,14 @@ void CBotNpc::sendVPA() // alternate VPA
} }
void CBotNpc::sendVisualProperties() // VisualPropertyA, B, C void CBotNpc::sendVisualProperties() // VisualPropertyA, B, C
{
if (getSpawn())
{ {
CMirrors::setVisualPropertyA( getSpawn()->dataSetRow(), _VisualPropertyA ); CMirrors::setVisualPropertyA( getSpawn()->dataSetRow(), _VisualPropertyA );
CMirrors::setVisualPropertyB( getSpawn()->dataSetRow(), _VisualPropertyB ); CMirrors::setVisualPropertyB( getSpawn()->dataSetRow(), _VisualPropertyB );
CMirrors::setVisualPropertyC( getSpawn()->dataSetRow(), _VisualPropertyC ); CMirrors::setVisualPropertyC( getSpawn()->dataSetRow(), _VisualPropertyC );
} }
}
bool CBotNpc::reSpawn(bool sendMessage) bool CBotNpc::reSpawn(bool sendMessage)
{ {

View file

@ -577,10 +577,10 @@ NLMISC_COMMAND(createStaticAIInstance, "Create a new static AIInstance for a giv
CUsedContinent &uc = CUsedContinent::instance(); CUsedContinent &uc = CUsedContinent::instance();
const uint32 in = uc.getInstanceForContinent(args[0]); const uint32 in = uc.getInstanceForContinent(args[0]);
if (in == ~0) if (in == INVALID_AI_INSTANCE)
{ {
nlwarning("The continent '%s' is unknow or not active. Can't create instance, FATAL", args[0].c_str()); nlwarning("The continent '%s' is unknow or not active. Can't create instance, FATAL", args[0].c_str());
nlassert(in != ~0); nlassert(in != INVALID_AI_INSTANCE);
// nlassertex(in != ~0, ("The continent '%s' is unknow or not active. Can't create instance, FATAL", args[0].c_str())); // nlassertex(in != ~0, ("The continent '%s' is unknow or not active. Can't create instance, FATAL", args[0].c_str()));
} }

View file

@ -101,12 +101,12 @@ public:
{ {
} }
CMsgAIFeedback(std::string message) CMsgAIFeedback(const std::string &message)
{ {
Message=message; Message=message;
} }
CMsgAIFeedback(char *msgStr) CMsgAIFeedback(const char *msgStr)
{ {
Message=std::string(msgStr); Message=std::string(msgStr);
} }
@ -120,6 +120,5 @@ public:
virtual void callback (const std::string &name, NLNET::TServiceId id); virtual void callback (const std::string &name, NLNET::TServiceId id);
}; };
#endif #endif

View file

@ -4176,7 +4176,7 @@ NLMISC_COMMAND(loadMap,"load a complete set of primitive files","<map name>")
// check that the continent is active // check that the continent is active
CUsedContinent &uc = CUsedContinent::instance(); CUsedContinent &uc = CUsedContinent::instance();
uint32 in = uc.getInstanceForContinent(continentName); uint32 in = uc.getInstanceForContinent(continentName);
if (in == ~0) if (in == INVALID_AI_INSTANCE)
{ {
log.displayNL("loadMap : while loading map '%s', can't load primitive '%s' coz continent '%s' is not active", log.displayNL("loadMap : while loading map '%s', can't load primitive '%s' coz continent '%s' is not active",
args[0].c_str(), args[0].c_str(),
@ -4216,7 +4216,7 @@ NLMISC_COMMAND(unloadMap,"unload a complete set of primitive files","<map name>"
// check that the continent is active // check that the continent is active
CUsedContinent &uc = CUsedContinent::instance(); CUsedContinent &uc = CUsedContinent::instance();
uint32 in = uc.getInstanceForContinent(continentName); uint32 in = uc.getInstanceForContinent(continentName);
if (in == ~0) if (in == INVALID_AI_INSTANCE)
{ {
log.displayNL("unloadMap : while loading map '%s', can't load primitive '%s' coz continent '%s' is not active", log.displayNL("unloadMap : while loading map '%s', can't load primitive '%s' coz continent '%s' is not active",
args[0].c_str(), args[0].c_str(),

View file

@ -420,7 +420,7 @@ bool getAIInstanceFromGroupName(string& groupName, uint32& instanceNumber)
{ {
string continent = groupName.substr(0, groupName.find('@')); string continent = groupName.substr(0, groupName.find('@'));
uint32 nr = CUsedContinent::instance().getInstanceForContinent(continent); uint32 nr = CUsedContinent::instance().getInstanceForContinent(continent);
if (nr == ~0) if (nr == INVALID_AI_INSTANCE)
{ {
return false; return false;
} }

View file

@ -242,11 +242,11 @@ float CItemCraftParameters::getCraftParameterValue( RM_FABER_STAT_TYPE::TRMStatT
case RM_FABER_STAT_TYPE::ShockWaveProtection: case RM_FABER_STAT_TYPE::ShockWaveProtection:
case RM_FABER_STAT_TYPE::PoisonProtection: case RM_FABER_STAT_TYPE::PoisonProtection:
case RM_FABER_STAT_TYPE::ElectricityProtection: case RM_FABER_STAT_TYPE::ElectricityProtection:
if (Protection1 == statType) if (Protection1 == (PROTECTION_TYPE::TProtectionType)statType)
return Protection1Factor; return Protection1Factor;
else if (Protection2 == statType) else if (Protection2 == (PROTECTION_TYPE::TProtectionType)statType)
return Protection2Factor; return Protection2Factor;
else if (Protection3 == statType) else if (Protection3 == (PROTECTION_TYPE::TProtectionType)statType)
return Protection3Factor; return Protection3Factor;
else return 0.0f; else return 0.0f;
case RM_FABER_STAT_TYPE::DesertResistance: case RM_FABER_STAT_TYPE::DesertResistance:

View file

@ -201,7 +201,7 @@ bool CTpSpawnZone::build(const NLLIGO::CPrimPoint * point)
nlwarning("<CTpSpawnZone build> : no z in CTpSpawnZone '%s'",_Name.c_str() ); nlwarning("<CTpSpawnZone build> : no z in CTpSpawnZone '%s'",_Name.c_str() );
return false; return false;
} }
Point.z = ( float ) atof( value.c_str() ); NLMISC::fromString(value, Point.z);
Point.z = float( sint32 (1000.0f* Point.z) ); Point.z = float( sint32 (1000.0f* Point.z) );
} }
else else

View file

@ -650,7 +650,7 @@ bool CStringManager::parseBlock(const ucstring &block, CPhrase &phrase)
&& (first - clause.String.begin()) == (sint) clause.Replacements[repCount].InsertPlace) && (first - clause.String.begin()) == (sint) clause.Replacements[repCount].InsertPlace)
{ {
// check parameter type // check parameter type
char *subst; const char *subst;
uint paramIndex = clause.Replacements[repCount].ParamIndex; uint paramIndex = clause.Replacements[repCount].ParamIndex;
TParamId &paramId = phrase.Params[paramIndex]->ParamId; TParamId &paramId = phrase.Params[paramIndex]->ParamId;

View file

@ -905,14 +905,16 @@ bool CDatabase::set(RY_PDS::TTableIndex table, RY_PDS::TRowIndex row, RY_PDS::TC
case PDS_float: case PDS_float:
{ {
float data = (float)atof(value.c_str()); float data;
NLMISC::fromString(value, data);
return set(table, row, column, sizeof(data), &data); return set(table, row, column, sizeof(data), &data);
} }
break; break;
case PDS_double: case PDS_double:
{ {
double data = (double)atof(value.c_str()); double data;
NLMISC::fromString(value, data);
return set(table, row, column, sizeof(data), &data); return set(table, row, column, sizeof(data), &data);
} }
break; break;

View file

@ -17,8 +17,9 @@
#include "stdpch.h" #include "stdpch.h"
#include <nel/net/service.h>
#include "used_continent.h" #include "used_continent.h"
#include "nel/net/service.h"
using namespace std; using namespace std;
using namespace NLMISC; using namespace NLMISC;
@ -105,7 +106,7 @@ uint32 CUsedContinent::getInstanceForContinent(const std::string &continentName)
if (it != _Continents.end()) if (it != _Continents.end())
return it->ContinentInstance; return it->ContinentInstance;
else else
return ~0; return INVALID_AI_INSTANCE;
} }
uint32 CUsedContinent::getInstanceForContinent(CONTINENT::TContinent continentEnum) const uint32 CUsedContinent::getInstanceForContinent(CONTINENT::TContinent continentEnum) const
@ -115,7 +116,7 @@ uint32 CUsedContinent::getInstanceForContinent(CONTINENT::TContinent continentEn
if (it != _Continents.end()) if (it != _Continents.end())
return it->ContinentInstance; return it->ContinentInstance;
else else
return ~0; return INVALID_AI_INSTANCE;
} }
const std::string &CUsedContinent::getContinentForInstance(uint32 instanceNumber) const const std::string &CUsedContinent::getContinentForInstance(uint32 instanceNumber) const