added AS library
This commit is contained in:
parent
5b9e214b83
commit
df67597ec7
650
CMakeLists.txt
650
CMakeLists.txt
@ -1,322 +1,336 @@
|
||||
# root CMakeLists for the SuperTuxKart project
|
||||
project(SuperTuxKart)
|
||||
set(PROJECT_VERSION "0.8.1")
|
||||
|
||||
cmake_minimum_required(VERSION 2.8.1)
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/cmake)
|
||||
|
||||
include(BuildTypeSTKRelease)
|
||||
if (NOT CMAKE_BUILD_TYPE)
|
||||
message(STATUS "No build type selected, default to STKRelease")
|
||||
set(CMAKE_BUILD_TYPE "STKRelease")
|
||||
endif()
|
||||
|
||||
option(USE_WIIUSE "Support for wiimote input devices" ON)
|
||||
option(USE_FRIBIDI "Support for right-to-left languages" ON)
|
||||
if(UNIX)
|
||||
option(USE_CPP2011 "Activate C++ 2011 mode (GCC only)" OFF)
|
||||
endif()
|
||||
if(MSVC)
|
||||
# Normally hide the option to build wiiuse on VS, since it depends
|
||||
# on the installation of the Windows DDK (Driver Developer Kit),
|
||||
# which also needs an absolute path :(
|
||||
option(WIIUSE_BUILD "Build wiiuse lib (only for developers)" OFF)
|
||||
mark_as_advanced(WIIUSE_BUILD)
|
||||
else()
|
||||
set(WIIUSE_BUILD ON)
|
||||
endif()
|
||||
|
||||
set(STK_SOURCE_DIR "src")
|
||||
set(STK_DATA_DIR "${PROJECT_SOURCE_DIR}/data")
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/bin")
|
||||
|
||||
# Define install paths
|
||||
set(STK_INSTALL_BINARY_DIR "bin" CACHE
|
||||
STRING "Install executable to this directory, absolute or relative to CMAKE_INSTALL_PREFIX")
|
||||
set(STK_INSTALL_DATA_DIR "share/supertuxkart" CACHE
|
||||
STRING "Install data folder to this directory, absolute or relative to CMAKE_INSTALL_PREFIX")
|
||||
|
||||
# Build the Bullet physics library
|
||||
add_subdirectory("${PROJECT_SOURCE_DIR}/lib/bullet")
|
||||
include_directories("${PROJECT_SOURCE_DIR}/lib/bullet/src")
|
||||
|
||||
# Build the ENet UDP network library
|
||||
add_subdirectory("${PROJECT_SOURCE_DIR}/lib/enet")
|
||||
include_directories("${PROJECT_SOURCE_DIR}/lib/enet/include")
|
||||
|
||||
# Build the irrlicht library
|
||||
add_subdirectory("${PROJECT_SOURCE_DIR}/lib/irrlicht")
|
||||
include_directories("${PROJECT_SOURCE_DIR}/lib/irrlicht/include")
|
||||
|
||||
# Build the Wiiuse library
|
||||
# Note: wiiuse MUST be declared after irrlicht, since otherwise
|
||||
# (at least on VS) irrlicht will find wiiuse io.h file because
|
||||
# of the added include directory.
|
||||
if(USE_WIIUSE)
|
||||
if(WIIUSE_BUILD)
|
||||
add_subdirectory("${PROJECT_SOURCE_DIR}/lib/wiiuse")
|
||||
endif()
|
||||
include_directories("${PROJECT_SOURCE_DIR}/lib/wiiuse")
|
||||
endif()
|
||||
|
||||
|
||||
# Set include paths
|
||||
include_directories(${STK_SOURCE_DIR})
|
||||
|
||||
# These variables enable MSVC to find libraries located in "dependencies"
|
||||
if(MSVC)
|
||||
set(ENV{PATH} ${PROJECT_SOURCE_DIR}/dependencies/include)
|
||||
set(ENV{LIB} ${PROJECT_SOURCE_DIR}/dependencies/lib)
|
||||
set(ENV{OPENALDIR} ${PROJECT_SOURCE_DIR}/dependencies)
|
||||
add_definitions(/D_IRR_STATIC_LIB_)
|
||||
endif()
|
||||
|
||||
if(APPLE)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -arch i386")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -arch i386 -F/Library/Frameworks")
|
||||
elseif(MSVC)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP") # Enable multi-processor compilation (faster)
|
||||
endif()
|
||||
|
||||
# OpenAL
|
||||
if(APPLE)
|
||||
# In theory it would be cleaner to let CMake detect the right dependencies. In practice, this means that if a OSX user has
|
||||
# unix-style installs of Vorbis/Ogg/OpenAL/etc. they will be picked up over our frameworks. This is blocking when I make releases :
|
||||
# the mac I use to make STK releases does have other installs of vorbis/ogg/etc. which aren't compatible with STK, so letting
|
||||
# CMake pick the library it wants essentially means I can't build.
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -framework OpenAL")
|
||||
set(OPENAL_LIBRARY)
|
||||
else()
|
||||
find_package(OpenAL REQUIRED)
|
||||
include_directories(${OPENAL_INCLUDE_DIR})
|
||||
endif()
|
||||
|
||||
# OggVorbis
|
||||
if(APPLE)
|
||||
# In theory it would be cleaner to let CMake detect the right dependencies. In practice, this means that if a OSX user has
|
||||
# unix-style installs of Vorbis/Ogg/OpenAL/etc. they will be picked up over our frameworks. This is blocking when I make releases :
|
||||
# the mac I use to make STK releases does have other installs of vorbis/ogg/etc. which aren't compatible with STK, so letting
|
||||
# CMake pick the library it wants essentially means I can't build.
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} -I/Library/Frameworks/Ogg.framework/Versions/A/Headers -I/Library/Frameworks/Vorbis.framework/Versions/A/Headers")
|
||||
else()
|
||||
find_package(OggVorbis REQUIRED)
|
||||
include_directories(${OGGVORBIS_INCLUDE_DIRS})
|
||||
endif()
|
||||
|
||||
# Fribidi
|
||||
if(USE_FRIBIDI)
|
||||
find_package(Fribidi)
|
||||
if(FRIBIDI_FOUND)
|
||||
include_directories(${FRIBIDI_INCLUDE_DIRS})
|
||||
else()
|
||||
message(FATAL_ERROR "Fribidi not found. "
|
||||
"Either install fribidi or disable bidi support with -DUSE_FRIBIDI=0 "
|
||||
"(if you don't use a right-to-left language then you don't need this).")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(UNIX)
|
||||
if(USE_CPP2011)
|
||||
add_definitions("-std=gnu++11")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# OpenGL
|
||||
find_package(OpenGL REQUIRED)
|
||||
include_directories(${OPENGL_INCLUDE_DIR})
|
||||
|
||||
if(UNIX AND NOT APPLE)
|
||||
find_library(IRRLICHT_XF86VM_LIBRARY Xxf86vm)
|
||||
mark_as_advanced(IRRLICHT_XF86VM_LIBRARY)
|
||||
else()
|
||||
set(IRRLICHT_XF86VM_LIBRARY "")
|
||||
endif()
|
||||
|
||||
|
||||
|
||||
# Set some compiler options
|
||||
if(UNIX)
|
||||
add_definitions(-Wall)
|
||||
endif()
|
||||
|
||||
if(WIN32)
|
||||
# By default windows.h has macros defined for min and max that screw up everything
|
||||
add_definitions(-DNOMINMAX)
|
||||
|
||||
# And shut up about unsafe stuff
|
||||
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
|
||||
# VS will automatically add NDEBUG for release mode, but only _DEBUG in debug mode.
|
||||
# Since STK uses DEBUG, this is added for debug compilation only:
|
||||
set_property(DIRECTORY PROPERTY COMPILE_DEFINITIONS_DEBUG DEBUG)
|
||||
else()
|
||||
# All non VS generators used create only a single compile mode, so
|
||||
# compile flags can be simplye be added
|
||||
if(CMAKE_BUILD_TYPE MATCHES Debug)
|
||||
add_definitions(-DDEBUG)
|
||||
else()
|
||||
add_definitions(-DNDEBUG)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# TODO: remove this switch
|
||||
add_definitions(-DHAVE_OGGVORBIS)
|
||||
|
||||
|
||||
# Provides list of source and header files (STK_SOURCES and STK_HEADERS)
|
||||
include(sources.cmake)
|
||||
|
||||
# Generate source groups useful for MSVC project explorer
|
||||
include(cmake/SourceGroupFunctions.cmake)
|
||||
source_group_hierarchy(STK_SOURCES STK_HEADERS)
|
||||
|
||||
|
||||
if(APPLE)
|
||||
# icon files to copy in the bundle
|
||||
set(OSX_ICON_FILES ${PROJECT_SOURCE_DIR}/data/supertuxkart.icns)
|
||||
set_source_files_properties(${OSX_ICON_FILES} PROPERTIES MACOSX_PACKAGE_LOCATION Resources)
|
||||
set(STK_SOURCES ${STK_SOURCES} ${OSX_ICON_FILES})
|
||||
|
||||
# build the executable and create an app bundle
|
||||
add_executable(supertuxkart MACOSX_BUNDLE ${STK_SOURCES})
|
||||
|
||||
find_library(IOKIT_LIBRARY IOKit)
|
||||
find_library(QUICKTIME_LIBRARY QuickTime)
|
||||
find_library(CARBON_LIBRARY Carbon)
|
||||
find_library(AUDIOUNIT_LIBRARY AudioUnit)
|
||||
find_library(COCOA_LIBRARY Cocoa)
|
||||
|
||||
target_link_libraries(supertuxkart
|
||||
${IOKIT_LIBRARY}
|
||||
${QUICKTIME_LIBRARY}
|
||||
${CARBON_LIBRARY}
|
||||
${AUDIOUNIT_LIBRARY}
|
||||
${COCOA_LIBRARY})
|
||||
|
||||
# configure CMake to use a custom Info.plist
|
||||
set_target_properties(supertuxkart PROPERTIES
|
||||
MACOSX_BUNDLE_INFO_PLIST ${PROJECT_SOURCE_DIR}/data/SuperTuxKart-Info.plist)
|
||||
|
||||
if(CMAKE_GENERATOR MATCHES "Xcode")
|
||||
add_custom_command(TARGET supertuxkart POST_BUILD
|
||||
COMMAND ln -f -s ${PROJECT_SOURCE_DIR}/data ${CMAKE_BINARY_DIR}/bin/\${CONFIGURATION}/supertuxkart.app/Contents/Resources)
|
||||
else()
|
||||
add_custom_command(TARGET supertuxkart POST_BUILD
|
||||
COMMAND ln -f -s ${PROJECT_SOURCE_DIR}/data ${CMAKE_BINARY_DIR}/bin/supertuxkart.app/Contents/Resources)
|
||||
endif()
|
||||
else()
|
||||
find_library(PTHREAD_LIBRARY NAMES pthread pthreadVC2 PATHS ${PROJECT_SOURCE_DIR}/dependencies/lib)
|
||||
mark_as_advanced(PTHREAD_LIBRARY)
|
||||
|
||||
# Set data dir (absolute or relative to CMAKE_INSTALL_PREFIX)
|
||||
get_filename_component(STK_INSTALL_DATA_DIR_ABSOLUTE ${STK_INSTALL_DATA_DIR} ABSOLUTE)
|
||||
if(${STK_INSTALL_DATA_DIR_ABSOLUTE} STREQUAL ${STK_INSTALL_DATA_DIR})
|
||||
add_definitions(-DSUPERTUXKART_DATADIR=\"${STK_INSTALL_DATA_DIR_ABSOLUTE}\")
|
||||
else()
|
||||
add_definitions(-DSUPERTUXKART_DATADIR=\"${CMAKE_INSTALL_PREFIX}/${STK_INSTALL_DATA_DIR}\")
|
||||
endif()
|
||||
|
||||
# Build the final executable
|
||||
add_executable(supertuxkart ${STK_SOURCES} ${STK_HEADERS})
|
||||
target_link_libraries(supertuxkart ${PTHREAD_LIBRARY})
|
||||
endif()
|
||||
|
||||
# CURL
|
||||
if(WIN32)
|
||||
target_link_libraries(supertuxkart ${PROJECT_SOURCE_DIR}/dependencies/lib/libcurldll.a)
|
||||
else()
|
||||
find_package(CURL REQUIRED)
|
||||
include_directories(${CURL_INCLUDE_DIRS})
|
||||
endif()
|
||||
|
||||
# Common library dependencies
|
||||
target_link_libraries(supertuxkart
|
||||
bulletdynamics
|
||||
bulletcollision
|
||||
bulletmath
|
||||
enet
|
||||
stkirrlicht
|
||||
${CURL_LIBRARIES}
|
||||
${OGGVORBIS_LIBRARIES}
|
||||
${IRRLICHT_XF86VM_LIBRARY}
|
||||
${OPENAL_LIBRARY}
|
||||
${OPENGL_LIBRARIES})
|
||||
|
||||
# root CMakeLists for the SuperTuxKart project
|
||||
project(SuperTuxKart)
|
||||
set(PROJECT_VERSION "0.8.1")
|
||||
|
||||
cmake_minimum_required(VERSION 2.8.1)
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/cmake)
|
||||
|
||||
include(BuildTypeSTKRelease)
|
||||
if (NOT CMAKE_BUILD_TYPE)
|
||||
message(STATUS "No build type selected, default to STKRelease")
|
||||
set(CMAKE_BUILD_TYPE "STKRelease")
|
||||
endif()
|
||||
|
||||
option(USE_WIIUSE "Support for wiimote input devices" ON)
|
||||
option(USE_FRIBIDI "Support for right-to-left languages" ON)
|
||||
if(UNIX)
|
||||
option(USE_CPP2011 "Activate C++ 2011 mode (GCC only)" OFF)
|
||||
endif()
|
||||
if(MSVC)
|
||||
# Normally hide the option to build wiiuse on VS, since it depends
|
||||
# on the installation of the Windows DDK (Driver Developer Kit),
|
||||
# which also needs an absolute path :(
|
||||
option(WIIUSE_BUILD "Build wiiuse lib (only for developers)" OFF)
|
||||
mark_as_advanced(WIIUSE_BUILD)
|
||||
else()
|
||||
set(WIIUSE_BUILD ON)
|
||||
endif()
|
||||
|
||||
set(STK_SOURCE_DIR "src")
|
||||
set(STK_DATA_DIR "${PROJECT_SOURCE_DIR}/data")
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/bin")
|
||||
|
||||
# Define install paths
|
||||
set(STK_INSTALL_BINARY_DIR "bin" CACHE
|
||||
STRING "Install executable to this directory, absolute or relative to CMAKE_INSTALL_PREFIX")
|
||||
set(STK_INSTALL_DATA_DIR "share/supertuxkart" CACHE
|
||||
STRING "Install data folder to this directory, absolute or relative to CMAKE_INSTALL_PREFIX")
|
||||
|
||||
# Build the Bullet physics library
|
||||
add_subdirectory("${PROJECT_SOURCE_DIR}/lib/bullet")
|
||||
include_directories("${PROJECT_SOURCE_DIR}/lib/bullet/src")
|
||||
|
||||
# Build the ENet UDP network library
|
||||
add_subdirectory("${PROJECT_SOURCE_DIR}/lib/enet")
|
||||
include_directories("${PROJECT_SOURCE_DIR}/lib/enet/include")
|
||||
|
||||
# Build the irrlicht library
|
||||
add_subdirectory("${PROJECT_SOURCE_DIR}/lib/irrlicht")
|
||||
include_directories("${PROJECT_SOURCE_DIR}/lib/irrlicht/include")
|
||||
|
||||
# Build the Wiiuse library
|
||||
# Note: wiiuse MUST be declared after irrlicht, since otherwise
|
||||
# (at least on VS) irrlicht will find wiiuse io.h file because
|
||||
# of the added include directory.
|
||||
if(USE_WIIUSE)
|
||||
if(WIIUSE_BUILD)
|
||||
add_subdirectory("${PROJECT_SOURCE_DIR}/lib/wiiuse")
|
||||
endif()
|
||||
include_directories("${PROJECT_SOURCE_DIR}/lib/wiiuse")
|
||||
endif()
|
||||
|
||||
# Build the angelscript library
|
||||
add_subdirectory("${PROJECT_SOURCE_DIR}/lib/angelscript")
|
||||
include_directories("${PROJECT_SOURCE_DIR}/lib/irrlicht/angelscript")
|
||||
|
||||
# Set include paths
|
||||
include_directories(${STK_SOURCE_DIR})
|
||||
|
||||
# These variables enable MSVC to find libraries located in "dependencies"
|
||||
if(MSVC)
|
||||
set(ENV{PATH} ${PROJECT_SOURCE_DIR}/dependencies/include)
|
||||
set(ENV{LIB} ${PROJECT_SOURCE_DIR}/dependencies/lib)
|
||||
set(ENV{OPENALDIR} ${PROJECT_SOURCE_DIR}/dependencies)
|
||||
add_definitions(/D_IRR_STATIC_LIB_)
|
||||
endif()
|
||||
|
||||
if(APPLE)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -arch i386")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -arch i386 -F/Library/Frameworks")
|
||||
elseif(MSVC)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP") # Enable multi-processor compilation (faster)
|
||||
endif()
|
||||
|
||||
# OpenAL
|
||||
if(APPLE)
|
||||
# In theory it would be cleaner to let CMake detect the right dependencies. In practice, this means that if a OSX user has
|
||||
# unix-style installs of Vorbis/Ogg/OpenAL/etc. they will be picked up over our frameworks. This is blocking when I make releases :
|
||||
# the mac I use to make STK releases does have other installs of vorbis/ogg/etc. which aren't compatible with STK, so letting
|
||||
# CMake pick the library it wants essentially means I can't build.
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -framework OpenAL")
|
||||
set(OPENAL_LIBRARY)
|
||||
else()
|
||||
find_package(OpenAL REQUIRED)
|
||||
include_directories(${OPENAL_INCLUDE_DIR})
|
||||
endif()
|
||||
|
||||
|
||||
|
||||
# OggVorbis
|
||||
if(APPLE)
|
||||
# In theory it would be cleaner to let CMake detect the right dependencies. In practice, this means that if a OSX user has
|
||||
# unix-style installs of Vorbis/Ogg/OpenAL/etc. they will be picked up over our frameworks. This is blocking when I make releases :
|
||||
# the mac I use to make STK releases does have other installs of vorbis/ogg/etc. which aren't compatible with STK, so letting
|
||||
# CMake pick the library it wants essentially means I can't build.
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} -I/Library/Frameworks/Ogg.framework/Versions/A/Headers -I/Library/Frameworks/Vorbis.framework/Versions/A/Headers")
|
||||
else()
|
||||
find_package(OggVorbis REQUIRED)
|
||||
include_directories(${OGGVORBIS_INCLUDE_DIRS})
|
||||
endif()
|
||||
|
||||
# Fribidi
|
||||
if(USE_FRIBIDI)
|
||||
find_package(Fribidi)
|
||||
if(FRIBIDI_FOUND)
|
||||
include_directories(${FRIBIDI_INCLUDE_DIRS})
|
||||
else()
|
||||
message(FATAL_ERROR "Fribidi not found. "
|
||||
"Either install fribidi or disable bidi support with -DUSE_FRIBIDI=0 "
|
||||
"(if you don't use a right-to-left language then you don't need this).")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(UNIX)
|
||||
if(USE_CPP2011)
|
||||
add_definitions("-std=gnu++11")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# OpenGL
|
||||
find_package(OpenGL REQUIRED)
|
||||
include_directories(${OPENGL_INCLUDE_DIR})
|
||||
|
||||
if(UNIX AND NOT APPLE)
|
||||
find_library(IRRLICHT_XF86VM_LIBRARY Xxf86vm)
|
||||
mark_as_advanced(IRRLICHT_XF86VM_LIBRARY)
|
||||
else()
|
||||
set(IRRLICHT_XF86VM_LIBRARY "")
|
||||
endif()
|
||||
|
||||
|
||||
# Set some compiler options
|
||||
if(UNIX)
|
||||
add_definitions(-Wall)
|
||||
endif()
|
||||
|
||||
if(WIN32)
|
||||
# By default windows.h has macros defined for min and max that screw up everything
|
||||
add_definitions(-DNOMINMAX)
|
||||
|
||||
# And shut up about unsafe stuff
|
||||
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
|
||||
# VS will automatically add NDEBUG for release mode, but only _DEBUG in debug mode.
|
||||
# Since STK uses DEBUG, this is added for debug compilation only:
|
||||
set_property(DIRECTORY PROPERTY COMPILE_DEFINITIONS_DEBUG DEBUG)
|
||||
else()
|
||||
# All non VS generators used create only a single compile mode, so
|
||||
# compile flags can be simplye be added
|
||||
if(CMAKE_BUILD_TYPE MATCHES Debug)
|
||||
add_definitions(-DDEBUG)
|
||||
else()
|
||||
add_definitions(-DNDEBUG)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# TODO: remove this switch
|
||||
add_definitions(-DHAVE_OGGVORBIS)
|
||||
|
||||
|
||||
# Provides list of source and header files (STK_SOURCES and STK_HEADERS)
|
||||
include(sources.cmake)
|
||||
|
||||
# Generate source groups useful for MSVC project explorer
|
||||
include(cmake/SourceGroupFunctions.cmake)
|
||||
source_group_hierarchy(STK_SOURCES STK_HEADERS)
|
||||
|
||||
|
||||
if(APPLE)
|
||||
# icon files to copy in the bundle
|
||||
set(OSX_ICON_FILES ${PROJECT_SOURCE_DIR}/data/supertuxkart.icns)
|
||||
set_source_files_properties(${OSX_ICON_FILES} PROPERTIES MACOSX_PACKAGE_LOCATION Resources)
|
||||
set(STK_SOURCES ${STK_SOURCES} ${OSX_ICON_FILES})
|
||||
|
||||
# build the executable and create an app bundle
|
||||
add_executable(supertuxkart MACOSX_BUNDLE ${STK_SOURCES})
|
||||
|
||||
find_library(IOKIT_LIBRARY IOKit)
|
||||
find_library(QUICKTIME_LIBRARY QuickTime)
|
||||
find_library(CARBON_LIBRARY Carbon)
|
||||
find_library(AUDIOUNIT_LIBRARY AudioUnit)
|
||||
find_library(COCOA_LIBRARY Cocoa)
|
||||
|
||||
|
||||
|
||||
target_link_libraries(supertuxkart
|
||||
${IOKIT_LIBRARY}
|
||||
${QUICKTIME_LIBRARY}
|
||||
${CARBON_LIBRARY}
|
||||
${AUDIOUNIT_LIBRARY}
|
||||
${COCOA_LIBRARY})
|
||||
|
||||
# configure CMake to use a custom Info.plist
|
||||
set_target_properties(supertuxkart PROPERTIES
|
||||
MACOSX_BUNDLE_INFO_PLIST ${PROJECT_SOURCE_DIR}/data/SuperTuxKart-Info.plist)
|
||||
|
||||
if(CMAKE_GENERATOR MATCHES "Xcode")
|
||||
add_custom_command(TARGET supertuxkart POST_BUILD
|
||||
COMMAND ln -f -s ${PROJECT_SOURCE_DIR}/data ${CMAKE_BINARY_DIR}/bin/\${CONFIGURATION}/supertuxkart.app/Contents/Resources)
|
||||
else()
|
||||
add_custom_command(TARGET supertuxkart POST_BUILD
|
||||
COMMAND ln -f -s ${PROJECT_SOURCE_DIR}/data ${CMAKE_BINARY_DIR}/bin/supertuxkart.app/Contents/Resources)
|
||||
endif()
|
||||
else()
|
||||
find_library(PTHREAD_LIBRARY NAMES pthread pthreadVC2 PATHS ${PROJECT_SOURCE_DIR}/dependencies/lib)
|
||||
mark_as_advanced(PTHREAD_LIBRARY)
|
||||
|
||||
# Set data dir (absolute or relative to CMAKE_INSTALL_PREFIX)
|
||||
get_filename_component(STK_INSTALL_DATA_DIR_ABSOLUTE ${STK_INSTALL_DATA_DIR} ABSOLUTE)
|
||||
if(${STK_INSTALL_DATA_DIR_ABSOLUTE} STREQUAL ${STK_INSTALL_DATA_DIR})
|
||||
add_definitions(-DSUPERTUXKART_DATADIR=\"${STK_INSTALL_DATA_DIR_ABSOLUTE}\")
|
||||
else()
|
||||
add_definitions(-DSUPERTUXKART_DATADIR=\"${CMAKE_INSTALL_PREFIX}/${STK_INSTALL_DATA_DIR}\")
|
||||
endif()
|
||||
|
||||
# Build the final executable
|
||||
add_executable(supertuxkart ${STK_SOURCES} ${STK_HEADERS})
|
||||
target_link_libraries(supertuxkart ${PTHREAD_LIBRARY})
|
||||
endif()
|
||||
|
||||
|
||||
|
||||
# CURL
|
||||
if(WIN32)
|
||||
target_link_libraries(supertuxkart ${PROJECT_SOURCE_DIR}/dependencies/lib/libcurldll.a)
|
||||
else()
|
||||
find_package(CURL REQUIRED)
|
||||
include_directories(${CURL_INCLUDE_DIRS})
|
||||
endif()
|
||||
|
||||
|
||||
# Common library dependencies
|
||||
target_link_libraries(supertuxkart
|
||||
bulletdynamics
|
||||
bulletcollision
|
||||
bulletmath
|
||||
enet
|
||||
stkirrlicht
|
||||
${CURL_LIBRARIES}
|
||||
${OGGVORBIS_LIBRARIES}
|
||||
${IRRLICHT_XF86VM_LIBRARY}
|
||||
${OPENAL_LIBRARY}
|
||||
${OPENGL_LIBRARIES})
|
||||
#LINUX
|
||||
#target_link_libraries(supertuxkart ${PROJECT_SOURCE_DIR}/dependencies/lib/libangelscript.a)
|
||||
|
||||
#WINDOWS
|
||||
target_link_libraries(supertuxkart ${PROJECT_SOURCE_DIR}/dependencies/lib/angelscriptd.lib)
|
||||
|
||||
if(APPLE)
|
||||
# In theory it would be cleaner to let CMake detect the right dependencies. In practice, this means that if a OSX user has
|
||||
# unix-style installs of Vorbis/Ogg/OpenAL/etc. they will be picked up over our frameworks. This is blocking when I make releases :
|
||||
# the mac I use to make STK releases does have other installs of vorbis/ogg/etc. which aren't compatible with STK, so letting
|
||||
# CMake pick the library it wants essentially means I can't build.
|
||||
set_target_properties(supertuxkart PROPERTIES LINK_FLAGS "-arch i386 -F/Library/Frameworks -framework OpenAL -framework Ogg -framework Vorbis")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -I/Library/Frameworks/OpenAL.framework/Versions/A/Headers")
|
||||
endif()
|
||||
|
||||
if(USE_FRIBIDI)
|
||||
target_link_libraries(supertuxkart ${FRIBIDI_LIBRARIES})
|
||||
add_definitions(-DENABLE_BIDI)
|
||||
endif()
|
||||
|
||||
# Wiiuse
|
||||
# ------
|
||||
if(USE_WIIUSE)
|
||||
if(APPLE)
|
||||
find_library(BLUETOOTH_LIBRARY NAMES IOBluetooth PATHS /Developer/Library/Frameworks/IOBluetooth.framework)
|
||||
target_link_libraries(supertuxkart wiiuse ${BLUETOOTH_LIBRARY})
|
||||
elseif(MSVC)
|
||||
add_definitions("/DWIIUSE_STATIC")
|
||||
if(WIIUSE_BUILD)
|
||||
target_link_libraries(supertuxkart wiiuse)
|
||||
else()
|
||||
target_link_libraries(supertuxkart ${PROJECT_SOURCE_DIR}/dependencies/lib/wiiuse.lib)
|
||||
endif()
|
||||
else()
|
||||
target_link_libraries(supertuxkart wiiuse bluetooth)
|
||||
endif()
|
||||
add_definitions(-DENABLE_WIIUSE)
|
||||
|
||||
endif()
|
||||
|
||||
if(MSVC)
|
||||
target_link_libraries(supertuxkart iphlpapi.lib)
|
||||
add_custom_command(TARGET supertuxkart POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_directory
|
||||
"${PROJECT_SOURCE_DIR}/dependencies/dll"
|
||||
$<TARGET_FILE_DIR:supertuxkart>)
|
||||
endif()
|
||||
|
||||
# Optional tools
|
||||
add_subdirectory(tools/font_tool)
|
||||
|
||||
|
||||
# ==== Make dist target ====
|
||||
if(MSVC)
|
||||
# Don't create a dist target for VS
|
||||
else()
|
||||
add_custom_target(dist
|
||||
COMMAND rm -rf ${CMAKE_BINARY_DIR}/SuperTuxKart-${PROJECT_VERSION} && rm -f ${CMAKE_BINARY_DIR}/SuperTuxKart-${PROJECT_VERSION}.tar.bz2
|
||||
&& echo "Exporting..."
|
||||
&& svn export ${PROJECT_SOURCE_DIR} ${CMAKE_BINARY_DIR}/SuperTuxKart-${PROJECT_VERSION}
|
||||
&& echo "Compressing..."
|
||||
&& cd ${CMAKE_BINARY_DIR}
|
||||
&& tar -cjf ${CMAKE_BINARY_DIR}/SuperTuxKart-${PROJECT_VERSION}.tar.bz2 ./SuperTuxKart-${PROJECT_VERSION}
|
||||
&& echo "Done, cleaning up"
|
||||
&& rm -rf ${CMAKE_BINARY_DIR}/SuperTuxKart-${PROJECT_VERSION}
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
)
|
||||
endif()
|
||||
|
||||
# ==== Install target ====
|
||||
install(TARGETS supertuxkart RUNTIME DESTINATION ${STK_INSTALL_BINARY_DIR} BUNDLE DESTINATION .)
|
||||
install(DIRECTORY ${STK_DATA_DIR} DESTINATION ${STK_INSTALL_DATA_DIR} PATTERN ".svn" EXCLUDE)
|
||||
install(FILES ${PROJECT_BINARY_DIR}/supertuxkart.desktop DESTINATION share/applications)
|
||||
install(FILES data/supertuxkart_32.png data/supertuxkart_128.png DESTINATION share/pixmaps)
|
||||
install(FILES data/supertuxkart.appdata DESTINATION share/appdata)
|
||||
|
||||
set(PREFIX ${CMAKE_INSTALL_PREFIX})
|
||||
configure_file(data/supertuxkart_desktop.template supertuxkart.desktop)
|
||||
add_dependencies(supertuxkart supertuxkart.desktop)
|
||||
target_link_libraries(supertuxkart ${PROJECT_SOURCE_DIR}/dependencies/lib/angelscriptd.lib)
|
||||
|
||||
if(APPLE)
|
||||
# In theory it would be cleaner to let CMake detect the right dependencies. In practice, this means that if a OSX user has
|
||||
# unix-style installs of Vorbis/Ogg/OpenAL/etc. they will be picked up over our frameworks. This is blocking when I make releases :
|
||||
# the mac I use to make STK releases does have other installs of vorbis/ogg/etc. which aren't compatible with STK, so letting
|
||||
# CMake pick the library it wants essentially means I can't build.
|
||||
set_target_properties(supertuxkart PROPERTIES LINK_FLAGS "-arch i386 -F/Library/Frameworks -framework OpenAL -framework Ogg -framework Vorbis")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -I/Library/Frameworks/OpenAL.framework/Versions/A/Headers")
|
||||
endif()
|
||||
|
||||
|
||||
|
||||
|
||||
if(USE_FRIBIDI)
|
||||
target_link_libraries(supertuxkart ${FRIBIDI_LIBRARIES})
|
||||
add_definitions(-DENABLE_BIDI)
|
||||
endif()
|
||||
|
||||
# Wiiuse
|
||||
# ------
|
||||
if(USE_WIIUSE)
|
||||
if(APPLE)
|
||||
find_library(BLUETOOTH_LIBRARY NAMES IOBluetooth PATHS /Developer/Library/Frameworks/IOBluetooth.framework)
|
||||
target_link_libraries(supertuxkart wiiuse ${BLUETOOTH_LIBRARY})
|
||||
elseif(MSVC)
|
||||
add_definitions("/DWIIUSE_STATIC")
|
||||
if(WIIUSE_BUILD)
|
||||
target_link_libraries(supertuxkart wiiuse)
|
||||
else()
|
||||
target_link_libraries(supertuxkart ${PROJECT_SOURCE_DIR}/dependencies/lib/wiiuse.lib)
|
||||
endif()
|
||||
else()
|
||||
target_link_libraries(supertuxkart wiiuse bluetooth)
|
||||
endif()
|
||||
add_definitions(-DENABLE_WIIUSE)
|
||||
|
||||
endif()
|
||||
|
||||
if(MSVC)
|
||||
target_link_libraries(supertuxkart iphlpapi.lib)
|
||||
add_custom_command(TARGET supertuxkart POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_directory
|
||||
"${PROJECT_SOURCE_DIR}/dependencies/dll"
|
||||
$<TARGET_FILE_DIR:supertuxkart>)
|
||||
endif()
|
||||
|
||||
|
||||
|
||||
|
||||
# Optional tools
|
||||
add_subdirectory(tools/font_tool)
|
||||
|
||||
|
||||
# ==== Make dist target ====
|
||||
if(MSVC)
|
||||
# Don't create a dist target for VS
|
||||
else()
|
||||
add_custom_target(dist
|
||||
COMMAND rm -rf ${CMAKE_BINARY_DIR}/SuperTuxKart-${PROJECT_VERSION} && rm -f ${CMAKE_BINARY_DIR}/SuperTuxKart-${PROJECT_VERSION}.tar.bz2
|
||||
&& echo "Exporting..."
|
||||
&& svn export ${PROJECT_SOURCE_DIR} ${CMAKE_BINARY_DIR}/SuperTuxKart-${PROJECT_VERSION}
|
||||
&& echo "Compressing..."
|
||||
&& cd ${CMAKE_BINARY_DIR}
|
||||
&& tar -cjf ${CMAKE_BINARY_DIR}/SuperTuxKart-${PROJECT_VERSION}.tar.bz2 ./SuperTuxKart-${PROJECT_VERSION}
|
||||
&& echo "Done, cleaning up"
|
||||
&& rm -rf ${CMAKE_BINARY_DIR}/SuperTuxKart-${PROJECT_VERSION}
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
)
|
||||
endif()
|
||||
|
||||
# ==== Install target ====
|
||||
install(TARGETS supertuxkart RUNTIME DESTINATION ${STK_INSTALL_BINARY_DIR} BUNDLE DESTINATION .)
|
||||
install(DIRECTORY ${STK_DATA_DIR} DESTINATION ${STK_INSTALL_DATA_DIR} PATTERN ".svn" EXCLUDE)
|
||||
install(FILES ${PROJECT_BINARY_DIR}/supertuxkart.desktop DESTINATION share/applications)
|
||||
install(FILES data/supertuxkart_32.png data/supertuxkart_128.png DESTINATION share/pixmaps)
|
||||
install(FILES data/supertuxkart.appdata DESTINATION share/appdata)
|
||||
|
||||
set(PREFIX ${CMAKE_INSTALL_PREFIX})
|
||||
configure_file(data/supertuxkart_desktop.template supertuxkart.desktop)
|
||||
add_dependencies(supertuxkart supertuxkart.desktop)
|
||||
|
1808
lib/angelscript/include/angelscript.h
Normal file
1808
lib/angelscript/include/angelscript.h
Normal file
File diff suppressed because it is too large
Load Diff
1
lib/angelscript/lib/delete.me
Normal file
1
lib/angelscript/lib/delete.me
Normal file
@ -0,0 +1 @@
|
||||
This file is only here to guarantee that unpackers don't skip creating the /lib directory.
|
25
lib/angelscript/projects/BCBuilder/AngelScript.bpg
Normal file
25
lib/angelscript/projects/BCBuilder/AngelScript.bpg
Normal file
@ -0,0 +1,25 @@
|
||||
#------------------------------------------------------------------------------
|
||||
VERSION = BWS.01
|
||||
#------------------------------------------------------------------------------
|
||||
!ifndef ROOT
|
||||
ROOT = $(MAKEDIR)\..
|
||||
!endif
|
||||
#------------------------------------------------------------------------------
|
||||
MAKE = $(ROOT)\bin\make.exe -$(MAKEFLAGS) -f$**
|
||||
DCC = $(ROOT)\bin\dcc32.exe $**
|
||||
BRCC = $(ROOT)\bin\brcc32.exe $**
|
||||
#------------------------------------------------------------------------------
|
||||
PROJECTS = AngelScriptBCC_Static_CB6.lib test_feature_CB6.exe
|
||||
#------------------------------------------------------------------------------
|
||||
default: $(PROJECTS)
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
AngelScriptBCC_Static_CB6.lib: AngelScriptBCC_Static_CB6.bpr
|
||||
$(ROOT)\bin\bpr2mak -t$(ROOT)\bin\deflib.bmk $**
|
||||
$(ROOT)\bin\make -$(MAKEFLAGS) -f$*.mak
|
||||
|
||||
test_feature_CB6.exe: ..\..\..\tests\test_feature\projects\BCBuilder\test_feature_CB6.bpr
|
||||
$(ROOT)\bin\bpr2mak $**
|
||||
$(ROOT)\bin\make -$(MAKEFLAGS) -f$*.mak
|
||||
|
||||
|
48
lib/angelscript/projects/BCBuilder/AngelScript.groupproj
Normal file
48
lib/angelscript/projects/BCBuilder/AngelScript.groupproj
Normal file
@ -0,0 +1,48 @@
|
||||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<ProjectGuid>{03055FC6-676A-44BB-8CFA-12023CE9BDF3}</ProjectGuid>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Projects Include="AngelScriptBCC_Static.cbproj">
|
||||
<Dependencies/>
|
||||
</Projects>
|
||||
<Projects Include="AngelScriptBCC.cbproj">
|
||||
<Dependencies>AngelScriptBCC_Static.cbproj</Dependencies>
|
||||
</Projects>
|
||||
</ItemGroup>
|
||||
<ProjectExtensions>
|
||||
<Borland.Personality>Default.Personality.12</Borland.Personality>
|
||||
<Borland.ProjectType/>
|
||||
<BorlandProject>
|
||||
<Default.Personality/>
|
||||
</BorlandProject>
|
||||
</ProjectExtensions>
|
||||
<Target Name="AngelScriptBCC_Static">
|
||||
<MSBuild Projects="AngelScriptBCC_Static.cbproj"/>
|
||||
</Target>
|
||||
<Target Name="AngelScriptBCC_Static:Clean">
|
||||
<MSBuild Targets="Clean" Projects="AngelScriptBCC_Static.cbproj"/>
|
||||
</Target>
|
||||
<Target Name="AngelScriptBCC_Static:Make">
|
||||
<MSBuild Targets="Make" Projects="AngelScriptBCC_Static.cbproj"/>
|
||||
</Target>
|
||||
<Target DependsOnTargets="AngelScriptBCC_Static" Name="AngelScriptBCC">
|
||||
<MSBuild Projects="AngelScriptBCC.cbproj"/>
|
||||
</Target>
|
||||
<Target DependsOnTargets="AngelScriptBCC_Static:Clean" Name="AngelScriptBCC:Clean">
|
||||
<MSBuild Targets="Clean" Projects="AngelScriptBCC.cbproj"/>
|
||||
</Target>
|
||||
<Target DependsOnTargets="AngelScriptBCC_Static:Make" Name="AngelScriptBCC:Make">
|
||||
<MSBuild Targets="Make" Projects="AngelScriptBCC.cbproj"/>
|
||||
</Target>
|
||||
<Target Name="Build">
|
||||
<CallTarget Targets="AngelScriptBCC_Static;AngelScriptBCC"/>
|
||||
</Target>
|
||||
<Target Name="Clean">
|
||||
<CallTarget Targets="AngelScriptBCC_Static:Clean;AngelScriptBCC:Clean"/>
|
||||
</Target>
|
||||
<Target Name="Make">
|
||||
<CallTarget Targets="AngelScriptBCC_Static:Make;AngelScriptBCC:Make"/>
|
||||
</Target>
|
||||
<Import Project="$(BDS)\Bin\CodeGear.Group.Targets" Condition="Exists('$(BDS)\Bin\CodeGear.Group.Targets')"/>
|
||||
</Project>
|
195
lib/angelscript/projects/BCBuilder/AngelScriptBCC.cbproj
Normal file
195
lib/angelscript/projects/BCBuilder/AngelScriptBCC.cbproj
Normal file
@ -0,0 +1,195 @@
|
||||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<ProjectGuid>{788281D2-5102-47C7-BB04-954B3E7DBE1F}</ProjectGuid>
|
||||
<ProjectType>CppDynamicLibrary</ProjectType>
|
||||
<Config Condition="'$(Config)'==''">Release</Config>
|
||||
<ProjectVersion>12.0</ProjectVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Config)'=='Base' or '$(Base)'!=''">
|
||||
<Base>true</Base>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Config)'=='Debug' or '$(Cfg_1)'!=''">
|
||||
<Cfg_1>true</Cfg_1>
|
||||
<CfgParent>Base</CfgParent>
|
||||
<Base>true</Base>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Config)'=='Release' or '$(Cfg_2)'!=''">
|
||||
<Cfg_2>true</Cfg_2>
|
||||
<CfgParent>Base</CfgParent>
|
||||
<Base>true</Base>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Base)'!=''">
|
||||
<AllPackageLibs>rtl.lib</AllPackageLibs>
|
||||
<LinkPackageStatics>rtl.lib</LinkPackageStatics>
|
||||
<BCC_PCHUsage>UseDontGenerate</BCC_PCHUsage>
|
||||
<BCC_wrch>false</BCC_wrch>
|
||||
<Defines>WIN32;AS_USE_NAMESPACE=1;NO_STRICT;ANGELSCRIPT_EXPORT;$(Defines)</Defines>
|
||||
<TASM_FloatingPoint>Real</TASM_FloatingPoint>
|
||||
<BCC_waus>false</BCC_waus>
|
||||
<_TCHARMapping>wchar_t</_TCHARMapping>
|
||||
<IntermediateOutputDir>..\..\intermediate\$(Config)\Export</IntermediateOutputDir>
|
||||
<IncludePath>..\..\source;..\..\source\;$(IncludePath)</IncludePath>
|
||||
<TASM_Defines>_RTLDLL;NO_STRICT;_NO_VCL;$(TASM_Defines)</TASM_Defines>
|
||||
<BRCC_Defines>_NO_VCL;$(BRCC_Defines)</BRCC_Defines>
|
||||
<PackageImports>vclx.bpi;vcl.bpi;rtl.bpi;dbrtl.bpi;vcldb.bpi;adortl.bpi;dbxcds.bpi;dbexpress.bpi;xmlrtl.bpi;vclie.bpi;inet.bpi;inetdbbde.bpi;inetdbxpress.bpi;soaprtl.bpi;dsnap.bpi;vclactnband.bpi;bdertl.bpi;vcldbx.bpi</PackageImports>
|
||||
<DCC_ResourcePath>..\..\source;$(DCC_ResourcePath)</DCC_ResourcePath>
|
||||
<DCC_CBuilderOutput>JPHNE</DCC_CBuilderOutput>
|
||||
<NoVCL>true</NoVCL>
|
||||
<DCC_UnitSearchPath>..\..\source;$(BDS)\lib\obj;$(DCC_UnitSearchPath)</DCC_UnitSearchPath>
|
||||
<BCC_PCHCache>true</BCC_PCHCache>
|
||||
<BRCC_IncludePath>..\..\source;$(BDS)\include;$(BDS)\include\dinkumware;$(BDS)\include\vcl;$(BRCC_IncludePath)</BRCC_IncludePath>
|
||||
<BCC_IncludeContentsOfHeaders>pch1.h;$(BCC_IncludeContentsOfHeaders)</BCC_IncludeContentsOfHeaders>
|
||||
<BCC_StopPCHAfter>pch1.h</BCC_StopPCHAfter>
|
||||
<BCC_IncludePath>..\..\source;$(BDS)\include;$(BDS)\include\dinkumware;$(BDS)\include\vcl;$(BCC_IncludePath)</BCC_IncludePath>
|
||||
<TASM_IncludePath>..\..\source;$(BDS)\include;$(BDS)\include\dinkumware;$(BDS)\include\vcl;$(TASM_IncludePath)</TASM_IncludePath>
|
||||
<DCC_IncludePath>..\..\source;..\..\..\..\..\..\..\..\..\Borland Studio-Projekte;$(BDS)\lib;$(BDS)\lib\obj;$(DCC_IncludePath)</DCC_IncludePath>
|
||||
<ILINK_GenerateImportLibrary>true</ILINK_GenerateImportLibrary>
|
||||
<BCC_GenerateMultithreaded>true</BCC_GenerateMultithreaded>
|
||||
<FinalOutputDir>..\..\bin</FinalOutputDir>
|
||||
<ILINK_WinAppType>DLL</ILINK_WinAppType>
|
||||
<ILINK_BpiLibOutputDir>..\..\bin</ILINK_BpiLibOutputDir>
|
||||
<ILINK_ObjectSearchPath>..\..\source;$(ILINK_ObjectSearchPath)</ILINK_ObjectSearchPath>
|
||||
<ILINK_IntermediateOutputPath>..\..\intermediate</ILINK_IntermediateOutputPath>
|
||||
<DCC_ObjPath>..\..\source;$(DCC_ObjPath)</DCC_ObjPath>
|
||||
<ILINK_AdditionalOptions> -r</ILINK_AdditionalOptions>
|
||||
<ILINK_LibraryPath>..\..\lib;..\..\lib\;..\..\source\;..\..\source;$(BDS)\lib;$(BDS)\lib\obj;$(BDS)\lib\psdk;$(ILINK_LibraryPath)</ILINK_LibraryPath>
|
||||
<OutputExt>dll</OutputExt>
|
||||
<BCC_GenerateDLL>true</BCC_GenerateDLL>
|
||||
<Multithreaded>true</Multithreaded>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Cfg_1)'!=''">
|
||||
<BCC_Defines>_DEBUG;$(BCC_Defines);$(BCC_Defines)</BCC_Defines>
|
||||
<BCC_UserSuppliedOptions> -k</BCC_UserSuppliedOptions>
|
||||
<ILINK_LibraryPath>$(BDS)\lib\debug;$(ILINK_LibraryPath);$(ILINK_LibraryPath)</ILINK_LibraryPath>
|
||||
<DCC_Define>DEBUG;$(DCC_Define);$(DCC_Define)</DCC_Define>
|
||||
<BCC_SourceDebuggingOn>true</BCC_SourceDebuggingOn>
|
||||
<ILINK_FullDebugInfo>true</ILINK_FullDebugInfo>
|
||||
<TASM_DisplaySourceLines>true</TASM_DisplaySourceLines>
|
||||
<ILINK_DisableIncrementalLinking>true</ILINK_DisableIncrementalLinking>
|
||||
<BCC_DisableOptimizations>true</BCC_DisableOptimizations>
|
||||
<TASM_Debugging>Full</TASM_Debugging>
|
||||
<DCC_AdditionalSwitches> -V</DCC_AdditionalSwitches>
|
||||
<BCC_DebugLineNumbers>true</BCC_DebugLineNumbers>
|
||||
<DCC_DebugInfoInExe>true</DCC_DebugInfoInExe>
|
||||
<BCC_InlineFunctionExpansion>false</BCC_InlineFunctionExpansion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Cfg_2)'!=''">
|
||||
<BCC_Defines>NDEBUG;$(BCC_Defines);$(BCC_Defines)</BCC_Defines>
|
||||
<BCC_OptimizeForSpeed>true</BCC_OptimizeForSpeed>
|
||||
<BCC_UserSuppliedOptions> -r</BCC_UserSuppliedOptions>
|
||||
<TASM_Debugging>None</TASM_Debugging>
|
||||
<DCC_AdditionalSwitches> -$O+</DCC_AdditionalSwitches>
|
||||
<ILINK_LibraryPath>$(BDS)\lib\release;$(ILINK_LibraryPath);$(ILINK_LibraryPath)</ILINK_LibraryPath>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<CppCompile Include="..\..\source\as_thread.cpp">
|
||||
<BuildOrder>4</BuildOrder>
|
||||
</CppCompile>
|
||||
<CppCompile Include="..\..\source\as_context.cpp">
|
||||
<BuildOrder>5</BuildOrder>
|
||||
</CppCompile>
|
||||
<CppCompile Include="..\..\source\as_memory.cpp">
|
||||
<BuildOrder>6</BuildOrder>
|
||||
</CppCompile>
|
||||
<CppCompile Include="..\..\source\as_scriptengine.cpp">
|
||||
<BuildOrder>3</BuildOrder>
|
||||
</CppCompile>
|
||||
<ResFiles Include="AngelScriptBCC.res">
|
||||
<BuildOrder>-1</BuildOrder>
|
||||
<BuildOrder>1</BuildOrder>
|
||||
</ResFiles>
|
||||
<None Include="pch1.h">
|
||||
<BuildOrder>25</BuildOrder>
|
||||
<BuildOrder>2</BuildOrder>
|
||||
</None>
|
||||
<LibFiles Include="..\..\lib\AngelScriptBCC_Static.lib">
|
||||
<IgnorePath>true</IgnorePath>
|
||||
<BuildOrder>2</BuildOrder>
|
||||
</LibFiles>
|
||||
<BuildConfiguration Include="Base">
|
||||
<Key>Base</Key>
|
||||
</BuildConfiguration>
|
||||
<BuildConfiguration Include="Debug">
|
||||
<Key>Cfg_1</Key>
|
||||
<CfgParent>Base</CfgParent>
|
||||
</BuildConfiguration>
|
||||
<BuildConfiguration Include="Release">
|
||||
<Key>Cfg_2</Key>
|
||||
<CfgParent>Base</CfgParent>
|
||||
</BuildConfiguration>
|
||||
</ItemGroup>
|
||||
<Import Project="$(BDS)\Bin\CodeGear.Cpp.Targets" Condition="Exists('$(BDS)\Bin\CodeGear.Cpp.Targets')"/>
|
||||
<ProjectExtensions>
|
||||
<Borland.Personality>CPlusPlusBuilder.Personality.12</Borland.Personality>
|
||||
<Borland.ProjectType>CppDynamicLibrary</Borland.ProjectType>
|
||||
<BorlandProject>
|
||||
<CPlusPlusBuilder.Personality>
|
||||
<VersionInfo>
|
||||
<VersionInfo Name="IncludeVerInfo">True</VersionInfo>
|
||||
<VersionInfo Name="AutoIncBuild">False</VersionInfo>
|
||||
<VersionInfo Name="MajorVer">2</VersionInfo>
|
||||
<VersionInfo Name="MinorVer">19</VersionInfo>
|
||||
<VersionInfo Name="Release">0</VersionInfo>
|
||||
<VersionInfo Name="Build">0</VersionInfo>
|
||||
<VersionInfo Name="Debug">False</VersionInfo>
|
||||
<VersionInfo Name="PreRelease">False</VersionInfo>
|
||||
<VersionInfo Name="Special">False</VersionInfo>
|
||||
<VersionInfo Name="Private">False</VersionInfo>
|
||||
<VersionInfo Name="DLL">True</VersionInfo>
|
||||
<VersionInfo Name="Locale">1033</VersionInfo>
|
||||
<VersionInfo Name="CodePage">1252</VersionInfo>
|
||||
</VersionInfo>
|
||||
<VersionInfoKeys>
|
||||
<VersionInfoKeys Name="CompanyName"/>
|
||||
<VersionInfoKeys Name="FileDescription">AngelCode Scripting Library</VersionInfoKeys>
|
||||
<VersionInfoKeys Name="FileVersion">2.19.0.0</VersionInfoKeys>
|
||||
<VersionInfoKeys Name="InternalName"/>
|
||||
<VersionInfoKeys Name="LegalCopyright">(c) 2003-2010 Andreas Jönsson</VersionInfoKeys>
|
||||
<VersionInfoKeys Name="LegalTrademarks"/>
|
||||
<VersionInfoKeys Name="OriginalFilename"/>
|
||||
<VersionInfoKeys Name="ProductName"/>
|
||||
<VersionInfoKeys Name="ProductVersion">2.19.0.0</VersionInfoKeys>
|
||||
<VersionInfoKeys Name="Comments"/>
|
||||
</VersionInfoKeys>
|
||||
<Debugging>
|
||||
<Debugging Name="DebugSourceDirs"/>
|
||||
</Debugging>
|
||||
<Parameters>
|
||||
<Parameters Name="RunParams"/>
|
||||
<Parameters Name="Launcher"/>
|
||||
<Parameters Name="UseLauncher">False</Parameters>
|
||||
<Parameters Name="DebugCWD"/>
|
||||
<Parameters Name="HostApplication"/>
|
||||
<Parameters Name="RemoteHost"/>
|
||||
<Parameters Name="RemotePath"/>
|
||||
<Parameters Name="RemoteParams"/>
|
||||
<Parameters Name="RemoteLauncher"/>
|
||||
<Parameters Name="UseRemoteLauncher">False</Parameters>
|
||||
<Parameters Name="RemoteCWD"/>
|
||||
<Parameters Name="RemoteDebug">False</Parameters>
|
||||
<Parameters Name="Debug Symbols Search Path"/>
|
||||
<Parameters Name="LoadAllSymbols">True</Parameters>
|
||||
<Parameters Name="LoadUnspecifiedSymbols">False</Parameters>
|
||||
</Parameters>
|
||||
<Excluded_Packages>
|
||||
<Excluded_Packages Name="e:\programme\bds40\Bin\dclib100.bpl">Borland InterBase Express Components</Excluded_Packages>
|
||||
<Excluded_Packages Name="e:\programme\bds40\Bin\dclIntraweb_80_100.bpl">Intraweb 8.0 Design Package for Borland Development Studio 2006</Excluded_Packages>
|
||||
<Excluded_Packages Name="e:\programme\bds40\Bin\dclIndyCore100.bpl">Indy 10 Core Design Time</Excluded_Packages>
|
||||
<Excluded_Packages Name="e:\programme\bds40\Bin\dclsmp100.bpl">Borland Sample Components</Excluded_Packages>
|
||||
<Excluded_Packages Name="e:\programme\bds40\Bin\dclIndyProtocols100.bpl">Indy 10 Protocols Design Time</Excluded_Packages>
|
||||
<Excluded_Packages Name="e:\programme\bds40\Bin\dcltee100.bpl">TeeChart-Komponenten</Excluded_Packages>
|
||||
<Excluded_Packages Name="e:\programme\bds40\Bin\dclindy100.bpl">Internet Direct Version 9 (Indy)- Eigenschaften- und Komponenteneditoren</Excluded_Packages>
|
||||
<Excluded_Packages Name="e:\programme\bds40\Bin\bcboffice2k100.bpl">Borland C++Builder Office 2000 Servers Package</Excluded_Packages>
|
||||
<Excluded_Packages Name="e:\programme\bds40\Bin\dclbcbsmp100.bpl">Borland Sample Controls Design Time Package</Excluded_Packages>
|
||||
<Excluded_Packages Name="e:\programme\bds40\Bin\bcbie100.bpl">Borland C++Builder Internet Explorer 5 Components Package</Excluded_Packages>
|
||||
</Excluded_Packages>
|
||||
<ProjectProperties>
|
||||
<ProjectProperties Name="AutoShowDeps">False</ProjectProperties>
|
||||
<ProjectProperties Name="ManagePaths">True</ProjectProperties>
|
||||
<ProjectProperties Name="VerifyPackages">True</ProjectProperties>
|
||||
</ProjectProperties>
|
||||
</CPlusPlusBuilder.Personality>
|
||||
</BorlandProject>
|
||||
<ProjectFileVersion>12</ProjectFileVersion>
|
||||
</ProjectExtensions>
|
||||
</Project>
|
613
lib/angelscript/projects/BCBuilder/AngelScriptBCC_Static.cbproj
Normal file
613
lib/angelscript/projects/BCBuilder/AngelScriptBCC_Static.cbproj
Normal file
@ -0,0 +1,613 @@
|
||||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<ProjectGuid>{5EA4EE0E-521B-4A7D-BEE8-BA2D8BBF7807}</ProjectGuid>
|
||||
<ProjectType>CppStaticLibrary</ProjectType>
|
||||
<Config Condition="'$(Config)'==''">Release</Config>
|
||||
<ProjectVersion>12.0</ProjectVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Config)'=='Base' or '$(Base)'!=''">
|
||||
<Base>true</Base>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Config)'=='Debug' or '$(Cfg_1)'!=''">
|
||||
<Cfg_1>true</Cfg_1>
|
||||
<CfgParent>Base</CfgParent>
|
||||
<Base>true</Base>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Config)'=='Release' or '$(Cfg_2)'!=''">
|
||||
<Cfg_2>true</Cfg_2>
|
||||
<CfgParent>Base</CfgParent>
|
||||
<Base>true</Base>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Base)'!=''">
|
||||
<BCC_PCHInject>pch1.h</BCC_PCHInject>
|
||||
<Defines>WIN32;AS_USE_NAMESPACE=1;$(Defines)</Defines>
|
||||
<BCC_wrch>false</BCC_wrch>
|
||||
<BCC_waus>false</BCC_waus>
|
||||
<AllPackageLibs>rtl.lib</AllPackageLibs>
|
||||
<BCC_StopPCHAfter>pch1.h</BCC_StopPCHAfter>
|
||||
<BCC_EnableBatchCompilation>true</BCC_EnableBatchCompilation>
|
||||
<_TCHARMapping>wchar_t</_TCHARMapping>
|
||||
<IntermediateOutputDir>..\..\intermediate\$(Config)</IntermediateOutputDir>
|
||||
<IncludePath>..\..\include\;..\..\source\;..\..\include;..\..\source;..\..\..\add_on\scripthelper;..\..\..\add_on\scriptbuilder;..\..\..\add_on\scriptstdstring;..\..\..\add_on\scriptmath;..\..\..\add_on\scriptfile;..\..\..\add_on\scriptdictionary;..\..\..\add_on\contextmgr;..\..\..\add_on\scriptarray;..\..\..\add_on\scriptany;..\..\..\add_on\scriptstdstring\;..\..\..\add_on\scriptmath\;..\..\..\add_on\scripthelper\;..\..\..\add_on\scriptfile\;..\..\..\add_on\scriptdictionary\;..\..\..\add_on\scriptbuilder\;..\..\..\add_on\scriptarray\;..\..\..\add_on\scriptany\;..\..\..\add_on\contextmgr\;$(IncludePath)</IncludePath>
|
||||
<TASM_Defines>_RTLDLL;NO_STRICT;$(TASM_Defines)</TASM_Defines>
|
||||
<BRCC_Defines>_RTLDLL;NO_STRICT;$(BRCC_Defines)</BRCC_Defines>
|
||||
<BCC_PCHCache>true</BCC_PCHCache>
|
||||
<BCC_Defines>NO_STRICT;$(BCC_Defines)</BCC_Defines>
|
||||
<DCC_CBuilderOutput>JPHNE</DCC_CBuilderOutput>
|
||||
<DCC_UnitSearchPath>.\;$(BDS)\lib;$(BDS)\lib\obj;$(DCC_UnitSearchPath)</DCC_UnitSearchPath>
|
||||
<DCC_ObjOutput>..\..\source\</DCC_ObjOutput>
|
||||
<BRCC_OutputDir>..\..\source\</BRCC_OutputDir>
|
||||
<BRCC_IncludePath>..\..\source;$(BDS)\include;$(BDS)\include\vcl;$(BDS)\include\dinkumware;$(BRCC_IncludePath)</BRCC_IncludePath>
|
||||
<BCC_OptimizeForSpeed>true</BCC_OptimizeForSpeed>
|
||||
<DCC_IncludePath>.\;$(BDS)\lib;$(BDS)\lib\obj;$(DCC_IncludePath)</DCC_IncludePath>
|
||||
<TASM_IncludePath>..\..\source;$(BDS)\include;$(BDS)\include\vcl;$(BDS)\include\dinkumware;$(TASM_IncludePath)</TASM_IncludePath>
|
||||
<BCC_IncludePath>..\..\source;$(BDS)\include;$(BDS)\include\vcl;$(BDS)\include\dinkumware;$(BCC_IncludePath)</BCC_IncludePath>
|
||||
<TLIB_PageSize>256</TLIB_PageSize>
|
||||
<FinalOutputDir>..\..\lib\</FinalOutputDir>
|
||||
<DCC_DcuOutput>..\..\intermediate\$(Config)</DCC_DcuOutput>
|
||||
<TASM_Debugging>None</TASM_Debugging>
|
||||
<TASM_AdditionalSwitches> /w2 ..\..\source\</TASM_AdditionalSwitches>
|
||||
<BCC_GenerateMultithreaded>true</BCC_GenerateMultithreaded>
|
||||
<BCC_GenerateWindowsApp>true</BCC_GenerateWindowsApp>
|
||||
<Multithreaded>true</Multithreaded>
|
||||
<ILINK_LibraryPath>$(BDS)\lib\obj;$(ILINK_LibraryPath)</ILINK_LibraryPath>
|
||||
<BCC_UserSuppliedOptions> -Vx -Ve</BCC_UserSuppliedOptions>
|
||||
<OutputExt>lib</OutputExt>
|
||||
<DCC_AdditionalSwitches> -M</DCC_AdditionalSwitches>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Cfg_1)'!=''">
|
||||
<Defines>_DEBUG;$(Defines)</Defines>
|
||||
<BCC_Defines>_DEBUG;$(BCC_Defines);$(BCC_Defines)</BCC_Defines>
|
||||
<BCC_UserSuppliedOptions> -Vx -Ve -k</BCC_UserSuppliedOptions>
|
||||
<ILINK_LibraryPath>$(BDS)\lib\debug;$(ILINK_LibraryPath);$(ILINK_LibraryPath)</ILINK_LibraryPath>
|
||||
<DCC_Define>DEBUG;$(DCC_Define);$(DCC_Define)</DCC_Define>
|
||||
<BCC_SourceDebuggingOn>true</BCC_SourceDebuggingOn>
|
||||
<ILINK_FullDebugInfo>true</ILINK_FullDebugInfo>
|
||||
<TASM_DisplaySourceLines>true</TASM_DisplaySourceLines>
|
||||
<ILINK_DisableIncrementalLinking>true</ILINK_DisableIncrementalLinking>
|
||||
<BCC_DisableOptimizations>true</BCC_DisableOptimizations>
|
||||
<TASM_Debugging>Full</TASM_Debugging>
|
||||
<DCC_AdditionalSwitches> -M -V</DCC_AdditionalSwitches>
|
||||
<BCC_DebugLineNumbers>true</BCC_DebugLineNumbers>
|
||||
<DCC_DebugInfoInExe>true</DCC_DebugInfoInExe>
|
||||
<BCC_InlineFunctionExpansion>false</BCC_InlineFunctionExpansion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Cfg_2)'!=''">
|
||||
<Defines>NDEBUG;$(Defines)</Defines>
|
||||
<BCC_Defines>NDEBUG;$(BCC_Defines);$(BCC_Defines)</BCC_Defines>
|
||||
<BCC_UserSuppliedOptions> -Vx -Ve -r</BCC_UserSuppliedOptions>
|
||||
<DCC_AdditionalSwitches> -M -$O+</DCC_AdditionalSwitches>
|
||||
<ILINK_LibraryPath>$(BDS)\lib\release;$(ILINK_LibraryPath);$(ILINK_LibraryPath)</ILINK_LibraryPath>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<None Include="..\..\source\as_scriptnode.h">
|
||||
<VirtualFolder>{C4677389-340C-45A6-AC4C-F440F64B74A8}</VirtualFolder>
|
||||
<BuildOrder>65</BuildOrder>
|
||||
</None>
|
||||
<CppCompile Include="..\..\source\as_callfunc_x86.cpp">
|
||||
<VirtualFolder>{1D68C792-68AA-47C5-9F9E-C72C393D9819}</VirtualFolder>
|
||||
<BuildOrder>41</BuildOrder>
|
||||
<BuildOrder>37</BuildOrder>
|
||||
</CppCompile>
|
||||
<None Include="..\..\source\as_outputbuffer.h">
|
||||
<VirtualFolder>{C4677389-340C-45A6-AC4C-F440F64B74A8}</VirtualFolder>
|
||||
<BuildOrder>58</BuildOrder>
|
||||
</None>
|
||||
<None Include="..\..\source\as_scriptfunction.h">
|
||||
<VirtualFolder>{C4677389-340C-45A6-AC4C-F440F64B74A8}</VirtualFolder>
|
||||
<BuildOrder>64</BuildOrder>
|
||||
</None>
|
||||
<None Include="..\..\source\as_objecttype.h">
|
||||
<VirtualFolder>{C4677389-340C-45A6-AC4C-F440F64B74A8}</VirtualFolder>
|
||||
<BuildOrder>57</BuildOrder>
|
||||
</None>
|
||||
<CppCompile Include="..\..\source\as_thread.cpp">
|
||||
<VirtualFolder>{1D68C792-68AA-47C5-9F9E-C72C393D9819}</VirtualFolder>
|
||||
<BuildOrder>11</BuildOrder>
|
||||
<BuildOrder>107</BuildOrder>
|
||||
</CppCompile>
|
||||
<None Include="..\..\source\as_string.h">
|
||||
<VirtualFolder>{C4677389-340C-45A6-AC4C-F440F64B74A8}</VirtualFolder>
|
||||
<BuildOrder>67</BuildOrder>
|
||||
</None>
|
||||
<None Include="..\..\source\as_thread.h">
|
||||
<VirtualFolder>{C4677389-340C-45A6-AC4C-F440F64B74A8}</VirtualFolder>
|
||||
<BuildOrder>70</BuildOrder>
|
||||
</None>
|
||||
<None Include="..\..\source\as_property.h">
|
||||
<VirtualFolder>{C4677389-340C-45A6-AC4C-F440F64B74A8}</VirtualFolder>
|
||||
<BuildOrder>60</BuildOrder>
|
||||
</None>
|
||||
<None Include="..\..\source\as_scriptcode.h">
|
||||
<VirtualFolder>{C4677389-340C-45A6-AC4C-F440F64B74A8}</VirtualFolder>
|
||||
<BuildOrder>62</BuildOrder>
|
||||
</None>
|
||||
<None Include="..\..\source\as_scriptengine.h">
|
||||
<VirtualFolder>{C4677389-340C-45A6-AC4C-F440F64B74A8}</VirtualFolder>
|
||||
<BuildOrder>63</BuildOrder>
|
||||
</None>
|
||||
<None Include="..\..\source\as_restore.h">
|
||||
<VirtualFolder>{C4677389-340C-45A6-AC4C-F440F64B74A8}</VirtualFolder>
|
||||
<BuildOrder>61</BuildOrder>
|
||||
</None>
|
||||
<None Include="..\..\source\as_criticalsection.h">
|
||||
<VirtualFolder>{C4677389-340C-45A6-AC4C-F440F64B74A8}</VirtualFolder>
|
||||
<BuildOrder>49</BuildOrder>
|
||||
</None>
|
||||
<None Include="..\..\source\as_datatype.h">
|
||||
<VirtualFolder>{C4677389-340C-45A6-AC4C-F440F64B74A8}</VirtualFolder>
|
||||
<BuildOrder>50</BuildOrder>
|
||||
</None>
|
||||
<None Include="..\..\source\as_context.h">
|
||||
<VirtualFolder>{C4677389-340C-45A6-AC4C-F440F64B74A8}</VirtualFolder>
|
||||
<BuildOrder>48</BuildOrder>
|
||||
</None>
|
||||
<None Include="..\..\source\as_config.h">
|
||||
<VirtualFolder>{C4677389-340C-45A6-AC4C-F440F64B74A8}</VirtualFolder>
|
||||
<BuildOrder>46</BuildOrder>
|
||||
</None>
|
||||
<None Include="..\..\..\add_on\scriptbuilder\scriptbuilder.h">
|
||||
<VirtualFolder>{B30C65C6-20F8-4D1C-B7F6-1708CE02A1B9}</VirtualFolder>
|
||||
<BuildOrder>83</BuildOrder>
|
||||
</None>
|
||||
<None Include="..\..\source\as_debug.h">
|
||||
<VirtualFolder>{C4677389-340C-45A6-AC4C-F440F64B74A8}</VirtualFolder>
|
||||
<BuildOrder>51</BuildOrder>
|
||||
</None>
|
||||
<None Include="..\..\source\as_memory.h">
|
||||
<VirtualFolder>{C4677389-340C-45A6-AC4C-F440F64B74A8}</VirtualFolder>
|
||||
<BuildOrder>55</BuildOrder>
|
||||
</None>
|
||||
<None Include="..\..\source\as_string_util.h">
|
||||
<VirtualFolder>{C4677389-340C-45A6-AC4C-F440F64B74A8}</VirtualFolder>
|
||||
<BuildOrder>68</BuildOrder>
|
||||
</None>
|
||||
<None Include="..\..\source\as_map.h">
|
||||
<VirtualFolder>{C4677389-340C-45A6-AC4C-F440F64B74A8}</VirtualFolder>
|
||||
<BuildOrder>54</BuildOrder>
|
||||
</None>
|
||||
<None Include="..\..\source\as_gc.h">
|
||||
<VirtualFolder>{C4677389-340C-45A6-AC4C-F440F64B74A8}</VirtualFolder>
|
||||
<BuildOrder>52</BuildOrder>
|
||||
</None>
|
||||
<None Include="..\..\source\as_generic.h">
|
||||
<VirtualFolder>{C4677389-340C-45A6-AC4C-F440F64B74A8}</VirtualFolder>
|
||||
<BuildOrder>53</BuildOrder>
|
||||
</None>
|
||||
<None Include="..\..\source\as_texts.h">
|
||||
<VirtualFolder>{C4677389-340C-45A6-AC4C-F440F64B74A8}</VirtualFolder>
|
||||
<BuildOrder>69</BuildOrder>
|
||||
</None>
|
||||
<CppCompile Include="..\..\..\add_on\scripthelper\scripthelper.cpp">
|
||||
<VirtualFolder>{B2262C45-6009-4277-AE08-EBE6C6317496}</VirtualFolder>
|
||||
<BuildOrder>88</BuildOrder>
|
||||
</CppCompile>
|
||||
<None Include="..\..\source\as_tokenizer.h">
|
||||
<VirtualFolder>{C4677389-340C-45A6-AC4C-F440F64B74A8}</VirtualFolder>
|
||||
<BuildOrder>72</BuildOrder>
|
||||
</None>
|
||||
<None Include="..\..\..\add_on\scriptfile\scriptfile.h">
|
||||
<VirtualFolder>{B30C65C6-20F8-4D1C-B7F6-1708CE02A1B9}</VirtualFolder>
|
||||
<BuildOrder>87</BuildOrder>
|
||||
</None>
|
||||
<CppCompile Include="..\..\..\add_on\scriptdictionary\scriptdictionary.cpp">
|
||||
<VirtualFolder>{B2262C45-6009-4277-AE08-EBE6C6317496}</VirtualFolder>
|
||||
<BuildOrder>84</BuildOrder>
|
||||
</CppCompile>
|
||||
<None Include="..\..\..\add_on\scriptdictionary\scriptdictionary.h">
|
||||
<VirtualFolder>{B30C65C6-20F8-4D1C-B7F6-1708CE02A1B9}</VirtualFolder>
|
||||
<BuildOrder>85</BuildOrder>
|
||||
</None>
|
||||
<CppCompile Include="..\..\..\add_on\scriptmath\scriptmath.cpp">
|
||||
<VirtualFolder>{B2262C45-6009-4277-AE08-EBE6C6317496}</VirtualFolder>
|
||||
<BuildOrder>90</BuildOrder>
|
||||
</CppCompile>
|
||||
<None Include="..\..\..\add_on\scripthelper\scripthelper.h">
|
||||
<VirtualFolder>{B30C65C6-20F8-4D1C-B7F6-1708CE02A1B9}</VirtualFolder>
|
||||
<BuildOrder>89</BuildOrder>
|
||||
</None>
|
||||
<None Include="..\..\..\add_on\scriptstring\scriptstring.h">
|
||||
<VirtualFolder>{B30C65C6-20F8-4D1C-B7F6-1708CE02A1B9}</VirtualFolder>
|
||||
<BuildOrder>97</BuildOrder>
|
||||
</None>
|
||||
<CppCompile Include="..\..\..\add_on\scriptstdstring\scriptstdstring.cpp">
|
||||
<VirtualFolder>{B2262C45-6009-4277-AE08-EBE6C6317496}</VirtualFolder>
|
||||
<BuildOrder>94</BuildOrder>
|
||||
</CppCompile>
|
||||
<None Include="..\..\..\add_on\scriptmath\scriptmath.h">
|
||||
<VirtualFolder>{B30C65C6-20F8-4D1C-B7F6-1708CE02A1B9}</VirtualFolder>
|
||||
<BuildOrder>91</BuildOrder>
|
||||
</None>
|
||||
<None Include="..\..\..\add_on\scriptmath3d\scriptmath3d.h">
|
||||
<VirtualFolder>{B30C65C6-20F8-4D1C-B7F6-1708CE02A1B9}</VirtualFolder>
|
||||
<BuildOrder>93</BuildOrder>
|
||||
</None>
|
||||
<None Include="..\..\source\as_tokendef.h">
|
||||
<VirtualFolder>{C4677389-340C-45A6-AC4C-F440F64B74A8}</VirtualFolder>
|
||||
<BuildOrder>71</BuildOrder>
|
||||
</None>
|
||||
<None Include="..\..\source\as_parser.h">
|
||||
<VirtualFolder>{C4677389-340C-45A6-AC4C-F440F64B74A8}</VirtualFolder>
|
||||
<BuildOrder>59</BuildOrder>
|
||||
</None>
|
||||
<None Include="..\..\source\as_variablescope.h">
|
||||
<VirtualFolder>{C4677389-340C-45A6-AC4C-F440F64B74A8}</VirtualFolder>
|
||||
<BuildOrder>74</BuildOrder>
|
||||
</None>
|
||||
<CppCompile Include="..\..\..\add_on\scriptarray\scriptarray.cpp">
|
||||
<VirtualFolder>{B2262C45-6009-4277-AE08-EBE6C6317496}</VirtualFolder>
|
||||
<BuildOrder>80</BuildOrder>
|
||||
</CppCompile>
|
||||
<None Include="..\..\source\as_scriptobject.h">
|
||||
<VirtualFolder>{C4677389-340C-45A6-AC4C-F440F64B74A8}</VirtualFolder>
|
||||
<BuildOrder>66</BuildOrder>
|
||||
</None>
|
||||
<None Include="..\..\source\as_typeinfo.h">
|
||||
<VirtualFolder>{C4677389-340C-45A6-AC4C-F440F64B74A8}</VirtualFolder>
|
||||
<BuildOrder>73</BuildOrder>
|
||||
</None>
|
||||
<None Include="..\..\..\add_on\scriptstdstring\scriptstdstring.h">
|
||||
<VirtualFolder>{B30C65C6-20F8-4D1C-B7F6-1708CE02A1B9}</VirtualFolder>
|
||||
<BuildOrder>95</BuildOrder>
|
||||
</None>
|
||||
<None Include="..\..\..\add_on\scriptarray\scriptarray.h">
|
||||
<VirtualFolder>{B30C65C6-20F8-4D1C-B7F6-1708CE02A1B9}</VirtualFolder>
|
||||
<BuildOrder>81</BuildOrder>
|
||||
</None>
|
||||
<CppCompile Include="..\..\..\add_on\scriptbuilder\scriptbuilder.cpp">
|
||||
<VirtualFolder>{B2262C45-6009-4277-AE08-EBE6C6317496}</VirtualFolder>
|
||||
<BuildOrder>82</BuildOrder>
|
||||
</CppCompile>
|
||||
<CppCompile Include="..\..\..\add_on\scriptfile\scriptfile.cpp">
|
||||
<VirtualFolder>{B2262C45-6009-4277-AE08-EBE6C6317496}</VirtualFolder>
|
||||
<BuildOrder>86</BuildOrder>
|
||||
</CppCompile>
|
||||
<None Include="..\..\..\add_on\scriptany\scriptany.h">
|
||||
<VirtualFolder>{B30C65C6-20F8-4D1C-B7F6-1708CE02A1B9}</VirtualFolder>
|
||||
<BuildOrder>78</BuildOrder>
|
||||
</None>
|
||||
<CppCompile Include="..\..\..\add_on\scriptany\scriptany.cpp">
|
||||
<VirtualFolder>{B2262C45-6009-4277-AE08-EBE6C6317496}</VirtualFolder>
|
||||
<BuildOrder>79</BuildOrder>
|
||||
</CppCompile>
|
||||
<None Include="..\..\source\as_configgroup.h">
|
||||
<VirtualFolder>{C4677389-340C-45A6-AC4C-F440F64B74A8}</VirtualFolder>
|
||||
<BuildOrder>47</BuildOrder>
|
||||
</None>
|
||||
<CppCompile Include="..\..\source\as_scriptnode.cpp">
|
||||
<VirtualFolder>{1D68C792-68AA-47C5-9F9E-C72C393D9819}</VirtualFolder>
|
||||
<BuildOrder>95</BuildOrder>
|
||||
<BuildOrder>15</BuildOrder>
|
||||
</CppCompile>
|
||||
<CppCompile Include="..\..\source\as_scriptengine.cpp">
|
||||
<VirtualFolder>{1D68C792-68AA-47C5-9F9E-C72C393D9819}</VirtualFolder>
|
||||
<BuildOrder>9</BuildOrder>
|
||||
<BuildOrder>89</BuildOrder>
|
||||
</CppCompile>
|
||||
<CppCompile Include="..\..\source\as_string.cpp">
|
||||
<VirtualFolder>{1D68C792-68AA-47C5-9F9E-C72C393D9819}</VirtualFolder>
|
||||
<BuildOrder>17</BuildOrder>
|
||||
<BuildOrder>101</BuildOrder>
|
||||
</CppCompile>
|
||||
<CppCompile Include="..\..\source\as_variablescope.cpp">
|
||||
<VirtualFolder>{1D68C792-68AA-47C5-9F9E-C72C393D9819}</VirtualFolder>
|
||||
<BuildOrder>12</BuildOrder>
|
||||
<BuildOrder>116</BuildOrder>
|
||||
</CppCompile>
|
||||
<CppCompile Include="..\..\source\as_scriptcode.cpp">
|
||||
<VirtualFolder>{1D68C792-68AA-47C5-9F9E-C72C393D9819}</VirtualFolder>
|
||||
<BuildOrder>86</BuildOrder>
|
||||
<BuildOrder>2</BuildOrder>
|
||||
</CppCompile>
|
||||
<CppCompile Include="..\..\source\as_scriptfunction.cpp">
|
||||
<VirtualFolder>{1D68C792-68AA-47C5-9F9E-C72C393D9819}</VirtualFolder>
|
||||
<BuildOrder>92</BuildOrder>
|
||||
<BuildOrder>16</BuildOrder>
|
||||
</CppCompile>
|
||||
<CppCompile Include="..\..\source\as_builder.cpp">
|
||||
<VirtualFolder>{1D68C792-68AA-47C5-9F9E-C72C393D9819}</VirtualFolder>
|
||||
<BuildOrder>27</BuildOrder>
|
||||
<BuildOrder>11</BuildOrder>
|
||||
</CppCompile>
|
||||
<CppCompile Include="..\..\source\as_gc.cpp">
|
||||
<VirtualFolder>{1D68C792-68AA-47C5-9F9E-C72C393D9819}</VirtualFolder>
|
||||
<BuildOrder>59</BuildOrder>
|
||||
<BuildOrder>31</BuildOrder>
|
||||
</CppCompile>
|
||||
<CppCompile Include="..\..\source\as_callfunc.cpp">
|
||||
<VirtualFolder>{1D68C792-68AA-47C5-9F9E-C72C393D9819}</VirtualFolder>
|
||||
<BuildOrder>23</BuildOrder>
|
||||
<BuildOrder>17</BuildOrder>
|
||||
</CppCompile>
|
||||
<CppCompile Include="..\..\source\as_string_util.cpp">
|
||||
<VirtualFolder>{1D68C792-68AA-47C5-9F9E-C72C393D9819}</VirtualFolder>
|
||||
<BuildOrder>14</BuildOrder>
|
||||
<BuildOrder>104</BuildOrder>
|
||||
</CppCompile>
|
||||
<CppCompile Include="..\..\source\as_tokenizer.cpp">
|
||||
<VirtualFolder>{1D68C792-68AA-47C5-9F9E-C72C393D9819}</VirtualFolder>
|
||||
<BuildOrder>110</BuildOrder>
|
||||
<BuildOrder>10</BuildOrder>
|
||||
</CppCompile>
|
||||
<CppCompile Include="..\..\source\as_bytecode.cpp">
|
||||
<VirtualFolder>{1D68C792-68AA-47C5-9F9E-C72C393D9819}</VirtualFolder>
|
||||
<BuildOrder>26</BuildOrder>
|
||||
<BuildOrder>14</BuildOrder>
|
||||
</CppCompile>
|
||||
<CppCompile Include="..\..\source\as_outputbuffer.cpp">
|
||||
<VirtualFolder>{1D68C792-68AA-47C5-9F9E-C72C393D9819}</VirtualFolder>
|
||||
<BuildOrder>77</BuildOrder>
|
||||
<BuildOrder>1</BuildOrder>
|
||||
</CppCompile>
|
||||
<CppCompile Include="..\..\source\as_module.cpp">
|
||||
<VirtualFolder>{1D68C792-68AA-47C5-9F9E-C72C393D9819}</VirtualFolder>
|
||||
<BuildOrder>71</BuildOrder>
|
||||
<BuildOrder>7</BuildOrder>
|
||||
</CppCompile>
|
||||
<CppCompile Include="..\..\source\as_scriptobject.cpp">
|
||||
<VirtualFolder>{1D68C792-68AA-47C5-9F9E-C72C393D9819}</VirtualFolder>
|
||||
<BuildOrder>98</BuildOrder>
|
||||
<BuildOrder>18</BuildOrder>
|
||||
</CppCompile>
|
||||
<CppCompile Include="..\..\source\as_objecttype.cpp">
|
||||
<VirtualFolder>{1D68C792-68AA-47C5-9F9E-C72C393D9819}</VirtualFolder>
|
||||
<BuildOrder>74</BuildOrder>
|
||||
<BuildOrder>4</BuildOrder>
|
||||
</CppCompile>
|
||||
<CppCompile Include="..\..\source\as_memory.cpp">
|
||||
<VirtualFolder>{1D68C792-68AA-47C5-9F9E-C72C393D9819}</VirtualFolder>
|
||||
<BuildOrder>8</BuildOrder>
|
||||
<BuildOrder>68</BuildOrder>
|
||||
</CppCompile>
|
||||
<CppCompile Include="..\..\source\as_parser.cpp">
|
||||
<VirtualFolder>{1D68C792-68AA-47C5-9F9E-C72C393D9819}</VirtualFolder>
|
||||
<BuildOrder>80</BuildOrder>
|
||||
<BuildOrder>0</BuildOrder>
|
||||
</CppCompile>
|
||||
<CppCompile Include="..\..\source\as_restore.cpp">
|
||||
<VirtualFolder>{1D68C792-68AA-47C5-9F9E-C72C393D9819}</VirtualFolder>
|
||||
<BuildOrder>83</BuildOrder>
|
||||
<BuildOrder>3</BuildOrder>
|
||||
</CppCompile>
|
||||
<CppCompile Include="..\..\source\as_globalproperty.cpp">
|
||||
<VirtualFolder>{1D68C792-68AA-47C5-9F9E-C72C393D9819}</VirtualFolder>
|
||||
<BuildOrder>65</BuildOrder>
|
||||
<BuildOrder>5</BuildOrder>
|
||||
</CppCompile>
|
||||
<CppCompile Include="..\..\source\as_typeinfo.cpp">
|
||||
<VirtualFolder>{1D68C792-68AA-47C5-9F9E-C72C393D9819}</VirtualFolder>
|
||||
<BuildOrder>13</BuildOrder>
|
||||
<BuildOrder>113</BuildOrder>
|
||||
</CppCompile>
|
||||
<CppCompile Include="..\..\source\as_configgroup.cpp">
|
||||
<VirtualFolder>{1D68C792-68AA-47C5-9F9E-C72C393D9819}</VirtualFolder>
|
||||
<BuildOrder>50</BuildOrder>
|
||||
<BuildOrder>30</BuildOrder>
|
||||
</CppCompile>
|
||||
<CppCompile Include="..\..\source\as_callfunc_arm.cpp">
|
||||
<VirtualFolder>{1D68C792-68AA-47C5-9F9E-C72C393D9819}</VirtualFolder>
|
||||
<BuildOrder>20</BuildOrder>
|
||||
</CppCompile>
|
||||
<CppCompile Include="..\..\source\as_generic.cpp">
|
||||
<VirtualFolder>{1D68C792-68AA-47C5-9F9E-C72C393D9819}</VirtualFolder>
|
||||
<BuildOrder>62</BuildOrder>
|
||||
<BuildOrder>6</BuildOrder>
|
||||
</CppCompile>
|
||||
<CppCompile Include="..\..\source\as_atomic.cpp">
|
||||
<VirtualFolder>{1D68C792-68AA-47C5-9F9E-C72C393D9819}</VirtualFolder>
|
||||
<BuildOrder>8</BuildOrder>
|
||||
<BuildOrder>24</BuildOrder>
|
||||
</CppCompile>
|
||||
<CppCompile Include="..\..\source\as_compiler.cpp">
|
||||
<VirtualFolder>{1D68C792-68AA-47C5-9F9E-C72C393D9819}</VirtualFolder>
|
||||
<BuildOrder>47</BuildOrder>
|
||||
<BuildOrder>33</BuildOrder>
|
||||
</CppCompile>
|
||||
<None Include="..\..\source\as_atomic.h">
|
||||
<VirtualFolder>{C4677389-340C-45A6-AC4C-F440F64B74A8}</VirtualFolder>
|
||||
<BuildOrder>41</BuildOrder>
|
||||
</None>
|
||||
<None Include="pch1.h">
|
||||
<BuildOrder>38</BuildOrder>
|
||||
</None>
|
||||
<None Include="..\..\source\as_builder.h">
|
||||
<VirtualFolder>{C4677389-340C-45A6-AC4C-F440F64B74A8}</VirtualFolder>
|
||||
<BuildOrder>42</BuildOrder>
|
||||
</None>
|
||||
<CppCompile Include="..\..\source\as_callfunc_x64_msvc.cpp">
|
||||
<VirtualFolder>{1D68C792-68AA-47C5-9F9E-C72C393D9819}</VirtualFolder>
|
||||
<BuildOrder>38</BuildOrder>
|
||||
<BuildOrder>34</BuildOrder>
|
||||
</CppCompile>
|
||||
<None Include="..\..\source\as_array.h">
|
||||
<VirtualFolder>{C4677389-340C-45A6-AC4C-F440F64B74A8}</VirtualFolder>
|
||||
<BuildOrder>39</BuildOrder>
|
||||
</None>
|
||||
<None Include="..\..\source\as_callfunc.h">
|
||||
<VirtualFolder>{C4677389-340C-45A6-AC4C-F440F64B74A8}</VirtualFolder>
|
||||
<BuildOrder>44</BuildOrder>
|
||||
</None>
|
||||
<None Include="..\..\source\as_bytecode.h">
|
||||
<VirtualFolder>{C4677389-340C-45A6-AC4C-F440F64B74A8}</VirtualFolder>
|
||||
<BuildOrder>43</BuildOrder>
|
||||
</None>
|
||||
<None Include="..\..\source\as_compiler.h">
|
||||
<VirtualFolder>{C4677389-340C-45A6-AC4C-F440F64B74A8}</VirtualFolder>
|
||||
<BuildOrder>45</BuildOrder>
|
||||
</None>
|
||||
<CppCompile Include="..\..\source\as_callfunc_ppc.cpp">
|
||||
<VirtualFolder>{1D68C792-68AA-47C5-9F9E-C72C393D9819}</VirtualFolder>
|
||||
<BuildOrder>26</BuildOrder>
|
||||
<BuildOrder>22</BuildOrder>
|
||||
</CppCompile>
|
||||
<None Include="..\..\source\as_module.h">
|
||||
<VirtualFolder>{C4677389-340C-45A6-AC4C-F440F64B74A8}</VirtualFolder>
|
||||
<BuildOrder>56</BuildOrder>
|
||||
</None>
|
||||
<CppCompile Include="..\..\..\add_on\contextmgr\contextmgr.cpp">
|
||||
<VirtualFolder>{B2262C45-6009-4277-AE08-EBE6C6317496}</VirtualFolder>
|
||||
<BuildOrder>75</BuildOrder>
|
||||
</CppCompile>
|
||||
<None Include="..\..\include\angelscript.h">
|
||||
<VirtualFolder>{C4677389-340C-45A6-AC4C-F440F64B74A8}</VirtualFolder>
|
||||
<BuildOrder>77</BuildOrder>
|
||||
</None>
|
||||
<CppCompile Include="..\..\source\as_datatype.cpp">
|
||||
<VirtualFolder>{1D68C792-68AA-47C5-9F9E-C72C393D9819}</VirtualFolder>
|
||||
<BuildOrder>56</BuildOrder>
|
||||
<BuildOrder>32</BuildOrder>
|
||||
</CppCompile>
|
||||
<None Include="..\..\..\add_on\contextmgr\contextmgr.h">
|
||||
<VirtualFolder>{B30C65C6-20F8-4D1C-B7F6-1708CE02A1B9}</VirtualFolder>
|
||||
<BuildOrder>76</BuildOrder>
|
||||
</None>
|
||||
<CppCompile Include="..\..\source\as_callfunc_mips.cpp">
|
||||
<VirtualFolder>{1D68C792-68AA-47C5-9F9E-C72C393D9819}</VirtualFolder>
|
||||
<BuildOrder>23</BuildOrder>
|
||||
<BuildOrder>19</BuildOrder>
|
||||
</CppCompile>
|
||||
<CppCompile Include="..\..\source\as_callfunc_xenon.cpp">
|
||||
<VirtualFolder>{1D68C792-68AA-47C5-9F9E-C72C393D9819}</VirtualFolder>
|
||||
<BuildOrder>44</BuildOrder>
|
||||
<BuildOrder>36</BuildOrder>
|
||||
</CppCompile>
|
||||
<CppCompile Include="..\..\source\as_callfunc_ppc_64.cpp">
|
||||
<VirtualFolder>{1D68C792-68AA-47C5-9F9E-C72C393D9819}</VirtualFolder>
|
||||
<BuildOrder>29</BuildOrder>
|
||||
<BuildOrder>21</BuildOrder>
|
||||
</CppCompile>
|
||||
<CppCompile Include="..\..\source\as_context.cpp">
|
||||
<VirtualFolder>{1D68C792-68AA-47C5-9F9E-C72C393D9819}</VirtualFolder>
|
||||
<BuildOrder>53</BuildOrder>
|
||||
<BuildOrder>29</BuildOrder>
|
||||
</CppCompile>
|
||||
<CppCompile Include="..\..\source\as_callfunc_x64_gcc.cpp">
|
||||
<VirtualFolder>{1D68C792-68AA-47C5-9F9E-C72C393D9819}</VirtualFolder>
|
||||
<BuildOrder>35</BuildOrder>
|
||||
</CppCompile>
|
||||
<CppCompile Include="..\..\source\as_callfunc_sh4.cpp">
|
||||
<VirtualFolder>{1D68C792-68AA-47C5-9F9E-C72C393D9819}</VirtualFolder>
|
||||
<BuildOrder>32</BuildOrder>
|
||||
<BuildOrder>28</BuildOrder>
|
||||
</CppCompile>
|
||||
<BuildConfiguration Include="Base">
|
||||
<Key>Base</Key>
|
||||
</BuildConfiguration>
|
||||
<BuildConfiguration Include="Debug">
|
||||
<Key>Cfg_1</Key>
|
||||
<CfgParent>Base</CfgParent>
|
||||
</BuildConfiguration>
|
||||
<BuildConfiguration Include="Release">
|
||||
<Key>Cfg_2</Key>
|
||||
<CfgParent>Base</CfgParent>
|
||||
</BuildConfiguration>
|
||||
</ItemGroup>
|
||||
<Import Project="$(BDS)\Bin\CodeGear.Cpp.Targets" Condition="Exists('$(BDS)\Bin\CodeGear.Cpp.Targets')"/>
|
||||
<ProjectExtensions>
|
||||
<Borland.Personality>CPlusPlusBuilder.Personality.12</Borland.Personality>
|
||||
<Borland.ProjectType>CppStaticLibrary</Borland.ProjectType>
|
||||
<BorlandProject>
|
||||
<CPlusPlusBuilder.Personality>
|
||||
<VersionInfo>
|
||||
<VersionInfo Name="IncludeVerInfo">False</VersionInfo>
|
||||
<VersionInfo Name="AutoIncBuild">False</VersionInfo>
|
||||
<VersionInfo Name="MajorVer">1</VersionInfo>
|
||||
<VersionInfo Name="MinorVer">0</VersionInfo>
|
||||
<VersionInfo Name="Release">0</VersionInfo>
|
||||
<VersionInfo Name="Build">0</VersionInfo>
|
||||
<VersionInfo Name="Debug">False</VersionInfo>
|
||||
<VersionInfo Name="PreRelease">False</VersionInfo>
|
||||
<VersionInfo Name="Special">False</VersionInfo>
|
||||
<VersionInfo Name="Private">False</VersionInfo>
|
||||
<VersionInfo Name="DLL">False</VersionInfo>
|
||||
<VersionInfo Name="Locale">1026</VersionInfo>
|
||||
<VersionInfo Name="CodePage">1251</VersionInfo>
|
||||
</VersionInfo>
|
||||
<VersionInfoKeys>
|
||||
<VersionInfoKeys Name="CompanyName"/>
|
||||
<VersionInfoKeys Name="FileDescription"/>
|
||||
<VersionInfoKeys Name="FileVersion">1.0.0.0</VersionInfoKeys>
|
||||
<VersionInfoKeys Name="InternalName"/>
|
||||
<VersionInfoKeys Name="LegalCopyright"/>
|
||||
<VersionInfoKeys Name="LegalTrademarks"/>
|
||||
<VersionInfoKeys Name="OriginalFilename"/>
|
||||
<VersionInfoKeys Name="ProductName"/>
|
||||
<VersionInfoKeys Name="ProductVersion">1.0.0.0</VersionInfoKeys>
|
||||
<VersionInfoKeys Name="Comments"/>
|
||||
</VersionInfoKeys>
|
||||
<HistoryLists_hlIncludePath>
|
||||
<HistoryLists_hlIncludePath Name="Count">3</HistoryLists_hlIncludePath>
|
||||
<HistoryLists_hlIncludePath Name="Item0">..\..\source;$(BCB)\include;$(BCB)\include\vcl</HistoryLists_hlIncludePath>
|
||||
<HistoryLists_hlIncludePath Name="Item1">..\..\source;C:\angelscript_2.18.1\sdk\angelscript\source;$(BCB)\include;$(BCB)\include\vcl</HistoryLists_hlIncludePath>
|
||||
<HistoryLists_hlIncludePath Name="Item2">C:\angelscript_2.18.1\sdk\angelscript\source;$(BCB)\include;$(BCB)\include\vcl</HistoryLists_hlIncludePath>
|
||||
</HistoryLists_hlIncludePath>
|
||||
<HistoryLists_hlLibraryPath>
|
||||
<HistoryLists_hlLibraryPath Name="Count">3</HistoryLists_hlLibraryPath>
|
||||
<HistoryLists_hlLibraryPath Name="Item0">..\..\source;$(BCB)\lib\obj;$(BCB)\lib</HistoryLists_hlLibraryPath>
|
||||
<HistoryLists_hlLibraryPath Name="Item1">..\..\source;C:\angelscript_2.18.1\sdk\angelscript\source;$(BCB)\lib\obj;$(BCB)\lib</HistoryLists_hlLibraryPath>
|
||||
<HistoryLists_hlLibraryPath Name="Item2">C:\angelscript_2.18.1\sdk\angelscript\source;$(BCB)\lib\obj;$(BCB)\lib</HistoryLists_hlLibraryPath>
|
||||
</HistoryLists_hlLibraryPath>
|
||||
<HistoryLists_hlDebugSourcePath>
|
||||
<HistoryLists_hlDebugSourcePath Name="Count">1</HistoryLists_hlDebugSourcePath>
|
||||
<HistoryLists_hlDebugSourcePath Name="Item0">$(BCB)\source\vcl</HistoryLists_hlDebugSourcePath>
|
||||
</HistoryLists_hlDebugSourcePath>
|
||||
<HistoryLists_hlFinalOutputDir>
|
||||
<HistoryLists_hlFinalOutputDir Name="Count">2</HistoryLists_hlFinalOutputDir>
|
||||
<HistoryLists_hlFinalOutputDir Name="Item0">..\..\lib\</HistoryLists_hlFinalOutputDir>
|
||||
<HistoryLists_hlFinalOutputDir Name="Item1">..\..\lib</HistoryLists_hlFinalOutputDir>
|
||||
</HistoryLists_hlFinalOutputDir>
|
||||
<HistoryLists_hlTlibPageSize>
|
||||
<HistoryLists_hlTlibPageSize Name="Count">2</HistoryLists_hlTlibPageSize>
|
||||
<HistoryLists_hlTlibPageSize Name="Item0">0x0080</HistoryLists_hlTlibPageSize>
|
||||
<HistoryLists_hlTlibPageSize Name="Item1">0x0010</HistoryLists_hlTlibPageSize>
|
||||
</HistoryLists_hlTlibPageSize>
|
||||
<Debugging>
|
||||
<Debugging Name="DebugSourceDirs">$(BCB)\source\vcl</Debugging>
|
||||
</Debugging>
|
||||
<Parameters>
|
||||
<Parameters Name="RunParams"/>
|
||||
<Parameters Name="Launcher"/>
|
||||
<Parameters Name="UseLauncher">False</Parameters>
|
||||
<Parameters Name="DebugCWD"/>
|
||||
<Parameters Name="HostApplication"/>
|
||||
<Parameters Name="RemoteHost"/>
|
||||
<Parameters Name="RemotePath"/>
|
||||
<Parameters Name="RemoteLauncher"/>
|
||||
<Parameters Name="RemoteCWD"/>
|
||||
<Parameters Name="RemoteDebug">False</Parameters>
|
||||
<Parameters Name="RemoteParams"/>
|
||||
<Parameters Name="UseRemoteLauncher">False</Parameters>
|
||||
<Parameters Name="Debug Symbols Search Path"/>
|
||||
<Parameters Name="LoadAllSymbols">True</Parameters>
|
||||
<Parameters Name="LoadUnspecifiedSymbols">False</Parameters>
|
||||
</Parameters>
|
||||
<Compiler>
|
||||
<Compiler Name="ShowInfoMsgs">0</Compiler>
|
||||
<Compiler Name="LinkDebugVcl">0</Compiler>
|
||||
<Compiler Name="LinkCGLIB">0</Compiler>
|
||||
</Compiler>
|
||||
<CORBA>
|
||||
<CORBA Name="AddServerUnit">1</CORBA>
|
||||
<CORBA Name="AddClientUnit">1</CORBA>
|
||||
<CORBA Name="PrecompiledHeaders">1</CORBA>
|
||||
</CORBA>
|
||||
<ProjectProperties>
|
||||
<ProjectProperties Name="AutoShowDeps">False</ProjectProperties>
|
||||
<ProjectProperties Name="ManagePaths">True</ProjectProperties>
|
||||
<ProjectProperties Name="VerifyPackages">True</ProjectProperties>
|
||||
</ProjectProperties>
|
||||
<VFOLDERS>
|
||||
<VFOLDER ID="{C50B9BFE-31E0-4D07-8DDA-47161A72C227}" name="Add-Ons">
|
||||
<VFOLDER ID="{B2262C45-6009-4277-AE08-EBE6C6317496}" name="Source"/>
|
||||
<VFOLDER ID="{B30C65C6-20F8-4D1C-B7F6-1708CE02A1B9}" name="Headers"/>
|
||||
</VFOLDER>
|
||||
<VFOLDER ID="{416B8851-CF85-4CBF-9906-D36FBF6565AC}" name="Script Engine">
|
||||
<VFOLDER ID="{C4677389-340C-45A6-AC4C-F440F64B74A8}" name="Headers"/>
|
||||
<VFOLDER ID="{1D68C792-68AA-47C5-9F9E-C72C393D9819}" name="Source"/>
|
||||
</VFOLDER>
|
||||
</VFOLDERS>
|
||||
</CPlusPlusBuilder.Personality>
|
||||
</BorlandProject>
|
||||
<ProjectFileVersion>12</ProjectFileVersion>
|
||||
</ProjectExtensions>
|
||||
</Project>
|
@ -0,0 +1,454 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<BorlandProject>
|
||||
<PersonalityInfo>
|
||||
<Option>
|
||||
<Option Name="Personality">CPlusPlusBuilder.Personality</Option>
|
||||
<Option Name="ProjectType">CppStaticLibrary</Option>
|
||||
<Option Name="Version">1.0</Option>
|
||||
<Option Name="GUID">{8966BD6E-C137-42DF-9299-B2D0BDDD4DAC}</Option>
|
||||
</Option>
|
||||
</PersonalityInfo>
|
||||
<CPlusPlusBuilder.Personality>
|
||||
<BCBPROJECT>
|
||||
<project version="10.0">
|
||||
<property category="build.config" name="active" value="0"/>
|
||||
<property category="build.config" name="count" value="1"/>
|
||||
<property category="build.config" name="excludedefaultforzero" value="0"/>
|
||||
<property category="build.config.0" name="builddir" value="Debug"/>
|
||||
<property category="build.config.0" name="key" value="Debug_Build"/>
|
||||
<property category="build.config.0" name="name" value="Debug-Build"/>
|
||||
<property category="build.config.0" name="settings.win32b" value="default"/>
|
||||
<property category="build.config.0" name="type" value="Toolset"/>
|
||||
<property category="build.config.0" name="win32.win32b.builddir" value="Debug_Build"/>
|
||||
<property category="build.config.1" name="key" value="Release_Build"/>
|
||||
<property category="build.config.1" name="name" value="Release-Build"/>
|
||||
<property category="build.config.1" name="settings.win32b" value="default"/>
|
||||
<property category="build.config.1" name="type" value="Toolset"/>
|
||||
<property category="build.config.1" name="win32.win32b.builddir" value="Release_Build"/>
|
||||
<property category="build.node" name="name" value="AngelScriptBCC_Static_CB2006.lib"/>
|
||||
<property category="build.node" name="use_packages" value="0"/>
|
||||
<property category="build.platform" name="active" value="win32"/>
|
||||
<property category="build.platform" name="win32.Debug_Build.toolset" value="win32b"/>
|
||||
<property category="build.platform" name="win32.Release_Build.toolset" value="win32b"/>
|
||||
<property category="build.platform" name="win32.default" value="win32b"/>
|
||||
<property category="build.platform" name="win32.enabled" value="1"/>
|
||||
<property category="build.platform" name="win32.win32b.enabled" value="1"/>
|
||||
<property category="win32.*.win32b.dcc32" name="param.filenames.merge" value="1"/>
|
||||
<property category="win32.*.win32b.tasm32" name="param.listfile.merge" value="1"/>
|
||||
<property category="win32.*.win32b.tasm32" name="param.objfile.merge" value="1"/>
|
||||
<property category="win32.*.win32b.tasm32" name="param.xreffile.merge" value="1"/>
|
||||
<property category="win32.Debug_Build.win32b.bcc32" name="option.D.arg.1" value="_DEBUG"/>
|
||||
<property category="win32.Debug_Build.win32b.bcc32" name="option.D.arg.merge" value="1"/>
|
||||
<property category="win32.Debug_Build.win32b.bcc32" name="option.D.enabled" value="1"/>
|
||||
<property category="win32.Debug_Build.win32b.bcc32" name="option.Od.enabled" value="1"/>
|
||||
<property category="win32.Debug_Build.win32b.bcc32" name="option.k.enabled" value="1"/>
|
||||
<property category="win32.Debug_Build.win32b.bcc32" name="option.n.arg.1" value="..\..\intermediate\Debug"/>
|
||||
<property category="win32.Debug_Build.win32b.bcc32" name="option.n.arg.merge" value="0"/>
|
||||
<property category="win32.Debug_Build.win32b.bcc32" name="option.n.enabled" value="1"/>
|
||||
<property category="win32.Debug_Build.win32b.bcc32" name="option.r.enabled" value="0"/>
|
||||
<property category="win32.Debug_Build.win32b.bcc32" name="option.v.enabled" value="1"/>
|
||||
<property category="win32.Debug_Build.win32b.bcc32" name="option.vi.enabled" value="0"/>
|
||||
<property category="win32.Debug_Build.win32b.bcc32" name="option.y.enabled" value="1"/>
|
||||
<property category="win32.Debug_Build.win32b.dcc32" name="option.$D.enabled" value="1"/>
|
||||
<property category="win32.Debug_Build.win32b.dcc32" name="option.$O.enabled" value="0"/>
|
||||
<property category="win32.Debug_Build.win32b.dcc32" name="option.D.arg.1" value="DEBUG"/>
|
||||
<property category="win32.Debug_Build.win32b.dcc32" name="option.D.arg.merge" value="1"/>
|
||||
<property category="win32.Debug_Build.win32b.dcc32" name="option.D.enabled" value="1"/>
|
||||
<property category="win32.Debug_Build.win32b.dcc32" name="option.V.enabled" value="1"/>
|
||||
<property category="win32.Debug_Build.win32b.ilink32" name="option.D.enabled" value="1"/>
|
||||
<property category="win32.Debug_Build.win32b.ilink32" name="option.Gn.enabled" value="1"/>
|
||||
<property category="win32.Debug_Build.win32b.ilink32" name="option.L.arg.1" value="$(BDS)\lib\debug"/>
|
||||
<property category="win32.Debug_Build.win32b.ilink32" name="option.L.arg.merge" value="1"/>
|
||||
<property category="win32.Debug_Build.win32b.ilink32" name="option.L.enabled" value="1"/>
|
||||
<property category="win32.Debug_Build.win32b.ilink32" name="option.v.enabled" value="1"/>
|
||||
<property category="win32.Debug_Build.win32b.tasm32" name="option.z.enabled" value="1"/>
|
||||
<property category="win32.Debug_Build.win32b.tasm32" name="option.zd.enabled" value="0"/>
|
||||
<property category="win32.Debug_Build.win32b.tasm32" name="option.zi.enabled" value="1"/>
|
||||
<property category="win32.Release_Build.win32b.bcc32" name="option.D.arg.1" value="NDEBUG"/>
|
||||
<property category="win32.Release_Build.win32b.bcc32" name="option.D.arg.merge" value="1"/>
|
||||
<property category="win32.Release_Build.win32b.bcc32" name="option.D.enabled" value="1"/>
|
||||
<property category="win32.Release_Build.win32b.bcc32" name="option.n.arg.1" value="..\..\intermediate\Release"/>
|
||||
<property category="win32.Release_Build.win32b.bcc32" name="option.n.arg.merge" value="0"/>
|
||||
<property category="win32.Release_Build.win32b.bcc32" name="option.n.enabled" value="1"/>
|
||||
<property category="win32.Release_Build.win32b.bcc32" name="option.r.enabled" value="1"/>
|
||||
<property category="win32.Release_Build.win32b.dcc32" name="option.$D.enabled" value="0"/>
|
||||
<property category="win32.Release_Build.win32b.dcc32" name="option.$O.enabled" value="1"/>
|
||||
<property category="win32.Release_Build.win32b.dcc32" name="option.V.enabled" value="0"/>
|
||||
<property category="win32.Release_Build.win32b.ilink32" name="option.L.arg.1" value="$(BDS)\lib\release"/>
|
||||
<property category="win32.Release_Build.win32b.ilink32" name="option.L.arg.merge" value="1"/>
|
||||
<property category="win32.Release_Build.win32b.ilink32" name="option.L.enabled" value="1"/>
|
||||
<property category="win32.Release_Build.win32b.tasm32" name="option.z.enabled" value="0"/>
|
||||
<property category="win32.Release_Build.win32b.tasm32" name="option.zd.enabled" value="0"/>
|
||||
<property category="win32.Release_Build.win32b.tasm32" name="option.zi.enabled" value="0"/>
|
||||
<property category="win32.Release_Build.win32b.tasm32" name="option.zn.enabled" value="1"/>
|
||||
<optionset name="all_configurations">
|
||||
<property category="node" name="displayname" value="Alle Konfigurationen"/>
|
||||
<property category="win32.*.win32b.bcc32" name="container.SelectedOptimizations.containerenabled" value="0"/>
|
||||
<property category="win32.*.win32b.bcc32" name="container.SelectedWarnings.containerenabled" value="1"/>
|
||||
<property category="win32.*.win32b.bcc32" name="option.4.enabled" value="0"/>
|
||||
<property category="win32.*.win32b.bcc32" name="option.5.enabled" value="0"/>
|
||||
<property category="win32.*.win32b.bcc32" name="option.6.enabled" value="0"/>
|
||||
<property category="win32.*.win32b.bcc32" name="option.A.enabled" value="0"/>
|
||||
<property category="win32.*.win32b.bcc32" name="option.AK.enabled" value="0"/>
|
||||
<property category="win32.*.win32b.bcc32" name="option.AU.enabled" value="0"/>
|
||||
<property category="win32.*.win32b.bcc32" name="option.D.arg.1" value="WIN32"/>
|
||||
<property category="win32.*.win32b.bcc32" name="option.D.arg.2" value="AS_USE_NAMESPACE"/>
|
||||
<property category="win32.*.win32b.bcc32" name="option.D.arg.merge" value="1"/>
|
||||
<property category="win32.*.win32b.bcc32" name="option.D.enabled" value="1"/>
|
||||
<property category="win32.*.win32b.bcc32" name="option.H.enabled" value="1"/>
|
||||
<property category="win32.*.win32b.bcc32" name="option.H=.arg.1" value="..\..\intermediate\angelscript_bcb100.pch"/>
|
||||
<property category="win32.*.win32b.bcc32" name="option.H=.arg.merge" value="0"/>
|
||||
<property category="win32.*.win32b.bcc32" name="option.H=.enabled" value="1"/>
|
||||
<property category="win32.*.win32b.bcc32" name="option.Hc.enabled" value="1"/>
|
||||
<property category="win32.*.win32b.bcc32" name="option.Hh=.arg.1" value="pch1.h"/>
|
||||
<property category="win32.*.win32b.bcc32" name="option.Hh=.arg.merge" value="0"/>
|
||||
<property category="win32.*.win32b.bcc32" name="option.Hh=.enabled" value="1"/>
|
||||
<property category="win32.*.win32b.bcc32" name="option.Hi.arg.1" value="pch1.h"/>
|
||||
<property category="win32.*.win32b.bcc32" name="option.Hi.arg.merge" value="1"/>
|
||||
<property category="win32.*.win32b.bcc32" name="option.Hi.enabled" value="1"/>
|
||||
<property category="win32.*.win32b.bcc32" name="option.I.arg.1" value="..\..\include"/>
|
||||
<property category="win32.*.win32b.bcc32" name="option.I.arg.10" value="..\..\..\add_on\scriptarray"/>
|
||||
<property category="win32.*.win32b.bcc32" name="option.I.arg.11" value="..\..\..\add_on\scriptany"/>
|
||||
<property category="win32.*.win32b.bcc32" name="option.I.arg.12" value="..\..\..\add_on\contextmgr"/>
|
||||
<property category="win32.*.win32b.bcc32" name="option.I.arg.13" value="..\..\source"/>
|
||||
<property category="win32.*.win32b.bcc32" name="option.I.arg.14" value="$(BDS)\include"/>
|
||||
<property category="win32.*.win32b.bcc32" name="option.I.arg.15" value="$(BDS)\include\vcl"/>
|
||||
<property category="win32.*.win32b.bcc32" name="option.I.arg.16" value="$(BDS)\include\dinkumware"/>
|
||||
<property category="win32.*.win32b.bcc32" name="option.I.arg.2" value="..\..\..\add_on\scriptstring"/>
|
||||
<property category="win32.*.win32b.bcc32" name="option.I.arg.3" value="..\..\..\add_on\scriptstdstring"/>
|
||||
<property category="win32.*.win32b.bcc32" name="option.I.arg.4" value="..\..\..\add_on\scriptmath3d"/>
|
||||
<property category="win32.*.win32b.bcc32" name="option.I.arg.5" value="..\..\..\add_on\scriptmath"/>
|
||||
<property category="win32.*.win32b.bcc32" name="option.I.arg.6" value="..\..\..\add_on\scripthelper"/>
|
||||
<property category="win32.*.win32b.bcc32" name="option.I.arg.7" value="..\..\..\add_on\scriptfile"/>
|
||||
<property category="win32.*.win32b.bcc32" name="option.I.arg.8" value="..\..\..\add_on\scriptdictionary"/>
|
||||
<property category="win32.*.win32b.bcc32" name="option.I.arg.9" value="..\..\..\add_on\scriptbuilder"/>
|
||||
<property category="win32.*.win32b.bcc32" name="option.I.arg.merge" value="1"/>
|
||||
<property category="win32.*.win32b.bcc32" name="option.I.enabled" value="1"/>
|
||||
<property category="win32.*.win32b.bcc32" name="option.Jgi.enabled" value="0"/>
|
||||
<property category="win32.*.win32b.bcc32" name="option.Jgx.enabled" value="0"/>
|
||||
<property category="win32.*.win32b.bcc32" name="option.O1.enabled" value="0"/>
|
||||
<property category="win32.*.win32b.bcc32" name="option.O2.enabled" value="1"/>
|
||||
<property category="win32.*.win32b.bcc32" name="option.Od.enabled" value="0"/>
|
||||
<property category="win32.*.win32b.bcc32" name="option.V0.enabled" value="0"/>
|
||||
<property category="win32.*.win32b.bcc32" name="option.V1.enabled" value="0"/>
|
||||
<property category="win32.*.win32b.bcc32" name="option.Ve.enabled" value="1"/>
|
||||
<property category="win32.*.win32b.bcc32" name="option.Vmd.enabled" value="0"/>
|
||||
<property category="win32.*.win32b.bcc32" name="option.Vmm.enabled" value="0"/>
|
||||
<property category="win32.*.win32b.bcc32" name="option.Vms.enabled" value="0"/>
|
||||
<property category="win32.*.win32b.bcc32" name="option.Vx.enabled" value="1"/>
|
||||
<property category="win32.*.win32b.bcc32" name="option.X.enabled" value="0"/>
|
||||
<property category="win32.*.win32b.bcc32" name="option.align-1.enabled" value="0"/>
|
||||
<property category="win32.*.win32b.bcc32" name="option.align-2.enabled" value="0"/>
|
||||
<property category="win32.*.win32b.bcc32" name="option.align-3.enabled" value="0"/>
|
||||
<property category="win32.*.win32b.bcc32" name="option.align-5.enabled" value="0"/>
|
||||
<property category="win32.*.win32b.bcc32" name="option.b.enabled" value="0"/>
|
||||
<property category="win32.*.win32b.bcc32" name="option.disablewarns.enabled" value="0"/>
|
||||
<property category="win32.*.win32b.bcc32" name="option.k.enabled" value="0"/>
|
||||
<property category="win32.*.win32b.bcc32" name="option.n.arg.1" value="..\..\intermediate\"/>
|
||||
<property category="win32.*.win32b.bcc32" name="option.n.arg.merge" value="0"/>
|
||||
<property category="win32.*.win32b.bcc32" name="option.n.enabled" value="1"/>
|
||||
<property category="win32.*.win32b.bcc32" name="option.noregistervars.enabled" value="0"/>
|
||||
<property category="win32.*.win32b.bcc32" name="option.p.enabled" value="0"/>
|
||||
<property category="win32.*.win32b.bcc32" name="option.pm.enabled" value="0"/>
|
||||
<property category="win32.*.win32b.bcc32" name="option.pr.enabled" value="0"/>
|
||||
<property category="win32.*.win32b.bcc32" name="option.ps.enabled" value="0"/>
|
||||
<property category="win32.*.win32b.bcc32" name="option.rd.enabled" value="0"/>
|
||||
<property category="win32.*.win32b.bcc32" name="option.sysdefines.arg.1" value="_RTLDLL"/>
|
||||
<property category="win32.*.win32b.bcc32" name="option.sysdefines.arg.2" value="NO_STRICT"/>
|
||||
<property category="win32.*.win32b.bcc32" name="option.sysdefines.arg.merge" value="1"/>
|
||||
<property category="win32.*.win32b.bcc32" name="option.sysdefines.enabled" value="1"/>
|
||||
<property category="win32.*.win32b.bcc32" name="option.tW.enabled" value="1"/>
|
||||
<property category="win32.*.win32b.bcc32" name="option.tWM.enabled" value="1"/>
|
||||
<property category="win32.*.win32b.bcc32" name="option.vi.enabled" value="1"/>
|
||||
<property category="win32.*.win32b.bcc32" name="option.w.enabled" value="0"/>
|
||||
<property category="win32.*.win32b.bcc32" name="option.waus.enabled" value="0"/>
|
||||
<property category="win32.*.win32b.bcc32" name="option.wbbf.enabled" value="1"/>
|
||||
<property category="win32.*.win32b.bcc32" name="option.wccc.enabled" value="0"/>
|
||||
<property category="win32.*.win32b.bcc32" name="option.wrch.enabled" value="0"/>
|
||||
<property category="win32.*.win32b.brcc32" name="option.D.arg.merge" value="1"/>
|
||||
<property category="win32.*.win32b.brcc32" name="option.D.enabled" value="0"/>
|
||||
<property category="win32.*.win32b.brcc32" name="option.INCLUDEPATH.arg.1" value="..\..\source"/>
|
||||
<property category="win32.*.win32b.brcc32" name="option.INCLUDEPATH.arg.2" value="$(BDS)\include"/>
|
||||
<property category="win32.*.win32b.brcc32" name="option.INCLUDEPATH.arg.3" value="$(BDS)\include\vcl"/>
|
||||
<property category="win32.*.win32b.brcc32" name="option.INCLUDEPATH.arg.4" value="$(BDS)\include\dinkumware"/>
|
||||
<property category="win32.*.win32b.brcc32" name="option.INCLUDEPATH.arg.merge" value="1"/>
|
||||
<property category="win32.*.win32b.brcc32" name="option.INCLUDEPATH.enabled" value="1"/>
|
||||
<property category="win32.*.win32b.brcc32" name="option.outputdir.arg.1" value="..\..\source\"/>
|
||||
<property category="win32.*.win32b.brcc32" name="option.outputdir.arg.merge" value="1"/>
|
||||
<property category="win32.*.win32b.brcc32" name="option.outputdir.enabled" value="1"/>
|
||||
<property category="win32.*.win32b.dcc32" name="option.$.arg.1" value="Y-"/>
|
||||
<property category="win32.*.win32b.dcc32" name="option.$.arg.merge" value="1"/>
|
||||
<property category="win32.*.win32b.dcc32" name="option.$.enabled" value="1"/>
|
||||
<property category="win32.*.win32b.dcc32" name="option.$D.enabled" value="0"/>
|
||||
<property category="win32.*.win32b.dcc32" name="option.$L.enabled" value="0"/>
|
||||
<property category="win32.*.win32b.dcc32" name="option.I.arg.1" value="..\..\..\add_on\scriptstring"/>
|
||||
<property category="win32.*.win32b.dcc32" name="option.I.arg.10" value="..\..\..\add_on\scriptany"/>
|
||||
<property category="win32.*.win32b.dcc32" name="option.I.arg.11" value="..\..\..\add_on\contextmgr"/>
|
||||
<property category="win32.*.win32b.dcc32" name="option.I.arg.12" value="..\..\source"/>
|
||||
<property category="win32.*.win32b.dcc32" name="option.I.arg.2" value="..\..\..\add_on\scriptstdstring"/>
|
||||
<property category="win32.*.win32b.dcc32" name="option.I.arg.3" value="..\..\..\add_on\scriptmath3d"/>
|
||||
<property category="win32.*.win32b.dcc32" name="option.I.arg.4" value="..\..\..\add_on\scriptmath"/>
|
||||
<property category="win32.*.win32b.dcc32" name="option.I.arg.5" value="..\..\..\add_on\scripthelper"/>
|
||||
<property category="win32.*.win32b.dcc32" name="option.I.arg.6" value="..\..\..\add_on\scriptfile"/>
|
||||
<property category="win32.*.win32b.dcc32" name="option.I.arg.7" value="..\..\..\add_on\scriptdictionary"/>
|
||||
<property category="win32.*.win32b.dcc32" name="option.I.arg.8" value="..\..\..\add_on\scriptbuilder"/>
|
||||
<property category="win32.*.win32b.dcc32" name="option.I.arg.9" value="..\..\..\add_on\scriptarray"/>
|
||||
<property category="win32.*.win32b.dcc32" name="option.I.arg.merge" value="1"/>
|
||||
<property category="win32.*.win32b.dcc32" name="option.I.enabled" value="0"/>
|
||||
<property category="win32.*.win32b.dcc32" name="option.M.enabled" value="1"/>
|
||||
<property category="win32.*.win32b.dcc32" name="option.N0.arg.1" value="..\..\source\"/>
|
||||
<property category="win32.*.win32b.dcc32" name="option.N0.arg.merge" value="1"/>
|
||||
<property category="win32.*.win32b.dcc32" name="option.N0.enabled" value="1"/>
|
||||
<property category="win32.*.win32b.dcc32" name="option.NO.arg.1" value="..\..\source\"/>
|
||||
<property category="win32.*.win32b.dcc32" name="option.NO.arg.merge" value="1"/>
|
||||
<property category="win32.*.win32b.dcc32" name="option.NO.enabled" value="1"/>
|
||||
<property category="win32.*.win32b.dcc32" name="option.O.arg.1" value="..\..\..\add_on\scriptstring"/>
|
||||
<property category="win32.*.win32b.dcc32" name="option.O.arg.10" value="..\..\..\add_on\scriptany"/>
|
||||
<property category="win32.*.win32b.dcc32" name="option.O.arg.11" value="..\..\..\add_on\contextmgr"/>
|
||||
<property category="win32.*.win32b.dcc32" name="option.O.arg.12" value="..\..\source"/>
|
||||
<property category="win32.*.win32b.dcc32" name="option.O.arg.2" value="..\..\..\add_on\scriptstdstring"/>
|
||||
<property category="win32.*.win32b.dcc32" name="option.O.arg.3" value="..\..\..\add_on\scriptmath3d"/>
|
||||
<property category="win32.*.win32b.dcc32" name="option.O.arg.4" value="..\..\..\add_on\scriptmath"/>
|
||||
<property category="win32.*.win32b.dcc32" name="option.O.arg.5" value="..\..\..\add_on\scripthelper"/>
|
||||
<property category="win32.*.win32b.dcc32" name="option.O.arg.6" value="..\..\..\add_on\scriptfile"/>
|
||||
<property category="win32.*.win32b.dcc32" name="option.O.arg.7" value="..\..\..\add_on\scriptdictionary"/>
|
||||
<property category="win32.*.win32b.dcc32" name="option.O.arg.8" value="..\..\..\add_on\scriptbuilder"/>
|
||||
<property category="win32.*.win32b.dcc32" name="option.O.arg.9" value="..\..\..\add_on\scriptarray"/>
|
||||
<property category="win32.*.win32b.dcc32" name="option.O.arg.merge" value="1"/>
|
||||
<property category="win32.*.win32b.dcc32" name="option.O.enabled" value="0"/>
|
||||
<property category="win32.*.win32b.dcc32" name="option.R.arg.1" value="..\..\..\add_on\scriptstring"/>
|
||||
<property category="win32.*.win32b.dcc32" name="option.R.arg.10" value="..\..\..\add_on\scriptany"/>
|
||||
<property category="win32.*.win32b.dcc32" name="option.R.arg.11" value="..\..\..\add_on\contextmgr"/>
|
||||
<property category="win32.*.win32b.dcc32" name="option.R.arg.12" value="..\..\source"/>
|
||||
<property category="win32.*.win32b.dcc32" name="option.R.arg.2" value="..\..\..\add_on\scriptstdstring"/>
|
||||
<property category="win32.*.win32b.dcc32" name="option.R.arg.3" value="..\..\..\add_on\scriptmath3d"/>
|
||||
<property category="win32.*.win32b.dcc32" name="option.R.arg.4" value="..\..\..\add_on\scriptmath"/>
|
||||
<property category="win32.*.win32b.dcc32" name="option.R.arg.5" value="..\..\..\add_on\scripthelper"/>
|
||||
<property category="win32.*.win32b.dcc32" name="option.R.arg.6" value="..\..\..\add_on\scriptfile"/>
|
||||
<property category="win32.*.win32b.dcc32" name="option.R.arg.7" value="..\..\..\add_on\scriptdictionary"/>
|
||||
<property category="win32.*.win32b.dcc32" name="option.R.arg.8" value="..\..\..\add_on\scriptbuilder"/>
|
||||
<property category="win32.*.win32b.dcc32" name="option.R.arg.9" value="..\..\..\add_on\scriptarray"/>
|
||||
<property category="win32.*.win32b.dcc32" name="option.R.arg.merge" value="1"/>
|
||||
<property category="win32.*.win32b.dcc32" name="option.R.enabled" value="0"/>
|
||||
<property category="win32.*.win32b.dcc32" name="option.U.arg.1" value="..\..\..\add_on\scriptstring"/>
|
||||
<property category="win32.*.win32b.dcc32" name="option.U.arg.10" value="..\..\..\add_on\scriptany"/>
|
||||
<property category="win32.*.win32b.dcc32" name="option.U.arg.11" value="..\..\..\add_on\contextmgr"/>
|
||||
<property category="win32.*.win32b.dcc32" name="option.U.arg.12" value="..\..\source"/>
|
||||
<property category="win32.*.win32b.dcc32" name="option.U.arg.13" value=".\"/>
|
||||
<property category="win32.*.win32b.dcc32" name="option.U.arg.14" value="$(BDS)\lib"/>
|
||||
<property category="win32.*.win32b.dcc32" name="option.U.arg.15" value="$(BDS)\lib\obj"/>
|
||||
<property category="win32.*.win32b.dcc32" name="option.U.arg.2" value="..\..\..\add_on\scriptstdstring"/>
|
||||
<property category="win32.*.win32b.dcc32" name="option.U.arg.3" value="..\..\..\add_on\scriptmath3d"/>
|
||||
<property category="win32.*.win32b.dcc32" name="option.U.arg.4" value="..\..\..\add_on\scriptmath"/>
|
||||
<property category="win32.*.win32b.dcc32" name="option.U.arg.5" value="..\..\..\add_on\scripthelper"/>
|
||||
<property category="win32.*.win32b.dcc32" name="option.U.arg.6" value="..\..\..\add_on\scriptfile"/>
|
||||
<property category="win32.*.win32b.dcc32" name="option.U.arg.7" value="..\..\..\add_on\scriptdictionary"/>
|
||||
<property category="win32.*.win32b.dcc32" name="option.U.arg.8" value="..\..\..\add_on\scriptbuilder"/>
|
||||
<property category="win32.*.win32b.dcc32" name="option.U.arg.9" value="..\..\..\add_on\scriptarray"/>
|
||||
<property category="win32.*.win32b.dcc32" name="option.U.arg.merge" value="1"/>
|
||||
<property category="win32.*.win32b.dcc32" name="option.U.enabled" value="1"/>
|
||||
<property category="win32.*.win32b.dcc32" name="param.filenames.merge" value="1"/>
|
||||
<property category="win32.*.win32b.idl2cpp" name="option.I.arg.1" value="..\..\..\add_on\scriptstring"/>
|
||||
<property category="win32.*.win32b.idl2cpp" name="option.I.arg.10" value="..\..\..\add_on\scriptany"/>
|
||||
<property category="win32.*.win32b.idl2cpp" name="option.I.arg.11" value="..\..\..\add_on\contextmgr"/>
|
||||
<property category="win32.*.win32b.idl2cpp" name="option.I.arg.12" value="..\..\source"/>
|
||||
<property category="win32.*.win32b.idl2cpp" name="option.I.arg.13" value="$(BDS)\include"/>
|
||||
<property category="win32.*.win32b.idl2cpp" name="option.I.arg.14" value="$(BDS)\include\vcl"/>
|
||||
<property category="win32.*.win32b.idl2cpp" name="option.I.arg.2" value="..\..\..\add_on\scriptstdstring"/>
|
||||
<property category="win32.*.win32b.idl2cpp" name="option.I.arg.3" value="..\..\..\add_on\scriptmath3d"/>
|
||||
<property category="win32.*.win32b.idl2cpp" name="option.I.arg.4" value="..\..\..\add_on\scriptmath"/>
|
||||
<property category="win32.*.win32b.idl2cpp" name="option.I.arg.5" value="..\..\..\add_on\scripthelper"/>
|
||||
<property category="win32.*.win32b.idl2cpp" name="option.I.arg.6" value="..\..\..\add_on\scriptfile"/>
|
||||
<property category="win32.*.win32b.idl2cpp" name="option.I.arg.7" value="..\..\..\add_on\scriptdictionary"/>
|
||||
<property category="win32.*.win32b.idl2cpp" name="option.I.arg.8" value="..\..\..\add_on\scriptbuilder"/>
|
||||
<property category="win32.*.win32b.idl2cpp" name="option.I.arg.9" value="..\..\..\add_on\scriptarray"/>
|
||||
<property category="win32.*.win32b.idl2cpp" name="option.I.arg.merge" value="1"/>
|
||||
<property category="win32.*.win32b.idl2cpp" name="option.I.enabled" value="1"/>
|
||||
<property category="win32.*.win32b.idl2cpp" name="option.boa.enabled" value="1"/>
|
||||
<property category="win32.*.win32b.idl2cpp" name="option.srcsuffix.arg" value="cpp"/>
|
||||
<property category="win32.*.win32b.idl2cpp" name="option.srcsuffix.arg.merge" value="1"/>
|
||||
<property category="win32.*.win32b.idl2cpp" name="option.srcsuffix.enabled" value="1"/>
|
||||
<property category="win32.*.win32b.ilink32" name="option.L.arg.1" value="$(BDS)\lib"/>
|
||||
<property category="win32.*.win32b.ilink32" name="option.L.arg.2" value="$(BDS)\lib\obj"/>
|
||||
<property category="win32.*.win32b.ilink32" name="option.L.arg.3" value="$(BDS)\lib\psdk"/>
|
||||
<property category="win32.*.win32b.ilink32" name="option.L.arg.merge" value="1"/>
|
||||
<property category="win32.*.win32b.ilink32" name="option.L.enabled" value="1"/>
|
||||
<property category="win32.*.win32b.ilink32" name="option.dynamicrtl.enabled" value="1"/>
|
||||
<property category="win32.*.win32b.tasm32" name="option.i.arg.1" value="..\..\source"/>
|
||||
<property category="win32.*.win32b.tasm32" name="option.i.arg.2" value="$(BDS)\include"/>
|
||||
<property category="win32.*.win32b.tasm32" name="option.i.arg.3" value="$(BDS)\include\vcl"/>
|
||||
<property category="win32.*.win32b.tasm32" name="option.i.arg.4" value="$(BDS)\include\dinkumware"/>
|
||||
<property category="win32.*.win32b.tasm32" name="option.i.arg.merge" value="1"/>
|
||||
<property category="win32.*.win32b.tasm32" name="option.i.enabled" value="1"/>
|
||||
<property category="win32.*.win32b.tasm32" name="option.outputdir.arg.1" value="..\..\source\"/>
|
||||
<property category="win32.*.win32b.tasm32" name="option.outputdir.arg.merge" value="1"/>
|
||||
<property category="win32.*.win32b.tasm32" name="option.outputdir.enabled" value="1"/>
|
||||
<property category="win32.*.win32b.tasm32" name="option.w2.enabled" value="1"/>
|
||||
<property category="win32.*.win32b.tasm32" name="option.zn.enabled" value="1"/>
|
||||
<property category="win32.*.win32b.tasm32" name="param.listfile.merge" value="1"/>
|
||||
<property category="win32.*.win32b.tasm32" name="param.objfile.merge" value="1"/>
|
||||
<property category="win32.*.win32b.tasm32" name="param.xreffile.merge" value="1"/>
|
||||
<property category="win32.*.win32b.tlib" name="option.P.arg" value="256"/>
|
||||
<property category="win32.*.win32b.tlib" name="option.P.arg.merge" value="1"/>
|
||||
<property category="win32.*.win32b.tlib" name="option.P.enabled" value="1"/>
|
||||
<property category="win32.*.win32b.tlib" name="option.outputdir.arg.1" value="..\..\lib\"/>
|
||||
<property category="win32.*.win32b.tlib" name="option.outputdir.arg.merge" value="1"/>
|
||||
<property category="win32.*.win32b.tlib" name="option.outputdir.enabled" value="1"/>
|
||||
</optionset>
|
||||
</project>
|
||||
<FILELIST>
|
||||
<FILE FILENAME="AngelScriptBCC_Static_CB2006.bpf" CONTAINERID="BPF" LOCALCOMMAND="" UNITNAME="AngelScriptBCC_Static_CB2006" FORMNAME="" DESIGNCLASS=""/>
|
||||
<FILE FILENAME="..\..\source\as_atomic.cpp" CONTAINERID="CCompiler" LOCALCOMMAND="" UNITNAME="as_atomic.cpp" FORMNAME="" DESIGNCLASS=""/>
|
||||
<FILE FILENAME="..\..\source\as_builder.cpp" CONTAINERID="CCompiler" LOCALCOMMAND="" UNITNAME="as_builder.cpp" FORMNAME="" DESIGNCLASS=""/>
|
||||
<FILE FILENAME="..\..\source\as_bytecode.cpp" CONTAINERID="CCompiler" LOCALCOMMAND="" UNITNAME="as_bytecode.cpp" FORMNAME="" DESIGNCLASS=""/>
|
||||
<FILE FILENAME="..\..\source\as_callfunc.cpp" CONTAINERID="CCompiler" LOCALCOMMAND="" UNITNAME="as_callfunc.cpp" FORMNAME="" DESIGNCLASS=""/>
|
||||
<FILE FILENAME="..\..\source\as_callfunc_arm.cpp" CONTAINERID="CCompiler" LOCALCOMMAND="" UNITNAME="as_callfunc_arm.cpp" FORMNAME="" DESIGNCLASS=""/>
|
||||
<FILE FILENAME="..\..\source\as_callfunc_mips.cpp" CONTAINERID="CCompiler" LOCALCOMMAND="" UNITNAME="as_callfunc_mips.cpp" FORMNAME="" DESIGNCLASS=""/>
|
||||
<FILE FILENAME="..\..\source\as_callfunc_ppc.cpp" CONTAINERID="CCompiler" LOCALCOMMAND="" UNITNAME="as_callfunc_ppc.cpp" FORMNAME="" DESIGNCLASS=""/>
|
||||
<FILE FILENAME="..\..\source\as_callfunc_ppc_64.cpp" CONTAINERID="CCompiler" LOCALCOMMAND="" UNITNAME="as_callfunc_ppc_64.cpp" FORMNAME="" DESIGNCLASS=""/>
|
||||
<FILE FILENAME="..\..\source\as_callfunc_sh4.cpp" CONTAINERID="CCompiler" LOCALCOMMAND="" UNITNAME="as_callfunc_sh4.cpp" FORMNAME="" DESIGNCLASS=""/>
|
||||
<FILE FILENAME="..\..\source\as_callfunc_x64_gcc.cpp" CONTAINERID="CCompiler" LOCALCOMMAND="" UNITNAME="as_callfunc_x64_gcc.cpp" FORMNAME="" DESIGNCLASS=""/>
|
||||
<FILE FILENAME="..\..\source\as_callfunc_x64_msvc.cpp" CONTAINERID="CCompiler" LOCALCOMMAND="" UNITNAME="as_callfunc_x64_msvc.cpp" FORMNAME="" DESIGNCLASS=""/>
|
||||
<FILE FILENAME="..\..\source\as_callfunc_x86.cpp" CONTAINERID="CCompiler" LOCALCOMMAND="" UNITNAME="as_callfunc_x86.cpp" FORMNAME="" DESIGNCLASS=""/>
|
||||
<FILE FILENAME="..\..\source\as_callfunc_xenon.cpp" CONTAINERID="CCompiler" LOCALCOMMAND="" UNITNAME="as_callfunc_xenon.cpp" FORMNAME="" DESIGNCLASS=""/>
|
||||
<FILE FILENAME="..\..\source\as_compiler.cpp" CONTAINERID="CCompiler" LOCALCOMMAND="" UNITNAME="as_compiler.cpp" FORMNAME="" DESIGNCLASS=""/>
|
||||
<FILE FILENAME="..\..\source\as_configgroup.cpp" CONTAINERID="CCompiler" LOCALCOMMAND="" UNITNAME="as_configgroup.cpp" FORMNAME="" DESIGNCLASS=""/>
|
||||
<FILE FILENAME="..\..\source\as_context.cpp" CONTAINERID="CCompiler" LOCALCOMMAND="" UNITNAME="as_context.cpp" FORMNAME="" DESIGNCLASS=""/>
|
||||
<FILE FILENAME="..\..\source\as_datatype.cpp" CONTAINERID="CCompiler" LOCALCOMMAND="" UNITNAME="as_datatype.cpp" FORMNAME="" DESIGNCLASS=""/>
|
||||
<FILE FILENAME="..\..\source\as_gc.cpp" CONTAINERID="CCompiler" LOCALCOMMAND="" UNITNAME="as_gc.cpp" FORMNAME="" DESIGNCLASS=""/>
|
||||
<FILE FILENAME="..\..\source\as_generic.cpp" CONTAINERID="CCompiler" LOCALCOMMAND="" UNITNAME="as_generic.cpp" FORMNAME="" DESIGNCLASS=""/>
|
||||
<FILE FILENAME="..\..\source\as_globalproperty.cpp" CONTAINERID="CCompiler" LOCALCOMMAND="" UNITNAME="as_globalproperty.cpp" FORMNAME="" DESIGNCLASS=""/>
|
||||
<FILE FILENAME="..\..\source\as_memory.cpp" CONTAINERID="CCompiler" LOCALCOMMAND="" UNITNAME="as_memory.cpp" FORMNAME="" DESIGNCLASS=""/>
|
||||
<FILE FILENAME="..\..\source\as_module.cpp" CONTAINERID="CCompiler" LOCALCOMMAND="" UNITNAME="as_module.cpp" FORMNAME="" DESIGNCLASS=""/>
|
||||
<FILE FILENAME="..\..\source\as_objecttype.cpp" CONTAINERID="CCompiler" LOCALCOMMAND="" UNITNAME="as_objecttype.cpp" FORMNAME="" DESIGNCLASS=""/>
|
||||
<FILE FILENAME="..\..\source\as_outputbuffer.cpp" CONTAINERID="CCompiler" LOCALCOMMAND="" UNITNAME="as_outputbuffer.cpp" FORMNAME="" DESIGNCLASS=""/>
|
||||
<FILE FILENAME="..\..\source\as_parser.cpp" CONTAINERID="CCompiler" LOCALCOMMAND="" UNITNAME="as_parser.cpp" FORMNAME="" DESIGNCLASS=""/>
|
||||
<FILE FILENAME="..\..\source\as_restore.cpp" CONTAINERID="CCompiler" LOCALCOMMAND="" UNITNAME="as_restore.cpp" FORMNAME="" DESIGNCLASS=""/>
|
||||
<FILE FILENAME="..\..\source\as_scriptcode.cpp" CONTAINERID="CCompiler" LOCALCOMMAND="" UNITNAME="as_scriptcode.cpp" FORMNAME="" DESIGNCLASS=""/>
|
||||
<FILE FILENAME="..\..\source\as_scriptengine.cpp" CONTAINERID="CCompiler" LOCALCOMMAND="" UNITNAME="as_scriptengine.cpp" FORMNAME="" DESIGNCLASS=""/>
|
||||
<FILE FILENAME="..\..\source\as_scriptfunction.cpp" CONTAINERID="CCompiler" LOCALCOMMAND="" UNITNAME="as_scriptfunction.cpp" FORMNAME="" DESIGNCLASS=""/>
|
||||
<FILE FILENAME="..\..\source\as_scriptnode.cpp" CONTAINERID="CCompiler" LOCALCOMMAND="" UNITNAME="as_scriptnode.cpp" FORMNAME="" DESIGNCLASS=""/>
|
||||
<FILE FILENAME="..\..\source\as_scriptobject.cpp" CONTAINERID="CCompiler" LOCALCOMMAND="" UNITNAME="as_scriptobject.cpp" FORMNAME="" DESIGNCLASS=""/>
|
||||
<FILE FILENAME="..\..\source\as_string.cpp" CONTAINERID="CCompiler" LOCALCOMMAND="" UNITNAME="as_string.cpp" FORMNAME="" DESIGNCLASS=""/>
|
||||
<FILE FILENAME="..\..\source\as_string_util.cpp" CONTAINERID="CCompiler" LOCALCOMMAND="" UNITNAME="as_string_util.cpp" FORMNAME="" DESIGNCLASS=""/>
|
||||
<FILE FILENAME="..\..\source\as_thread.cpp" CONTAINERID="CCompiler" LOCALCOMMAND="" UNITNAME="as_thread.cpp" FORMNAME="" DESIGNCLASS=""/>
|
||||
<FILE FILENAME="..\..\source\as_tokenizer.cpp" CONTAINERID="CCompiler" LOCALCOMMAND="" UNITNAME="as_tokenizer.cpp" FORMNAME="" DESIGNCLASS=""/>
|
||||
<FILE FILENAME="..\..\source\as_typeinfo.cpp" CONTAINERID="CCompiler" LOCALCOMMAND="" UNITNAME="as_typeinfo.cpp" FORMNAME="" DESIGNCLASS=""/>
|
||||
<FILE FILENAME="..\..\source\as_variablescope.cpp" CONTAINERID="CCompiler" LOCALCOMMAND="" UNITNAME="as_variablescope.cpp" FORMNAME="" DESIGNCLASS=""/>
|
||||
<FILE FILENAME="pch1.h" CONTAINERID="" LOCALCOMMAND="" UNITNAME="" FORMNAME="" DESIGNCLASS=""/>
|
||||
<FILE FILENAME="..\..\..\add_on\contextmgr\contextmgr.cpp" CONTAINERID="CCompiler" LOCALCOMMAND="" UNITNAME="contextmgr" FORMNAME="" DESIGNCLASS=""/>
|
||||
<FILE FILENAME="..\..\..\add_on\contextmgr\contextmgr.h" CONTAINERID="" LOCALCOMMAND=""/>
|
||||
<FILE FILENAME="..\..\..\add_on\scriptany\scriptany.h" CONTAINERID="" LOCALCOMMAND=""/>
|
||||
<FILE FILENAME="..\..\..\add_on\scriptany\scriptany.cpp" CONTAINERID="CCompiler" LOCALCOMMAND="" UNITNAME="scriptany" FORMNAME="" DESIGNCLASS=""/>
|
||||
<FILE FILENAME="..\..\..\add_on\scriptarray\scriptarray.h" CONTAINERID="" LOCALCOMMAND=""/>
|
||||
<FILE FILENAME="..\..\..\add_on\scriptarray\scriptarray.cpp" CONTAINERID="CCompiler" LOCALCOMMAND="" UNITNAME="scriptarray" FORMNAME="" DESIGNCLASS=""/>
|
||||
<FILE FILENAME="..\..\..\add_on\scriptbuilder\scriptbuilder.h" CONTAINERID="" LOCALCOMMAND=""/>
|
||||
<FILE FILENAME="..\..\..\add_on\scriptbuilder\scriptbuilder.cpp" CONTAINERID="CCompiler" LOCALCOMMAND="" UNITNAME="scriptbuilder" FORMNAME="" DESIGNCLASS=""/>
|
||||
<FILE FILENAME="..\..\..\add_on\scriptdictionary\scriptdictionary.h" CONTAINERID="" LOCALCOMMAND=""/>
|
||||
<FILE FILENAME="..\..\..\add_on\scriptdictionary\scriptdictionary.cpp" CONTAINERID="CCompiler" LOCALCOMMAND="" UNITNAME="scriptdictionary" FORMNAME="" DESIGNCLASS=""/>
|
||||
<FILE FILENAME="..\..\..\add_on\scriptfile\scriptfile.h" CONTAINERID="" LOCALCOMMAND=""/>
|
||||
<FILE FILENAME="..\..\..\add_on\scriptfile\scriptfile.cpp" CONTAINERID="CCompiler" LOCALCOMMAND="" UNITNAME="scriptfile" FORMNAME="" DESIGNCLASS=""/>
|
||||
<FILE FILENAME="..\..\..\add_on\scripthelper\scripthelper.h" CONTAINERID="" LOCALCOMMAND=""/>
|
||||
<FILE FILENAME="..\..\..\add_on\scripthelper\scripthelper.cpp" CONTAINERID="CCompiler" LOCALCOMMAND="" UNITNAME="scripthelper" FORMNAME="" DESIGNCLASS=""/>
|
||||
<FILE FILENAME="..\..\..\add_on\scriptmath\scriptmath.h" CONTAINERID="" LOCALCOMMAND=""/>
|
||||
<FILE FILENAME="..\..\..\add_on\scriptmath\scriptmath.cpp" CONTAINERID="CCompiler" LOCALCOMMAND="" UNITNAME="scriptmath" FORMNAME="" DESIGNCLASS=""/>
|
||||
<FILE FILENAME="..\..\..\add_on\scriptmath3d\scriptmath3d.h" CONTAINERID="" LOCALCOMMAND=""/>
|
||||
<FILE FILENAME="..\..\..\add_on\scriptmath3d\scriptmath3d.cpp" CONTAINERID="CCompiler" LOCALCOMMAND="" UNITNAME="scriptmath3d" FORMNAME="" DESIGNCLASS=""/>
|
||||
<FILE FILENAME="..\..\..\add_on\scriptstdstring\scriptstdstring.h" CONTAINERID="" LOCALCOMMAND=""/>
|
||||
<FILE FILENAME="..\..\..\add_on\scriptstdstring\scriptstdstring.cpp" CONTAINERID="CCompiler" LOCALCOMMAND="" UNITNAME="scriptstdstring" FORMNAME="" DESIGNCLASS=""/>
|
||||
<FILE FILENAME="..\..\..\add_on\scriptstring\scriptstring_utils.cpp" CONTAINERID="CCompiler" LOCALCOMMAND="" UNITNAME="scriptstring_utils" FORMNAME="" DESIGNCLASS=""/>
|
||||
<FILE FILENAME="..\..\..\add_on\scriptstring\scriptstring.cpp" CONTAINERID="CCompiler" LOCALCOMMAND="" UNITNAME="scriptstring" FORMNAME="" DESIGNCLASS=""/>
|
||||
<FILE FILENAME="..\..\..\add_on\scriptstring\scriptstring.h" CONTAINERID="" LOCALCOMMAND=""/>
|
||||
</FILELIST>
|
||||
<IDEOPTIONS>
|
||||
<VersionInfo>
|
||||
<VersionInfo Name="IncludeVerInfo">False</VersionInfo>
|
||||
<VersionInfo Name="AutoIncBuild">False</VersionInfo>
|
||||
<VersionInfo Name="MajorVer">1</VersionInfo>
|
||||
<VersionInfo Name="MinorVer">0</VersionInfo>
|
||||
<VersionInfo Name="Release">0</VersionInfo>
|
||||
<VersionInfo Name="Build">0</VersionInfo>
|
||||
<VersionInfo Name="Debug">False</VersionInfo>
|
||||
<VersionInfo Name="PreRelease">False</VersionInfo>
|
||||
<VersionInfo Name="Special">False</VersionInfo>
|
||||
<VersionInfo Name="Private">False</VersionInfo>
|
||||
<VersionInfo Name="DLL">False</VersionInfo>
|
||||
<VersionInfo Name="Locale">1026</VersionInfo>
|
||||
<VersionInfo Name="CodePage">1251</VersionInfo>
|
||||
</VersionInfo>
|
||||
<VersionInfoKeys>
|
||||
<VersionInfoKeys Name="CompanyName"></VersionInfoKeys>
|
||||
<VersionInfoKeys Name="FileDescription"></VersionInfoKeys>
|
||||
<VersionInfoKeys Name="FileVersion">1.0.0.0</VersionInfoKeys>
|
||||
<VersionInfoKeys Name="InternalName"></VersionInfoKeys>
|
||||
<VersionInfoKeys Name="LegalCopyright"></VersionInfoKeys>
|
||||
<VersionInfoKeys Name="LegalTrademarks"></VersionInfoKeys>
|
||||
<VersionInfoKeys Name="OriginalFilename"></VersionInfoKeys>
|
||||
<VersionInfoKeys Name="ProductName"></VersionInfoKeys>
|
||||
<VersionInfoKeys Name="ProductVersion">1.0.0.0</VersionInfoKeys>
|
||||
<VersionInfoKeys Name="Comments"></VersionInfoKeys>
|
||||
</VersionInfoKeys>
|
||||
<HistoryLists_hlIncludePath>
|
||||
<HistoryLists_hlIncludePath Name="Count">3</HistoryLists_hlIncludePath>
|
||||
<HistoryLists_hlIncludePath Name="Item0">..\..\source;$(BCB)\include;$(BCB)\include\vcl</HistoryLists_hlIncludePath>
|
||||
<HistoryLists_hlIncludePath Name="Item1">..\..\source;C:\angelscript_2.18.1\sdk\angelscript\source;$(BCB)\include;$(BCB)\include\vcl</HistoryLists_hlIncludePath>
|
||||
<HistoryLists_hlIncludePath Name="Item2">C:\angelscript_2.18.1\sdk\angelscript\source;$(BCB)\include;$(BCB)\include\vcl</HistoryLists_hlIncludePath>
|
||||
</HistoryLists_hlIncludePath>
|
||||
<HistoryLists_hlLibraryPath>
|
||||
<HistoryLists_hlLibraryPath Name="Count">3</HistoryLists_hlLibraryPath>
|
||||
<HistoryLists_hlLibraryPath Name="Item0">..\..\source;$(BCB)\lib\obj;$(BCB)\lib</HistoryLists_hlLibraryPath>
|
||||
<HistoryLists_hlLibraryPath Name="Item1">..\..\source;C:\angelscript_2.18.1\sdk\angelscript\source;$(BCB)\lib\obj;$(BCB)\lib</HistoryLists_hlLibraryPath>
|
||||
<HistoryLists_hlLibraryPath Name="Item2">C:\angelscript_2.18.1\sdk\angelscript\source;$(BCB)\lib\obj;$(BCB)\lib</HistoryLists_hlLibraryPath>
|
||||
</HistoryLists_hlLibraryPath>
|
||||
<HistoryLists_hlDebugSourcePath>
|
||||
<HistoryLists_hlDebugSourcePath Name="Count">1</HistoryLists_hlDebugSourcePath>
|
||||
<HistoryLists_hlDebugSourcePath Name="Item0">$(BCB)\source\vcl</HistoryLists_hlDebugSourcePath>
|
||||
</HistoryLists_hlDebugSourcePath>
|
||||
<HistoryLists_hlFinalOutputDir>
|
||||
<HistoryLists_hlFinalOutputDir Name="Count">2</HistoryLists_hlFinalOutputDir>
|
||||
<HistoryLists_hlFinalOutputDir Name="Item0">..\..\lib\</HistoryLists_hlFinalOutputDir>
|
||||
<HistoryLists_hlFinalOutputDir Name="Item1">..\..\lib</HistoryLists_hlFinalOutputDir>
|
||||
</HistoryLists_hlFinalOutputDir>
|
||||
<HistoryLists_hlTlibPageSize>
|
||||
<HistoryLists_hlTlibPageSize Name="Count">2</HistoryLists_hlTlibPageSize>
|
||||
<HistoryLists_hlTlibPageSize Name="Item0">0x0080</HistoryLists_hlTlibPageSize>
|
||||
<HistoryLists_hlTlibPageSize Name="Item1">0x0010</HistoryLists_hlTlibPageSize>
|
||||
</HistoryLists_hlTlibPageSize>
|
||||
<Debugging>
|
||||
<Debugging Name="DebugSourceDirs">$(BCB)\source\vcl</Debugging>
|
||||
</Debugging>
|
||||
<Parameters>
|
||||
<Parameters Name="RunParams"></Parameters>
|
||||
<Parameters Name="Launcher"></Parameters>
|
||||
<Parameters Name="UseLauncher">False</Parameters>
|
||||
<Parameters Name="DebugCWD"></Parameters>
|
||||
<Parameters Name="HostApplication"></Parameters>
|
||||
<Parameters Name="RemoteHost"></Parameters>
|
||||
<Parameters Name="RemotePath"></Parameters>
|
||||
<Parameters Name="RemoteParams"></Parameters>
|
||||
<Parameters Name="RemoteLauncher"></Parameters>
|
||||
<Parameters Name="UseRemoteLauncher">False</Parameters>
|
||||
<Parameters Name="RemoteCWD"></Parameters>
|
||||
<Parameters Name="RemoteDebug">False</Parameters>
|
||||
<Parameters Name="Debug Symbols Search Path"></Parameters>
|
||||
<Parameters Name="LoadAllSymbols">True</Parameters>
|
||||
<Parameters Name="LoadUnspecifiedSymbols">False</Parameters>
|
||||
</Parameters>
|
||||
<Language>
|
||||
<Language Name="ActiveLang"></Language>
|
||||
<Language Name="ProjectLang">$00000000</Language>
|
||||
<Language Name="RootDir"></Language>
|
||||
</Language>
|
||||
<Linker>
|
||||
<Linker Name="LibPrefix"></Linker>
|
||||
<Linker Name="LibSuffix"></Linker>
|
||||
<Linker Name="LibVersion"></Linker>
|
||||
</Linker>
|
||||
</IDEOPTIONS>
|
||||
</BCBPROJECT>
|
||||
<Source>
|
||||
<Source Name="MainSource">AngelScriptBCC_Static_CB2006.bpf</Source>
|
||||
</Source>
|
||||
<buildevents/>
|
||||
</CPlusPlusBuilder.Personality>
|
||||
</BorlandProject>
|
8
lib/angelscript/projects/BCBuilder/angelscript.bpf
Normal file
8
lib/angelscript/projects/BCBuilder/angelscript.bpf
Normal file
@ -0,0 +1,8 @@
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
#pragma hdrstop
|
||||
#define Library
|
||||
|
||||
// To add a file to the library use the Project menu 'Add to Project'.
|
||||
|
||||
|
27
lib/angelscript/projects/BCBuilder/pch1.h
Normal file
27
lib/angelscript/projects/BCBuilder/pch1.h
Normal file
@ -0,0 +1,27 @@
|
||||
/*
|
||||
Diese vorcompilierte Header-Include-Datei wurde am 12.06.2010 17:09:47 vom
|
||||
RAD Studio-Experten für vorcompilierte Header mit den folgenden Einstellungen
|
||||
erzeugt:
|
||||
|
||||
Projekt: E:\Eigene Dateien\RAD Studio\Projekte\repository\3rdparty\AngelScript\svn\angelscript\projects\BCBuilder\AngelScriptBCC_Static.cbproj
|
||||
AllowUnguarded = -1
|
||||
ExcludeProjectFiles = -1
|
||||
IncludePathsOn = -1
|
||||
IncludePaths =
|
||||
ExcludePaths =
|
||||
IncludeCount = 5
|
||||
ManageHeader = -1
|
||||
*/
|
||||
|
||||
#ifndef pch1_H
|
||||
#define pch1_H
|
||||
#include <stdio.h>
|
||||
#include <memory.h>
|
||||
#include <string.h>
|
||||
#include <new>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <assert.h>
|
||||
#include <string>
|
||||
#include <stdarg.h>
|
||||
#endif
|
33
lib/angelscript/projects/android/Android.mk
Normal file
33
lib/angelscript/projects/android/Android.mk
Normal file
@ -0,0 +1,33 @@
|
||||
commonSources:= as_callfunc_arm_gcc.S as_atomic.cpp as_builder.cpp as_bytecode.cpp as_callfunc.cpp as_callfunc_arm.cpp as_callfunc_mips.cpp as_callfunc_ppc.cpp as_callfunc_ppc_64.cpp as_callfunc_sh4.cpp as_callfunc_x86.cpp as_callfunc_x64_gcc.cpp as_compiler.cpp as_context.cpp as_configgroup.cpp as_datatype.cpp as_generic.cpp as_gc.cpp as_globalproperty.cpp as_memory.cpp as_module.cpp as_objecttype.cpp as_outputbuffer.cpp as_parser.cpp as_restore.cpp as_scriptcode.cpp as_scriptengine.cpp as_scriptfunction.cpp as_scriptnode.cpp as_scriptobject.cpp as_string.cpp as_string_util.cpp as_thread.cpp as_tokenizer.cpp as_typeinfo.cpp as_variablescope.cpp
|
||||
LOCAL_PATH:= $(call my-dir)/../../source
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
# Android API: Checks if can use pthreads. Version 9+ fully supports threads and atomic instructions
|
||||
ifeq ($(TARGET_PLATFORM),android-3)
|
||||
LOCAL_CFLAGS := -DAS_NO_THREADS
|
||||
else
|
||||
ifeq ($(TARGET_PLATFORM),android-4)
|
||||
LOCAL_CFLAGS := -DAS_NO_THREADS
|
||||
else
|
||||
ifeq ($(TARGET_PLATFORM),android-5)
|
||||
LOCAL_CFLAGS := -DAS_NO_THREADS
|
||||
else
|
||||
ifeq ($(TARGET_PLATFORM),android-6)
|
||||
LOCAL_CFLAGS := -DAS_NO_THREADS
|
||||
else
|
||||
ifeq ($(TARGET_PLATFORM),android-7)
|
||||
LOCAL_CFLAGS := -DAS_NO_THREADS
|
||||
else
|
||||
ifeq ($(TARGET_PLATFORM),android-8)
|
||||
LOCAL_CFLAGS := -DAS_NO_THREADS
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
LOCAL_SRC_FILES:= $(commonSources)
|
||||
LOCAL_MODULE:= libangelscript
|
||||
LOCAL_ARM_MODE:= arm
|
||||
include $(BUILD_STATIC_LIBRARY)
|
119
lib/angelscript/projects/cmake/CMakeLists.txt
Normal file
119
lib/angelscript/projects/cmake/CMakeLists.txt
Normal file
@ -0,0 +1,119 @@
|
||||
cmake_minimum_required(VERSION 2.6)
|
||||
set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS TRUE)
|
||||
cmake_policy(SET CMP0003 NEW)
|
||||
|
||||
project(Angelscript)
|
||||
|
||||
set(ANGELSCRIPT_SOURCE
|
||||
../../source/as_atomic.cpp
|
||||
../../source/as_builder.cpp
|
||||
../../source/as_bytecode.cpp
|
||||
../../source/as_callfunc.cpp
|
||||
../../source/as_callfunc_x86.cpp
|
||||
../../source/as_callfunc_x64_gcc.cpp
|
||||
../../source/as_callfunc_x64_msvc.cpp
|
||||
../../source/as_callfunc_x64_mingw.cpp
|
||||
../../source/as_compiler.cpp
|
||||
../../source/as_configgroup.cpp
|
||||
../../source/as_context.cpp
|
||||
../../source/as_datatype.cpp
|
||||
../../source/as_gc.cpp
|
||||
../../source/as_generic.cpp
|
||||
../../source/as_globalproperty.cpp
|
||||
../../source/as_memory.cpp
|
||||
../../source/as_module.cpp
|
||||
../../source/as_objecttype.cpp
|
||||
../../source/as_outputbuffer.cpp
|
||||
../../source/as_parser.cpp
|
||||
../../source/as_restore.cpp
|
||||
../../source/as_scriptcode.cpp
|
||||
../../source/as_scriptengine.cpp
|
||||
../../source/as_scriptfunction.cpp
|
||||
../../source/as_scriptnode.cpp
|
||||
../../source/as_scriptobject.cpp
|
||||
../../source/as_string.cpp
|
||||
../../source/as_string_util.cpp
|
||||
../../source/as_thread.cpp
|
||||
../../source/as_tokenizer.cpp
|
||||
../../source/as_typeinfo.cpp
|
||||
../../source/as_variablescope.cpp
|
||||
)
|
||||
|
||||
if(MSVC AND CMAKE_CL_64)
|
||||
enable_language(ASM_MASM)
|
||||
if(CMAKE_ASM_MASM_COMPILER_WORKS)
|
||||
set(ANGELSCRIPT_SOURCE ${ANGELSCRIPT_SOURCE} ../../source/as_callfunc_x64_msvc_asm.asm)
|
||||
else()
|
||||
message(FATAL ERROR "MSVC x86_64 target requires a working assembler")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(ANDROID)
|
||||
enable_language(ASM)
|
||||
if(CMAKE_ASM_COMPILER_WORKS)
|
||||
set(ANGELSCRIPT_SOURCE ${ANGELSCRIPT_SOURCE} ../../source/as_callfunc_arm.cpp ../../source/as_callfunc_arm_gcc.S)
|
||||
else()
|
||||
message(FATAL ERROR "Android target requires a working assembler")
|
||||
endif(CMAKE_ASM_COMPILER_WORKS)
|
||||
endif()
|
||||
|
||||
set(ANGELSCRIPT_HEADERS
|
||||
../../include/angelscript.h
|
||||
../../source/as_array.h
|
||||
../../source/as_builder.h
|
||||
../../source/as_bytecode.h
|
||||
../../source/as_callfunc.h
|
||||
../../source/as_compiler.h
|
||||
../../source/as_config.h
|
||||
../../source/as_configgroup.h
|
||||
../../source/as_context.h
|
||||
../../source/as_criticalsection.h
|
||||
../../source/as_datatype.h
|
||||
../../source/as_debug.h
|
||||
../../source/as_generic.h
|
||||
../../source/as_map.h
|
||||
../../source/as_memory.h
|
||||
../../source/as_module.h
|
||||
../../source/as_objecttype.h
|
||||
../../source/as_outputbuffer.h
|
||||
../../source/as_parser.h
|
||||
../../source/as_property.h
|
||||
../../source/as_restore.h
|
||||
../../source/as_scriptcode.h
|
||||
../../source/as_scriptengine.h
|
||||
../../source/as_scriptfunction.h
|
||||
../../source/as_scriptnode.h
|
||||
../../source/as_scriptobject.h
|
||||
../../source/as_string.h
|
||||
../../source/as_string_util.h
|
||||
../../source/as_texts.h
|
||||
../../source/as_thread.h
|
||||
../../source/as_tokendef.h
|
||||
../../source/as_tokenizer.h
|
||||
../../source/as_typeinfo.h
|
||||
../../source/as_variablescope.h
|
||||
)
|
||||
|
||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../../include)
|
||||
|
||||
add_definitions("-D_CRT_SECURE_NO_WARNINGS -DANGELSCRIPT_EXPORT -D_LIB")
|
||||
|
||||
# Fix x64 issues on Linux
|
||||
if("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "x86_64" AND NOT APPLE)
|
||||
add_definitions(-fPIC)
|
||||
endif()
|
||||
|
||||
add_library(Angelscript STATIC ${ANGELSCRIPT_SOURCE} ${ANGELSCRIPT_HEADERS})
|
||||
set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/../../lib)
|
||||
|
||||
find_package(Threads)
|
||||
target_link_libraries(Angelscript ${CMAKE_THREAD_LIBS_INIT})
|
||||
|
||||
if(MSVC)
|
||||
set_target_properties(Angelscript PROPERTIES COMPILE_FLAGS "/MP")
|
||||
endif(MSVC)
|
||||
|
||||
set(RUNTIME_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/../../bin)
|
||||
|
||||
add_subdirectory(../../../samples/game/projects/cmake/ ./game)
|
||||
|
127
lib/angelscript/projects/codeblocks/angelscript.cbp
Normal file
127
lib/angelscript/projects/codeblocks/angelscript.cbp
Normal file
@ -0,0 +1,127 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
|
||||
<CodeBlocks_project_file>
|
||||
<FileVersion major="1" minor="6" />
|
||||
<Project>
|
||||
<Option title="Static library" />
|
||||
<Option pch_mode="0" />
|
||||
<Option compiler="gcc" />
|
||||
<Build>
|
||||
<Target title="Release">
|
||||
<Option output="../../lib/libangelscript.a" prefix_auto="0" extension_auto="0" />
|
||||
<Option working_dir="" />
|
||||
<Option object_output="objs/Release" />
|
||||
<Option type="2" />
|
||||
<Option compiler="gcc" />
|
||||
<Option createDefFile="1" />
|
||||
<Option projectResourceIncludeDirsRelation="2" />
|
||||
<Compiler>
|
||||
<Add option="-O2" />
|
||||
<Add option="-Wall" />
|
||||
<Add option="-fno-strict-aliasing" />
|
||||
<Add option="-m32" />
|
||||
<Add option="-DANGELSCRIPT_EXPORT" />
|
||||
<Add option="-DNDEBUG" />
|
||||
</Compiler>
|
||||
</Target>
|
||||
<Target title="Release 64">
|
||||
<Option output="../../lib/libangelscript64.a" prefix_auto="0" extension_auto="0" />
|
||||
<Option working_dir="" />
|
||||
<Option object_output="objs/release 64" />
|
||||
<Option type="2" />
|
||||
<Option compiler="gcc" />
|
||||
<Option createDefFile="1" />
|
||||
<Option projectResourceIncludeDirsRelation="2" />
|
||||
<Compiler>
|
||||
<Add option="-O2" />
|
||||
<Add option="-Wall" />
|
||||
<Add option="-fno-strict-aliasing" />
|
||||
<Add option="-m64" />
|
||||
<Add option="-DANGELSCRIPT_EXPORT" />
|
||||
<Add option="-DNDEBUG" />
|
||||
</Compiler>
|
||||
</Target>
|
||||
</Build>
|
||||
<VirtualTargets>
|
||||
<Add alias="All" targets="Release;" />
|
||||
</VirtualTargets>
|
||||
<Unit filename="../../include/angelscript.h" />
|
||||
<Unit filename="../../source/as_array.h" />
|
||||
<Unit filename="../../source/as_atomic.cpp" />
|
||||
<Unit filename="../../source/as_atomic.h" />
|
||||
<Unit filename="../../source/as_builder.cpp" />
|
||||
<Unit filename="../../source/as_builder.h" />
|
||||
<Unit filename="../../source/as_bytecode.cpp" />
|
||||
<Unit filename="../../source/as_bytecode.h" />
|
||||
<Unit filename="../../source/as_callfunc.cpp" />
|
||||
<Unit filename="../../source/as_callfunc.h" />
|
||||
<Unit filename="../../source/as_callfunc_arm.cpp" />
|
||||
<Unit filename="../../source/as_callfunc_mips.cpp" />
|
||||
<Unit filename="../../source/as_callfunc_ppc.cpp" />
|
||||
<Unit filename="../../source/as_callfunc_ppc_64.cpp" />
|
||||
<Unit filename="../../source/as_callfunc_sh4.cpp" />
|
||||
<Unit filename="../../source/as_callfunc_x64_gcc.cpp" />
|
||||
<Unit filename="../../source/as_callfunc_x64_mingw.cpp" />
|
||||
<Unit filename="../../source/as_callfunc_x64_msvc.cpp" />
|
||||
<Unit filename="../../source/as_callfunc_x86.cpp" />
|
||||
<Unit filename="../../source/as_callfunc_xenon.cpp" />
|
||||
<Unit filename="../../source/as_compiler.cpp" />
|
||||
<Unit filename="../../source/as_compiler.h" />
|
||||
<Unit filename="../../source/as_config.h" />
|
||||
<Unit filename="../../source/as_configgroup.cpp" />
|
||||
<Unit filename="../../source/as_configgroup.h" />
|
||||
<Unit filename="../../source/as_context.cpp" />
|
||||
<Unit filename="../../source/as_context.h" />
|
||||
<Unit filename="../../source/as_criticalsection.h" />
|
||||
<Unit filename="../../source/as_datatype.cpp" />
|
||||
<Unit filename="../../source/as_datatype.h" />
|
||||
<Unit filename="../../source/as_debug.h" />
|
||||
<Unit filename="../../source/as_gc.cpp" />
|
||||
<Unit filename="../../source/as_gc.h" />
|
||||
<Unit filename="../../source/as_generic.cpp" />
|
||||
<Unit filename="../../source/as_generic.h" />
|
||||
<Unit filename="../../source/as_globalproperty.cpp" />
|
||||
<Unit filename="../../source/as_map.h" />
|
||||
<Unit filename="../../source/as_memory.cpp" />
|
||||
<Unit filename="../../source/as_memory.h" />
|
||||
<Unit filename="../../source/as_module.cpp" />
|
||||
<Unit filename="../../source/as_module.h" />
|
||||
<Unit filename="../../source/as_objecttype.cpp" />
|
||||
<Unit filename="../../source/as_objecttype.h" />
|
||||
<Unit filename="../../source/as_outputbuffer.cpp" />
|
||||
<Unit filename="../../source/as_outputbuffer.h" />
|
||||
<Unit filename="../../source/as_parser.cpp" />
|
||||
<Unit filename="../../source/as_parser.h" />
|
||||
<Unit filename="../../source/as_property.h" />
|
||||
<Unit filename="../../source/as_restore.cpp" />
|
||||
<Unit filename="../../source/as_restore.h" />
|
||||
<Unit filename="../../source/as_scriptcode.cpp" />
|
||||
<Unit filename="../../source/as_scriptcode.h" />
|
||||
<Unit filename="../../source/as_scriptengine.cpp" />
|
||||
<Unit filename="../../source/as_scriptengine.h" />
|
||||
<Unit filename="../../source/as_scriptfunction.cpp" />
|
||||
<Unit filename="../../source/as_scriptfunction.h" />
|
||||
<Unit filename="../../source/as_scriptnode.cpp" />
|
||||
<Unit filename="../../source/as_scriptnode.h" />
|
||||
<Unit filename="../../source/as_scriptobject.cpp" />
|
||||
<Unit filename="../../source/as_scriptobject.h" />
|
||||
<Unit filename="../../source/as_string.cpp" />
|
||||
<Unit filename="../../source/as_string.h" />
|
||||
<Unit filename="../../source/as_string_util.cpp" />
|
||||
<Unit filename="../../source/as_string_util.h" />
|
||||
<Unit filename="../../source/as_texts.h" />
|
||||
<Unit filename="../../source/as_thread.cpp" />
|
||||
<Unit filename="../../source/as_thread.h" />
|
||||
<Unit filename="../../source/as_tokendef.h" />
|
||||
<Unit filename="../../source/as_tokenizer.cpp" />
|
||||
<Unit filename="../../source/as_tokenizer.h" />
|
||||
<Unit filename="../../source/as_typeinfo.cpp" />
|
||||
<Unit filename="../../source/as_typeinfo.h" />
|
||||
<Unit filename="../../source/as_variablescope.cpp" />
|
||||
<Unit filename="../../source/as_variablescope.h" />
|
||||
<Extensions>
|
||||
<code_completion />
|
||||
<envvars />
|
||||
<debugger />
|
||||
</Extensions>
|
||||
</Project>
|
||||
</CodeBlocks_project_file>
|
769
lib/angelscript/projects/dev-cpp/AngelScript.dev
Normal file
769
lib/angelscript/projects/dev-cpp/AngelScript.dev
Normal file
@ -0,0 +1,769 @@
|
||||
[Project]
|
||||
FileName=AngelScript.dev
|
||||
Name=AngelScript
|
||||
UnitCount=68
|
||||
Type=2
|
||||
Ver=1
|
||||
ObjFiles=
|
||||
Includes=
|
||||
Libs=
|
||||
PrivateResource=
|
||||
ResourceIncludes=
|
||||
MakeIncludes=
|
||||
Compiler=
|
||||
CppCompiler=
|
||||
Linker=
|
||||
IsCpp=1
|
||||
Icon=
|
||||
ExeOutput=..\..\lib
|
||||
ObjectOutput=obj
|
||||
OverrideOutput=0
|
||||
OverrideOutputName=AngelScript.a
|
||||
HostApplication=
|
||||
Folders=
|
||||
CommandLine=
|
||||
UseCustomMakefile=0
|
||||
CustomMakefile=
|
||||
IncludeVersionInfo=0
|
||||
SupportXPThemes=0
|
||||
CompilerSet=0
|
||||
CompilerSettings=0000000000000001000000
|
||||
|
||||
[Unit1]
|
||||
FileName=..\..\include\angelscript.h
|
||||
CompileCpp=1
|
||||
Folder=AngelScript
|
||||
Compile=1
|
||||
Link=1
|
||||
Priority=1000
|
||||
OverrideBuildCmd=0
|
||||
BuildCmd=
|
||||
|
||||
[Unit2]
|
||||
FileName=..\..\source\as_variablescope.h
|
||||
CompileCpp=1
|
||||
Folder=AngelScript
|
||||
Compile=1
|
||||
Link=1
|
||||
Priority=1000
|
||||
OverrideBuildCmd=0
|
||||
BuildCmd=
|
||||
|
||||
[Unit3]
|
||||
FileName=..\..\source\as_arrayobject.cpp
|
||||
CompileCpp=1
|
||||
Folder=AngelScript
|
||||
Compile=1
|
||||
Link=1
|
||||
Priority=1000
|
||||
OverrideBuildCmd=0
|
||||
BuildCmd=
|
||||
|
||||
[Unit4]
|
||||
FileName=..\..\source\as_arrayobject.h
|
||||
CompileCpp=1
|
||||
Folder=AngelScript
|
||||
Compile=1
|
||||
Link=1
|
||||
Priority=1000
|
||||
OverrideBuildCmd=0
|
||||
BuildCmd=
|
||||
|
||||
[Unit5]
|
||||
FileName=..\..\source\as_builder.cpp
|
||||
CompileCpp=1
|
||||
Folder=AngelScript
|
||||
Compile=1
|
||||
Link=1
|
||||
Priority=1000
|
||||
OverrideBuildCmd=0
|
||||
BuildCmd=
|
||||
|
||||
[Unit6]
|
||||
FileName=..\..\source\as_builder.h
|
||||
CompileCpp=1
|
||||
Folder=AngelScript
|
||||
Compile=1
|
||||
Link=1
|
||||
Priority=1000
|
||||
OverrideBuildCmd=0
|
||||
BuildCmd=
|
||||
|
||||
[Unit7]
|
||||
FileName=..\..\source\as_bytecode.cpp
|
||||
CompileCpp=1
|
||||
Folder=AngelScript
|
||||
Compile=1
|
||||
Link=1
|
||||
Priority=1000
|
||||
OverrideBuildCmd=0
|
||||
BuildCmd=
|
||||
|
||||
[Unit8]
|
||||
FileName=..\..\source\as_bytecode.h
|
||||
CompileCpp=1
|
||||
Folder=AngelScript
|
||||
Compile=1
|
||||
Link=1
|
||||
Priority=1000
|
||||
OverrideBuildCmd=0
|
||||
BuildCmd=
|
||||
|
||||
[Unit9]
|
||||
FileName=..\..\source\as_bytecodedef.h
|
||||
CompileCpp=1
|
||||
Folder=AngelScript
|
||||
Compile=1
|
||||
Link=1
|
||||
Priority=1000
|
||||
OverrideBuildCmd=0
|
||||
BuildCmd=
|
||||
|
||||
[Unit10]
|
||||
FileName=..\..\source\as_callfunc.h
|
||||
CompileCpp=1
|
||||
Folder=AngelScript
|
||||
Compile=1
|
||||
Link=1
|
||||
Priority=1000
|
||||
OverrideBuildCmd=0
|
||||
BuildCmd=
|
||||
|
||||
[Unit11]
|
||||
FileName=..\..\source\as_callfunc_x86.cpp
|
||||
CompileCpp=1
|
||||
Folder=AngelScript
|
||||
Compile=1
|
||||
Link=1
|
||||
Priority=1000
|
||||
OverrideBuildCmd=0
|
||||
BuildCmd=
|
||||
|
||||
[Unit12]
|
||||
FileName=..\..\source\as_compiler.cpp
|
||||
CompileCpp=1
|
||||
Folder=AngelScript
|
||||
Compile=1
|
||||
Link=1
|
||||
Priority=1000
|
||||
OverrideBuildCmd=0
|
||||
BuildCmd=
|
||||
|
||||
[Unit13]
|
||||
FileName=..\..\source\as_compiler.h
|
||||
CompileCpp=1
|
||||
Folder=AngelScript
|
||||
Compile=1
|
||||
Link=1
|
||||
Priority=1000
|
||||
OverrideBuildCmd=0
|
||||
BuildCmd=
|
||||
|
||||
[Unit14]
|
||||
FileName=..\..\source\as_config.h
|
||||
CompileCpp=1
|
||||
Folder=AngelScript
|
||||
Compile=1
|
||||
Link=1
|
||||
Priority=1000
|
||||
OverrideBuildCmd=0
|
||||
BuildCmd=
|
||||
|
||||
[Unit15]
|
||||
FileName=..\..\source\as_context.cpp
|
||||
CompileCpp=1
|
||||
Folder=AngelScript
|
||||
Compile=1
|
||||
Link=1
|
||||
Priority=1000
|
||||
OverrideBuildCmd=0
|
||||
BuildCmd=
|
||||
|
||||
[Unit16]
|
||||
FileName=..\..\source\as_context.h
|
||||
CompileCpp=1
|
||||
Folder=AngelScript
|
||||
Compile=1
|
||||
Link=1
|
||||
Priority=1000
|
||||
OverrideBuildCmd=0
|
||||
BuildCmd=
|
||||
|
||||
[Unit17]
|
||||
FileName=..\..\source\as_datatype.cpp
|
||||
CompileCpp=1
|
||||
Folder=AngelScript
|
||||
Compile=1
|
||||
Link=1
|
||||
Priority=1000
|
||||
OverrideBuildCmd=0
|
||||
BuildCmd=
|
||||
|
||||
[Unit18]
|
||||
FileName=..\..\source\as_datatype.h
|
||||
CompileCpp=1
|
||||
Folder=AngelScript
|
||||
Compile=1
|
||||
Link=1
|
||||
Priority=1000
|
||||
OverrideBuildCmd=0
|
||||
BuildCmd=
|
||||
|
||||
[Unit19]
|
||||
FileName=..\..\source\as_debug.h
|
||||
CompileCpp=1
|
||||
Folder=AngelScript
|
||||
Compile=1
|
||||
Link=1
|
||||
Priority=1000
|
||||
OverrideBuildCmd=0
|
||||
BuildCmd=
|
||||
|
||||
[Unit20]
|
||||
FileName=..\..\source\as_map.h
|
||||
CompileCpp=1
|
||||
Folder=AngelScript
|
||||
Compile=1
|
||||
Link=1
|
||||
Priority=1000
|
||||
OverrideBuildCmd=0
|
||||
BuildCmd=
|
||||
|
||||
[Unit21]
|
||||
FileName=..\..\source\as_memory.cpp
|
||||
CompileCpp=1
|
||||
Folder=AngelScript
|
||||
Compile=1
|
||||
Link=1
|
||||
Priority=1000
|
||||
OverrideBuildCmd=0
|
||||
BuildCmd=
|
||||
|
||||
[Unit22]
|
||||
FileName=..\..\source\as_module.cpp
|
||||
CompileCpp=1
|
||||
Folder=AngelScript
|
||||
Compile=1
|
||||
Link=1
|
||||
Priority=1000
|
||||
OverrideBuildCmd=0
|
||||
BuildCmd=
|
||||
|
||||
[Unit23]
|
||||
FileName=..\..\source\as_module.h
|
||||
CompileCpp=1
|
||||
Folder=AngelScript
|
||||
Compile=1
|
||||
Link=1
|
||||
Priority=1000
|
||||
OverrideBuildCmd=0
|
||||
BuildCmd=
|
||||
|
||||
[Unit24]
|
||||
FileName=..\..\source\as_objecttype.cpp
|
||||
CompileCpp=1
|
||||
Folder=AngelScript
|
||||
Compile=1
|
||||
Link=1
|
||||
Priority=1000
|
||||
OverrideBuildCmd=0
|
||||
BuildCmd=
|
||||
|
||||
[Unit25]
|
||||
FileName=..\..\source\as_objecttype.h
|
||||
CompileCpp=1
|
||||
Folder=AngelScript
|
||||
Compile=1
|
||||
Link=1
|
||||
Priority=1000
|
||||
OverrideBuildCmd=0
|
||||
BuildCmd=
|
||||
|
||||
[Unit26]
|
||||
FileName=..\..\source\as_outputbuffer.cpp
|
||||
CompileCpp=1
|
||||
Folder=AngelScript
|
||||
Compile=1
|
||||
Link=1
|
||||
Priority=1000
|
||||
OverrideBuildCmd=0
|
||||
BuildCmd=
|
||||
|
||||
[Unit27]
|
||||
FileName=..\..\source\as_outputbuffer.h
|
||||
CompileCpp=1
|
||||
Folder=AngelScript
|
||||
Compile=1
|
||||
Link=1
|
||||
Priority=1000
|
||||
OverrideBuildCmd=0
|
||||
BuildCmd=
|
||||
|
||||
[Unit28]
|
||||
FileName=..\..\source\as_parser.cpp
|
||||
CompileCpp=1
|
||||
Folder=AngelScript
|
||||
Compile=1
|
||||
Link=1
|
||||
Priority=1000
|
||||
OverrideBuildCmd=0
|
||||
BuildCmd=
|
||||
|
||||
[Unit29]
|
||||
FileName=..\..\source\as_parser.h
|
||||
CompileCpp=1
|
||||
Folder=AngelScript
|
||||
Compile=1
|
||||
Link=1
|
||||
Priority=1000
|
||||
OverrideBuildCmd=0
|
||||
BuildCmd=
|
||||
|
||||
[Unit30]
|
||||
FileName=..\..\source\as_property.h
|
||||
CompileCpp=1
|
||||
Folder=AngelScript
|
||||
Compile=1
|
||||
Link=1
|
||||
Priority=1000
|
||||
OverrideBuildCmd=0
|
||||
BuildCmd=
|
||||
|
||||
[Unit31]
|
||||
FileName=..\..\source\as_restore.cpp
|
||||
CompileCpp=1
|
||||
Folder=AngelScript
|
||||
Compile=1
|
||||
Link=1
|
||||
Priority=1000
|
||||
OverrideBuildCmd=0
|
||||
BuildCmd=
|
||||
|
||||
[Unit32]
|
||||
FileName=..\..\source\as_restore.h
|
||||
CompileCpp=1
|
||||
Folder=AngelScript
|
||||
Compile=1
|
||||
Link=1
|
||||
Priority=1000
|
||||
OverrideBuildCmd=0
|
||||
BuildCmd=
|
||||
|
||||
[Unit33]
|
||||
FileName=..\..\source\as_scriptcode.cpp
|
||||
CompileCpp=1
|
||||
Folder=AngelScript
|
||||
Compile=1
|
||||
Link=1
|
||||
Priority=1000
|
||||
OverrideBuildCmd=0
|
||||
BuildCmd=
|
||||
|
||||
[Unit34]
|
||||
FileName=..\..\source\as_scriptcode.h
|
||||
CompileCpp=1
|
||||
Folder=AngelScript
|
||||
Compile=1
|
||||
Link=1
|
||||
Priority=1000
|
||||
OverrideBuildCmd=0
|
||||
BuildCmd=
|
||||
|
||||
[Unit35]
|
||||
FileName=..\..\source\as_scriptengine.cpp
|
||||
CompileCpp=1
|
||||
Folder=AngelScript
|
||||
Compile=1
|
||||
Link=1
|
||||
Priority=1000
|
||||
OverrideBuildCmd=0
|
||||
BuildCmd=
|
||||
|
||||
[Unit36]
|
||||
FileName=..\..\source\as_scriptengine.h
|
||||
CompileCpp=1
|
||||
Folder=AngelScript
|
||||
Compile=1
|
||||
Link=1
|
||||
Priority=1000
|
||||
OverrideBuildCmd=0
|
||||
BuildCmd=
|
||||
|
||||
[Unit37]
|
||||
FileName=..\..\source\as_scriptfunction.cpp
|
||||
CompileCpp=1
|
||||
Folder=AngelScript
|
||||
Compile=1
|
||||
Link=1
|
||||
Priority=1000
|
||||
OverrideBuildCmd=0
|
||||
BuildCmd=
|
||||
|
||||
[Unit38]
|
||||
FileName=..\..\source\as_scriptfunction.h
|
||||
CompileCpp=1
|
||||
Folder=AngelScript
|
||||
Compile=1
|
||||
Link=1
|
||||
Priority=1000
|
||||
OverrideBuildCmd=0
|
||||
BuildCmd=
|
||||
|
||||
[Unit39]
|
||||
FileName=..\..\source\as_scriptnode.cpp
|
||||
CompileCpp=1
|
||||
Folder=AngelScript
|
||||
Compile=1
|
||||
Link=1
|
||||
Priority=1000
|
||||
OverrideBuildCmd=0
|
||||
BuildCmd=
|
||||
|
||||
[Unit40]
|
||||
FileName=..\..\source\as_scriptnode.h
|
||||
CompileCpp=1
|
||||
Folder=AngelScript
|
||||
Compile=1
|
||||
Link=1
|
||||
Priority=1000
|
||||
OverrideBuildCmd=0
|
||||
BuildCmd=
|
||||
|
||||
[Unit41]
|
||||
FileName=..\..\source\as_string.cpp
|
||||
CompileCpp=1
|
||||
Folder=AngelScript
|
||||
Compile=1
|
||||
Link=1
|
||||
Priority=1000
|
||||
OverrideBuildCmd=0
|
||||
BuildCmd=
|
||||
|
||||
[Unit42]
|
||||
FileName=..\..\source\as_string.h
|
||||
CompileCpp=1
|
||||
Folder=AngelScript
|
||||
Compile=1
|
||||
Link=1
|
||||
Priority=1000
|
||||
OverrideBuildCmd=0
|
||||
BuildCmd=
|
||||
|
||||
[Unit43]
|
||||
FileName=..\..\source\as_string_util.cpp
|
||||
CompileCpp=1
|
||||
Folder=AngelScript
|
||||
Compile=1
|
||||
Link=1
|
||||
Priority=1000
|
||||
OverrideBuildCmd=0
|
||||
BuildCmd=
|
||||
|
||||
[Unit44]
|
||||
FileName=..\..\source\as_string_util.h
|
||||
CompileCpp=1
|
||||
Folder=AngelScript
|
||||
Compile=1
|
||||
Link=1
|
||||
Priority=1000
|
||||
OverrideBuildCmd=0
|
||||
BuildCmd=
|
||||
|
||||
[Unit45]
|
||||
FileName=..\..\source\as_structs.h
|
||||
CompileCpp=1
|
||||
Folder=AngelScript
|
||||
Compile=1
|
||||
Link=1
|
||||
Priority=1000
|
||||
OverrideBuildCmd=0
|
||||
BuildCmd=
|
||||
|
||||
[Unit46]
|
||||
FileName=..\..\source\as_texts.h
|
||||
CompileCpp=1
|
||||
Folder=AngelScript
|
||||
Compile=1
|
||||
Link=1
|
||||
Priority=1000
|
||||
OverrideBuildCmd=0
|
||||
BuildCmd=
|
||||
|
||||
[Unit47]
|
||||
FileName=..\..\source\as_thread.cpp
|
||||
CompileCpp=1
|
||||
Folder=AngelScript
|
||||
Compile=1
|
||||
Link=1
|
||||
Priority=1000
|
||||
OverrideBuildCmd=0
|
||||
BuildCmd=
|
||||
|
||||
[Unit48]
|
||||
FileName=..\..\source\as_thread.h
|
||||
CompileCpp=1
|
||||
Folder=AngelScript
|
||||
Compile=1
|
||||
Link=1
|
||||
Priority=1000
|
||||
OverrideBuildCmd=0
|
||||
BuildCmd=
|
||||
|
||||
[Unit49]
|
||||
FileName=..\..\source\as_tokendef.h
|
||||
CompileCpp=1
|
||||
Folder=AngelScript
|
||||
Compile=1
|
||||
Link=1
|
||||
Priority=1000
|
||||
OverrideBuildCmd=0
|
||||
BuildCmd=
|
||||
|
||||
[Unit50]
|
||||
FileName=..\..\source\as_tokenizer.cpp
|
||||
CompileCpp=1
|
||||
Folder=AngelScript
|
||||
Compile=1
|
||||
Link=1
|
||||
Priority=1000
|
||||
OverrideBuildCmd=0
|
||||
BuildCmd=
|
||||
|
||||
[Unit51]
|
||||
FileName=..\..\source\as_tokenizer.h
|
||||
CompileCpp=1
|
||||
Folder=AngelScript
|
||||
Compile=1
|
||||
Link=1
|
||||
Priority=1000
|
||||
OverrideBuildCmd=0
|
||||
BuildCmd=
|
||||
|
||||
[Unit52]
|
||||
FileName=..\..\source\as_typeinfo.cpp
|
||||
CompileCpp=1
|
||||
Folder=AngelScript
|
||||
Compile=1
|
||||
Link=1
|
||||
Priority=1000
|
||||
OverrideBuildCmd=0
|
||||
BuildCmd=
|
||||
|
||||
[Unit53]
|
||||
FileName=..\..\source\as_typeinfo.h
|
||||
CompileCpp=1
|
||||
Folder=AngelScript
|
||||
Compile=1
|
||||
Link=1
|
||||
Priority=1000
|
||||
OverrideBuildCmd=0
|
||||
BuildCmd=
|
||||
|
||||
[Unit54]
|
||||
FileName=..\..\source\as_types.h
|
||||
CompileCpp=1
|
||||
Folder=AngelScript
|
||||
Compile=1
|
||||
Link=1
|
||||
Priority=1000
|
||||
OverrideBuildCmd=0
|
||||
BuildCmd=
|
||||
|
||||
[Unit55]
|
||||
FileName=..\..\source\as_variablescope.cpp
|
||||
CompileCpp=1
|
||||
Folder=AngelScript
|
||||
Compile=1
|
||||
Link=1
|
||||
Priority=1000
|
||||
OverrideBuildCmd=0
|
||||
BuildCmd=
|
||||
|
||||
[Unit56]
|
||||
FileName=..\..\source\as_array.h
|
||||
CompileCpp=1
|
||||
Folder=AngelScript
|
||||
Compile=1
|
||||
Link=1
|
||||
Priority=1000
|
||||
OverrideBuildCmd=0
|
||||
BuildCmd=
|
||||
|
||||
[Unit57]
|
||||
FileName=..\..\source\as_callfunc_sh4.cpp
|
||||
CompileCpp=1
|
||||
Folder=AngelScript
|
||||
Compile=1
|
||||
Link=1
|
||||
Priority=1000
|
||||
OverrideBuildCmd=0
|
||||
BuildCmd=
|
||||
|
||||
[Unit58]
|
||||
FileName=..\..\source\as_generic.h
|
||||
CompileCpp=1
|
||||
Folder=AngelScript
|
||||
Compile=1
|
||||
Link=1
|
||||
Priority=1000
|
||||
OverrideBuildCmd=0
|
||||
BuildCmd=
|
||||
|
||||
[Unit59]
|
||||
FileName=..\..\source\as_generic.cpp
|
||||
CompileCpp=1
|
||||
Folder=AngelScript
|
||||
Compile=1
|
||||
Link=1
|
||||
Priority=1000
|
||||
OverrideBuildCmd=0
|
||||
BuildCmd=
|
||||
|
||||
[Unit60]
|
||||
FileName=..\..\source\as_callfunc.cpp
|
||||
CompileCpp=1
|
||||
Folder=AngelScript
|
||||
Compile=1
|
||||
Link=1
|
||||
Priority=1000
|
||||
OverrideBuildCmd=0
|
||||
BuildCmd=
|
||||
|
||||
[VersionInfo]
|
||||
Major=0
|
||||
Minor=1
|
||||
Release=1
|
||||
Build=1
|
||||
LanguageID=1033
|
||||
CharsetID=1252
|
||||
CompanyName=
|
||||
FileVersion=
|
||||
FileDescription=Developed using the Dev-C++ IDE
|
||||
InternalName=
|
||||
LegalCopyright=
|
||||
LegalTrademarks=
|
||||
OriginalFilename=
|
||||
ProductName=
|
||||
ProductVersion=
|
||||
AutoIncBuildNr=0
|
||||
|
||||
[Unit61]
|
||||
FileName=..\..\source\as_scriptobject.cpp
|
||||
CompileCpp=1
|
||||
Folder=AngelScript
|
||||
Compile=1
|
||||
Link=1
|
||||
Priority=1000
|
||||
OverrideBuildCmd=0
|
||||
BuildCmd=
|
||||
|
||||
[Unit62]
|
||||
FileName=..\..\source\as_scriptobject.h
|
||||
CompileCpp=1
|
||||
Folder=AngelScript
|
||||
Compile=1
|
||||
Link=1
|
||||
Priority=1000
|
||||
OverrideBuildCmd=0
|
||||
BuildCmd=
|
||||
|
||||
[Unit63]
|
||||
FileName=..\..\source\as_gcobject.cpp
|
||||
CompileCpp=1
|
||||
Folder=AngelScript
|
||||
Compile=1
|
||||
Link=1
|
||||
Priority=1000
|
||||
OverrideBuildCmd=0
|
||||
BuildCmd=
|
||||
|
||||
[Unit64]
|
||||
FileName=..\..\source\as_gcobject.h
|
||||
CompileCpp=1
|
||||
Folder=AngelScript
|
||||
Compile=1
|
||||
Link=1
|
||||
Priority=1000
|
||||
OverrideBuildCmd=0
|
||||
BuildCmd=
|
||||
|
||||
[Unit65]
|
||||
FileName=..\..\source\as_anyobject.cpp
|
||||
CompileCpp=1
|
||||
Folder=AngelScript
|
||||
Compile=1
|
||||
Link=1
|
||||
Priority=1000
|
||||
OverrideBuildCmd=0
|
||||
BuildCmd=
|
||||
|
||||
[Unit66]
|
||||
FileName=..\..\source\as_anyobject.h
|
||||
CompileCpp=1
|
||||
Folder=AngelScript
|
||||
Compile=1
|
||||
Link=1
|
||||
Priority=1000
|
||||
OverrideBuildCmd=0
|
||||
BuildCmd=
|
||||
|
||||
[Unit67]
|
||||
FileName=..\..\source\as_configgroup.h
|
||||
CompileCpp=1
|
||||
Folder=AngelScript
|
||||
Compile=1
|
||||
Link=1
|
||||
Priority=1000
|
||||
OverrideBuildCmd=0
|
||||
BuildCmd=
|
||||
|
||||
[Unit68]
|
||||
FileName=..\..\source\as_configgroup.cpp
|
||||
CompileCpp=1
|
||||
Folder=AngelScript
|
||||
Compile=1
|
||||
Link=1
|
||||
Priority=1000
|
||||
OverrideBuildCmd=0
|
||||
BuildCmd=
|
||||
|
||||
[Unit69]
|
||||
FileName=..\..\source\as_configgroup.cpp
|
||||
CompileCpp=1
|
||||
Folder=AngelScript
|
||||
Compile=1
|
||||
Link=1
|
||||
Priority=1000
|
||||
OverrideBuildCmd=0
|
||||
BuildCmd=
|
||||
|
||||
[Unit70]
|
||||
FileName=..\..\source\as_configgroup.cpp
|
||||
CompileCpp=1
|
||||
Folder=AngelScript
|
||||
Compile=1
|
||||
Link=1
|
||||
Priority=1000
|
||||
OverrideBuildCmd=0
|
||||
BuildCmd=
|
||||
|
||||
[Unit71]
|
||||
FileName=..\..\source\as_configgroup.h
|
||||
CompileCpp=1
|
||||
Folder=AngelScript
|
||||
Compile=1
|
||||
Link=1
|
||||
Priority=1000
|
||||
OverrideBuildCmd=0
|
||||
BuildCmd=
|
||||
|
||||
[Unit72]
|
||||
FileName=..\..\source\as_configgroup.cpp
|
||||
CompileCpp=1
|
||||
Folder=AngelScript
|
||||
Compile=1
|
||||
Link=1
|
||||
Priority=1000
|
||||
OverrideBuildCmd=0
|
||||
BuildCmd=
|
||||
|
114
lib/angelscript/projects/dev-cpp/Makefile.win
Normal file
114
lib/angelscript/projects/dev-cpp/Makefile.win
Normal file
@ -0,0 +1,114 @@
|
||||
# Project: AngelScript
|
||||
# Makefile created by Dev-C++ 4.9.9.1
|
||||
|
||||
CPP = g++.exe -D__DEBUG__
|
||||
CC = gcc.exe -D__DEBUG__
|
||||
WINDRES = windres.exe
|
||||
RES =
|
||||
OBJ = obj/as_arrayobject.o obj/as_builder.o obj/as_bytecode.o obj/as_callfunc_x86.o obj/as_compiler.o obj/as_context.o obj/as_datatype.o obj/as_module.o obj/as_objecttype.o obj/as_outputbuffer.o obj/as_parser.o obj/as_restore.o obj/as_scriptcode.o obj/as_scriptengine.o obj/as_scriptfunction.o obj/as_scriptnode.o obj/as_string.o obj/as_string_util.o obj/as_thread.o obj/as_tokenizer.o obj/as_typeinfo.o obj/as_variablescope.o obj/as_callfunc_sh4.o obj/as_generic.o obj/as_callfunc.o obj/as_scriptstruct.o obj/as_gcobject.o obj/as_anyobject.o obj/as_configgroup.o $(RES)
|
||||
LINKOBJ = obj/as_arrayobject.o obj/as_builder.o obj/as_bytecode.o obj/as_callfunc_x86.o obj/as_compiler.o obj/as_context.o obj/as_datatype.o obj/as_module.o obj/as_objecttype.o obj/as_outputbuffer.o obj/as_parser.o obj/as_restore.o obj/as_scriptcode.o obj/as_scriptengine.o obj/as_scriptfunction.o obj/as_scriptnode.o obj/as_string.o obj/as_string_util.o obj/as_thread.o obj/as_tokenizer.o obj/as_typeinfo.o obj/as_variablescope.o obj/as_callfunc_sh4.o obj/as_generic.o obj/as_callfunc.o obj/as_scriptstruct.o obj/as_gcobject.o obj/as_anyobject.o obj/as_configgroup.o $(RES)
|
||||
LIBS = -L"C:/Dev-Cpp/lib" -g3
|
||||
INCS = -I"C:/Dev-Cpp/include"
|
||||
CXXINCS = -I"C:/Dev-Cpp/include/c++/3.3.1" -I"C:/Dev-Cpp/include/c++/3.3.1/mingw32" -I"C:/Dev-Cpp/include/c++/3.3.1/backward" -I"C:/Dev-Cpp/lib/gcc-lib/mingw32/3.3.1/include" -I"C:/Dev-Cpp/include"
|
||||
BIN = ../../lib/AngelScript.a
|
||||
CXXFLAGS = $(CXXINCS) -g3
|
||||
CFLAGS = $(INCS) -g3
|
||||
|
||||
.PHONY: all all-before all-after clean clean-custom
|
||||
|
||||
all: all-before ../../lib/AngelScript.a all-after
|
||||
|
||||
|
||||
clean: clean-custom
|
||||
rm -f $(OBJ) $(BIN)
|
||||
|
||||
$(BIN): $(LINKOBJ)
|
||||
ar r $(BIN) $(LINKOBJ)
|
||||
ranlib $(BIN)
|
||||
|
||||
obj/as_arrayobject.o: ../../source/as_arrayobject.cpp
|
||||
$(CPP) -c ../../source/as_arrayobject.cpp -o obj/as_arrayobject.o $(CXXFLAGS)
|
||||
|
||||
obj/as_builder.o: ../../source/as_builder.cpp
|
||||
$(CPP) -c ../../source/as_builder.cpp -o obj/as_builder.o $(CXXFLAGS)
|
||||
|
||||
obj/as_bytecode.o: ../../source/as_bytecode.cpp
|
||||
$(CPP) -c ../../source/as_bytecode.cpp -o obj/as_bytecode.o $(CXXFLAGS)
|
||||
|
||||
obj/as_callfunc_x86.o: ../../source/as_callfunc_x86.cpp
|
||||
$(CPP) -c ../../source/as_callfunc_x86.cpp -o obj/as_callfunc_x86.o $(CXXFLAGS)
|
||||
|
||||
obj/as_compiler.o: ../../source/as_compiler.cpp
|
||||
$(CPP) -c ../../source/as_compiler.cpp -o obj/as_compiler.o $(CXXFLAGS)
|
||||
|
||||
obj/as_context.o: ../../source/as_context.cpp
|
||||
$(CPP) -c ../../source/as_context.cpp -o obj/as_context.o $(CXXFLAGS)
|
||||
|
||||
obj/as_datatype.o: ../../source/as_datatype.cpp
|
||||
$(CPP) -c ../../source/as_datatype.cpp -o obj/as_datatype.o $(CXXFLAGS)
|
||||
|
||||
obj/as_module.o: ../../source/as_module.cpp
|
||||
$(CPP) -c ../../source/as_module.cpp -o obj/as_module.o $(CXXFLAGS)
|
||||
|
||||
obj/as_objecttype.o: ../../source/as_objecttype.cpp
|
||||
$(CPP) -c ../../source/as_objecttype.cpp -o obj/as_objecttype.o $(CXXFLAGS)
|
||||
|
||||
obj/as_outputbuffer.o: ../../source/as_outputbuffer.cpp
|
||||
$(CPP) -c ../../source/as_outputbuffer.cpp -o obj/as_outputbuffer.o $(CXXFLAGS)
|
||||
|
||||
obj/as_parser.o: ../../source/as_parser.cpp
|
||||
$(CPP) -c ../../source/as_parser.cpp -o obj/as_parser.o $(CXXFLAGS)
|
||||
|
||||
obj/as_restore.o: ../../source/as_restore.cpp
|
||||
$(CPP) -c ../../source/as_restore.cpp -o obj/as_restore.o $(CXXFLAGS)
|
||||
|
||||
obj/as_scriptcode.o: ../../source/as_scriptcode.cpp
|
||||
$(CPP) -c ../../source/as_scriptcode.cpp -o obj/as_scriptcode.o $(CXXFLAGS)
|
||||
|
||||
obj/as_scriptengine.o: ../../source/as_scriptengine.cpp
|
||||
$(CPP) -c ../../source/as_scriptengine.cpp -o obj/as_scriptengine.o $(CXXFLAGS)
|
||||
|
||||
obj/as_scriptfunction.o: ../../source/as_scriptfunction.cpp
|
||||
$(CPP) -c ../../source/as_scriptfunction.cpp -o obj/as_scriptfunction.o $(CXXFLAGS)
|
||||
|
||||
obj/as_scriptnode.o: ../../source/as_scriptnode.cpp
|
||||
$(CPP) -c ../../source/as_scriptnode.cpp -o obj/as_scriptnode.o $(CXXFLAGS)
|
||||
|
||||
obj/as_string.o: ../../source/as_string.cpp
|
||||
$(CPP) -c ../../source/as_string.cpp -o obj/as_string.o $(CXXFLAGS)
|
||||
|
||||
obj/as_string_util.o: ../../source/as_string_util.cpp
|
||||
$(CPP) -c ../../source/as_string_util.cpp -o obj/as_string_util.o $(CXXFLAGS)
|
||||
|
||||
obj/as_thread.o: ../../source/as_thread.cpp
|
||||
$(CPP) -c ../../source/as_thread.cpp -o obj/as_thread.o $(CXXFLAGS)
|
||||
|
||||
obj/as_tokenizer.o: ../../source/as_tokenizer.cpp
|
||||
$(CPP) -c ../../source/as_tokenizer.cpp -o obj/as_tokenizer.o $(CXXFLAGS)
|
||||
|
||||
obj/as_typeinfo.o: ../../source/as_typeinfo.cpp
|
||||
$(CPP) -c ../../source/as_typeinfo.cpp -o obj/as_typeinfo.o $(CXXFLAGS)
|
||||
|
||||
obj/as_variablescope.o: ../../source/as_variablescope.cpp
|
||||
$(CPP) -c ../../source/as_variablescope.cpp -o obj/as_variablescope.o $(CXXFLAGS)
|
||||
|
||||
obj/as_callfunc_sh4.o: ../../source/as_callfunc_sh4.cpp
|
||||
$(CPP) -c ../../source/as_callfunc_sh4.cpp -o obj/as_callfunc_sh4.o $(CXXFLAGS)
|
||||
|
||||
obj/as_generic.o: ../../source/as_generic.cpp
|
||||
$(CPP) -c ../../source/as_generic.cpp -o obj/as_generic.o $(CXXFLAGS)
|
||||
|
||||
obj/as_callfunc.o: ../../source/as_callfunc.cpp
|
||||
$(CPP) -c ../../source/as_callfunc.cpp -o obj/as_callfunc.o $(CXXFLAGS)
|
||||
|
||||
obj/as_scriptstruct.o: ../../source/as_scriptstruct.cpp
|
||||
$(CPP) -c ../../source/as_scriptstruct.cpp -o obj/as_scriptstruct.o $(CXXFLAGS)
|
||||
|
||||
obj/as_gcobject.o: ../../source/as_gcobject.cpp
|
||||
$(CPP) -c ../../source/as_gcobject.cpp -o obj/as_gcobject.o $(CXXFLAGS)
|
||||
|
||||
obj/as_anyobject.o: ../../source/as_anyobject.cpp
|
||||
$(CPP) -c ../../source/as_anyobject.cpp -o obj/as_anyobject.o $(CXXFLAGS)
|
||||
|
||||
obj/as_configgroup.o: ../../source/as_configgroup.cpp
|
||||
$(CPP) -c ../../source/as_configgroup.cpp -o obj/as_configgroup.o $(CXXFLAGS)
|
0
lib/angelscript/projects/dev-cpp/obj/delete.me
Normal file
0
lib/angelscript/projects/dev-cpp/obj/delete.me
Normal file
22
lib/angelscript/projects/dreamcast/Makefile
Normal file
22
lib/angelscript/projects/dreamcast/Makefile
Normal file
@ -0,0 +1,22 @@
|
||||
#
|
||||
# GNU make Makefile for Angelscript
|
||||
#
|
||||
|
||||
TARGET = libangelscript.a
|
||||
|
||||
CC_FILES := $(shell ls -1 as_*.cpp)
|
||||
OBJS = $(patsubst %.cpp, %.o, $(CC_FILES))
|
||||
|
||||
all: ../include/memory.h defaultall
|
||||
|
||||
../include/memory.h:
|
||||
echo "#include <string.h>" >> ../include/memory.h
|
||||
|
||||
include $(KOS_BASE)/addons/Makefile.prefab
|
||||
|
||||
KOS_CFLAGS += -Dmemory=string -D__dreamcast__ -I../include -I.
|
||||
|
||||
clean:
|
||||
rm -f *~ *.o *.a
|
||||
|
||||
|
2
lib/angelscript/projects/dreamcast/obj/delete.me
Normal file
2
lib/angelscript/projects/dreamcast/obj/delete.me
Normal file
@ -0,0 +1,2 @@
|
||||
This file is here just in case your unarchiver does not extract empty directories.
|
||||
Feel free to remove it.
|
22
lib/angelscript/projects/dreamcast/readme.txt
Normal file
22
lib/angelscript/projects/dreamcast/readme.txt
Normal file
@ -0,0 +1,22 @@
|
||||
Author of sh4 specifics
|
||||
-----------------------
|
||||
Fredrik Ehnbom - original version in May, 2004
|
||||
Fredrik Ehnbom - updated version for 2.0.0wip2 in Jan, 2005
|
||||
|
||||
Howto use
|
||||
-----------------------
|
||||
This assumes a working kallistios installation. It was developed with
|
||||
kallistios 1.3.x subversion revision 183 and sh-elf-gcc 3.4.3. Though,
|
||||
it does not really rely on anything kallistios specific, so it should
|
||||
be possible to get it up and running on other sh4-based architectures.
|
||||
|
||||
AngelScript uses memory.h which does not seem to be provided with kos.
|
||||
Don't worry though, the makefile creates one for you ;)
|
||||
|
||||
To build the library, just go to angelscript/source and type
|
||||
|
||||
make -f ../projects/dreamcast/Makefile
|
||||
|
||||
or wherever you put the makefile shipped with this textdocument.
|
||||
The library will be in $KOS_BASE/addons/lib/dreamcast/ together with
|
||||
all the other kos addon libraries.
|
131
lib/angelscript/projects/gnuc macosx/makefile
Normal file
131
lib/angelscript/projects/gnuc macosx/makefile
Normal file
@ -0,0 +1,131 @@
|
||||
# Angelscript makefile for linux (based on MingW makefile)
|
||||
# Type 'make' then 'make install' to complete the installation of the library
|
||||
|
||||
# For 'make install' to work, set LOCAL according to your system configuration
|
||||
LOCAL = /usr/local
|
||||
|
||||
# If you want to build a shared library, then run make with SHARED=1 and VERSION=version
|
||||
LIB = libangelscript.a
|
||||
DEVLIB = libangelscript.dylib
|
||||
BUNDLE = libangelscript.so
|
||||
INC = angelscript.h
|
||||
|
||||
SRCDIR = ../../source
|
||||
INCDIR = ../../include
|
||||
OBJDIR = obj
|
||||
LIBDIR = ../../lib
|
||||
CXX = c++
|
||||
AFLAGS= -arch i386 -arch x86_64
|
||||
CXXFLAGS = -g -Wall -fPIC $(AFLAGS)
|
||||
CXXBFLAGS = $(CXXFLAGS) -fno-common
|
||||
|
||||
DELETER = rm -f
|
||||
COPIER = cp -a
|
||||
|
||||
SRCNAMES = \
|
||||
as_atomic.cpp \
|
||||
as_builder.cpp \
|
||||
as_bytecode.cpp \
|
||||
as_callfunc.cpp \
|
||||
as_callfunc_arm.cpp \
|
||||
as_callfunc_mips.cpp \
|
||||
as_callfunc_ppc.cpp \
|
||||
as_callfunc_ppc_64.cpp \
|
||||
as_callfunc_sh4.cpp \
|
||||
as_callfunc_x86.cpp \
|
||||
as_callfunc_x64_gcc.cpp \
|
||||
as_compiler.cpp \
|
||||
as_context.cpp \
|
||||
as_configgroup.cpp \
|
||||
as_datatype.cpp \
|
||||
as_generic.cpp \
|
||||
as_gc.cpp \
|
||||
as_globalproperty.cpp \
|
||||
as_memory.cpp \
|
||||
as_module.cpp \
|
||||
as_objecttype.cpp \
|
||||
as_outputbuffer.cpp \
|
||||
as_parser.cpp \
|
||||
as_restore.cpp \
|
||||
as_scriptcode.cpp \
|
||||
as_scriptengine.cpp \
|
||||
as_scriptfunction.cpp \
|
||||
as_scriptnode.cpp \
|
||||
as_scriptobject.cpp \
|
||||
as_string.cpp \
|
||||
as_string_util.cpp \
|
||||
as_thread.cpp \
|
||||
as_tokenizer.cpp \
|
||||
as_typeinfo.cpp \
|
||||
as_variablescope.cpp \
|
||||
|
||||
OBJ = $(addprefix $(OBJDIR)/, $(notdir $(SRCNAMES:.cpp=.o)))
|
||||
BOBJ = $(addprefix $(OBJDIR)/, $(notdir $(SRCNAMES:.cpp=.lo)))
|
||||
TARG = $(LIBDIR)/$(LIB) $(LIBDIR)/$(DEVLIB) $(LIBDIR)/$(BUNDLE)
|
||||
|
||||
|
||||
all: $(TARG)
|
||||
$(LIBDIR)/$(LIB): $(OBJDIR) $(LIBDIR) $(OBJ)
|
||||
rm -f $(LIBDIR)/$(LIB)
|
||||
ar r $(LIBDIR)/$(LIB) $(OBJ)
|
||||
ranlib $(LIBDIR)/$(LIB)
|
||||
file $(LIBDIR)/$(LIB)
|
||||
|
||||
$(LIBDIR)/$(DEVLIB): $(OBJDIR) $(LIBDIR) $(OBJ)
|
||||
rm -f $(LIBDIR)/$(DEVLIB)
|
||||
$(CXX) $(AFLAGS) -dynamiclib -o $(DEVLIB) $(OBJ)
|
||||
mv $(DEVLIB) $(LIBDIR)/$(DEVLIB)
|
||||
file $(LIBDIR)/$(DEVLIB)
|
||||
|
||||
$(LIBDIR)/$(BUNDLE): $(OBJDIR) $(LIBDIR) $(BOBJ)
|
||||
rm -f $(LIBDIR)/$(BUNDLE)
|
||||
$(CXX) $(AFLAGS) -bundle -flat_namespace -undefined suppress -o $(LIBDIR)/$(BUNDLE) $(BOBJ)
|
||||
file $(LIBDIR)/$(BUNDLE)
|
||||
|
||||
@echo -------------------------------------------------------------------
|
||||
@echo Done. As root, type 'make install' to install the library.
|
||||
|
||||
$(OBJDIR):
|
||||
mkdir $(OBJDIR)
|
||||
|
||||
$(LIBDIR):
|
||||
mkdir $(LIBDIR)
|
||||
|
||||
$(OBJDIR)/%.o: $(SRCDIR)/%.cpp
|
||||
$(CXX) $(CXXFLAGS) -o $@ -c $<
|
||||
|
||||
$(OBJDIR)/%.o: $(SRCDIR)/%.S
|
||||
$(CXX) $(CXXFLAGS) -o $@ -c $<
|
||||
|
||||
$(OBJDIR)/%.o: $(SRCDIR)/%.s
|
||||
$(CXX) $(CXXFLAGS) -o $@ -c $<
|
||||
|
||||
$(OBJDIR)/%.lo: $(SRCDIR)/%.cpp
|
||||
$(CXX) $(CXXBFLAGS) -o $@ -c $<
|
||||
|
||||
$(OBJDIR)/%.lo: $(SRCDIR)/%.S
|
||||
$(CXX) $(CXXBFLAGS) -o $@ -c $<
|
||||
|
||||
$(OBJDIR)/%.lo: $(SRCDIR)/%.s
|
||||
$(CXX) $(CXXBFLAGS) -o $@ -c $<
|
||||
|
||||
clean:
|
||||
$(DELETER) $(OBJ) $(BOBJ) $(TARG)
|
||||
|
||||
install: $(TARG)
|
||||
@echo Installing to: $(LOCAL)/lib and $(LOCAL)/include...
|
||||
@echo -------------------------------------------------------------------
|
||||
ifdef SHARED
|
||||
$(COPIER) $(LIBDIR)/$(DEVLIB) $(LOCAL)/lib
|
||||
endif
|
||||
$(COPIER) $(TARG) $(LOCAL)/lib
|
||||
$(COPIER) $(INCDIR)/$(INC) $(LOCAL)/include
|
||||
@echo -------------------------------------------------------------------
|
||||
@echo Angelscript library installed. Enjoy!
|
||||
|
||||
uninstall:
|
||||
$(DELETER) $(LOCAL)/include/$(INC) $(LOCAL)/lib/$(LIB) $(LOCAL)/lib/$(DEVLIB)
|
||||
@echo -------------------------------------------------------------------
|
||||
@echo Angelscript library uninstalled.
|
||||
|
||||
.PHONY: all clean install uninstall
|
155
lib/angelscript/projects/gnuc/makefile
Normal file
155
lib/angelscript/projects/gnuc/makefile
Normal file
@ -0,0 +1,155 @@
|
||||
# Angelscript makefile for linux (based on MingW makefile)
|
||||
# Type 'make' then 'make install' to complete the installation of the library
|
||||
|
||||
# For 'make install' to work, set LOCAL according to your system configuration
|
||||
LOCAL ?= /usr/local
|
||||
INSTALL_LIBDIR ?= lib
|
||||
|
||||
# If you want to build a shared library, then run make with SHARED=1 and VERSION=version
|
||||
ifdef SHARED
|
||||
LIB = libangelscript-$(VERSION).so
|
||||
DEVLIB = libangelscript.so
|
||||
else
|
||||
LIB = libangelscript.a
|
||||
DEVLIB = libangelscript.a
|
||||
endif
|
||||
INC = angelscript.h
|
||||
|
||||
SRCDIR = ../../source
|
||||
INCDIR = ../../include
|
||||
ifeq ($(TARGETPLATFORM), iphone)
|
||||
IPHONEBIN = /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin
|
||||
OBJDIR = obj-iphone
|
||||
LIBDIR = ../../lib-iphone
|
||||
CXX ?= $(IPHONEBIN)/clang++
|
||||
CXXFLAGS += -Wall -fPIC -fno-strict-aliasing -arch armv7 -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk -miphoneos-version-min=3.0
|
||||
else ifeq ($(TARGETPLATFORM), iphonesimulator)
|
||||
IPHONEBIN = /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin
|
||||
OBJDIR = obj-iphone
|
||||
LIBDIR = ../../lib-iphone
|
||||
CXX ?= $(IPHONEBIN)/clang++
|
||||
CXXFLAGS += -Wall -fPIC -fno-strict-aliasing -arch i386 -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk -miphoneos-version-min=3.0
|
||||
else ifeq ($(TARGETPLATFORM), android)
|
||||
ANDROIDNDKROOT = /cygdrive/c/android/android-ndk-1.6_r1
|
||||
ANDROIDBIN = $(ANDROIDNDKROOT)/build/prebuilt/windows/arm-eabi-4.2.1/bin
|
||||
SYSROOT = $(ANDROIDNDKROOT)/build/platforms/android-4/arch-arm
|
||||
OBJDIR = obj-android
|
||||
LIBDIR = ../../lib-android
|
||||
CXX ?= $(ANDROIDBIN)/arm-eabi-gcc
|
||||
CXXFLAGS += -I$(SYSROOT)/usr/include \
|
||||
-Wall \
|
||||
-DANDROID \
|
||||
-fno-exceptions \
|
||||
-march=armv6 -mthumb-interwork \
|
||||
-mfloat-abi=softfp -fno-rtti
|
||||
else
|
||||
OBJDIR = obj
|
||||
LIBDIR = ../../lib
|
||||
CXX ?= g++
|
||||
# On i686 architecture you may need to add -march=i686 if you get
|
||||
# an undefined symbol for __sync_sub_and_fetch_4 in as_atomic.cpp.
|
||||
CXXFLAGS += -Wall -fPIC -fno-strict-aliasing
|
||||
endif
|
||||
|
||||
AR ?= ar
|
||||
RANLIB ?= ranlib
|
||||
DELETER = rm -f
|
||||
COPIER = cp -a
|
||||
|
||||
SRCNAMES = \
|
||||
as_atomic.cpp \
|
||||
as_builder.cpp \
|
||||
as_bytecode.cpp \
|
||||
as_callfunc.cpp \
|
||||
as_callfunc_arm.cpp \
|
||||
as_callfunc_mips.cpp \
|
||||
as_callfunc_ppc.cpp \
|
||||
as_callfunc_ppc_64.cpp \
|
||||
as_callfunc_sh4.cpp \
|
||||
as_callfunc_x86.cpp \
|
||||
as_callfunc_x64_gcc.cpp \
|
||||
as_callfunc_x64_mingw.cpp \
|
||||
as_compiler.cpp \
|
||||
as_context.cpp \
|
||||
as_configgroup.cpp \
|
||||
as_datatype.cpp \
|
||||
as_generic.cpp \
|
||||
as_gc.cpp \
|
||||
as_globalproperty.cpp \
|
||||
as_memory.cpp \
|
||||
as_module.cpp \
|
||||
as_objecttype.cpp \
|
||||
as_outputbuffer.cpp \
|
||||
as_parser.cpp \
|
||||
as_restore.cpp \
|
||||
as_scriptcode.cpp \
|
||||
as_scriptengine.cpp \
|
||||
as_scriptfunction.cpp \
|
||||
as_scriptnode.cpp \
|
||||
as_scriptobject.cpp \
|
||||
as_string.cpp \
|
||||
as_string_util.cpp \
|
||||
as_thread.cpp \
|
||||
as_tokenizer.cpp \
|
||||
as_typeinfo.cpp \
|
||||
as_variablescope.cpp \
|
||||
|
||||
OBJ = $(addprefix $(OBJDIR)/, $(notdir $(SRCNAMES:.cpp=.o)))
|
||||
BIN = $(LIBDIR)/$(LIB)
|
||||
|
||||
ifeq ($(TARGETPLATFORM), iphone)
|
||||
OBJ += $(OBJDIR)/as_callfunc_arm_xcode.o
|
||||
else
|
||||
OBJ += $(OBJDIR)/as_callfunc_arm_gcc.o
|
||||
endif
|
||||
|
||||
all: $(BIN)
|
||||
|
||||
$(BIN): $(OBJDIR) $(LIBDIR) $(OBJ)
|
||||
ifdef SHARED
|
||||
$(CXX) $(CXXFLAGS) $(LDFLAGS) -shared -Wl,-soname,$(LIB) -o $(BIN) $(OBJ)
|
||||
else
|
||||
$(AR) r $(BIN) $(OBJ)
|
||||
$(RANLIB) $(BIN)
|
||||
endif
|
||||
@echo -------------------------------------------------------------------
|
||||
@echo Done. As root, type 'make install' to install the library.
|
||||
|
||||
$(OBJDIR):
|
||||
mkdir $(OBJDIR)
|
||||
|
||||
$(LIBDIR):
|
||||
mkdir $(LIBDIR)
|
||||
|
||||
$(OBJDIR)/%.o: $(SRCDIR)/%.cpp
|
||||
$(CXX) $(CXXFLAGS) -o $@ -c $<
|
||||
|
||||
$(OBJDIR)/%.o: $(SRCDIR)/%.S
|
||||
$(CXX) $(CXXFLAGS) -o $@ -c $<
|
||||
|
||||
$(OBJDIR)/%.o: $(SRCDIR)/%.s
|
||||
$(CXX) $(CXXFLAGS) -o $@ -c $<
|
||||
|
||||
|
||||
clean:
|
||||
$(DELETER) $(OBJ) $(BIN) $(LIBDIR)/$(DEVLIB)
|
||||
|
||||
install: $(BIN)
|
||||
@echo Installing to: $(LOCAL)/$(INSTALL_LIBDIR) and $(LOCAL)/include...
|
||||
@echo -------------------------------------------------------------------
|
||||
ifdef SHARED
|
||||
$(COPIER) $(LIBDIR)/$(LIB) $(LOCAL)/$(INSTALL_LIBDIR)
|
||||
ln -s $(LOCAL)/$(INSTALL_LIBDIR)/$(LIB) $(LOCAL)/$(INSTALL_LIBDIR)/$(DEVLIB)
|
||||
ln -s $(LOCAL)/$(INSTALL_LIBDIR)/$(LIB) $(LOCAL)/$(INSTALL_LIBDIR)/$(DEVLIB).$(VERSION)
|
||||
endif
|
||||
$(COPIER) $(BIN) $(LOCAL)/$(INSTALL_LIBDIR)
|
||||
$(COPIER) $(INCDIR)/$(INC) $(LOCAL)/include
|
||||
@echo -------------------------------------------------------------------
|
||||
@echo Angelscript library installed. Enjoy!
|
||||
|
||||
uninstall:
|
||||
$(DELETER) $(LOCAL)/include/$(INC) $(LOCAL)/$(INSTALL_LIBDIR)/$(LIB) $(LOCAL)/$(INSTALL_LIBDIR)/$(DEVLIB)
|
||||
@echo -------------------------------------------------------------------
|
||||
@echo Angelscript library uninstalled.
|
||||
|
||||
.PHONY: all clean install uninstall
|
2
lib/angelscript/projects/gnuc/obj/delete.me
Normal file
2
lib/angelscript/projects/gnuc/obj/delete.me
Normal file
@ -0,0 +1,2 @@
|
||||
This file is here just in case your unarchiver does not extract empty directories.
|
||||
Feel free to remove it.
|
20
lib/angelscript/projects/gnuc/readme.txt
Normal file
20
lib/angelscript/projects/gnuc/readme.txt
Normal file
@ -0,0 +1,20 @@
|
||||
To compile the library, just type in the command line:
|
||||
|
||||
make
|
||||
|
||||
In order to install the library you might have to adopt the makefile to
|
||||
match your system configuration. By default the library will be installed
|
||||
to "/usr/local/..." (lib/ and include/). To change that, edit the makefile
|
||||
variable $LOCAL.
|
||||
|
||||
In order to install the library, switch to root:
|
||||
|
||||
su
|
||||
make install
|
||||
exit
|
||||
|
||||
You can uninstall the library, too:
|
||||
|
||||
su
|
||||
make uninstall
|
||||
exit
|
111
lib/angelscript/projects/marmalade/angelscript_lib.mkb
Normal file
111
lib/angelscript/projects/marmalade/angelscript_lib.mkb
Normal file
@ -0,0 +1,111 @@
|
||||
#!/usr/bin/env mkb
|
||||
|
||||
options
|
||||
{
|
||||
enable-exceptions=1
|
||||
lib
|
||||
module_path="../../source"
|
||||
}
|
||||
|
||||
subproject angelscript_lib
|
||||
|
||||
defines
|
||||
{
|
||||
}
|
||||
|
||||
if {{ defined I3D_ARCH_ARM }}
|
||||
{
|
||||
files
|
||||
{
|
||||
(../../source)
|
||||
as_callfunc_arm_gcc.S
|
||||
}
|
||||
option buildenv=scons
|
||||
}
|
||||
else
|
||||
{
|
||||
files
|
||||
{
|
||||
(../../source)
|
||||
#as_callfunc_x64_msvc_asm.asm
|
||||
as_callfunc_arm_msvc.asm
|
||||
}
|
||||
}
|
||||
|
||||
files
|
||||
{
|
||||
(../../source)
|
||||
as_array.h
|
||||
as_atomic.cpp
|
||||
as_atomic.h
|
||||
as_builder.cpp
|
||||
as_builder.h
|
||||
as_bytecode.cpp
|
||||
as_bytecode.h
|
||||
as_callfunc.cpp
|
||||
as_callfunc.h
|
||||
as_callfunc_arm.cpp
|
||||
as_callfunc_mips.cpp
|
||||
as_callfunc_ppc.cpp
|
||||
as_callfunc_ppc_64.cpp
|
||||
as_callfunc_sh4.cpp
|
||||
as_callfunc_x64_gcc.cpp
|
||||
as_callfunc_x64_mingw.cpp
|
||||
as_callfunc_x64_msvc.cpp
|
||||
as_callfunc_x86.cpp
|
||||
as_callfunc_xenon.cpp
|
||||
as_compiler.cpp
|
||||
as_compiler.h
|
||||
as_config.h
|
||||
as_configgroup.cpp
|
||||
as_configgroup.h
|
||||
as_context.cpp
|
||||
as_context.h
|
||||
as_criticalsection.h
|
||||
as_datatype.cpp
|
||||
as_datatype.h
|
||||
as_debug.h
|
||||
as_gc.cpp
|
||||
as_gc.h
|
||||
as_generic.cpp
|
||||
as_generic.h
|
||||
as_globalproperty.cpp
|
||||
as_map.h
|
||||
as_memory.cpp
|
||||
as_memory.h
|
||||
as_module.cpp
|
||||
as_module.h
|
||||
as_objecttype.cpp
|
||||
as_objecttype.h
|
||||
as_outputbuffer.cpp
|
||||
as_outputbuffer.h
|
||||
as_parser.cpp
|
||||
as_parser.h
|
||||
as_property.h
|
||||
as_restore.cpp
|
||||
as_restore.h
|
||||
as_scriptcode.cpp
|
||||
as_scriptcode.h
|
||||
as_scriptengine.cpp
|
||||
as_scriptengine.h
|
||||
as_scriptfunction.cpp
|
||||
as_scriptfunction.h
|
||||
as_scriptnode.cpp
|
||||
as_scriptnode.h
|
||||
as_scriptobject.cpp
|
||||
as_scriptobject.h
|
||||
as_string.cpp
|
||||
as_string.h
|
||||
as_string_util.cpp
|
||||
as_string_util.h
|
||||
as_texts.h
|
||||
as_thread.cpp
|
||||
as_thread.h
|
||||
as_tokendef.h
|
||||
as_tokenizer.cpp
|
||||
as_tokenizer.h
|
||||
as_typeinfo.cpp
|
||||
as_typeinfo.h
|
||||
as_variablescope.cpp
|
||||
as_variablescope.h
|
||||
}
|
24
lib/angelscript/projects/marmalade/angelscript_lib.mkf
Normal file
24
lib/angelscript/projects/marmalade/angelscript_lib.mkf
Normal file
@ -0,0 +1,24 @@
|
||||
#!/usr/bin/env mkb
|
||||
|
||||
display_name "AngelScript_Lib"
|
||||
|
||||
includepath
|
||||
{
|
||||
../../include
|
||||
../../sdk/add_on
|
||||
}
|
||||
|
||||
defines
|
||||
{
|
||||
}
|
||||
|
||||
library
|
||||
{
|
||||
".,angelscript_lib"
|
||||
}
|
||||
|
||||
files
|
||||
{
|
||||
(../../include)
|
||||
angelscript.h
|
||||
}
|
79
lib/angelscript/projects/mingw/makefile
Normal file
79
lib/angelscript/projects/mingw/makefile
Normal file
@ -0,0 +1,79 @@
|
||||
# Angelscript MingW makefile
|
||||
# Type 'make' then 'make install' to complete the installation of the library
|
||||
|
||||
CXX ?= g++
|
||||
AR ?= ar
|
||||
CXXFLAGS = -ggdb
|
||||
SRCDIR = ../../source
|
||||
OBJDIR = obj
|
||||
SRCNAMES = \
|
||||
as_atomic.cpp \
|
||||
as_builder.cpp \
|
||||
as_bytecode.cpp \
|
||||
as_callfunc.cpp \
|
||||
as_callfunc_mips.cpp \
|
||||
as_callfunc_ppc_64.cpp \
|
||||
as_callfunc_ppc.cpp \
|
||||
as_callfunc_sh4.cpp \
|
||||
as_callfunc_x86.cpp \
|
||||
as_callfunc_x64_mingw.cpp \
|
||||
as_compiler.cpp \
|
||||
as_configgroup.cpp \
|
||||
as_context.cpp \
|
||||
as_datatype.cpp \
|
||||
as_generic.cpp \
|
||||
as_gc.cpp \
|
||||
as_globalproperty.cpp \
|
||||
as_memory.cpp \
|
||||
as_module.cpp \
|
||||
as_objecttype.cpp \
|
||||
as_outputbuffer.cpp \
|
||||
as_parser.cpp \
|
||||
as_restore.cpp \
|
||||
as_scriptcode.cpp \
|
||||
as_scriptengine.cpp \
|
||||
as_scriptfunction.cpp \
|
||||
as_scriptnode.cpp \
|
||||
as_scriptobject.cpp \
|
||||
as_string.cpp \
|
||||
as_string_util.cpp \
|
||||
as_thread.cpp \
|
||||
as_tokenizer.cpp \
|
||||
as_typeinfo.cpp \
|
||||
as_variablescope.cpp \
|
||||
|
||||
OBJ = $(addprefix $(OBJDIR)/, $(notdir $(SRCNAMES:.cpp=.o)))
|
||||
BIN = ../../lib/libangelscript.a
|
||||
OBJ_D = $(subst /,\,$(OBJ))
|
||||
BIN_D = $(subst /,\,$(BIN))
|
||||
DELETER = del /f
|
||||
COPIER = copy /y
|
||||
INCLUDEFILES_D = ..\..\include\angelscript.h
|
||||
UNINSTALLFILES_D = $(MINGDIR)\lib\libangelscript.a $(MINGDIR)\include\angelscript.h
|
||||
|
||||
all: $(BIN)
|
||||
|
||||
$(BIN): $(OBJ)
|
||||
$(AR) rcs $(BIN) $(OBJ)
|
||||
@echo -------------------------------------------------------------------
|
||||
@echo Done. Now type 'make install' to install the library on your MinGW.
|
||||
|
||||
$(OBJDIR)/%.o: $(SRCDIR)/%.cpp
|
||||
$(CXX) $(CXXFLAGS) -o $@ -c $<
|
||||
|
||||
|
||||
clean:
|
||||
$(DELETER) $(OBJ_D) $(BIN_D)
|
||||
|
||||
install: $(BIN)
|
||||
$(COPIER) $(BIN_D) $(MINGDIR)\lib
|
||||
$(COPIER) $(INCLUDEFILES_D) $(MINGDIR)\include
|
||||
@echo -------------------------------------------------------------------
|
||||
@echo Angelscript library installed. Enjoy!
|
||||
|
||||
uninstall:
|
||||
$(DELETER) $(UNINSTALLFILES_D)
|
||||
@echo -------------------------------------------------------------------
|
||||
@echo Angelscript library uninstalled.
|
||||
|
||||
.PHONY: all clean install uninstall
|
2
lib/angelscript/projects/mingw/obj/delete.me
Normal file
2
lib/angelscript/projects/mingw/obj/delete.me
Normal file
@ -0,0 +1,2 @@
|
||||
This file is here just in case your unarchiver does not extract empty directories.
|
||||
Feel free to remove it.
|
9
lib/angelscript/projects/mingw/readme.txt
Normal file
9
lib/angelscript/projects/mingw/readme.txt
Normal file
@ -0,0 +1,9 @@
|
||||
If you haven't done that already set up an environment variable named MINGDIR
|
||||
pointing the the directory where your MinGW is, e.g. "C:\MINGW"
|
||||
|
||||
To compile the library, just type in the command line:
|
||||
|
||||
make
|
||||
make install
|
||||
|
||||
Sent in by Jakub "krajzega" Wasilewski
|
BIN
lib/angelscript/projects/msvc10/angelscript.sdf
Normal file
BIN
lib/angelscript/projects/msvc10/angelscript.sdf
Normal file
Binary file not shown.
26
lib/angelscript/projects/msvc10/angelscript.sln
Normal file
26
lib/angelscript/projects/msvc10/angelscript.sln
Normal file
@ -0,0 +1,26 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 11.00
|
||||
# Visual Studio 2010
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "angelscript", "angelscript.vcxproj", "{39E6AF97-6BA3-4A72-8C61-BCEBF214EBFD}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
Debug|x64 = Debug|x64
|
||||
Release|Win32 = Release|Win32
|
||||
Release|x64 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{39E6AF97-6BA3-4A72-8C61-BCEBF214EBFD}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{39E6AF97-6BA3-4A72-8C61-BCEBF214EBFD}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{39E6AF97-6BA3-4A72-8C61-BCEBF214EBFD}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{39E6AF97-6BA3-4A72-8C61-BCEBF214EBFD}.Debug|x64.Build.0 = Debug|x64
|
||||
{39E6AF97-6BA3-4A72-8C61-BCEBF214EBFD}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{39E6AF97-6BA3-4A72-8C61-BCEBF214EBFD}.Release|Win32.Build.0 = Release|Win32
|
||||
{39E6AF97-6BA3-4A72-8C61-BCEBF214EBFD}.Release|x64.ActiveCfg = Release|x64
|
||||
{39E6AF97-6BA3-4A72-8C61-BCEBF214EBFD}.Release|x64.Build.0 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
BIN
lib/angelscript/projects/msvc10/angelscript.v11.suo
Normal file
BIN
lib/angelscript/projects/msvc10/angelscript.v11.suo
Normal file
Binary file not shown.
@ -0,0 +1,2 @@
|
||||
#v4.0:v110:false
|
||||
Debug|Win32|D:\Uni Torrents\angelscript_2.28.1\sdk\angelscript\projects\msvc2012\|
|
BIN
lib/angelscript/projects/msvc2012/angelscript.sdf
Normal file
BIN
lib/angelscript/projects/msvc2012/angelscript.sdf
Normal file
Binary file not shown.
26
lib/angelscript/projects/msvc2012/angelscript.sln
Normal file
26
lib/angelscript/projects/msvc2012/angelscript.sln
Normal file
@ -0,0 +1,26 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Express 2012 for Windows Desktop
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "angelscript", "angelscript.vcxproj", "{39E6AF97-6BA3-4A72-8C61-BCEBF214EBFD}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
Debug|x64 = Debug|x64
|
||||
Release|Win32 = Release|Win32
|
||||
Release|x64 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{39E6AF97-6BA3-4A72-8C61-BCEBF214EBFD}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{39E6AF97-6BA3-4A72-8C61-BCEBF214EBFD}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{39E6AF97-6BA3-4A72-8C61-BCEBF214EBFD}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{39E6AF97-6BA3-4A72-8C61-BCEBF214EBFD}.Debug|x64.Build.0 = Debug|x64
|
||||
{39E6AF97-6BA3-4A72-8C61-BCEBF214EBFD}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{39E6AF97-6BA3-4A72-8C61-BCEBF214EBFD}.Release|Win32.Build.0 = Release|Win32
|
||||
{39E6AF97-6BA3-4A72-8C61-BCEBF214EBFD}.Release|x64.ActiveCfg = Release|x64
|
||||
{39E6AF97-6BA3-4A72-8C61-BCEBF214EBFD}.Release|x64.Build.0 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
BIN
lib/angelscript/projects/msvc2012/angelscript.v11.suo
Normal file
BIN
lib/angelscript/projects/msvc2012/angelscript.v11.suo
Normal file
Binary file not shown.
29
lib/angelscript/projects/msvc6/angelscript.dsw
Normal file
29
lib/angelscript/projects/msvc6/angelscript.dsw
Normal file
@ -0,0 +1,29 @@
|
||||
Microsoft Developer Studio Workspace File, Format Version 6.00
|
||||
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "angelscript lib"=.\lib\angelscript.dsp - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Global:
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<3>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
417
lib/angelscript/projects/msvc6/lib/angelscript.dsp
Normal file
417
lib/angelscript/projects/msvc6/lib/angelscript.dsp
Normal file
@ -0,0 +1,417 @@
|
||||
# Microsoft Developer Studio Project File - Name="angelscript lib" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Static Library" 0x0104
|
||||
|
||||
CFG=angelscript lib - Win32 Debug
|
||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||
!MESSAGE use the Export Makefile command and run
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "angelscript.mak".
|
||||
!MESSAGE
|
||||
!MESSAGE You can specify a configuration when running NMAKE
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "angelscript.mak" CFG="angelscript lib - Win32 Debug"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "angelscript lib - Win32 Release" (based on "Win32 (x86) Static Library")
|
||||
!MESSAGE "angelscript lib - Win32 Debug" (based on "Win32 (x86) Static Library")
|
||||
!MESSAGE "angelscript lib - Win32 Debug with stats" (based on "Win32 (x86) Static Library")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
# PROP AllowPerConfigDependencies 0
|
||||
# PROP Scc_ProjName ""
|
||||
# PROP Scc_LocalPath ""
|
||||
CPP=cl.exe
|
||||
RSC=rc.exe
|
||||
|
||||
!IF "$(CFG)" == "angelscript lib - Win32 Release"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "Release"
|
||||
# PROP BASE Intermediate_Dir "Release"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "Release"
|
||||
# PROP Intermediate_Dir "Release"
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
|
||||
# ADD CPP /nologo /MT /W3 /O2 /Oy- /Ob2 /D "AS_NO_EXCEPTIONS" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /D "ANGELSCRIPT_EXPORT" /YX /FD /opt:nowin98 /c
|
||||
# ADD BASE RSC /l 0x416 /d "NDEBUG"
|
||||
# ADD RSC /l 0x416 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LIB32=link.exe -lib
|
||||
# ADD BASE LIB32 /nologo
|
||||
# ADD LIB32 /nologo /out:"..\..\..\lib\angelscript.lib"
|
||||
|
||||
!ELSEIF "$(CFG)" == "angelscript lib - Win32 Debug"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir "Debug"
|
||||
# PROP BASE Intermediate_Dir "Debug"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "Debug"
|
||||
# PROP Intermediate_Dir "Debug"
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /D "AS_NO_EXCEPTIONS" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /D "ANGELSCRIPT_EXPORT" /YX /FD /opt:nowin98 /GZ /c
|
||||
# ADD BASE RSC /l 0x416 /d "_DEBUG"
|
||||
# ADD RSC /l 0x416 /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LIB32=link.exe -lib
|
||||
# ADD BASE LIB32 /nologo
|
||||
# ADD LIB32 /nologo /out:"..\..\..\lib\angelscriptd.lib"
|
||||
|
||||
!ELSEIF "$(CFG)" == "angelscript lib - Win32 Debug with stats"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir "angelscript_lib___Win32_Debug_with_stats"
|
||||
# PROP BASE Intermediate_Dir "angelscript_lib___Win32_Debug_with_stats"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "Debug_with_stats"
|
||||
# PROP Intermediate_Dir "Debug_with_stats"
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /MDd /W3 /Gm /ZI /Od /D "AS_DEBUG" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /D "ANGELSCRIPT_EXPORT" /YX /FD /opt:nowin98 /GZ /c
|
||||
# ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /D "AS_NO_EXCEPTIONS" /D "AS_DEBUG_STATS" /D "AS_USE_NAMESPACE" /D "AS_DEBUG" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /D "ANGELSCRIPT_EXPORT" /FR /YX /FD /opt:nowin98 /GZ /c
|
||||
# ADD BASE RSC /l 0x416 /d "_DEBUG"
|
||||
# ADD RSC /l 0x416 /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LIB32=link.exe -lib
|
||||
# ADD BASE LIB32 /nologo /out:"..\..\..\lib\angelscript.lib"
|
||||
# ADD LIB32 /nologo /out:"..\..\..\lib\angelscriptd.lib"
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
# Name "angelscript lib - Win32 Release"
|
||||
# Name "angelscript lib - Win32 Debug"
|
||||
# Name "angelscript lib - Win32 Debug with stats"
|
||||
# Begin Group "Source Files"
|
||||
|
||||
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\source\as_atomic.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\source\as_builder.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\source\as_bytecode.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\source\as_callfunc.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\source\as_callfunc_arm.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\source\as_callfunc_mips.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\source\as_callfunc_ppc.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\source\as_callfunc_ppc_64.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\source\as_callfunc_sh4.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\source\as_callfunc_x64_gcc.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\source\as_callfunc_x64_msvc.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\source\as_callfunc_x86.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\source\as_callfunc_xenon.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\source\as_compiler.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\source\as_configgroup.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\source\as_context.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\source\as_datatype.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\source\as_gc.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\source\as_generic.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\source\as_globalproperty.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\source\as_memory.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\source\as_module.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\source\as_objecttype.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\source\as_outputbuffer.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\source\as_parser.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\source\as_restore.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\source\as_scriptcode.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\source\as_scriptengine.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\source\as_scriptfunction.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\source\as_scriptnode.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\source\as_scriptobject.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\source\as_string.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\source\as_string_util.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\source\as_thread.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\source\as_tokenizer.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\source\as_typeinfo.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\source\as_variablescope.cpp
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Header Files"
|
||||
|
||||
# PROP Default_Filter "h;hpp;hxx;hm;inl"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\source\as_array.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\source\as_atomic.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\source\as_builder.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\source\as_bytecode.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\source\as_callfunc.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\source\as_compiler.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\source\as_config.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\source\as_configgroup.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\source\as_context.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\source\as_criticalsection.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\source\as_datatype.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\source\as_debug.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\source\as_gc.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\source\as_generic.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\source\as_map.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\source\as_memory.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\source\as_module.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\source\as_objecttype.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\source\as_outputbuffer.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\source\as_parser.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\source\as_property.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\source\as_restore.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\source\as_scriptcode.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\source\as_scriptengine.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\source\as_scriptfunction.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\source\as_scriptnode.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\source\as_scriptobject.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\source\as_string.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\source\as_string_util.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\source\as_symboltable.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\source\as_texts.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\source\as_thread.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\source\as_tokendef.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\source\as_tokenizer.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\source\as_typeinfo.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\source\as_variablescope.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Interface"
|
||||
|
||||
# PROP Default_Filter ""
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\include\angelscript.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# End Target
|
||||
# End Project
|
21
lib/angelscript/projects/msvc7/msvc7.sln
Normal file
21
lib/angelscript/projects/msvc7/msvc7.sln
Normal file
@ -0,0 +1,21 @@
|
||||
Microsoft Visual Studio Solution File, Format Version 8.00
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "msvc7", "msvc7.vcproj", "{42D445F6-0462-4870-87CD-01E964EA8B97}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfiguration) = preSolution
|
||||
Debug = Debug
|
||||
Release = Release
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfiguration) = postSolution
|
||||
{42D445F6-0462-4870-87CD-01E964EA8B97}.Debug.ActiveCfg = Debug|Win32
|
||||
{42D445F6-0462-4870-87CD-01E964EA8B97}.Debug.Build.0 = Debug|Win32
|
||||
{42D445F6-0462-4870-87CD-01E964EA8B97}.Release.ActiveCfg = Release|Win32
|
||||
{42D445F6-0462-4870-87CD-01E964EA8B97}.Release.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityAddIns) = postSolution
|
||||
EndGlobalSection
|
||||
EndGlobal
|
329
lib/angelscript/projects/msvc7/msvc7.vcproj
Normal file
329
lib/angelscript/projects/msvc7/msvc7.vcproj
Normal file
@ -0,0 +1,329 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="7.10"
|
||||
Name="msvc7"
|
||||
ProjectGUID="{42D445F6-0462-4870-87CD-01E964EA8B97}"
|
||||
RootNamespace="msvc7"
|
||||
Keyword="Win32Proj">
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"/>
|
||||
</Platforms>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="../../lib"
|
||||
IntermediateDirectory="Debug"
|
||||
ConfigurationType="4"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
PreprocessorDefinitions="AS_USE_NAMESPACE;AS_DEBUG;WIN32;_DEBUG;_LIB;AS_C_INTERFACE"
|
||||
MinimalRebuild="TRUE"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="5"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="4"
|
||||
Detect64BitPortabilityProblems="TRUE"
|
||||
DebugInformationFormat="4"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
OutputFile="$(OutDir)/angelscriptd.lib"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="../../lib"
|
||||
IntermediateDirectory="Release"
|
||||
ConfigurationType="4"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
|
||||
StringPooling="TRUE"
|
||||
RuntimeLibrary="0"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="TRUE"
|
||||
DebugInformationFormat="3"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
OutputFile="$(OutDir)/angelscript.lib"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
|
||||
<File
|
||||
RelativePath="..\..\source\as_atomic.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_builder.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_bytecode.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_callfunc.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_callfunc_mips.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_callfunc_ppc.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_callfunc_sh4.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_callfunc_x64_gcc.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_callfunc_x86.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_callfunc_xenon.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_compiler.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_configgroup.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_context.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_datatype.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_gc.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_generic.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_globalproperty.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_memory.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_module.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_objecttype.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_outputbuffer.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_parser.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_restore.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_scriptcode.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_scriptengine.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_scriptfunction.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_scriptnode.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_scriptobject.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_string.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_string_util.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_thread.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_tokenizer.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_typeinfo.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_variablescope.cpp">
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
|
||||
<File
|
||||
RelativePath="..\..\include\angelscript.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_array.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_atomic.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_builder.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_bytecode.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_bytecodedef.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_callfunc.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_compiler.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_config.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_configgroup.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_context.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_criticalsection.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_datatype.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_debug.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_gc.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_generic.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_map.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_memory.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_module.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_objecttype.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_outputbuffer.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_parser.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_property.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_restore.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_scriptcode.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_scriptengine.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_scriptfunction.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_scriptnode.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_scriptobject.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_string.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_string_util.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_texts.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_thread.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_tokendef.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_tokenizer.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_typeinfo.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_variablescope.h">
|
||||
</File>
|
||||
</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>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
20
lib/angelscript/projects/msvc8/angelscript.sln
Normal file
20
lib/angelscript/projects/msvc8/angelscript.sln
Normal file
@ -0,0 +1,20 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 9.00
|
||||
# Visual C++ Express 2005
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "angelscript", "angelscript.vcproj", "{39E6AF97-6BA3-4A72-8C61-BCEBF214EBFD}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
Release|Win32 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{39E6AF97-6BA3-4A72-8C61-BCEBF214EBFD}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{39E6AF97-6BA3-4A72-8C61-BCEBF214EBFD}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{39E6AF97-6BA3-4A72-8C61-BCEBF214EBFD}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{39E6AF97-6BA3-4A72-8C61-BCEBF214EBFD}.Release|Win32.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
425
lib/angelscript/projects/msvc8/angelscript.vcproj
Normal file
425
lib/angelscript/projects/msvc8/angelscript.vcproj
Normal file
@ -0,0 +1,425 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8,00"
|
||||
Name="angelscript"
|
||||
ProjectGUID="{39E6AF97-6BA3-4A72-8C61-BCEBF214EBFD}"
|
||||
RootNamespace="angelscript"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="..\..\lib"
|
||||
IntermediateDirectory="$(ConfigurationName)"
|
||||
ConfigurationType="4"
|
||||
WholeProgramOptimization="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
WholeProgramOptimization="false"
|
||||
PreprocessorDefinitions="ANGELSCRIPT_EXPORT;AS_DEBUG;WIN32;_DEBUG;_LIB"
|
||||
StringPooling="true"
|
||||
ExceptionHandling="0"
|
||||
BasicRuntimeChecks="3"
|
||||
SmallerTypeCheck="false"
|
||||
RuntimeLibrary="3"
|
||||
RuntimeTypeInfo="false"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
OutputFile="$(OutDir)\$(ProjectName)d.lib"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="../../lib"
|
||||
IntermediateDirectory="$(ConfigurationName)"
|
||||
ConfigurationType="4"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
WholeProgramOptimization="true"
|
||||
PreprocessorDefinitions="ANGELSCRIPT_EXPORT;WIN32;NDEBUG;_LIB"
|
||||
StringPooling="true"
|
||||
ExceptionHandling="0"
|
||||
RuntimeLibrary="2"
|
||||
BufferSecurityCheck="false"
|
||||
RuntimeTypeInfo="false"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\..\source\as_atomic.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_builder.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_bytecode.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_callfunc.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_callfunc_mips.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_callfunc_sh4.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_callfunc_x86.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_compiler.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_configgroup.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_context.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_datatype.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_gc.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_generic.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_globalproperty.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_memory.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_module.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_objecttype.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_outputbuffer.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_parser.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_restore.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_scriptcode.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_scriptengine.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_scriptfunction.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_scriptnode.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_scriptobject.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_string.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_string_util.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_thread.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_tokenizer.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_typeinfo.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_variablescope.cpp"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\..\include\angelscript.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_array.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_builder.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_bytecode.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_bytecodedef.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_callfunc.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_compiler.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_config.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_configgroup.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_context.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_datatype.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_debug.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_generic.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_map.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_module.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_objecttype.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_outputbuffer.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_parser.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_property.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_restore.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_scriptcode.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_scriptengine.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_scriptfunction.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_scriptnode.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_scriptobject.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_string.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_string_util.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_texts.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_thread.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_tokendef.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_tokenizer.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_typeinfo.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_variablescope.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Resource Files"
|
||||
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
|
||||
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
|
||||
>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
26
lib/angelscript/projects/msvc9/angelscript.sln
Normal file
26
lib/angelscript/projects/msvc9/angelscript.sln
Normal file
@ -0,0 +1,26 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 10.00
|
||||
# Visual C++ Express 2008
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "angelscript", "angelscript.vcproj", "{39E6AF97-6BA3-4A72-8C61-BCEBF214EBFD}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
Debug|x64 = Debug|x64
|
||||
Release|Win32 = Release|Win32
|
||||
Release|x64 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{39E6AF97-6BA3-4A72-8C61-BCEBF214EBFD}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{39E6AF97-6BA3-4A72-8C61-BCEBF214EBFD}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{39E6AF97-6BA3-4A72-8C61-BCEBF214EBFD}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{39E6AF97-6BA3-4A72-8C61-BCEBF214EBFD}.Debug|x64.Build.0 = Debug|x64
|
||||
{39E6AF97-6BA3-4A72-8C61-BCEBF214EBFD}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{39E6AF97-6BA3-4A72-8C61-BCEBF214EBFD}.Release|Win32.Build.0 = Release|Win32
|
||||
{39E6AF97-6BA3-4A72-8C61-BCEBF214EBFD}.Release|x64.ActiveCfg = Release|x64
|
||||
{39E6AF97-6BA3-4A72-8C61-BCEBF214EBFD}.Release|x64.Build.0 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
663
lib/angelscript/projects/msvc9/angelscript.vcproj
Normal file
663
lib/angelscript/projects/msvc9/angelscript.vcproj
Normal file
@ -0,0 +1,663 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="9,00"
|
||||
Name="angelscript"
|
||||
ProjectGUID="{39E6AF97-6BA3-4A72-8C61-BCEBF214EBFD}"
|
||||
RootNamespace="angelscript"
|
||||
TargetFrameworkVersion="131072"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
<Platform
|
||||
Name="x64"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
<DefaultToolFile
|
||||
FileName="masm.rules"
|
||||
/>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="..\..\lib"
|
||||
IntermediateDirectory="$(ConfigurationName)"
|
||||
ConfigurationType="4"
|
||||
WholeProgramOptimization="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="MASM"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
WholeProgramOptimization="false"
|
||||
PreprocessorDefinitions="ANGELSCRIPT_EXPORT;AS_DEBUG;WIN32;_DEBUG;_LIB"
|
||||
StringPooling="true"
|
||||
ExceptionHandling="1"
|
||||
BasicRuntimeChecks="3"
|
||||
SmallerTypeCheck="false"
|
||||
RuntimeLibrary="1"
|
||||
RuntimeTypeInfo="false"
|
||||
WarningLevel="4"
|
||||
WarnAsError="true"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
LinkLibraryDependencies="true"
|
||||
OutputFile="$(OutDir)\$(ProjectName)d.lib"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="../../lib"
|
||||
IntermediateDirectory="$(ConfigurationName)"
|
||||
ConfigurationType="4"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="MASM"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="3"
|
||||
FavorSizeOrSpeed="1"
|
||||
WholeProgramOptimization="true"
|
||||
PreprocessorDefinitions="ANGELSCRIPT_EXPORT;WIN32;NDEBUG;_LIB"
|
||||
StringPooling="true"
|
||||
ExceptionHandling="1"
|
||||
RuntimeLibrary="0"
|
||||
BufferSecurityCheck="false"
|
||||
RuntimeTypeInfo="false"
|
||||
WarningLevel="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Debug|x64"
|
||||
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
|
||||
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
|
||||
ConfigurationType="4"
|
||||
WholeProgramOptimization="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="MASM"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
TargetEnvironment="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
WholeProgramOptimization="false"
|
||||
PreprocessorDefinitions="ANGELSCRIPT_EXPORT;AS_DEBUG;_DEBUG;_LIB"
|
||||
StringPooling="true"
|
||||
ExceptionHandling="1"
|
||||
BasicRuntimeChecks="3"
|
||||
SmallerTypeCheck="false"
|
||||
RuntimeLibrary="1"
|
||||
RuntimeTypeInfo="false"
|
||||
WarningLevel="4"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
LinkLibraryDependencies="true"
|
||||
OutputFile="..\..\lib\angelscript64d.lib"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|x64"
|
||||
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
|
||||
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
|
||||
ConfigurationType="4"
|
||||
WholeProgramOptimization="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="MASM"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
TargetEnvironment="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="3"
|
||||
InlineFunctionExpansion="2"
|
||||
EnableIntrinsicFunctions="true"
|
||||
FavorSizeOrSpeed="1"
|
||||
WholeProgramOptimization="true"
|
||||
PreprocessorDefinitions="ANGELSCRIPT_EXPORT;NDEBUG;_LIB"
|
||||
StringPooling="true"
|
||||
ExceptionHandling="1"
|
||||
RuntimeLibrary="0"
|
||||
BufferSecurityCheck="false"
|
||||
RuntimeTypeInfo="false"
|
||||
WarningLevel="4"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
LinkLibraryDependencies="true"
|
||||
OutputFile="..\..\lib\angelscript64.lib"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\..\source\as_atomic.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_builder.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_bytecode.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_callfunc.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_callfunc_arm.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_callfunc_mips.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_callfunc_ppc.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_callfunc_ppc_64.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_callfunc_sh4.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_callfunc_x64_gcc.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_callfunc_x64_mingw.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_callfunc_x64_msvc.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_callfunc_x64_msvc_asm.asm"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
ExcludedFromBuild="true"
|
||||
>
|
||||
<Tool
|
||||
Name="MASM"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
ExcludedFromBuild="true"
|
||||
>
|
||||
<Tool
|
||||
Name="MASM"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|x64"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
CommandLine="ml64.exe /c /nologo /Fo$(OutDir)\as_callfunc_x64_msvc_asm.obj /W3 /Zi /Ta $(InputDir)\$(InputFileName)
"
|
||||
Outputs="$(OutDir)\as_callfunc_x64_msvc_asm.obj"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|x64"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
CommandLine="ml64.exe /c /nologo /Fo$(OutDir)\as_callfunc_x64_msvc_asm.obj /W3 /Zi /Ta $(InputDir)\$(InputFileName)
"
|
||||
Outputs="$(OutDir)\as_callfunc_x64_msvc_asm.obj"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_callfunc_x86.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_callfunc_xenon.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_compiler.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_configgroup.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_context.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_datatype.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_gc.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_generic.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_globalproperty.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_memory.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_module.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_objecttype.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_outputbuffer.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_parser.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_restore.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_scriptcode.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_scriptengine.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_scriptfunction.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_scriptnode.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_scriptobject.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_string.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_string_util.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_thread.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_tokenizer.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_typeinfo.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_variablescope.cpp"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\..\include\angelscript.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_array.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_atomic.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_builder.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_bytecode.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_callfunc.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_compiler.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_config.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_configgroup.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_context.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_criticalsection.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_datatype.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_debug.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_gc.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_generic.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_map.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_memory.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_module.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_objecttype.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_outputbuffer.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_parser.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_property.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_restore.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_scriptcode.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_scriptengine.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_scriptfunction.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_scriptnode.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_scriptobject.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_string.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_string_util.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_symboltable.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_texts.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_thread.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_tokendef.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_tokenizer.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_typeinfo.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\source\as_variablescope.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Resource Files"
|
||||
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
|
||||
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
|
||||
>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
136
lib/angelscript/projects/trolltechqt/angelscript.pro
Normal file
136
lib/angelscript/projects/trolltechqt/angelscript.pro
Normal file
@ -0,0 +1,136 @@
|
||||
TEMPLATE = lib
|
||||
|
||||
DEPENDPATH += ../../source ../../include
|
||||
INCLUDEPATH += ../../include
|
||||
|
||||
QMAKE_CXXFLAGS += -Wno-strict-aliasing
|
||||
|
||||
CONFIG -= debug debug_and_release release app_bundle qt dll
|
||||
|
||||
CONFIG += staticlib release
|
||||
|
||||
DEFINES += _CRT_SECURE_NO_WARNINGS
|
||||
|
||||
DESTDIR = ../../lib
|
||||
|
||||
win32: LIBS += -lwinmm
|
||||
|
||||
HEADERS += ../../include/angelscript.h \
|
||||
../../source/as_array.h \
|
||||
../../source/as_atomic.h \
|
||||
../../source/as_builder.h \
|
||||
../../source/as_bytecode.h \
|
||||
../../source/as_callfunc.h \
|
||||
../../source/as_compiler.h \
|
||||
../../source/as_config.h \
|
||||
../../source/as_configgroup.h \
|
||||
../../source/as_context.h \
|
||||
../../source/as_criticalsection.h \
|
||||
../../source/as_datatype.h \
|
||||
../../source/as_debug.h \
|
||||
../../source/as_gc.h \
|
||||
../../source/as_generic.h \
|
||||
../../source/as_map.h \
|
||||
../../source/as_memory.h \
|
||||
../../source/as_module.h \
|
||||
../../source/as_objecttype.h \
|
||||
../../source/as_outputbuffer.h \
|
||||
../../source/as_parser.h \
|
||||
../../source/as_property.h \
|
||||
../../source/as_restore.h \
|
||||
../../source/as_scriptcode.h \
|
||||
../../source/as_scriptengine.h \
|
||||
../../source/as_scriptfunction.h \
|
||||
../../source/as_scriptnode.h \
|
||||
../../source/as_scriptobject.h \
|
||||
../../source/as_string.h \
|
||||
../../source/as_string_util.h \
|
||||
../../source/as_symboltable.h \
|
||||
../../source/as_texts.h \
|
||||
../../source/as_thread.h \
|
||||
../../source/as_tokendef.h \
|
||||
../../source/as_tokenizer.h \
|
||||
../../source/as_typeinfo.h \
|
||||
../../source/as_variablescope.h
|
||||
|
||||
SOURCES += ../../source/as_atomic.cpp \
|
||||
../../source/as_builder.cpp \
|
||||
../../source/as_bytecode.cpp \
|
||||
../../source/as_callfunc.cpp \
|
||||
../../source/as_callfunc_mips.cpp \
|
||||
../../source/as_callfunc_ppc.cpp \
|
||||
../../source/as_callfunc_ppc_64.cpp \
|
||||
../../source/as_callfunc_sh4.cpp \
|
||||
../../source/as_callfunc_x64_gcc.cpp \
|
||||
../../source/as_callfunc_x64_mingw.cpp \
|
||||
../../source/as_callfunc_x64_msvc.cpp \
|
||||
../../source/as_callfunc_x86.cpp \
|
||||
../../source/as_callfunc_xenon.cpp \
|
||||
../../source/as_compiler.cpp \
|
||||
../../source/as_configgroup.cpp \
|
||||
../../source/as_context.cpp \
|
||||
../../source/as_datatype.cpp \
|
||||
../../source/as_gc.cpp \
|
||||
../../source/as_generic.cpp \
|
||||
../../source/as_globalproperty.cpp \
|
||||
../../source/as_memory.cpp \
|
||||
../../source/as_module.cpp \
|
||||
../../source/as_objecttype.cpp \
|
||||
../../source/as_outputbuffer.cpp \
|
||||
../../source/as_parser.cpp \
|
||||
../../source/as_restore.cpp \
|
||||
../../source/as_scriptcode.cpp \
|
||||
../../source/as_scriptengine.cpp \
|
||||
../../source/as_scriptfunction.cpp \
|
||||
../../source/as_scriptnode.cpp \
|
||||
../../source/as_scriptobject.cpp \
|
||||
../../source/as_string.cpp \
|
||||
../../source/as_string_util.cpp \
|
||||
../../source/as_thread.cpp \
|
||||
../../source/as_tokenizer.cpp \
|
||||
../../source/as_typeinfo.cpp \
|
||||
../../source/as_variablescope.cpp
|
||||
|
||||
HEADERS += ../../../add_on/scriptany/scriptany.h \
|
||||
../../../add_on/scriptarray/scriptarray.h \
|
||||
../../../add_on/scriptdictionary/scriptdictionary.h \
|
||||
../../../add_on/scriptmath/scriptmath.h \
|
||||
../../../add_on/scripthandle/scripthandle.h \
|
||||
../../../add_on/scriptstdstring/scriptstdstring.h \
|
||||
../../../add_on/scriptbuilder/scriptbuilder.h
|
||||
|
||||
SOURCES += ../../../add_on/scriptany/scriptany.cpp \
|
||||
../../../add_on/scriptarray/scriptarray.cpp \
|
||||
../../../add_on/scriptdictionary/scriptdictionary.cpp \
|
||||
../../../add_on/scriptmath/scriptmath.cpp \
|
||||
../../../add_on/scripthandle/scripthandle.cpp \
|
||||
../../../add_on/scriptstdstring/scriptstdstring.cpp \
|
||||
../../../add_on/scriptstdstring/scriptstdstring_utils.cpp \
|
||||
../../../add_on/scriptbuilder/scriptbuilder.cpp
|
||||
|
||||
OBJECTS_DIR = tmp
|
||||
MOC_DIR = tmp
|
||||
UI_DIR = tmp
|
||||
RCC_DIR = tmp
|
||||
|
||||
!win32-g++:win32:contains(QMAKE_HOST.arch, x86_64):{
|
||||
asm_compiler.commands = ml64 /c
|
||||
asm_compiler.commands += /Fo ${QMAKE_FILE_OUT} ${QMAKE_FILE_IN}
|
||||
asm_compiler.output = ${QMAKE_VAR_OBJECTS_DIR}${QMAKE_FILE_BASE}$${first(QMAKE_EXT_OBJ)}
|
||||
asm_compiler.input = ASM_SOURCES
|
||||
asm_compiler.variable_out = OBJECTS
|
||||
asm_compiler.name = compiling[asm] ${QMAKE_FILE_IN}
|
||||
silent:asm_compiler.commands = @echo compiling[asm] ${QMAKE_FILE_IN} && $$asm_compiler.commands
|
||||
QMAKE_EXTRA_COMPILERS += asm_compiler
|
||||
|
||||
ASM_SOURCES += \
|
||||
$$PWD/angelscript/source/as_callfunc_x64_msvc_asm.asm
|
||||
|
||||
if(win32-msvc2008|win32-msvc2010):equals(TEMPLATE_PREFIX, "vc") {
|
||||
SOURCES += \
|
||||
$$PWD/angelscript/source/as_callfunc_x64_msvc_asm.asm
|
||||
}
|
||||
}
|
||||
|
||||
# QMAKE_CXXFLAGS_RELEASE += /MP
|
||||
|
1076
lib/angelscript/projects/xcode/angelscript.xcodeproj/project.pbxproj
Normal file
1076
lib/angelscript/projects/xcode/angelscript.xcodeproj/project.pbxproj
Normal file
File diff suppressed because it is too large
Load Diff
7
lib/angelscript/projects/xcode/angelscript_Prefix.pch
Normal file
7
lib/angelscript/projects/xcode/angelscript_Prefix.pch
Normal file
@ -0,0 +1,7 @@
|
||||
//
|
||||
// Prefix header for all source files of the 'CocoaTouchStaticLibrary' target in the 'CocoaTouchStaticLibrary' project.
|
||||
//
|
||||
|
||||
#ifdef __OBJC__
|
||||
#import <Foundation/Foundation.h>
|
||||
#endif
|
516
lib/angelscript/source/as_array.h
Normal file
516
lib/angelscript/source/as_array.h
Normal file
@ -0,0 +1,516 @@
|
||||
/*
|
||||
AngelCode Scripting Library
|
||||
Copyright (c) 2003-2012 Andreas Jonsson
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any
|
||||
damages arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any
|
||||
purpose, including commercial applications, and to alter it and
|
||||
redistribute it freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you
|
||||
must not claim that you wrote the original software. If you use
|
||||
this software in a product, an acknowledgment in the product
|
||||
documentation would be appreciated but is not required.
|
||||
|
||||
2. Altered source versions must be plainly marked as such, and
|
||||
must not be misrepresented as being the original software.
|
||||
|
||||
3. This notice may not be removed or altered from any source
|
||||
distribution.
|
||||
|
||||
The original version of this library can be located at:
|
||||
http://www.angelcode.com/angelscript/
|
||||
|
||||
Andreas Jonsson
|
||||
andreas@angelcode.com
|
||||
*/
|
||||
|
||||
#ifndef AS_ARRAY_H
|
||||
#define AS_ARRAY_H
|
||||
|
||||
#if !defined(AS_NO_MEMORY_H)
|
||||
#include <memory.h>
|
||||
#endif
|
||||
#include <string.h> // some compilers declare memcpy() here
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(disable:4345) // warning about a change in how the code is handled in this version
|
||||
#endif
|
||||
|
||||
BEGIN_AS_NAMESPACE
|
||||
|
||||
template <class T> class asCArray
|
||||
{
|
||||
public:
|
||||
asCArray();
|
||||
asCArray(const asCArray<T> &);
|
||||
asCArray(size_t reserve);
|
||||
~asCArray();
|
||||
|
||||
void Allocate(size_t numElements, bool keepData);
|
||||
void AllocateNoConstruct(size_t numElements, bool keepData);
|
||||
size_t GetCapacity() const;
|
||||
|
||||
void PushLast(const T &element);
|
||||
T PopLast();
|
||||
|
||||
bool SetLength(size_t numElements);
|
||||
bool SetLengthNoConstruct(size_t numElements);
|
||||
size_t GetLength() const;
|
||||
|
||||
void Copy(const T*, size_t count);
|
||||
asCArray<T> &operator =(const asCArray<T> &);
|
||||
void SwapWith(asCArray<T> &other);
|
||||
|
||||
const T &operator [](size_t index) const;
|
||||
T &operator [](size_t index);
|
||||
T *AddressOf();
|
||||
const T *AddressOf() const;
|
||||
|
||||
void Concatenate(const asCArray<T> &);
|
||||
void Concatenate(T*, unsigned int count);
|
||||
|
||||
bool Exists(const T &element) const;
|
||||
int IndexOf(const T &element) const;
|
||||
void RemoveIndex(size_t index); // Removes the entry without reordering the array
|
||||
void RemoveValue(const T &element); // Removes the value without reordering the array
|
||||
void RemoveIndexUnordered(size_t index); // Removes the entry without keeping the order
|
||||
|
||||
bool operator==(const asCArray<T> &) const;
|
||||
bool operator!=(const asCArray<T> &) const;
|
||||
|
||||
protected:
|
||||
T *array;
|
||||
size_t length;
|
||||
size_t maxLength;
|
||||
char buf[8];
|
||||
};
|
||||
|
||||
// Implementation
|
||||
|
||||
template <class T>
|
||||
T *asCArray<T>::AddressOf()
|
||||
{
|
||||
return array;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
const T *asCArray<T>::AddressOf() const
|
||||
{
|
||||
return array;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
asCArray<T>::asCArray(void)
|
||||
{
|
||||
array = 0;
|
||||
length = 0;
|
||||
maxLength = 0;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
asCArray<T>::asCArray(const asCArray<T> ©)
|
||||
{
|
||||
array = 0;
|
||||
length = 0;
|
||||
maxLength = 0;
|
||||
|
||||
*this = copy;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
asCArray<T>::asCArray(size_t reserve)
|
||||
{
|
||||
array = 0;
|
||||
length = 0;
|
||||
maxLength = 0;
|
||||
|
||||
Allocate(reserve, false);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
asCArray<T>::~asCArray(void)
|
||||
{
|
||||
// Allocating a zero length array will free all memory
|
||||
Allocate(0,0);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
size_t asCArray<T>::GetLength() const
|
||||
{
|
||||
return length;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
const T &asCArray<T>::operator [](size_t index) const
|
||||
{
|
||||
asASSERT(index < length);
|
||||
|
||||
return array[index];
|
||||
}
|
||||
|
||||
template <class T>
|
||||
T &asCArray<T>::operator [](size_t index)
|
||||
{
|
||||
asASSERT(index < length);
|
||||
|
||||
return array[index];
|
||||
}
|
||||
|
||||
template <class T>
|
||||
void asCArray<T>::PushLast(const T &element)
|
||||
{
|
||||
if( length == maxLength )
|
||||
{
|
||||
if( maxLength == 0 )
|
||||
Allocate(1, false);
|
||||
else
|
||||
Allocate(2*maxLength, true);
|
||||
|
||||
if( length == maxLength )
|
||||
{
|
||||
// Out of memory. Return without doing anything
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
array[length++] = element;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
T asCArray<T>::PopLast()
|
||||
{
|
||||
asASSERT(length > 0);
|
||||
|
||||
return array[--length];
|
||||
}
|
||||
|
||||
template <class T>
|
||||
void asCArray<T>::Allocate(size_t numElements, bool keepData)
|
||||
{
|
||||
// We have 4 situations
|
||||
// 1. The previous array is 8 bytes or smaller and the new array is also 8 bytes or smaller
|
||||
// 2. The previous array is 8 bytes or smaller and the new array is larger than 8 bytes
|
||||
// 3. The previous array is larger than 8 bytes and the new array is 8 bytes or smaller
|
||||
// 4. The previous array is larger than 8 bytes and the new array is also larger than 8 bytes
|
||||
|
||||
T *tmp = 0;
|
||||
if( numElements )
|
||||
{
|
||||
if( sizeof(T)*numElements <= 8 )
|
||||
// Use the internal buffer
|
||||
tmp = reinterpret_cast<T*>(buf);
|
||||
else
|
||||
{
|
||||
// Allocate the array and construct each of the elements
|
||||
tmp = asNEWARRAY(T,numElements);
|
||||
if( tmp == 0 )
|
||||
{
|
||||
// Out of memory. Return without doing anything
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if( array == tmp )
|
||||
{
|
||||
// Construct only the newly allocated elements
|
||||
for( size_t n = length; n < numElements; n++ )
|
||||
new (&tmp[n]) T();
|
||||
}
|
||||
else
|
||||
{
|
||||
// Construct all elements
|
||||
for( size_t n = 0; n < numElements; n++ )
|
||||
new (&tmp[n]) T();
|
||||
}
|
||||
}
|
||||
|
||||
if( array )
|
||||
{
|
||||
size_t oldLength = length;
|
||||
|
||||
if( array == tmp )
|
||||
{
|
||||
if( keepData )
|
||||
{
|
||||
if( length > numElements )
|
||||
length = numElements;
|
||||
}
|
||||
else
|
||||
length = 0;
|
||||
|
||||
// Call the destructor for elements that are no longer used
|
||||
for( size_t n = length; n < oldLength; n++ )
|
||||
array[n].~T();
|
||||
}
|
||||
else
|
||||
{
|
||||
if( keepData )
|
||||
{
|
||||
if( length > numElements )
|
||||
length = numElements;
|
||||
|
||||
for( size_t n = 0; n < length; n++ )
|
||||
tmp[n] = array[n];
|
||||
}
|
||||
else
|
||||
length = 0;
|
||||
|
||||
// Call the destructor for all elements
|
||||
for( size_t n = 0; n < oldLength; n++ )
|
||||
array[n].~T();
|
||||
|
||||
if( array != reinterpret_cast<T*>(buf) )
|
||||
asDELETEARRAY(array);
|
||||
}
|
||||
}
|
||||
|
||||
array = tmp;
|
||||
maxLength = numElements;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
void asCArray<T>::AllocateNoConstruct(size_t numElements, bool keepData)
|
||||
{
|
||||
// We have 4 situations
|
||||
// 1. The previous array is 8 bytes or smaller and the new array is also 8 bytes or smaller
|
||||
// 2. The previous array is 8 bytes or smaller and the new array is larger than 8 bytes
|
||||
// 3. The previous array is larger than 8 bytes and the new array is 8 bytes or smaller
|
||||
// 4. The previous array is larger than 8 bytes and the new array is also larger than 8 bytes
|
||||
|
||||
T *tmp = 0;
|
||||
if( numElements )
|
||||
{
|
||||
if( sizeof(T)*numElements <= 8 )
|
||||
// Use the internal buffer
|
||||
tmp = reinterpret_cast<T*>(buf);
|
||||
else
|
||||
{
|
||||
// Allocate the array and construct each of the elements
|
||||
tmp = asNEWARRAY(T,numElements);
|
||||
if( tmp == 0 )
|
||||
{
|
||||
// Out of memory. Return without doing anything
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if( array )
|
||||
{
|
||||
if( array == tmp )
|
||||
{
|
||||
if( keepData )
|
||||
{
|
||||
if( length > numElements )
|
||||
length = numElements;
|
||||
}
|
||||
else
|
||||
length = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
if( keepData )
|
||||
{
|
||||
if( length > numElements )
|
||||
length = numElements;
|
||||
|
||||
memcpy(tmp, array, sizeof(T)*length);
|
||||
}
|
||||
else
|
||||
length = 0;
|
||||
|
||||
if( array != reinterpret_cast<T*>(buf) )
|
||||
asDELETEARRAY(array);
|
||||
}
|
||||
}
|
||||
|
||||
array = tmp;
|
||||
maxLength = numElements;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
size_t asCArray<T>::GetCapacity() const
|
||||
{
|
||||
return maxLength;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
bool asCArray<T>::SetLength(size_t numElements)
|
||||
{
|
||||
if( numElements > maxLength )
|
||||
{
|
||||
Allocate(numElements, true);
|
||||
if( numElements > maxLength )
|
||||
{
|
||||
// Out of memory. Return without doing anything
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
length = numElements;
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
bool asCArray<T>::SetLengthNoConstruct(size_t numElements)
|
||||
{
|
||||
if( numElements > maxLength )
|
||||
{
|
||||
AllocateNoConstruct(numElements, true);
|
||||
if( numElements > maxLength )
|
||||
{
|
||||
// Out of memory. Return without doing anything
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
length = numElements;
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
void asCArray<T>::Copy(const T *data, size_t count)
|
||||
{
|
||||
if( maxLength < count )
|
||||
{
|
||||
Allocate(count, false);
|
||||
if( maxLength < count )
|
||||
{
|
||||
// Out of memory. Return without doing anything
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
for( size_t n = 0; n < count; n++ )
|
||||
array[n] = data[n];
|
||||
|
||||
length = count;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
asCArray<T> &asCArray<T>::operator =(const asCArray<T> ©)
|
||||
{
|
||||
Copy(copy.array, copy.length);
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
void asCArray<T>::SwapWith(asCArray<T> &other)
|
||||
{
|
||||
T *tmpArray = array;
|
||||
size_t tmpLength = length;
|
||||
size_t tmpMaxLength = maxLength;
|
||||
char tmpBuf[sizeof(buf)];
|
||||
memcpy(tmpBuf, buf, sizeof(buf));
|
||||
|
||||
array = other.array;
|
||||
length = other.length;
|
||||
maxLength = other.maxLength;
|
||||
memcpy(buf, other.buf, sizeof(buf));
|
||||
|
||||
other.array = tmpArray;
|
||||
other.length = tmpLength;
|
||||
other.maxLength = tmpMaxLength;
|
||||
memcpy(other.buf, tmpBuf, sizeof(buf));
|
||||
|
||||
// If the data is in the internal buffer, then the array pointer must refer to it
|
||||
if( array == reinterpret_cast<T*>(other.buf) )
|
||||
array = reinterpret_cast<T*>(buf);
|
||||
if( other.array == reinterpret_cast<T*>(buf) )
|
||||
other.array = reinterpret_cast<T*>(other.buf);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
bool asCArray<T>::operator ==(const asCArray<T> &other) const
|
||||
{
|
||||
if( length != other.length ) return false;
|
||||
|
||||
for( size_t n = 0; n < length; n++ )
|
||||
if( array[n] != other.array[n] )
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
bool asCArray<T>::operator !=(const asCArray<T> &other) const
|
||||
{
|
||||
return !(*this == other);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
void asCArray<T>::Concatenate(const asCArray<T> &other)
|
||||
{
|
||||
if( maxLength < length + other.length )
|
||||
Allocate(length + other.length, true);
|
||||
|
||||
for( size_t n = 0; n < other.length; n++ )
|
||||
array[length+n] = other.array[n];
|
||||
|
||||
length += other.length;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
void asCArray<T>::Concatenate(T* array, unsigned int count)
|
||||
{
|
||||
for( unsigned int c = 0; c < count; c++ )
|
||||
PushLast(array[c]);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
bool asCArray<T>::Exists(const T &e) const
|
||||
{
|
||||
return IndexOf(e) == -1 ? false : true;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
int asCArray<T>::IndexOf(const T &e) const
|
||||
{
|
||||
for( size_t n = 0; n < length; n++ )
|
||||
if( array[n] == e ) return static_cast<int>(n);
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
void asCArray<T>::RemoveIndex(size_t index)
|
||||
{
|
||||
if( index < length )
|
||||
{
|
||||
for( size_t n = index; n < length-1; n++ )
|
||||
array[n] = array[n+1];
|
||||
|
||||
PopLast();
|
||||
}
|
||||
}
|
||||
|
||||
template <class T>
|
||||
void asCArray<T>::RemoveValue(const T &e)
|
||||
{
|
||||
for( size_t n = 0; n < length; n++ )
|
||||
{
|
||||
if( array[n] == e )
|
||||
{
|
||||
RemoveIndex(n);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template <class T>
|
||||
void asCArray<T>::RemoveIndexUnordered(size_t index)
|
||||
{
|
||||
if( index == length - 1 )
|
||||
PopLast();
|
||||
else if( index < length )
|
||||
array[index] = PopLast();
|
||||
}
|
||||
|
||||
END_AS_NAMESPACE
|
||||
|
||||
#endif
|
163
lib/angelscript/source/as_atomic.cpp
Normal file
163
lib/angelscript/source/as_atomic.cpp
Normal file
@ -0,0 +1,163 @@
|
||||
/*
|
||||
AngelCode Scripting Library
|
||||
Copyright (c) 2003-2013 Andreas Jonsson
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any
|
||||
damages arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any
|
||||
purpose, including commercial applications, and to alter it and
|
||||
redistribute it freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you
|
||||
must not claim that you wrote the original software. If you use
|
||||
this software in a product, an acknowledgment in the product
|
||||
documentation would be appreciated but is not required.
|
||||
|
||||
2. Altered source versions must be plainly marked as such, and
|
||||
must not be misrepresented as being the original software.
|
||||
|
||||
3. This notice may not be removed or altered from any source
|
||||
distribution.
|
||||
|
||||
The original version of this library can be located at:
|
||||
http://www.angelcode.com/angelscript/
|
||||
|
||||
Andreas Jonsson
|
||||
andreas@angelcode.com
|
||||
*/
|
||||
|
||||
//
|
||||
// as_atomic.cpp
|
||||
//
|
||||
// The implementation of the atomic class for thread safe reference counting
|
||||
//
|
||||
|
||||
#include "as_atomic.h"
|
||||
|
||||
BEGIN_AS_NAMESPACE
|
||||
|
||||
asCAtomic::asCAtomic()
|
||||
{
|
||||
value = 0;
|
||||
}
|
||||
|
||||
asDWORD asCAtomic::get() const
|
||||
{
|
||||
return value;
|
||||
}
|
||||
|
||||
void asCAtomic::set(asDWORD val)
|
||||
{
|
||||
value = val;
|
||||
}
|
||||
|
||||
asDWORD asCAtomic::atomicInc()
|
||||
{
|
||||
return asAtomicInc((int&)value);
|
||||
}
|
||||
|
||||
asDWORD asCAtomic::atomicDec()
|
||||
{
|
||||
return asAtomicDec((int&)value);
|
||||
}
|
||||
|
||||
//
|
||||
// The following code implements the atomicInc and atomicDec on different platforms
|
||||
//
|
||||
#if defined(AS_NO_THREADS) || defined(AS_NO_ATOMIC)
|
||||
|
||||
int asAtomicInc(int &value)
|
||||
{
|
||||
return ++value;
|
||||
}
|
||||
|
||||
int asAtomicDec(int &value)
|
||||
{
|
||||
return --value;
|
||||
}
|
||||
|
||||
#elif defined(AS_XENON) /// XBox360
|
||||
|
||||
END_AS_NAMESPACE
|
||||
#include <xtl.h>
|
||||
BEGIN_AS_NAMESPACE
|
||||
|
||||
int asAtomicInc(int &value)
|
||||
{
|
||||
return InterlockedIncrement((LONG*)&value);
|
||||
}
|
||||
|
||||
int asAtomicDec(int &value)
|
||||
{
|
||||
return InterlockedDecrement((LONG*)&value);
|
||||
}
|
||||
|
||||
#elif defined(AS_WIN)
|
||||
|
||||
END_AS_NAMESPACE
|
||||
#define WIN32_MEAN_AND_LEAN
|
||||
#include <windows.h>
|
||||
BEGIN_AS_NAMESPACE
|
||||
|
||||
int asAtomicInc(int &value)
|
||||
{
|
||||
return InterlockedIncrement((LONG*)&value);
|
||||
}
|
||||
|
||||
int asAtomicDec(int &value)
|
||||
{
|
||||
asASSERT(value > 0);
|
||||
return InterlockedDecrement((LONG*)&value);
|
||||
}
|
||||
|
||||
#elif defined(AS_LINUX) || defined(AS_BSD) || defined(AS_ILLUMOS) || defined(AS_ANDROID)
|
||||
|
||||
//
|
||||
// atomic_inc_and_test() and atomic_dec_and_test() from asm/atomic.h is not meant
|
||||
// to be used outside the Linux kernel. Instead we should use the GNUC provided
|
||||
// __sync_add_and_fetch() and __sync_sub_and_fetch() functions.
|
||||
//
|
||||
// Reference: http://golubenco.org/blog/atomic-operations/
|
||||
//
|
||||
// These are only available in GCC 4.1 and above, so for older versions we
|
||||
// use the critical sections, though it is a lot slower.
|
||||
//
|
||||
|
||||
int asAtomicInc(int &value)
|
||||
{
|
||||
return __sync_add_and_fetch(&value, 1);
|
||||
}
|
||||
|
||||
int asAtomicDec(int &value)
|
||||
{
|
||||
return __sync_sub_and_fetch(&value, 1);
|
||||
}
|
||||
|
||||
#elif defined(AS_MAC) || defined(AS_IPHONE)
|
||||
|
||||
END_AS_NAMESPACE
|
||||
#include <libkern/OSAtomic.h>
|
||||
BEGIN_AS_NAMESPACE
|
||||
|
||||
int asAtomicInc(int &value)
|
||||
{
|
||||
return OSAtomicIncrement32((int32_t*)&value);
|
||||
}
|
||||
|
||||
int asAtomicDec(int &value)
|
||||
{
|
||||
return OSAtomicDecrement32((int32_t*)&value);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
// If we get here, then the configuration in as_config.h
|
||||
// is wrong for the compiler/platform combination.
|
||||
int ERROR_PleaseFixTheConfig[-1];
|
||||
|
||||
#endif
|
||||
|
||||
END_AS_NAMESPACE
|
||||
|
69
lib/angelscript/source/as_atomic.h
Normal file
69
lib/angelscript/source/as_atomic.h
Normal file
@ -0,0 +1,69 @@
|
||||
/*
|
||||
AngelCode Scripting Library
|
||||
Copyright (c) 2003-2013 Andreas Jonsson
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any
|
||||
damages arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any
|
||||
purpose, including commercial applications, and to alter it and
|
||||
redistribute it freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you
|
||||
must not claim that you wrote the original software. If you use
|
||||
this software in a product, an acknowledgment in the product
|
||||
documentation would be appreciated but is not required.
|
||||
|
||||
2. Altered source versions must be plainly marked as such, and
|
||||
must not be misrepresented as being the original software.
|
||||
|
||||
3. This notice may not be removed or altered from any source
|
||||
distribution.
|
||||
|
||||
The original version of this library can be located at:
|
||||
http://www.angelcode.com/angelscript/
|
||||
|
||||
Andreas Jonsson
|
||||
andreas@angelcode.com
|
||||
*/
|
||||
|
||||
|
||||
//
|
||||
// as_atomic.h
|
||||
//
|
||||
// The asCAtomic class provides methods for performing threadsafe
|
||||
// operations on a single dword, e.g. reference counting and
|
||||
// bitfields.
|
||||
//
|
||||
|
||||
|
||||
|
||||
#ifndef AS_ATOMIC_H
|
||||
#define AS_ATOMIC_H
|
||||
|
||||
#include "as_config.h"
|
||||
|
||||
BEGIN_AS_NAMESPACE
|
||||
|
||||
class asCAtomic
|
||||
{
|
||||
public:
|
||||
asCAtomic();
|
||||
|
||||
asDWORD get() const;
|
||||
void set(asDWORD val);
|
||||
|
||||
// Increase and return new value
|
||||
asDWORD atomicInc();
|
||||
|
||||
// Decrease and return new value
|
||||
asDWORD atomicDec();
|
||||
|
||||
protected:
|
||||
asDWORD value;
|
||||
};
|
||||
|
||||
END_AS_NAMESPACE
|
||||
|
||||
#endif
|
4998
lib/angelscript/source/as_builder.cpp
Normal file
4998
lib/angelscript/source/as_builder.cpp
Normal file
File diff suppressed because it is too large
Load Diff
254
lib/angelscript/source/as_builder.h
Normal file
254
lib/angelscript/source/as_builder.h
Normal file
@ -0,0 +1,254 @@
|
||||
/*
|
||||
AngelCode Scripting Library
|
||||
Copyright (c) 2003-2013 Andreas Jonsson
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any
|
||||
damages arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any
|
||||
purpose, including commercial applications, and to alter it and
|
||||
redistribute it freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you
|
||||
must not claim that you wrote the original software. If you use
|
||||
this software in a product, an acknowledgment in the product
|
||||
documentation would be appreciated but is not required.
|
||||
|
||||
2. Altered source versions must be plainly marked as such, and
|
||||
must not be misrepresented as being the original software.
|
||||
|
||||
3. This notice may not be removed or altered from any source
|
||||
distribution.
|
||||
|
||||
The original version of this library can be located at:
|
||||
http://www.angelcode.com/angelscript/
|
||||
|
||||
Andreas Jonsson
|
||||
andreas@angelcode.com
|
||||
*/
|
||||
|
||||
|
||||
//
|
||||
// as_builder.h
|
||||
//
|
||||
// This is the class that manages the compilation of the scripts
|
||||
//
|
||||
|
||||
|
||||
#ifndef AS_BUILDER_H
|
||||
#define AS_BUILDER_H
|
||||
|
||||
#include "as_config.h"
|
||||
#include "as_symboltable.h"
|
||||
#include "as_scriptengine.h"
|
||||
#include "as_module.h"
|
||||
#include "as_array.h"
|
||||
#include "as_scriptcode.h"
|
||||
#include "as_scriptnode.h"
|
||||
#include "as_datatype.h"
|
||||
#include "as_property.h"
|
||||
|
||||
BEGIN_AS_NAMESPACE
|
||||
|
||||
#ifndef AS_NO_COMPILER
|
||||
|
||||
struct sFunctionDescription
|
||||
{
|
||||
asCScriptCode *script;
|
||||
asCScriptNode *node;
|
||||
asCString name;
|
||||
asCObjectType *objType;
|
||||
asCArray<asCString> paramNames;
|
||||
int funcId;
|
||||
bool isExistingShared;
|
||||
};
|
||||
|
||||
struct sGlobalVariableDescription
|
||||
{
|
||||
asCScriptCode *script;
|
||||
asCScriptNode *declaredAtNode;
|
||||
asCScriptNode *initializationNode;
|
||||
asCString name;
|
||||
asCGlobalProperty *property;
|
||||
asCDataType datatype;
|
||||
int index;
|
||||
bool isCompiled;
|
||||
bool isPureConstant;
|
||||
bool isEnumValue;
|
||||
asQWORD constantValue;
|
||||
};
|
||||
|
||||
struct sPropertyInitializer
|
||||
{
|
||||
sPropertyInitializer() : declNode(0), initNode(0), file(0) {}
|
||||
sPropertyInitializer(const asCString &nm, asCScriptNode *decl, asCScriptNode *init, asCScriptCode *f) : name(nm), declNode(decl), initNode(init), file(f) {}
|
||||
sPropertyInitializer &operator=(const sPropertyInitializer &o) {name = o.name; declNode = o.declNode; initNode = o.initNode; file = o.file; return *this;}
|
||||
|
||||
asCString name;
|
||||
asCScriptNode *declNode;
|
||||
asCScriptNode *initNode;
|
||||
asCScriptCode *file;
|
||||
};
|
||||
|
||||
struct sClassDeclaration
|
||||
{
|
||||
sClassDeclaration() {script = 0; node = 0; validState = 0; objType = 0; isExistingShared = false; isFinal = false;}
|
||||
|
||||
asCScriptCode *script;
|
||||
asCScriptNode *node;
|
||||
asCString name;
|
||||
int validState;
|
||||
asCObjectType *objType;
|
||||
bool isExistingShared;
|
||||
bool isFinal;
|
||||
|
||||
asCArray<sPropertyInitializer> propInits;
|
||||
};
|
||||
|
||||
struct sFuncDef
|
||||
{
|
||||
asCScriptCode *script;
|
||||
asCScriptNode *node;
|
||||
asCString name;
|
||||
int idx;
|
||||
};
|
||||
|
||||
struct sMixinClass
|
||||
{
|
||||
asCScriptCode *script;
|
||||
asCScriptNode *node;
|
||||
asCString name;
|
||||
asSNameSpace *ns;
|
||||
};
|
||||
|
||||
#endif // AS_NO_COMPILER
|
||||
|
||||
class asCBuilder
|
||||
{
|
||||
public:
|
||||
asCBuilder(asCScriptEngine *engine, asCModule *module);
|
||||
~asCBuilder();
|
||||
|
||||
// These methods are used by the application interface
|
||||
int VerifyProperty(asCDataType *dt, const char *decl, asCString &outName, asCDataType &outType, asSNameSpace *ns);
|
||||
int ParseDataType(const char *datatype, asCDataType *result, asSNameSpace *implicitNamespace, bool isReturnType = false);
|
||||
int ParseTemplateDecl(const char *decl, asCString *name, asCArray<asCString> &subtypeNames);
|
||||
int ParseFunctionDeclaration(asCObjectType *type, const char *decl, asCScriptFunction *func, bool isSystemFunction, asCArray<bool> *paramAutoHandles = 0, bool *returnAutoHandle = 0, asSNameSpace *ns = 0, asCScriptNode **listPattern = 0);
|
||||
int ParseVariableDeclaration(const char *decl, asSNameSpace *implicitNamespace, asCString &outName, asSNameSpace *&outNamespace, asCDataType &outDt);
|
||||
int CheckNameConflict(const char *name, asCScriptNode *node, asCScriptCode *code, asSNameSpace *ns);
|
||||
int CheckNameConflictMember(asCObjectType *type, const char *name, asCScriptNode *node, asCScriptCode *code, bool isProperty);
|
||||
|
||||
#ifndef AS_NO_COMPILER
|
||||
int AddCode(const char *name, const char *code, int codeLength, int lineOffset, int sectionIdx, bool makeCopy);
|
||||
int Build();
|
||||
|
||||
int CompileFunction(const char *sectionName, const char *code, int lineOffset, asDWORD compileFlags, asCScriptFunction **outFunc);
|
||||
int CompileGlobalVar(const char *sectionName, const char *code, int lineOffset);
|
||||
#endif
|
||||
|
||||
protected:
|
||||
friend class asCModule;
|
||||
friend class asCParser;
|
||||
friend class asCScriptFunction;
|
||||
friend class asCScriptEngine;
|
||||
|
||||
void Reset();
|
||||
|
||||
void WriteInfo(const asCString &scriptname, const asCString &msg, int r, int c, bool preMessage);
|
||||
void WriteInfo(const asCString &msg, asCScriptCode *file, asCScriptNode *node);
|
||||
void WriteError(const asCString &scriptname, const asCString &msg, int r, int c);
|
||||
void WriteError(const asCString &msg, asCScriptCode *file, asCScriptNode *node);
|
||||
void WriteWarning(const asCString &scriptname, const asCString &msg, int r, int c);
|
||||
|
||||
asCGlobalProperty *GetGlobalProperty(const char *prop, asSNameSpace *ns, bool *isCompiled, bool *isPureConstant, asQWORD *constantValue, bool *isAppProp);
|
||||
int ValidateDefaultArgs(asCScriptCode *script, asCScriptNode *node, asCScriptFunction *func);
|
||||
asCString GetCleanExpressionString(asCScriptNode *n, asCScriptCode *file);
|
||||
|
||||
asSNameSpace *GetNameSpaceFromNode(asCScriptNode *node, asCScriptCode *script, asSNameSpace *implicitNs, asCScriptNode **next);
|
||||
asCString GetScopeFromNode(asCScriptNode *n, asCScriptCode *script, asCScriptNode **next = 0);
|
||||
asSNameSpace *GetParentNameSpace(asSNameSpace *ns);
|
||||
|
||||
asCObjectType *GetObjectType(const char *type, asSNameSpace *ns);
|
||||
asCScriptFunction *GetFuncDef(const char *type);
|
||||
asCObjectType *GetObjectTypeFromTypesKnownByObject(const char *type, asCObjectType *currentType);
|
||||
asCDataType CreateDataTypeFromNode(asCScriptNode *node, asCScriptCode *file, asSNameSpace *implicitNamespace, bool acceptHandleForScope = false, asCObjectType *currentType = 0);
|
||||
asCDataType ModifyDataTypeFromNode(const asCDataType &type, asCScriptNode *node, asCScriptCode *file, asETypeModifiers *inOutFlag, bool *autoHandle);
|
||||
|
||||
struct preMessage_t
|
||||
{
|
||||
bool isSet;
|
||||
asCString message;
|
||||
asCString scriptname;
|
||||
int r;
|
||||
int c;
|
||||
} preMessage;
|
||||
|
||||
int numErrors;
|
||||
int numWarnings;
|
||||
bool silent;
|
||||
|
||||
asCScriptEngine *engine;
|
||||
asCModule *module;
|
||||
|
||||
#ifndef AS_NO_COMPILER
|
||||
protected:
|
||||
friend class asCCompiler;
|
||||
|
||||
int GetNamespaceAndNameFromNode(asCScriptNode *n, asCScriptCode *script, asSNameSpace *implicitNs, asSNameSpace *&outNs, asCString &outName);
|
||||
int RegisterMixinClass(asCScriptNode *node, asCScriptCode *file, asSNameSpace *ns);
|
||||
sMixinClass *GetMixinClass(const char *name, asSNameSpace *ns);
|
||||
void IncludePropertiesFromMixins(sClassDeclaration *decl);
|
||||
void IncludeMethodsFromMixins(sClassDeclaration *decl);
|
||||
void AddInterfaceToClass(sClassDeclaration *decl, asCScriptNode *errNode, asCObjectType *intf);
|
||||
void AddInterfaceFromMixinToClass(sClassDeclaration *decl, asCScriptNode *errNode, sMixinClass *mixin);
|
||||
|
||||
int RegisterScriptFunctionFromNode(asCScriptNode *node, asCScriptCode *file, asCObjectType *object = 0, bool isInterface = false, bool isGlobalFunction = false, asSNameSpace *ns = 0, bool isExistingShared = false, bool isMixin = false);
|
||||
int RegisterScriptFunction(asCScriptNode *node, asCScriptCode *file, asCObjectType *objType, bool isInterface, bool isGlobalFunction, asSNameSpace *ns, bool isExistingShared, bool isMixin, asCString &name, asCDataType &returnType, asCArray<asCString> ¶meterNames, asCArray<asCDataType> ¶meterTypes, asCArray<asETypeModifiers> &inOutFlags, asCArray<asCString *> &defaultArgs, bool isConstMethod, bool isConstructor, bool isDestructor, bool isPrivate, bool isOverride, bool isFinal, bool isShared);
|
||||
int RegisterVirtualProperty(asCScriptNode *node, asCScriptCode *file, asCObjectType *object = 0, bool isInterface = false, bool isGlobalFunction = false, asSNameSpace *ns = 0, bool isExistingShared = false);
|
||||
int RegisterImportedFunction(int funcID, asCScriptNode *node, asCScriptCode *file, asSNameSpace *ns);
|
||||
int RegisterGlobalVar(asCScriptNode *node, asCScriptCode *file, asSNameSpace *ns);
|
||||
int RegisterClass(asCScriptNode *node, asCScriptCode *file, asSNameSpace *ns);
|
||||
int RegisterInterface(asCScriptNode *node, asCScriptCode *file, asSNameSpace *ns);
|
||||
int RegisterEnum(asCScriptNode *node, asCScriptCode *file, asSNameSpace *ns);
|
||||
int RegisterTypedef(asCScriptNode *node, asCScriptCode *file, asSNameSpace *ns);
|
||||
int RegisterFuncDef(asCScriptNode *node, asCScriptCode *file, asSNameSpace *ns);
|
||||
void CompleteFuncDef(sFuncDef *funcDef);
|
||||
void CompileInterfaces();
|
||||
void CompileClasses();
|
||||
void GetParsedFunctionDetails(asCScriptNode *node, asCScriptCode *file, asCObjectType *objType, asCString &name, asCDataType &returnType, asCArray<asCString> ¶meterNames, asCArray<asCDataType> ¶meterTypes, asCArray<asETypeModifiers> &inOutFlags, asCArray<asCString *> &defaultArgs, bool &isConstMethod, bool &isConstructor, bool &isDestructor, bool &isPrivate, bool &isOverride, bool &isFinal, bool &isShared, asSNameSpace *implicitNamespace);
|
||||
bool DoesMethodExist(asCObjectType *objType, int methodId, asUINT *methodIndex = 0);
|
||||
void AddDefaultConstructor(asCObjectType *objType, asCScriptCode *file);
|
||||
asCObjectProperty *AddPropertyToClass(sClassDeclaration *c, const asCString &name, const asCDataType &type, bool isPrivate, asCScriptCode *file = 0, asCScriptNode *node = 0);
|
||||
int CreateVirtualFunction(asCScriptFunction *func, int idx);
|
||||
void ParseScripts();
|
||||
void RegisterTypesFromScript(asCScriptNode *node, asCScriptCode *script, asSNameSpace *ns);
|
||||
void RegisterNonTypesFromScript(asCScriptNode *node, asCScriptCode *script, asSNameSpace *ns);
|
||||
void CompileFunctions();
|
||||
void CompileGlobalVariables();
|
||||
int GetEnumValueFromObjectType(asCObjectType *objType, const char *name, asCDataType &outDt, asDWORD &outValue);
|
||||
int GetEnumValue(const char *name, asCDataType &outDt, asDWORD &outValue, asSNameSpace *ns);
|
||||
bool DoesTypeExist(const asCString &type);
|
||||
asCObjectProperty *GetObjectProperty(asCDataType &obj, const char *prop);
|
||||
asCScriptFunction *GetFunctionDescription(int funcId);
|
||||
void GetFunctionDescriptions(const char *name, asCArray<int> &funcs, asSNameSpace *ns);
|
||||
void GetObjectMethodDescriptions(const char *name, asCObjectType *objectType, asCArray<int> &methods, bool objIsConst, const asCString &scope = "");
|
||||
|
||||
asCArray<asCScriptCode *> scripts;
|
||||
asCArray<sFunctionDescription *> functions;
|
||||
asCSymbolTable<sGlobalVariableDescription> globVariables;
|
||||
asCArray<sClassDeclaration *> classDeclarations;
|
||||
asCArray<sClassDeclaration *> interfaceDeclarations;
|
||||
asCArray<sClassDeclaration *> namedTypeDeclarations;
|
||||
asCArray<sFuncDef *> funcDefs;
|
||||
asCArray<sMixinClass *> mixinClasses;
|
||||
|
||||
// For use with the DoesTypeExists() method
|
||||
bool hasCachedKnownTypes;
|
||||
asCMap<asCString, bool> knownTypes;
|
||||
#endif
|
||||
};
|
||||
|
||||
END_AS_NAMESPACE
|
||||
|
||||
#endif
|
2829
lib/angelscript/source/as_bytecode.cpp
Normal file
2829
lib/angelscript/source/as_bytecode.cpp
Normal file
File diff suppressed because it is too large
Load Diff
200
lib/angelscript/source/as_bytecode.h
Normal file
200
lib/angelscript/source/as_bytecode.h
Normal file
@ -0,0 +1,200 @@
|
||||
/*
|
||||
AngelCode Scripting Library
|
||||
Copyright (c) 2003-2012 Andreas Jonsson
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any
|
||||
damages arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any
|
||||
purpose, including commercial applications, and to alter it and
|
||||
redistribute it freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you
|
||||
must not claim that you wrote the original software. If you use
|
||||
this software in a product, an acknowledgment in the product
|
||||
documentation would be appreciated but is not required.
|
||||
|
||||
2. Altered source versions must be plainly marked as such, and
|
||||
must not be misrepresented as being the original software.
|
||||
|
||||
3. This notice may not be removed or altered from any source
|
||||
distribution.
|
||||
|
||||
The original version of this library can be located at:
|
||||
http://www.angelcode.com/angelscript/
|
||||
|
||||
Andreas Jonsson
|
||||
andreas@angelcode.com
|
||||
*/
|
||||
|
||||
|
||||
//
|
||||
// as_bytecode.h
|
||||
//
|
||||
// A class for constructing the final byte code
|
||||
//
|
||||
|
||||
|
||||
|
||||
#ifndef AS_BYTECODE_H
|
||||
#define AS_BYTECODE_H
|
||||
|
||||
#include "as_config.h"
|
||||
|
||||
#ifndef AS_NO_COMPILER
|
||||
|
||||
#include "as_array.h"
|
||||
|
||||
BEGIN_AS_NAMESPACE
|
||||
|
||||
#define BYTECODE_SIZE 4
|
||||
#define MAX_DATA_SIZE 8
|
||||
#define MAX_INSTR_SIZE (BYTECODE_SIZE+MAX_DATA_SIZE)
|
||||
|
||||
class asCScriptEngine;
|
||||
class asCScriptFunction;
|
||||
class asCByteInstruction;
|
||||
|
||||
class asCByteCode
|
||||
{
|
||||
public:
|
||||
asCByteCode(asCScriptEngine *engine);
|
||||
~asCByteCode();
|
||||
|
||||
void ClearAll();
|
||||
|
||||
int GetSize();
|
||||
|
||||
void Finalize(const asCArray<int> &tempVariableOffsets);
|
||||
|
||||
void Optimize();
|
||||
void OptimizeLocally(const asCArray<int> &tempVariableOffsets);
|
||||
void ExtractLineNumbers();
|
||||
void ExtractObjectVariableInfo(asCScriptFunction *outFunc);
|
||||
int ResolveJumpAddresses();
|
||||
int FindLabel(int label, asCByteInstruction *from, asCByteInstruction **dest, int *positionDelta);
|
||||
|
||||
void AddPath(asCArray<asCByteInstruction *> &paths, asCByteInstruction *instr, int stackSize);
|
||||
|
||||
void Output(asDWORD *array);
|
||||
void AddCode(asCByteCode *bc);
|
||||
|
||||
void PostProcess();
|
||||
|
||||
#ifdef AS_DEBUG
|
||||
void DebugOutput(const char *name, asCScriptEngine *engine, asCScriptFunction *func);
|
||||
#endif
|
||||
|
||||
int GetLastInstr();
|
||||
int RemoveLastInstr();
|
||||
asDWORD GetLastInstrValueDW();
|
||||
|
||||
void InsertIfNotExists(asCArray<int> &vars, int var);
|
||||
void GetVarsUsed(asCArray<int> &vars);
|
||||
bool IsVarUsed(int offset);
|
||||
void ExchangeVar(int oldOffset, int newOffset);
|
||||
bool IsSimpleExpression();
|
||||
|
||||
void Label(short label);
|
||||
void Line(int line, int column, int scriptIdx);
|
||||
void ObjInfo(int offset, int info);
|
||||
void Block(bool start);
|
||||
void VarDecl(int varDeclIdx);
|
||||
void Call(asEBCInstr bc, int funcID, int pop);
|
||||
void CallPtr(asEBCInstr bc, int funcPtrVar, int pop);
|
||||
void Alloc(asEBCInstr bc, void *objID, int funcID, int pop);
|
||||
void Ret(int pop);
|
||||
void JmpP(int var, asDWORD max);
|
||||
|
||||
int InsertFirstInstrDWORD(asEBCInstr bc, asDWORD param);
|
||||
int InsertFirstInstrQWORD(asEBCInstr bc, asQWORD param);
|
||||
int Instr(asEBCInstr bc);
|
||||
int InstrQWORD(asEBCInstr bc, asQWORD param);
|
||||
int InstrDOUBLE(asEBCInstr bc, double param);
|
||||
int InstrPTR(asEBCInstr bc, void *param);
|
||||
int InstrDWORD(asEBCInstr bc, asDWORD param);
|
||||
int InstrWORD(asEBCInstr bc, asWORD param);
|
||||
int InstrSHORT(asEBCInstr bc, short param);
|
||||
int InstrFLOAT(asEBCInstr bc, float param);
|
||||
int InstrINT(asEBCInstr bc, int param);
|
||||
int InstrW_W_W(asEBCInstr bc, int a, int b, int c);
|
||||
int InstrSHORT_B(asEBCInstr bc, short a, asBYTE b);
|
||||
int InstrSHORT_W(asEBCInstr bc, short a, asWORD b);
|
||||
int InstrSHORT_DW(asEBCInstr bc, short a, asDWORD b);
|
||||
int InstrSHORT_QW(asEBCInstr bc, short a, asQWORD b);
|
||||
int InstrW_DW(asEBCInstr bc, asWORD a, asDWORD b);
|
||||
int InstrW_QW(asEBCInstr bc, asWORD a, asQWORD b);
|
||||
int InstrW_PTR(asEBCInstr bc, short a, void *param);
|
||||
int InstrW_FLOAT(asEBCInstr bc, asWORD a, float b);
|
||||
int InstrW_W(asEBCInstr bc, int w, int b);
|
||||
int InstrSHORT_DW_DW(asEBCInstr bc, short a, asDWORD b, asDWORD c);
|
||||
|
||||
asCArray<int> lineNumbers;
|
||||
asCArray<int> sectionIdxs;
|
||||
int largestStackUsed;
|
||||
|
||||
protected:
|
||||
// Assignments are not allowed
|
||||
void operator=(const asCByteCode &) {}
|
||||
|
||||
// Helpers for Optimize
|
||||
bool CanBeSwapped(asCByteInstruction *curr);
|
||||
asCByteInstruction *ChangeFirstDeleteNext(asCByteInstruction *curr, asEBCInstr bc);
|
||||
asCByteInstruction *DeleteFirstChangeNext(asCByteInstruction *curr, asEBCInstr bc);
|
||||
asCByteInstruction *DeleteInstruction(asCByteInstruction *instr);
|
||||
void RemoveInstruction(asCByteInstruction *instr);
|
||||
asCByteInstruction *GoBack(asCByteInstruction *curr);
|
||||
asCByteInstruction *GoForward(asCByteInstruction *curr);
|
||||
void InsertBefore(asCByteInstruction *before, asCByteInstruction *instr);
|
||||
bool RemoveUnusedValue(asCByteInstruction *curr, asCByteInstruction **next);
|
||||
bool IsTemporary(int offset);
|
||||
bool IsTempRegUsed(asCByteInstruction *curr);
|
||||
bool IsTempVarRead(asCByteInstruction *curr, int offset);
|
||||
bool PostponeInitOfTemp(asCByteInstruction *curr, asCByteInstruction **next);
|
||||
bool IsTempVarReadByInstr(asCByteInstruction *curr, int var);
|
||||
bool IsTempVarOverwrittenByInstr(asCByteInstruction *curr, int var);
|
||||
bool IsInstrJmpOrLabel(asCByteInstruction *curr);
|
||||
|
||||
int AddInstruction();
|
||||
int AddInstructionFirst();
|
||||
|
||||
asCByteInstruction *first;
|
||||
asCByteInstruction *last;
|
||||
|
||||
const asCArray<int> *temporaryVariables;
|
||||
|
||||
asCScriptEngine *engine;
|
||||
};
|
||||
|
||||
class asCByteInstruction
|
||||
{
|
||||
public:
|
||||
asCByteInstruction();
|
||||
|
||||
void AddAfter(asCByteInstruction *nextCode);
|
||||
void AddBefore(asCByteInstruction *nextCode);
|
||||
void Remove();
|
||||
|
||||
int GetSize();
|
||||
int GetStackIncrease();
|
||||
|
||||
asCByteInstruction *next;
|
||||
asCByteInstruction *prev;
|
||||
|
||||
asEBCInstr op;
|
||||
asQWORD arg;
|
||||
short wArg[3];
|
||||
int size;
|
||||
int stackInc;
|
||||
|
||||
// Testing
|
||||
bool marked;
|
||||
int stackSize;
|
||||
};
|
||||
|
||||
END_AS_NAMESPACE
|
||||
|
||||
#endif // AS_NO_COMPILER
|
||||
|
||||
#endif
|
696
lib/angelscript/source/as_callfunc.cpp
Normal file
696
lib/angelscript/source/as_callfunc.cpp
Normal file
@ -0,0 +1,696 @@
|
||||
/*
|
||||
AngelCode Scripting Library
|
||||
Copyright (c) 2003-2014 Andreas Jonsson
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any
|
||||
damages arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any
|
||||
purpose, including commercial applications, and to alter it and
|
||||
redistribute it freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you
|
||||
must not claim that you wrote the original software. If you use
|
||||
this software in a product, an acknowledgment in the product
|
||||
documentation would be appreciated but is not required.
|
||||
|
||||
2. Altered source versions must be plainly marked as such, and
|
||||
must not be misrepresented as being the original software.
|
||||
|
||||
3. This notice may not be removed or altered from any source
|
||||
distribution.
|
||||
|
||||
The original version of this library can be located at:
|
||||
http://www.angelcode.com/angelscript/
|
||||
|
||||
Andreas Jonsson
|
||||
andreas@angelcode.com
|
||||
*/
|
||||
|
||||
|
||||
//
|
||||
// as_callfunc.cpp
|
||||
//
|
||||
// These functions handle the actual calling of system functions
|
||||
//
|
||||
|
||||
|
||||
|
||||
#include "as_config.h"
|
||||
#include "as_callfunc.h"
|
||||
#include "as_scriptengine.h"
|
||||
#include "as_texts.h"
|
||||
#include "as_context.h"
|
||||
|
||||
BEGIN_AS_NAMESPACE
|
||||
|
||||
int DetectCallingConvention(bool isMethod, const asSFuncPtr &ptr, int callConv, void *objForThiscall, asSSystemFunctionInterface *internal)
|
||||
{
|
||||
memset(internal, 0, sizeof(asSSystemFunctionInterface));
|
||||
|
||||
internal->func = ptr.ptr.f.func;
|
||||
internal->objForThiscall = 0;
|
||||
|
||||
// Was a compatible calling convention specified?
|
||||
if( internal->func )
|
||||
{
|
||||
if( ptr.flag == 1 && callConv != asCALL_GENERIC )
|
||||
return asWRONG_CALLING_CONV;
|
||||
else if( ptr.flag == 2 && (callConv == asCALL_GENERIC || callConv == asCALL_THISCALL || callConv == asCALL_THISCALL_ASGLOBAL) )
|
||||
return asWRONG_CALLING_CONV;
|
||||
else if( ptr.flag == 3 && !(callConv == asCALL_THISCALL || callConv == asCALL_THISCALL_ASGLOBAL) )
|
||||
return asWRONG_CALLING_CONV;
|
||||
}
|
||||
|
||||
asDWORD base = callConv;
|
||||
if( !isMethod )
|
||||
{
|
||||
if( base == asCALL_CDECL )
|
||||
internal->callConv = ICC_CDECL;
|
||||
else if( base == asCALL_STDCALL )
|
||||
internal->callConv = ICC_STDCALL;
|
||||
else if( base == asCALL_THISCALL_ASGLOBAL )
|
||||
{
|
||||
if( objForThiscall == 0 )
|
||||
return asINVALID_ARG;
|
||||
internal->objForThiscall = objForThiscall;
|
||||
internal->callConv = ICC_THISCALL;
|
||||
|
||||
// This is really a thiscall, so it is necessary to check for virtual method pointers
|
||||
base = asCALL_THISCALL;
|
||||
isMethod = true;
|
||||
}
|
||||
else if( base == asCALL_GENERIC )
|
||||
internal->callConv = ICC_GENERIC_FUNC;
|
||||
else
|
||||
return asNOT_SUPPORTED;
|
||||
}
|
||||
|
||||
if( isMethod )
|
||||
{
|
||||
#ifndef AS_NO_CLASS_METHODS
|
||||
if( base == asCALL_THISCALL )
|
||||
{
|
||||
internal->callConv = ICC_THISCALL;
|
||||
#ifdef GNU_STYLE_VIRTUAL_METHOD
|
||||
if( (size_t(ptr.ptr.f.func) & 1) )
|
||||
internal->callConv = ICC_VIRTUAL_THISCALL;
|
||||
#endif
|
||||
internal->baseOffset = ( int )MULTI_BASE_OFFSET(ptr);
|
||||
#if defined(AS_ARM) && defined(__GNUC__)
|
||||
// As the least significant bit in func is used to switch to THUMB mode
|
||||
// on ARM processors, the LSB in the __delta variable is used instead of
|
||||
// the one in __pfn on ARM processors.
|
||||
if( (size_t(internal->baseOffset) & 1) )
|
||||
internal->callConv = ICC_VIRTUAL_THISCALL;
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_VIRTUAL_BASE_OFFSET
|
||||
// We don't support virtual inheritance
|
||||
if( VIRTUAL_BASE_OFFSET(ptr) != 0 )
|
||||
return asNOT_SUPPORTED;
|
||||
#endif
|
||||
}
|
||||
else
|
||||
#endif
|
||||
if( base == asCALL_CDECL_OBJLAST )
|
||||
internal->callConv = ICC_CDECL_OBJLAST;
|
||||
else if( base == asCALL_CDECL_OBJFIRST )
|
||||
internal->callConv = ICC_CDECL_OBJFIRST;
|
||||
else if( base == asCALL_GENERIC )
|
||||
internal->callConv = ICC_GENERIC_METHOD;
|
||||
else
|
||||
return asNOT_SUPPORTED;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// This function should prepare system functions so that it will be faster to call them
|
||||
int PrepareSystemFunctionGeneric(asCScriptFunction *func, asSSystemFunctionInterface *internal, asCScriptEngine * /*engine*/)
|
||||
{
|
||||
asASSERT(internal->callConv == ICC_GENERIC_METHOD || internal->callConv == ICC_GENERIC_FUNC);
|
||||
|
||||
// Calculate the size needed for the parameters
|
||||
internal->paramSize = func->GetSpaceNeededForArguments();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// This function should prepare system functions so that it will be faster to call them
|
||||
int PrepareSystemFunction(asCScriptFunction *func, asSSystemFunctionInterface *internal, asCScriptEngine *engine)
|
||||
{
|
||||
#ifdef AS_MAX_PORTABILITY
|
||||
// This should never happen, as when AS_MAX_PORTABILITY is on, all functions
|
||||
// are asCALL_GENERIC, which are prepared by PrepareSystemFunctionGeneric
|
||||
asASSERT(false);
|
||||
#endif
|
||||
|
||||
// References are always returned as primitive data
|
||||
if( func->returnType.IsReference() || func->returnType.IsObjectHandle() )
|
||||
{
|
||||
internal->hostReturnInMemory = false;
|
||||
internal->hostReturnSize = sizeof(void*)/4;
|
||||
internal->hostReturnFloat = false;
|
||||
}
|
||||
// Registered types have special flags that determine how they are returned
|
||||
else if( func->returnType.IsObject() )
|
||||
{
|
||||
asDWORD objType = func->returnType.GetObjectType()->flags;
|
||||
|
||||
// Only value types can be returned by value
|
||||
asASSERT( objType & asOBJ_VALUE );
|
||||
|
||||
if( !(objType & (asOBJ_APP_CLASS | asOBJ_APP_PRIMITIVE | asOBJ_APP_FLOAT)) )
|
||||
{
|
||||
// If the return is by value then we need to know the true type
|
||||
engine->WriteMessage("", 0, 0, asMSGTYPE_INFORMATION, func->GetDeclarationStr().AddressOf());
|
||||
|
||||
asCString str;
|
||||
str.Format(TXT_CANNOT_RET_TYPE_s_BY_VAL, func->returnType.GetObjectType()->name.AddressOf());
|
||||
engine->WriteMessage("", 0, 0, asMSGTYPE_ERROR, str.AddressOf());
|
||||
engine->ConfigError(asINVALID_CONFIGURATION, 0, 0, 0);
|
||||
}
|
||||
else if( objType & asOBJ_APP_CLASS )
|
||||
{
|
||||
internal->hostReturnFloat = false;
|
||||
if( objType & COMPLEX_RETURN_MASK )
|
||||
{
|
||||
internal->hostReturnInMemory = true;
|
||||
internal->hostReturnSize = sizeof(void*)/4;
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef HAS_128_BIT_PRIMITIVES
|
||||
if( func->returnType.GetSizeInMemoryDWords() > 4 )
|
||||
#else
|
||||
if( func->returnType.GetSizeInMemoryDWords() > 2 )
|
||||
#endif
|
||||
{
|
||||
internal->hostReturnInMemory = true;
|
||||
internal->hostReturnSize = sizeof(void*)/4;
|
||||
}
|
||||
else
|
||||
{
|
||||
internal->hostReturnInMemory = false;
|
||||
internal->hostReturnSize = func->returnType.GetSizeInMemoryDWords();
|
||||
#ifdef SPLIT_OBJS_BY_MEMBER_TYPES
|
||||
if( func->returnType.GetObjectType()->flags & asOBJ_APP_CLASS_ALLFLOATS )
|
||||
internal->hostReturnFloat = true;
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef THISCALL_RETURN_SIMPLE_IN_MEMORY
|
||||
if((internal->callConv == ICC_THISCALL ||
|
||||
internal->callConv == ICC_VIRTUAL_THISCALL) &&
|
||||
func->returnType.GetSizeInMemoryDWords() >= THISCALL_RETURN_SIMPLE_IN_MEMORY_MIN_SIZE)
|
||||
{
|
||||
internal->hostReturnInMemory = true;
|
||||
internal->hostReturnSize = sizeof(void*)/4;
|
||||
}
|
||||
#endif
|
||||
#ifdef CDECL_RETURN_SIMPLE_IN_MEMORY
|
||||
if((internal->callConv == ICC_CDECL ||
|
||||
internal->callConv == ICC_CDECL_OBJLAST ||
|
||||
internal->callConv == ICC_CDECL_OBJFIRST) &&
|
||||
func->returnType.GetSizeInMemoryDWords() >= CDECL_RETURN_SIMPLE_IN_MEMORY_MIN_SIZE)
|
||||
{
|
||||
internal->hostReturnInMemory = true;
|
||||
internal->hostReturnSize = sizeof(void*)/4;
|
||||
}
|
||||
#endif
|
||||
#ifdef STDCALL_RETURN_SIMPLE_IN_MEMORY
|
||||
if( internal->callConv == ICC_STDCALL &&
|
||||
func->returnType.GetSizeInMemoryDWords() >= STDCALL_RETURN_SIMPLE_IN_MEMORY_MIN_SIZE)
|
||||
{
|
||||
internal->hostReturnInMemory = true;
|
||||
internal->hostReturnSize = sizeof(void*)/4;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef SPLIT_OBJS_BY_MEMBER_TYPES
|
||||
// It's not safe to return objects by value because different registers
|
||||
// will be used depending on the memory layout of the object.
|
||||
// Ref: http://www.x86-64.org/documentation/abi.pdf
|
||||
// Ref: http://www.agner.org/optimize/calling_conventions.pdf
|
||||
// If the application informs that the class should be treated as all integers, then we allow it
|
||||
if( !internal->hostReturnInMemory &&
|
||||
!(func->returnType.GetObjectType()->flags & (asOBJ_APP_CLASS_ALLINTS | asOBJ_APP_CLASS_ALLFLOATS)) )
|
||||
{
|
||||
engine->WriteMessage("", 0, 0, asMSGTYPE_INFORMATION, func->GetDeclarationStr().AddressOf());
|
||||
|
||||
asCString str;
|
||||
str.Format(TXT_DONT_SUPPORT_RET_TYPE_s_BY_VAL, func->returnType.Format().AddressOf());
|
||||
engine->WriteMessage("", 0, 0, asMSGTYPE_ERROR, str.AddressOf());
|
||||
engine->ConfigError(asINVALID_CONFIGURATION, 0, 0, 0);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else if( objType & asOBJ_APP_PRIMITIVE )
|
||||
{
|
||||
internal->hostReturnInMemory = false;
|
||||
internal->hostReturnSize = func->returnType.GetSizeInMemoryDWords();
|
||||
internal->hostReturnFloat = false;
|
||||
}
|
||||
else if( objType & asOBJ_APP_FLOAT )
|
||||
{
|
||||
internal->hostReturnInMemory = false;
|
||||
internal->hostReturnSize = func->returnType.GetSizeInMemoryDWords();
|
||||
internal->hostReturnFloat = true;
|
||||
}
|
||||
}
|
||||
// Primitive types can easily be determined
|
||||
#ifdef HAS_128_BIT_PRIMITIVES
|
||||
else if( func->returnType.GetSizeInMemoryDWords() > 4 )
|
||||
{
|
||||
// Shouldn't be possible to get here
|
||||
asASSERT(false);
|
||||
}
|
||||
else if( func->returnType.GetSizeInMemoryDWords() == 4 )
|
||||
{
|
||||
internal->hostReturnInMemory = false;
|
||||
internal->hostReturnSize = 4;
|
||||
internal->hostReturnFloat = false;
|
||||
}
|
||||
#else
|
||||
else if( func->returnType.GetSizeInMemoryDWords() > 2 )
|
||||
{
|
||||
// Shouldn't be possible to get here
|
||||
asASSERT(false);
|
||||
}
|
||||
#endif
|
||||
else if( func->returnType.GetSizeInMemoryDWords() == 2 )
|
||||
{
|
||||
internal->hostReturnInMemory = false;
|
||||
internal->hostReturnSize = 2;
|
||||
internal->hostReturnFloat = func->returnType.IsEqualExceptConst(asCDataType::CreatePrimitive(ttDouble, true));
|
||||
}
|
||||
else if( func->returnType.GetSizeInMemoryDWords() == 1 )
|
||||
{
|
||||
internal->hostReturnInMemory = false;
|
||||
internal->hostReturnSize = 1;
|
||||
internal->hostReturnFloat = func->returnType.IsEqualExceptConst(asCDataType::CreatePrimitive(ttFloat, true));
|
||||
}
|
||||
else
|
||||
{
|
||||
internal->hostReturnInMemory = false;
|
||||
internal->hostReturnSize = 0;
|
||||
internal->hostReturnFloat = false;
|
||||
}
|
||||
|
||||
// Calculate the size needed for the parameters
|
||||
internal->paramSize = func->GetSpaceNeededForArguments();
|
||||
|
||||
// Verify if the function takes any objects by value
|
||||
asUINT n;
|
||||
internal->takesObjByVal = false;
|
||||
for( n = 0; n < func->parameterTypes.GetLength(); n++ )
|
||||
{
|
||||
if( func->parameterTypes[n].IsObject() && !func->parameterTypes[n].IsObjectHandle() && !func->parameterTypes[n].IsReference() )
|
||||
{
|
||||
internal->takesObjByVal = true;
|
||||
|
||||
// Can't pass objects by value unless the application type is informed
|
||||
if( !(func->parameterTypes[n].GetObjectType()->flags & (asOBJ_APP_CLASS | asOBJ_APP_PRIMITIVE | asOBJ_APP_FLOAT)) )
|
||||
{
|
||||
engine->WriteMessage("", 0, 0, asMSGTYPE_INFORMATION, func->GetDeclarationStr().AddressOf());
|
||||
|
||||
asCString str;
|
||||
str.Format(TXT_CANNOT_PASS_TYPE_s_BY_VAL, func->parameterTypes[n].GetObjectType()->name.AddressOf());
|
||||
engine->WriteMessage("", 0, 0, asMSGTYPE_ERROR, str.AddressOf());
|
||||
engine->ConfigError(asINVALID_CONFIGURATION, 0, 0, 0);
|
||||
}
|
||||
|
||||
|
||||
#ifdef SPLIT_OBJS_BY_MEMBER_TYPES
|
||||
// It's not safe to pass objects by value because different registers
|
||||
// will be used depending on the memory layout of the object
|
||||
// Ref: http://www.x86-64.org/documentation/abi.pdf
|
||||
// Ref: http://www.agner.org/optimize/calling_conventions.pdf
|
||||
if(
|
||||
#ifdef COMPLEX_OBJS_PASSED_BY_REF
|
||||
!(func->parameterTypes[n].GetObjectType()->flags & COMPLEX_MASK) &&
|
||||
#endif
|
||||
#ifdef LARGE_OBJS_PASS_BY_REF
|
||||
func->parameterTypes[n].GetSizeInMemoryDWords() < AS_LARGE_OBJ_MIN_SIZE &&
|
||||
#endif
|
||||
!(func->parameterTypes[n].GetObjectType()->flags & (asOBJ_APP_PRIMITIVE | asOBJ_APP_FLOAT | asOBJ_APP_CLASS_ALLINTS | asOBJ_APP_CLASS_ALLFLOATS)) )
|
||||
{
|
||||
engine->WriteMessage("", 0, 0, asMSGTYPE_INFORMATION, func->GetDeclarationStr().AddressOf());
|
||||
|
||||
asCString str;
|
||||
str.Format(TXT_DONT_SUPPORT_TYPE_s_BY_VAL, func->parameterTypes[n].GetObjectType()->name.AddressOf());
|
||||
engine->WriteMessage("", 0, 0, asMSGTYPE_ERROR, str.AddressOf());
|
||||
engine->ConfigError(asINVALID_CONFIGURATION, 0, 0, 0);
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Verify if the function has any registered autohandles
|
||||
internal->hasAutoHandles = false;
|
||||
for( n = 0; n < internal->paramAutoHandles.GetLength(); n++ )
|
||||
{
|
||||
if( internal->paramAutoHandles[n] )
|
||||
{
|
||||
internal->hasAutoHandles = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef AS_MAX_PORTABILITY
|
||||
|
||||
int CallSystemFunction(int id, asCContext *context, void *objectPointer)
|
||||
{
|
||||
asCScriptEngine *engine = context->m_engine;
|
||||
asSSystemFunctionInterface *sysFunc = engine->scriptFunctions[id]->sysFuncIntf;
|
||||
int callConv = sysFunc->callConv;
|
||||
if( callConv == ICC_GENERIC_FUNC || callConv == ICC_GENERIC_METHOD )
|
||||
return context->CallGeneric(id, objectPointer);
|
||||
|
||||
context->SetInternalException(TXT_INVALID_CALLING_CONVENTION);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
//
|
||||
// CallSystemFunctionNative
|
||||
//
|
||||
// This function is implemented for each platform where the native calling conventions is supported.
|
||||
// See the various as_callfunc_xxx.cpp files for their implementation. It is responsible for preparing
|
||||
// the arguments for the function call, calling the function, and then retrieving the return value.
|
||||
//
|
||||
// Parameters:
|
||||
//
|
||||
// context - This is the context that can be used to retrieve specific information from the engine
|
||||
// descr - This is the script function object that holds the information on how to call the function
|
||||
// obj - This is the object pointer, if the call is for a class method, otherwise it is null
|
||||
// args - This is the function arguments, which are packed as in AngelScript
|
||||
// retPointer - This points to a the memory buffer where the return object is to be placed, if the function returns the value in memory rather than in registers
|
||||
// retQW2 - This output parameter should be used if the function returns a value larger than 64bits in registers
|
||||
//
|
||||
// Return value:
|
||||
//
|
||||
// The function should return the value that is returned in registers.
|
||||
//
|
||||
asQWORD CallSystemFunctionNative(asCContext *context, asCScriptFunction *descr, void *obj, asDWORD *args, void *retPointer, asQWORD &retQW2);
|
||||
|
||||
|
||||
int CallSystemFunction(int id, asCContext *context, void *objectPointer)
|
||||
{
|
||||
asCScriptEngine *engine = context->m_engine;
|
||||
asCScriptFunction *descr = engine->scriptFunctions[id];
|
||||
asSSystemFunctionInterface *sysFunc = descr->sysFuncIntf;
|
||||
|
||||
int callConv = sysFunc->callConv;
|
||||
if( callConv == ICC_GENERIC_FUNC || callConv == ICC_GENERIC_METHOD )
|
||||
return context->CallGeneric(id, objectPointer);
|
||||
|
||||
asQWORD retQW = 0;
|
||||
asQWORD retQW2 = 0;
|
||||
asDWORD *args = context->m_regs.stackPointer;
|
||||
void *retPointer = 0;
|
||||
void *obj = 0;
|
||||
int popSize = sysFunc->paramSize;
|
||||
|
||||
if( callConv >= ICC_THISCALL )
|
||||
{
|
||||
if( sysFunc->objForThiscall )
|
||||
{
|
||||
// This class method is being called as if it is a global function
|
||||
obj = sysFunc->objForThiscall;
|
||||
asASSERT( objectPointer == 0 );
|
||||
}
|
||||
else if( objectPointer )
|
||||
{
|
||||
obj = objectPointer;
|
||||
}
|
||||
else
|
||||
{
|
||||
// The object pointer should be popped from the context stack
|
||||
popSize += AS_PTR_SIZE;
|
||||
|
||||
// Check for null pointer
|
||||
obj = (void*)*(asPWORD*)(args);
|
||||
if( obj == 0 )
|
||||
{
|
||||
context->SetInternalException(TXT_NULL_POINTER_ACCESS);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Add the base offset for multiple inheritance
|
||||
#if defined(__GNUC__) && defined(AS_ARM)
|
||||
// On GNUC + ARM the lsb of the offset is used to indicate a virtual function
|
||||
// and the whole offset is thus shifted one bit left to keep the original
|
||||
// offset resolution
|
||||
obj = (void*)(asPWORD(obj) + (sysFunc->baseOffset>>1));
|
||||
#else
|
||||
obj = (void*)(asPWORD(obj) + sysFunc->baseOffset);
|
||||
#endif
|
||||
|
||||
// Skip the object pointer
|
||||
args += AS_PTR_SIZE;
|
||||
}
|
||||
}
|
||||
|
||||
if( descr->DoesReturnOnStack() )
|
||||
{
|
||||
// Get the address of the location for the return value from the stack
|
||||
retPointer = (void*)*(asPWORD*)(args);
|
||||
popSize += AS_PTR_SIZE;
|
||||
args += AS_PTR_SIZE;
|
||||
|
||||
// When returning the value on the location allocated by the called
|
||||
// we shouldn't set the object type in the register
|
||||
context->m_regs.objectType = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Set the object type of the reference held in the register
|
||||
context->m_regs.objectType = descr->returnType.GetObjectType();
|
||||
}
|
||||
|
||||
context->m_callingSystemFunction = descr;
|
||||
#ifdef AS_NO_EXCEPTIONS
|
||||
retQW = CallSystemFunctionNative(context, descr, obj, args, sysFunc->hostReturnInMemory ? retPointer : 0, retQW2);
|
||||
#else
|
||||
// This try/catch block is to catch potential exception that may
|
||||
// be thrown by the registered function. The implementation of the
|
||||
// CallSystemFunctionNative() must make sure not to have any manual
|
||||
// clean-up after the call to the real function, or that won't be
|
||||
// executed in case of an exception.
|
||||
try
|
||||
{
|
||||
retQW = CallSystemFunctionNative(context, descr, obj, args, sysFunc->hostReturnInMemory ? retPointer : 0, retQW2);
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
// Convert the exception to a script exception so the VM can
|
||||
// properly report the error to the application and then clean up
|
||||
context->SetException(TXT_EXCEPTION_CAUGHT);
|
||||
}
|
||||
#endif
|
||||
context->m_callingSystemFunction = 0;
|
||||
|
||||
#if defined(COMPLEX_OBJS_PASSED_BY_REF) || defined(AS_LARGE_OBJS_PASSED_BY_REF)
|
||||
if( sysFunc->takesObjByVal )
|
||||
{
|
||||
// Need to free the complex objects passed by value, but that the
|
||||
// calling convention implicitly passes by reference behind the scene as the
|
||||
// calling function is the owner of that memory.
|
||||
|
||||
// args is pointing to the first real argument as used in CallSystemFunctionNative,
|
||||
// i.e. hidden arguments such as the object pointer and return address have already
|
||||
// been skipped.
|
||||
|
||||
int spos = 0;
|
||||
for( asUINT n = 0; n < descr->parameterTypes.GetLength(); n++ )
|
||||
{
|
||||
bool needFree = false;
|
||||
asCDataType &dt = descr->parameterTypes[n];
|
||||
#ifdef COMPLEX_OBJS_PASSED_BY_REF
|
||||
if( dt.GetObjectType() && dt.GetObjectType()->flags & COMPLEX_MASK ) needFree = true;
|
||||
#endif
|
||||
#ifdef AS_LARGE_OBJS_PASSED_BY_REF
|
||||
if( dt.GetSizeInMemoryDWords() >= AS_LARGE_OBJ_MIN_SIZE ) needFree = true;
|
||||
#endif
|
||||
if( needFree &&
|
||||
dt.IsObject() &&
|
||||
!dt.IsObjectHandle() &&
|
||||
!dt.IsReference() )
|
||||
{
|
||||
void *obj = (void*)*(asPWORD*)&args[spos];
|
||||
spos += AS_PTR_SIZE;
|
||||
|
||||
#ifndef AS_CALLEE_DESTROY_OBJ_BY_VAL
|
||||
// If the called function doesn't destroy objects passed by value we must do so here
|
||||
asSTypeBehaviour *beh = &dt.GetObjectType()->beh;
|
||||
if( beh->destruct )
|
||||
engine->CallObjectMethod(obj, beh->destruct);
|
||||
#endif
|
||||
|
||||
engine->CallFree(obj);
|
||||
}
|
||||
else
|
||||
spos += dt.GetSizeOnStackDWords();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// Store the returned value in our stack
|
||||
if( descr->returnType.IsObject() && !descr->returnType.IsReference() )
|
||||
{
|
||||
if( descr->returnType.IsObjectHandle() )
|
||||
{
|
||||
#if defined(AS_BIG_ENDIAN) && AS_PTR_SIZE == 1
|
||||
// Since we're treating the system function as if it is returning a QWORD we are
|
||||
// actually receiving the value in the high DWORD of retQW.
|
||||
retQW >>= 32;
|
||||
#endif
|
||||
|
||||
context->m_regs.objectRegister = (void*)(asPWORD)retQW;
|
||||
|
||||
if( sysFunc->returnAutoHandle && context->m_regs.objectRegister )
|
||||
{
|
||||
asASSERT( !(descr->returnType.GetObjectType()->flags & asOBJ_NOCOUNT) );
|
||||
engine->CallObjectMethod(context->m_regs.objectRegister, descr->returnType.GetObjectType()->beh.addref);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
asASSERT( retPointer );
|
||||
|
||||
if( !sysFunc->hostReturnInMemory )
|
||||
{
|
||||
// Copy the returned value to the pointer sent by the script engine
|
||||
if( sysFunc->hostReturnSize == 1 )
|
||||
{
|
||||
#if defined(AS_BIG_ENDIAN) && AS_PTR_SIZE == 1
|
||||
// Since we're treating the system function as if it is returning a QWORD we are
|
||||
// actually receiving the value in the high DWORD of retQW.
|
||||
retQW >>= 32;
|
||||
#endif
|
||||
|
||||
*(asDWORD*)retPointer = (asDWORD)retQW;
|
||||
}
|
||||
else if( sysFunc->hostReturnSize == 2 )
|
||||
*(asQWORD*)retPointer = retQW;
|
||||
else if( sysFunc->hostReturnSize == 3 )
|
||||
{
|
||||
*(asQWORD*)retPointer = retQW;
|
||||
*(((asDWORD*)retPointer) + 2) = (asDWORD)retQW2;
|
||||
}
|
||||
else // if( sysFunc->hostReturnSize == 4 )
|
||||
{
|
||||
*(asQWORD*)retPointer = retQW;
|
||||
*(((asQWORD*)retPointer) + 1) = retQW2;
|
||||
}
|
||||
}
|
||||
|
||||
if( context->m_status == asEXECUTION_EXCEPTION )
|
||||
{
|
||||
// If the function raised a script exception it really shouldn't have
|
||||
// initialized the object. However, as it is a soft exception there is
|
||||
// no way for the application to not return a value, so instead we simply
|
||||
// destroy it here, to pretend it was never created.
|
||||
if( descr->returnType.GetObjectType()->beh.destruct )
|
||||
engine->CallObjectMethod(retPointer, descr->returnType.GetObjectType()->beh.destruct);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Store value in value register
|
||||
if( sysFunc->hostReturnSize == 1 )
|
||||
{
|
||||
#if defined(AS_BIG_ENDIAN)
|
||||
// Since we're treating the system function as if it is returning a QWORD we are
|
||||
// actually receiving the value in the high DWORD of retQW.
|
||||
retQW >>= 32;
|
||||
|
||||
// Due to endian issues we need to handle return values that are
|
||||
// less than a DWORD (32 bits) in size specially
|
||||
int numBytes = descr->returnType.GetSizeInMemoryBytes();
|
||||
if( descr->returnType.IsReference() ) numBytes = 4;
|
||||
switch( numBytes )
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
// 8 bits
|
||||
asBYTE *val = (asBYTE*)&context->m_regs.valueRegister;
|
||||
val[0] = (asBYTE)retQW;
|
||||
val[1] = 0;
|
||||
val[2] = 0;
|
||||
val[3] = 0;
|
||||
val[4] = 0;
|
||||
val[5] = 0;
|
||||
val[6] = 0;
|
||||
val[7] = 0;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
{
|
||||
// 16 bits
|
||||
asWORD *val = (asWORD*)&context->m_regs.valueRegister;
|
||||
val[0] = (asWORD)retQW;
|
||||
val[1] = 0;
|
||||
val[2] = 0;
|
||||
val[3] = 0;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
// 32 bits
|
||||
asDWORD *val = (asDWORD*)&context->m_regs.valueRegister;
|
||||
val[0] = (asDWORD)retQW;
|
||||
val[1] = 0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
#else
|
||||
*(asDWORD*)&context->m_regs.valueRegister = (asDWORD)retQW;
|
||||
#endif
|
||||
}
|
||||
else
|
||||
context->m_regs.valueRegister = retQW;
|
||||
}
|
||||
|
||||
// Release autohandles in the arguments
|
||||
if( sysFunc->hasAutoHandles )
|
||||
{
|
||||
args = context->m_regs.stackPointer;
|
||||
if( callConv >= ICC_THISCALL && !objectPointer )
|
||||
args += AS_PTR_SIZE;
|
||||
|
||||
int spos = 0;
|
||||
for( asUINT n = 0; n < descr->parameterTypes.GetLength(); n++ )
|
||||
{
|
||||
if( sysFunc->paramAutoHandles[n] && *(asPWORD*)&args[spos] != 0 )
|
||||
{
|
||||
// Call the release method on the type
|
||||
engine->CallObjectMethod((void*)*(asPWORD*)&args[spos], descr->parameterTypes[n].GetObjectType()->beh.release);
|
||||
*(asPWORD*)&args[spos] = 0;
|
||||
}
|
||||
|
||||
if( descr->parameterTypes[n].IsObject() && !descr->parameterTypes[n].IsObjectHandle() && !descr->parameterTypes[n].IsReference() )
|
||||
spos += AS_PTR_SIZE;
|
||||
else
|
||||
spos += descr->parameterTypes[n].GetSizeOnStackDWords();
|
||||
}
|
||||
}
|
||||
|
||||
return popSize;
|
||||
}
|
||||
|
||||
#endif // AS_MAX_PORTABILITY
|
||||
|
||||
END_AS_NAMESPACE
|
||||
|
134
lib/angelscript/source/as_callfunc.h
Normal file
134
lib/angelscript/source/as_callfunc.h
Normal file
@ -0,0 +1,134 @@
|
||||
/*
|
||||
AngelCode Scripting Library
|
||||
Copyright (c) 2003-2012 Andreas Jonsson
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any
|
||||
damages arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any
|
||||
purpose, including commercial applications, and to alter it and
|
||||
redistribute it freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you
|
||||
must not claim that you wrote the original software. If you use
|
||||
this software in a product, an acknowledgment in the product
|
||||
documentation would be appreciated but is not required.
|
||||
|
||||
2. Altered source versions must be plainly marked as such, and
|
||||
must not be misrepresented as being the original software.
|
||||
|
||||
3. This notice may not be removed or altered from any source
|
||||
distribution.
|
||||
|
||||
The original version of this library can be located at:
|
||||
http://www.angelcode.com/angelscript/
|
||||
|
||||
Andreas Jonsson
|
||||
andreas@angelcode.com
|
||||
*/
|
||||
|
||||
|
||||
//
|
||||
// as_callfunc.h
|
||||
//
|
||||
// These functions handle the actual calling of system functions
|
||||
//
|
||||
|
||||
|
||||
#ifndef AS_CALLFUNC_H
|
||||
#define AS_CALLFUNC_H
|
||||
|
||||
#include "as_array.h"
|
||||
|
||||
BEGIN_AS_NAMESPACE
|
||||
|
||||
class asCContext;
|
||||
class asCScriptEngine;
|
||||
class asCScriptFunction;
|
||||
struct asSSystemFunctionInterface;
|
||||
|
||||
int DetectCallingConvention(bool isMethod, const asSFuncPtr &ptr, int callConv, void *objForThiscall, asSSystemFunctionInterface *internal);
|
||||
|
||||
int PrepareSystemFunctionGeneric(asCScriptFunction *func, asSSystemFunctionInterface *internal, asCScriptEngine *engine);
|
||||
|
||||
int PrepareSystemFunction(asCScriptFunction *func, asSSystemFunctionInterface *internal, asCScriptEngine *engine);
|
||||
|
||||
int CallSystemFunction(int id, asCContext *context, void *objectPointer);
|
||||
|
||||
inline asPWORD FuncPtrToUInt(asFUNCTION_t func)
|
||||
{
|
||||
// A little trickery as the C++ standard doesn't allow direct
|
||||
// conversion between function pointer and data pointer
|
||||
union { asFUNCTION_t func; asPWORD idx; } u;
|
||||
u.func = func;
|
||||
|
||||
return u.idx;
|
||||
}
|
||||
|
||||
enum internalCallConv
|
||||
{
|
||||
ICC_GENERIC_FUNC,
|
||||
ICC_GENERIC_FUNC_RETURNINMEM, // never used
|
||||
ICC_CDECL,
|
||||
ICC_CDECL_RETURNINMEM,
|
||||
ICC_STDCALL,
|
||||
ICC_STDCALL_RETURNINMEM,
|
||||
ICC_THISCALL,
|
||||
ICC_THISCALL_RETURNINMEM,
|
||||
ICC_VIRTUAL_THISCALL,
|
||||
ICC_VIRTUAL_THISCALL_RETURNINMEM,
|
||||
ICC_CDECL_OBJLAST,
|
||||
ICC_CDECL_OBJLAST_RETURNINMEM,
|
||||
ICC_CDECL_OBJFIRST,
|
||||
ICC_CDECL_OBJFIRST_RETURNINMEM,
|
||||
ICC_GENERIC_METHOD,
|
||||
ICC_GENERIC_METHOD_RETURNINMEM // never used
|
||||
};
|
||||
|
||||
struct asSSystemFunctionInterface
|
||||
{
|
||||
asFUNCTION_t func;
|
||||
int baseOffset;
|
||||
internalCallConv callConv;
|
||||
int scriptReturnSize;
|
||||
bool hostReturnInMemory;
|
||||
bool hostReturnFloat;
|
||||
int hostReturnSize;
|
||||
int paramSize;
|
||||
bool takesObjByVal;
|
||||
asCArray<bool> paramAutoHandles;
|
||||
bool returnAutoHandle;
|
||||
bool hasAutoHandles;
|
||||
void *objForThiscall;
|
||||
|
||||
asSSystemFunctionInterface() {}
|
||||
|
||||
asSSystemFunctionInterface(const asSSystemFunctionInterface &in)
|
||||
{
|
||||
*this = in;
|
||||
}
|
||||
|
||||
asSSystemFunctionInterface &operator=(const asSSystemFunctionInterface &in)
|
||||
{
|
||||
func = in.func;
|
||||
baseOffset = in.baseOffset;
|
||||
callConv = in.callConv;
|
||||
scriptReturnSize = in.scriptReturnSize;
|
||||
hostReturnInMemory = in.hostReturnInMemory;
|
||||
hostReturnFloat = in.hostReturnFloat;
|
||||
hostReturnSize = in.hostReturnSize;
|
||||
paramSize = in.paramSize;
|
||||
takesObjByVal = in.takesObjByVal;
|
||||
paramAutoHandles = in.paramAutoHandles;
|
||||
returnAutoHandle = in.returnAutoHandle;
|
||||
hasAutoHandles = in.hasAutoHandles;
|
||||
objForThiscall = in.objForThiscall;
|
||||
return *this;
|
||||
}
|
||||
};
|
||||
|
||||
END_AS_NAMESPACE
|
||||
|
||||
#endif
|
||||
|
585
lib/angelscript/source/as_callfunc_arm.cpp
Normal file
585
lib/angelscript/source/as_callfunc_arm.cpp
Normal file
@ -0,0 +1,585 @@
|
||||
/*
|
||||
AngelCode Scripting Library
|
||||
Copyright (c) 2003-2013 Andreas Jonsson
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any
|
||||
damages arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any
|
||||
purpose, including commercial applications, and to alter it and
|
||||
redistribute it freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you
|
||||
must not claim that you wrote the original software. If you use
|
||||
this software in a product, an acknowledgment in the product
|
||||
documentation would be appreciated but is not required.
|
||||
|
||||
2. Altered source versions must be plainly marked as such, and
|
||||
must not be misrepresented as being the original software.
|
||||
|
||||
3. This notice may not be removed or altered from any source
|
||||
distribution.
|
||||
|
||||
The original version of this library can be located at:
|
||||
http://www.angelcode.com/angelscript/
|
||||
|
||||
Andreas Jonsson
|
||||
andreas@angelcode.com
|
||||
*/
|
||||
|
||||
|
||||
//
|
||||
// as_callfunc_arm.cpp
|
||||
//
|
||||
// These functions handle the actual calling of system functions on the arm platform
|
||||
//
|
||||
// Written by Fredrik Ehnbom in June 2009, based on as_callfunc_x86.cpp
|
||||
//
|
||||
// The code was complemented to support Linux with ARM by Carlos Luna in December, 2012.
|
||||
|
||||
|
||||
// This code has to conform to both AAPCS and the modified ABI for iOS
|
||||
//
|
||||
// Reference:
|
||||
//
|
||||
// AAPCS: http://infocenter.arm.com/help/topic/com.arm.doc.ihi0042d/IHI0042D_aapcs.pdf
|
||||
// iOS: http://developer.apple.com/library/ios/documentation/Xcode/Conceptual/iPhoneOSABIReference/iPhoneOSABIReference.pdf
|
||||
|
||||
#include "as_config.h"
|
||||
|
||||
#ifndef AS_MAX_PORTABILITY
|
||||
#ifdef AS_ARM
|
||||
|
||||
#include "as_callfunc.h"
|
||||
#include "as_scriptengine.h"
|
||||
#include "as_texts.h"
|
||||
#include "as_tokendef.h"
|
||||
#include "as_context.h"
|
||||
|
||||
#if defined(AS_SOFTFP)
|
||||
|
||||
// This code supports the soft-float ABI, i.e. g++ -mfloat-abi=softfp
|
||||
//
|
||||
// The code for iOS, Android, Marmalade and Windows Phone goes here
|
||||
|
||||
BEGIN_AS_NAMESPACE
|
||||
|
||||
extern "C" asQWORD armFunc (const asDWORD *, int, asFUNCTION_t);
|
||||
extern "C" asQWORD armFuncR0 (const asDWORD *, int, asFUNCTION_t, asDWORD r0);
|
||||
extern "C" asQWORD armFuncR0R1 (const asDWORD *, int, asFUNCTION_t, asDWORD r0, asDWORD r1);
|
||||
extern "C" asQWORD armFuncObjLast (const asDWORD *, int, asFUNCTION_t, asDWORD obj);
|
||||
extern "C" asQWORD armFuncR0ObjLast (const asDWORD *, int, asFUNCTION_t, asDWORD r0, asDWORD obj);
|
||||
|
||||
asQWORD CallSystemFunctionNative(asCContext *context, asCScriptFunction *descr, void *obj, asDWORD *args, void *retPointer, asQWORD &/*retQW2*/)
|
||||
{
|
||||
asCScriptEngine *engine = context->m_engine;
|
||||
asSSystemFunctionInterface *sysFunc = descr->sysFuncIntf;
|
||||
int callConv = sysFunc->callConv;
|
||||
|
||||
asQWORD retQW = 0;
|
||||
asFUNCTION_t func = sysFunc->func;
|
||||
int paramSize = sysFunc->paramSize;
|
||||
asFUNCTION_t *vftable;
|
||||
|
||||
if( sysFunc->hostReturnInMemory )
|
||||
{
|
||||
// The return is made in memory
|
||||
callConv++;
|
||||
}
|
||||
|
||||
asDWORD paramBuffer[64+2];
|
||||
// Android & Linux needs to align 64bit types on even registers, but this isn't done on iOS or Windows Phone
|
||||
// TODO: optimize runtime: There should be a check for this in PrepareSystemFunction() so this
|
||||
// doesn't have to be done for functions that don't have any 64bit types
|
||||
#if !defined(AS_ANDROID) && !defined(AS_LINUX)
|
||||
if( sysFunc->takesObjByVal )
|
||||
#endif
|
||||
{
|
||||
#if defined(AS_ANDROID) || defined(AS_LINUX)
|
||||
// mask is used as a toggler to skip uneven registers.
|
||||
int mask = 1;
|
||||
|
||||
// Check for object pointer as first argument
|
||||
switch( callConv )
|
||||
{
|
||||
case ICC_THISCALL:
|
||||
case ICC_CDECL_OBJFIRST:
|
||||
case ICC_VIRTUAL_THISCALL:
|
||||
case ICC_THISCALL_RETURNINMEM:
|
||||
case ICC_CDECL_OBJFIRST_RETURNINMEM:
|
||||
case ICC_VIRTUAL_THISCALL_RETURNINMEM:
|
||||
mask = 0;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
// Check for hidden address in case of return by value
|
||||
if( sysFunc->hostReturnInMemory )
|
||||
mask = !mask;
|
||||
#endif
|
||||
paramSize = 0;
|
||||
int spos = 0;
|
||||
int dpos = 2;
|
||||
|
||||
for( asUINT n = 0; n < descr->parameterTypes.GetLength(); n++ )
|
||||
{
|
||||
// TODO: runtime optimize: Declare a reference to descr->parameterTypes[n] so the array doesn't have to be access all the time
|
||||
if( descr->parameterTypes[n].IsObject() && !descr->parameterTypes[n].IsObjectHandle() && !descr->parameterTypes[n].IsReference() )
|
||||
{
|
||||
#ifdef COMPLEX_OBJS_PASSED_BY_REF
|
||||
if( descr->parameterTypes[n].GetObjectType()->flags & COMPLEX_MASK )
|
||||
{
|
||||
paramBuffer[dpos++] = args[spos++];
|
||||
paramSize++;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
#if defined(AS_ANDROID) || defined(AS_LINUX)
|
||||
if( (descr->parameterTypes[n].GetObjectType()->flags & asOBJ_APP_CLASS_ALIGN8) &&
|
||||
((dpos & 1) == mask) )
|
||||
{
|
||||
// 64 bit value align
|
||||
dpos++;
|
||||
paramSize++;
|
||||
}
|
||||
#endif
|
||||
// Copy the object's memory to the buffer
|
||||
memcpy(¶mBuffer[dpos], *(void**)(args+spos), descr->parameterTypes[n].GetSizeInMemoryBytes());
|
||||
|
||||
// Delete the original memory
|
||||
engine->CallFree(*(char**)(args+spos));
|
||||
spos++;
|
||||
dpos += descr->parameterTypes[n].GetSizeInMemoryDWords();
|
||||
paramSize += descr->parameterTypes[n].GetSizeInMemoryDWords();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
#if defined(AS_ANDROID) || defined(AS_LINUX)
|
||||
// Should an alignment be performed?
|
||||
if( !descr->parameterTypes[n].IsObjectHandle() &&
|
||||
!descr->parameterTypes[n].IsReference() &&
|
||||
descr->parameterTypes[n].GetSizeOnStackDWords() == 2 &&
|
||||
((dpos & 1) == mask) )
|
||||
{
|
||||
// 64 bit value align
|
||||
dpos++;
|
||||
paramSize++;
|
||||
}
|
||||
#endif
|
||||
|
||||
// Copy the value directly
|
||||
paramBuffer[dpos++] = args[spos++];
|
||||
if( descr->parameterTypes[n].GetSizeOnStackDWords() > 1 )
|
||||
paramBuffer[dpos++] = args[spos++];
|
||||
paramSize += descr->parameterTypes[n].GetSizeOnStackDWords();
|
||||
}
|
||||
}
|
||||
// Keep a free location at the beginning
|
||||
args = ¶mBuffer[2];
|
||||
}
|
||||
|
||||
switch( callConv )
|
||||
{
|
||||
case ICC_CDECL_RETURNINMEM: // fall through
|
||||
case ICC_STDCALL_RETURNINMEM:
|
||||
retQW = armFuncR0(args, paramSize<<2, func, (asDWORD)retPointer);
|
||||
break;
|
||||
case ICC_CDECL: // fall through
|
||||
case ICC_STDCALL:
|
||||
retQW = armFunc(args, paramSize<<2, func);
|
||||
break;
|
||||
case ICC_THISCALL: // fall through
|
||||
case ICC_CDECL_OBJFIRST:
|
||||
retQW = armFuncR0(args, paramSize<<2, func, (asDWORD)obj);
|
||||
break;
|
||||
case ICC_THISCALL_RETURNINMEM:
|
||||
#ifdef __GNUC__
|
||||
// On GNUC the address where the return value will be placed should be put in R0
|
||||
retQW = armFuncR0R1(args, paramSize<<2, func, (asDWORD)retPointer, (asDWORD)obj);
|
||||
#else
|
||||
// On Windows the R0 should always hold the object pointer, and the address for the return value comes after
|
||||
retQW = armFuncR0R1(args, paramSize<<2, func, (asDWORD)obj, (asDWORD)retPointer);
|
||||
#endif
|
||||
break;
|
||||
case ICC_CDECL_OBJFIRST_RETURNINMEM:
|
||||
retQW = armFuncR0R1(args, paramSize<<2, func, (asDWORD)retPointer, (asDWORD)obj);
|
||||
break;
|
||||
case ICC_VIRTUAL_THISCALL:
|
||||
// Get virtual function table from the object pointer
|
||||
vftable = *(asFUNCTION_t**)obj;
|
||||
retQW = armFuncR0(args, paramSize<<2, vftable[FuncPtrToUInt(func)>>2], (asDWORD)obj);
|
||||
break;
|
||||
case ICC_VIRTUAL_THISCALL_RETURNINMEM:
|
||||
// Get virtual function table from the object pointer
|
||||
vftable = *(asFUNCTION_t**)obj;
|
||||
#ifdef __GNUC__
|
||||
// On GNUC the address where the return value will be placed should be put in R0
|
||||
retQW = armFuncR0R1(args, (paramSize+1)<<2, vftable[FuncPtrToUInt(func)>>2], (asDWORD)retPointer, (asDWORD)obj);
|
||||
#else
|
||||
// On Windows the R0 should always hold the object pointer, and the address for the return value comes after
|
||||
retQW = armFuncR0R1(args, (paramSize+1)<<2, vftable[FuncPtrToUInt(func)>>2], (asDWORD)obj, (asDWORD)retPointer);
|
||||
#endif
|
||||
break;
|
||||
case ICC_CDECL_OBJLAST:
|
||||
retQW = armFuncObjLast(args, paramSize<<2, func, (asDWORD)obj);
|
||||
break;
|
||||
case ICC_CDECL_OBJLAST_RETURNINMEM:
|
||||
retQW = armFuncR0ObjLast(args, paramSize<<2, func, (asDWORD)retPointer, (asDWORD)obj);
|
||||
break;
|
||||
default:
|
||||
context->SetInternalException(TXT_INVALID_CALLING_CONVENTION);
|
||||
}
|
||||
|
||||
return retQW;
|
||||
}
|
||||
|
||||
END_AS_NAMESPACE
|
||||
|
||||
#elif !defined(AS_SOFTFP)
|
||||
|
||||
// This code supports the hard-float ABI, i.e. g++ -mfloat-abi=hard
|
||||
// The main difference is that the floating point values are passed in the fpu registers
|
||||
|
||||
#define VFP_OFFSET 70
|
||||
#define STACK_OFFSET 6
|
||||
#define PARAM_BUFFER_SIZE 104
|
||||
|
||||
BEGIN_AS_NAMESPACE
|
||||
|
||||
extern "C" asQWORD armFunc (const asDWORD *, int, asFUNCTION_t);
|
||||
extern "C" asQWORD armFuncR0 (const asDWORD *, int, asFUNCTION_t, asDWORD r0);
|
||||
extern "C" asQWORD armFuncR0R1 (const asDWORD *, int, asFUNCTION_t, asDWORD r0, asDWORD r1);
|
||||
extern "C" asQWORD armFuncObjLast (const asDWORD *, int, asFUNCTION_t, asDWORD obj);
|
||||
extern "C" asQWORD armFuncR0ObjLast (const asDWORD *, int, asFUNCTION_t, asDWORD r0, asDWORD obj);
|
||||
|
||||
asQWORD CallSystemFunctionNative(asCContext *context, asCScriptFunction *descr, void *obj, asDWORD *args, void *retPointer, asQWORD &/*retQW2*/)
|
||||
{
|
||||
asCScriptEngine *engine = context->m_engine;
|
||||
asSSystemFunctionInterface *sysFunc = descr->sysFuncIntf;
|
||||
int callConv = sysFunc->callConv;
|
||||
|
||||
asQWORD retQW = 0;
|
||||
asFUNCTION_t func = sysFunc->func;
|
||||
int paramSize = sysFunc->paramSize;
|
||||
asFUNCTION_t *vftable;
|
||||
|
||||
//---------------------------------------------------------------------------- RPi
|
||||
int freeFloatSlot = VFP_OFFSET;
|
||||
int freeDoubleSlot = VFP_OFFSET;
|
||||
int stackPos = STACK_OFFSET;
|
||||
int stackSize = 0;
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
//---------------------------------------------------------------------------- RPi
|
||||
// We´ll divide paramBuffer into several segments:
|
||||
//
|
||||
// 0-1 Unused
|
||||
// 2-5 (+8 / +0 asm) values that should be placed in R0 - R3
|
||||
// 6-67 (+24 / +16 asm) values that should be placed on the stack
|
||||
// 68 (+272 / +264 asm) number of values stored in r registers (R0 - R3)
|
||||
// 69 (+276 / +268 asm) number of args stored on the stack
|
||||
// 70-85 (+280 / +272 asm) values that should be placed in VFP registers (16)
|
||||
// 86-87 (+344 / +336 asm) sp original value - sp final value - for debugging
|
||||
// 88-103 (+352 / +344 asm) Check area for free-used VFP registers
|
||||
//
|
||||
// Total number of elements: 104
|
||||
//
|
||||
// When passing the paramBuffer to the asm routines via the args pointer we are
|
||||
// offsetting the start of the array to being at element # 2. That´s why in asm
|
||||
// all addresses must have an offset of -2 words (-8 bytes).
|
||||
//---------------------------------------------------------------------------- RPi
|
||||
|
||||
asDWORD paramBuffer[PARAM_BUFFER_SIZE];
|
||||
memset(paramBuffer, 0, sizeof(asDWORD) * PARAM_BUFFER_SIZE);
|
||||
|
||||
if( sysFunc->hostReturnInMemory )
|
||||
{
|
||||
// TODO: runtime optimize: This check should be done in PrepareSystemFunction
|
||||
if ( !( descr->returnType.GetObjectType()->flags & COMPLEX_RETURN_MASK ) &&
|
||||
( descr->returnType.GetObjectType()->flags & asOBJ_APP_CLASS_ALLFLOATS ) &&
|
||||
descr->returnType.GetSizeInMemoryBytes() <= 8 )
|
||||
callConv--;
|
||||
|
||||
// The return is made in memory
|
||||
callConv++;
|
||||
}
|
||||
|
||||
// Linux needs to align 64bit types on even registers, but this isn't done on iOS or Windows Phone
|
||||
// TODO: optimize runtime: There should be a check for this in PrepareSystemFunction() so this
|
||||
// doesn't have to be done for functions that don't have any 64bit types
|
||||
{
|
||||
// mask is used as a toggler to skip uneven registers.
|
||||
int mask = 1;
|
||||
|
||||
// Check for object pointer as first argument
|
||||
switch( callConv )
|
||||
{
|
||||
case ICC_THISCALL:
|
||||
case ICC_CDECL_OBJFIRST:
|
||||
case ICC_VIRTUAL_THISCALL:
|
||||
case ICC_THISCALL_RETURNINMEM:
|
||||
case ICC_CDECL_OBJFIRST_RETURNINMEM:
|
||||
case ICC_VIRTUAL_THISCALL_RETURNINMEM:
|
||||
mask = 0;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
// Check for hidden address in case of return by value
|
||||
if( sysFunc->hostReturnInMemory )
|
||||
mask = !mask;
|
||||
|
||||
paramSize = 0;
|
||||
int spos = 0;
|
||||
int dpos = 2;
|
||||
|
||||
for( asUINT n = 0; n < descr->parameterTypes.GetLength(); n++ )
|
||||
{
|
||||
// TODO: runtime optimize: Declare a reference to descr->parameterTypes[n] so the array doesn't have to be access all the time
|
||||
if( descr->parameterTypes[n].IsObject() && !descr->parameterTypes[n].IsObjectHandle() && !descr->parameterTypes[n].IsReference() )
|
||||
{
|
||||
#ifdef COMPLEX_OBJS_PASSED_BY_REF
|
||||
if( descr->parameterTypes[n].GetObjectType()->flags & COMPLEX_MASK )
|
||||
{
|
||||
paramBuffer[dpos++] = args[spos++];
|
||||
paramSize++;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
if( (descr->parameterTypes[n].GetObjectType()->flags & asOBJ_APP_CLASS_ALIGN8) )
|
||||
{
|
||||
if ( (dpos & 1) == mask )
|
||||
{
|
||||
// 64 bit value align
|
||||
dpos++;
|
||||
paramSize++;
|
||||
}
|
||||
|
||||
if ( (stackPos & 1) == mask )
|
||||
{
|
||||
// 64 bit value align
|
||||
stackPos++;
|
||||
stackSize++;
|
||||
}
|
||||
}
|
||||
|
||||
// Copy the object's memory to the buffer
|
||||
if (descr->parameterTypes[n].GetObjectType()->flags & asOBJ_APP_CLASS_ALLFLOATS)
|
||||
{
|
||||
int target = (freeFloatSlot > freeDoubleSlot) ? freeFloatSlot : freeDoubleSlot;
|
||||
|
||||
if ( descr->parameterTypes[n].GetSizeInMemoryDWords() <= ( (VFP_OFFSET + 16) - target) )
|
||||
{
|
||||
memcpy(¶mBuffer[target], *(void**)(args+spos), descr->parameterTypes[n].GetSizeInMemoryBytes());
|
||||
memset(¶mBuffer[target + 18], (asDWORD)1, descr->parameterTypes[n].GetSizeInMemoryDWords());
|
||||
target += descr->parameterTypes[n].GetSizeInMemoryDWords();
|
||||
freeFloatSlot = freeDoubleSlot = target;
|
||||
}
|
||||
else
|
||||
{
|
||||
memcpy(¶mBuffer[stackPos], *(void**)(args+spos), descr->parameterTypes[n].GetSizeInMemoryBytes());
|
||||
stackPos += descr->parameterTypes[n].GetSizeInMemoryDWords();
|
||||
stackSize += descr->parameterTypes[n].GetSizeOnStackDWords();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
memcpy(¶mBuffer[dpos], *(void**)(args+spos), descr->parameterTypes[n].GetSizeInMemoryBytes());
|
||||
dpos += descr->parameterTypes[n].GetSizeInMemoryDWords();
|
||||
paramSize += descr->parameterTypes[n].GetSizeInMemoryDWords();
|
||||
}
|
||||
|
||||
// Delete the original memory
|
||||
engine->CallFree(*(char**)(args+spos));
|
||||
spos++;
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
else if( descr->parameterTypes[n].IsFloatType() && !descr->parameterTypes[n].IsReference() )
|
||||
{
|
||||
// Are there any "s" registers available?
|
||||
if ( freeFloatSlot < (VFP_OFFSET + 16) )
|
||||
{
|
||||
if (freeFloatSlot == freeDoubleSlot)
|
||||
freeDoubleSlot += 2;
|
||||
|
||||
paramBuffer[freeFloatSlot + 18] = (asDWORD)1;
|
||||
paramBuffer[freeFloatSlot++] = args[spos++];
|
||||
|
||||
while(freeFloatSlot < (VFP_OFFSET + 16) && paramBuffer[freeFloatSlot + 18] != 0)
|
||||
freeFloatSlot++;
|
||||
}
|
||||
// If not, then store the float arg in the stack area
|
||||
else
|
||||
{
|
||||
paramBuffer[stackPos++] = args[spos++];
|
||||
stackSize++;
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
else if( descr->parameterTypes[n].IsDoubleType() && !descr->parameterTypes[n].IsReference() )
|
||||
{
|
||||
// Are there any "d" registers available?
|
||||
if ( freeDoubleSlot < (VFP_OFFSET + 15) )
|
||||
{
|
||||
if (freeFloatSlot == freeDoubleSlot)
|
||||
freeFloatSlot += 2;
|
||||
|
||||
// Copy two dwords for the double
|
||||
paramBuffer[freeDoubleSlot + 18] = (asDWORD)1;
|
||||
paramBuffer[freeDoubleSlot + 19] = (asDWORD)1;
|
||||
paramBuffer[freeDoubleSlot++] = args[spos++];
|
||||
paramBuffer[freeDoubleSlot++] = args[spos++];
|
||||
|
||||
while(freeDoubleSlot < (VFP_OFFSET + 15) && paramBuffer[freeDoubleSlot + 18] != 0)
|
||||
freeDoubleSlot += 2;
|
||||
}
|
||||
// If not, then store the double arg in the stack area
|
||||
else
|
||||
{
|
||||
if ( (stackPos & 1) == mask )
|
||||
{
|
||||
// 64 bit value align
|
||||
stackPos++;
|
||||
stackSize++;
|
||||
}
|
||||
|
||||
paramBuffer[stackPos++] = args[spos++];
|
||||
paramBuffer[stackPos++] = args[spos++];
|
||||
stackSize += 2;
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Copy the value directly to "r" registers or the stack, checking for alignment
|
||||
if (paramSize < 4)
|
||||
{
|
||||
// Should an alignment be performed?
|
||||
if( (dpos & 1) == mask && descr->parameterTypes[n].GetSizeOnStackDWords() == 2 &&
|
||||
!descr->parameterTypes[n].IsObjectHandle() && !descr->parameterTypes[n].IsReference() &&
|
||||
!descr->parameterTypes[n].IsAnyType() )
|
||||
{
|
||||
// 64 bit value align
|
||||
dpos++;
|
||||
paramSize++;
|
||||
}
|
||||
|
||||
paramBuffer[dpos++] = args[spos++];
|
||||
paramSize += descr->parameterTypes[n].GetSizeOnStackDWords();
|
||||
}
|
||||
else
|
||||
{
|
||||
// Should an alignment be performed?
|
||||
if( (stackPos & 1) == mask && descr->parameterTypes[n].GetSizeOnStackDWords() == 2 &&
|
||||
!descr->parameterTypes[n].IsObjectHandle() && !descr->parameterTypes[n].IsReference() &&
|
||||
!descr->parameterTypes[n].IsAnyType() )
|
||||
{
|
||||
// 64 bit value align
|
||||
stackPos++;
|
||||
stackSize++;
|
||||
}
|
||||
|
||||
paramBuffer[stackPos++] = args[spos++];
|
||||
stackSize += descr->parameterTypes[n].GetSizeOnStackDWords();
|
||||
}
|
||||
|
||||
if( descr->parameterTypes[n].GetSizeOnStackDWords() > 1 )
|
||||
{
|
||||
if (paramSize < 5)
|
||||
paramBuffer[dpos++] = args[spos++];
|
||||
else
|
||||
paramBuffer[stackPos++] = args[spos++];
|
||||
}
|
||||
}// else...
|
||||
}// Loop
|
||||
|
||||
// Keep a free location at the beginning
|
||||
args = ¶mBuffer[2];
|
||||
}
|
||||
|
||||
paramBuffer[69] = static_cast<asDWORD>(stackSize<<2);
|
||||
|
||||
switch( callConv )
|
||||
{
|
||||
case ICC_CDECL_RETURNINMEM: // fall through
|
||||
case ICC_STDCALL_RETURNINMEM:
|
||||
retQW = armFuncR0(args, paramSize<<2, func, (asDWORD)retPointer);
|
||||
break;
|
||||
case ICC_CDECL: // fall through
|
||||
case ICC_STDCALL:
|
||||
retQW = armFunc(args, paramSize<<2, func);
|
||||
break;
|
||||
case ICC_THISCALL: // fall through
|
||||
case ICC_CDECL_OBJFIRST:
|
||||
retQW = armFuncR0(args, paramSize<<2, func, (asDWORD)obj);
|
||||
break;
|
||||
case ICC_THISCALL_RETURNINMEM:
|
||||
// On GNUC the address where the return value will be placed should be put in R0
|
||||
retQW = armFuncR0R1(args, paramSize<<2, func, (asDWORD)retPointer, (asDWORD)obj);
|
||||
break;
|
||||
case ICC_CDECL_OBJFIRST_RETURNINMEM:
|
||||
retQW = armFuncR0R1(args, paramSize<<2, func, (asDWORD)retPointer, (asDWORD)obj);
|
||||
break;
|
||||
case ICC_VIRTUAL_THISCALL:
|
||||
// Get virtual function table from the object pointer
|
||||
vftable = *(asFUNCTION_t**)obj;
|
||||
retQW = armFuncR0(args, paramSize<<2, vftable[FuncPtrToUInt(func)>>2], (asDWORD)obj);
|
||||
break;
|
||||
case ICC_VIRTUAL_THISCALL_RETURNINMEM:
|
||||
// Get virtual function table from the object pointer
|
||||
vftable = *(asFUNCTION_t**)obj;
|
||||
// On GNUC the address where the return value will be placed should be put in R0
|
||||
retQW = armFuncR0R1(args, (paramSize+1)<<2, vftable[FuncPtrToUInt(func)>>2], (asDWORD)retPointer, (asDWORD)obj);
|
||||
break;
|
||||
case ICC_CDECL_OBJLAST:
|
||||
retQW = armFuncObjLast(args, paramSize<<2, func, (asDWORD)obj);
|
||||
break;
|
||||
case ICC_CDECL_OBJLAST_RETURNINMEM:
|
||||
retQW = armFuncR0ObjLast(args, paramSize<<2, func, (asDWORD)retPointer, (asDWORD)obj);
|
||||
break;
|
||||
default:
|
||||
context->SetInternalException(TXT_INVALID_CALLING_CONVENTION);
|
||||
}
|
||||
|
||||
// On Linux with arm the float and double values are returns in the
|
||||
// floating point registers, s0 and s1. Objects that contain only
|
||||
// float types and are not considered complex are also returned in the
|
||||
// floating point registers.
|
||||
if( sysFunc->hostReturnFloat )
|
||||
{
|
||||
retQW = paramBuffer[VFP_OFFSET];
|
||||
|
||||
if ( sysFunc->hostReturnSize > 1 )
|
||||
retQW = *( (asQWORD*)¶mBuffer[VFP_OFFSET] );
|
||||
}
|
||||
else if ( descr->returnType.IsObject() )
|
||||
{
|
||||
// TODO: runtime optimize: This should be identified with a flag determined in PrepareSystemFunction
|
||||
if ( !descr->returnType.IsObjectHandle() &&
|
||||
!descr->returnType.IsReference() &&
|
||||
!(descr->returnType.GetObjectType()->flags & COMPLEX_RETURN_MASK) &&
|
||||
(descr->returnType.GetObjectType()->flags & asOBJ_APP_CLASS_ALLFLOATS) )
|
||||
memcpy( retPointer, ¶mBuffer[VFP_OFFSET], descr->returnType.GetSizeInMemoryBytes() );
|
||||
}
|
||||
|
||||
return retQW;
|
||||
}
|
||||
|
||||
END_AS_NAMESPACE
|
||||
|
||||
#endif // AS_LINUX
|
||||
|
||||
#endif // AS_ARM
|
||||
#endif // AS_MAX_PORTABILITY
|
||||
|
||||
|
||||
|
||||
|
692
lib/angelscript/source/as_callfunc_arm_gcc.S
Normal file
692
lib/angelscript/source/as_callfunc_arm_gcc.S
Normal file
@ -0,0 +1,692 @@
|
||||
/*
|
||||
AngelCode Scripting Library
|
||||
Copyright (c) 2003-2013 Andreas Jonsson
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any
|
||||
damages arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any
|
||||
purpose, including commercial applications, and to alter it and
|
||||
redistribute it freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you
|
||||
must not claim that you wrote the original software. If you use
|
||||
this software in a product, an acknowledgment in the product
|
||||
documentation would be appreciated but is not required.
|
||||
|
||||
2. Altered source versions must be plainly marked as such, and
|
||||
must not be misrepresented as being the original software.
|
||||
|
||||
3. This notice may not be removed or altered from any source
|
||||
distribution.
|
||||
|
||||
The original version of this library can be located at:
|
||||
http://www.angelcode.com/angelscript/
|
||||
|
||||
Andreas Jonsson
|
||||
andreas@angelcode.com
|
||||
*/
|
||||
|
||||
/*
|
||||
Assembly routines for the ARM call convention
|
||||
Written by Fredrik Ehnbom in June 2009
|
||||
|
||||
Adapted to GNUC by darktemplar216 in September 2009
|
||||
|
||||
Modified by Lasse Oorni for 8-byte stack alignment in May 2012
|
||||
|
||||
The assembler routines for Linux were written by Carlos Luna in December 2012
|
||||
*/
|
||||
|
||||
#if defined(__arm__) || defined(__ARM__) || defined(I3D_ARCH_ARM)
|
||||
|
||||
#if !defined(__linux__) || defined(__ANDROID__) || defined(ANDROID) || defined(__SOFTFP__)
|
||||
|
||||
/* iOS, Android, and Marmalade goes here */
|
||||
|
||||
.global armFunc
|
||||
.global armFuncR0
|
||||
.global armFuncR0R1
|
||||
.global armFuncObjLast
|
||||
.global armFuncR0ObjLast
|
||||
|
||||
/* --------------------------------------------------------------------------------------------*/
|
||||
armFunc:
|
||||
stmdb sp!, {r4-r8, lr}
|
||||
mov r6, r0 /* arg table */
|
||||
movs r7, r1 /* arg size (also set the condition code flags so that we detect if there are no arguments) */
|
||||
mov r4, r2 /* function address */
|
||||
mov r8, #0
|
||||
|
||||
beq nomoreargs
|
||||
|
||||
/* Load the first 4 arguments into r0-r3 */
|
||||
cmp r7, #4
|
||||
ldrge r0, [r6],#4
|
||||
cmp r7, #2*4
|
||||
ldrge r1, [r6],#4
|
||||
cmp r7, #3*4
|
||||
ldrge r2, [r6],#4
|
||||
cmp r7, #4*4
|
||||
ldrge r3, [r6],#4
|
||||
ble nomoreargs
|
||||
|
||||
/* Load the rest of the arguments onto the stack */
|
||||
sub r7, r7, #4*4 /* skip the 4 registers already loaded into r0-r3 */
|
||||
add r8, r7, #4 /* ensure 8-byte stack alignment */
|
||||
bic r8, r8, #4
|
||||
sub sp, sp, r8
|
||||
mov r12, sp /* copy size != frame size, so store frame start sp */
|
||||
stackargsloop:
|
||||
ldr r5, [r6], #4
|
||||
str r5, [sp], #4
|
||||
subs r7, r7, #4
|
||||
bne stackargsloop
|
||||
mov sp, r12
|
||||
nomoreargs:
|
||||
blx r4
|
||||
add sp, sp, r8
|
||||
ldmia sp!, {r4-r8, pc}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------*/
|
||||
armFuncObjLast:
|
||||
stmdb sp!, {r4-r8, lr}
|
||||
mov r6, r0 /* arg table */
|
||||
movs r7, r1 /* arg size (also set the condition code flags so that we detect if there are no arguments) */
|
||||
mov r4, r2 /* function address */
|
||||
mov r8, #0
|
||||
|
||||
mov r0, r3 /* objlast. might get overwritten */
|
||||
mov r5, r3 /* objlast to temp reg */
|
||||
|
||||
beq nomoreargsarmFuncObjLast
|
||||
|
||||
/* Load the first 4 arguments into r0-r3 */
|
||||
cmp r7, #4
|
||||
ldrge r0, [r6],#4
|
||||
cmp r7, #2*4
|
||||
ldrge r1, [r6],#4
|
||||
movlt r1, r5
|
||||
cmp r7, #3*4
|
||||
ldrge r2, [r6],#4
|
||||
movlt r2, r5
|
||||
cmp r7, #4*4
|
||||
ldrge r3, [r6],#4
|
||||
movlt r3, r5
|
||||
blt nomoreargsarmFuncObjLast
|
||||
|
||||
/* Load the rest of the arguments onto the stack */
|
||||
sub r7, r7, #4*4 /* skip the 4 registers already loaded into r0-r3 */
|
||||
add r8, r7, #8 /* account for the objlast pointer, ensure 8-byte stack alignment */
|
||||
bic r8, r8, #4
|
||||
str r5, [sp,#-4] /* store the objlast on stack, twice in case we adjusted alignment */
|
||||
str r5, [sp,#-8]
|
||||
sub sp, sp, r8 /* adjust frame */
|
||||
cmp r7, #0 /* we may also have come here with no extra params */
|
||||
beq nomoreargsarmFuncObjLast
|
||||
mov r12, sp /* copy size != frame size, so store frame start sp */
|
||||
stackargslooparmFuncObjLast:
|
||||
ldr r5, [r6], #4
|
||||
str r5, [sp], #4
|
||||
subs r7, r7, #4
|
||||
bne stackargslooparmFuncObjLast
|
||||
mov sp, r12
|
||||
nomoreargsarmFuncObjLast:
|
||||
blx r4
|
||||
add sp, sp, r8
|
||||
ldmia sp!, {r4-r8, pc}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------*/
|
||||
armFuncR0ObjLast:
|
||||
stmdb sp!, {r4-r8, lr}
|
||||
ldr r5, [sp,#6*4] /* objlast to temp reg */
|
||||
|
||||
mov r6, r0 /* arg table */
|
||||
movs r7, r1 /* arg size (also set the condition code flags so that we detect if there are no arguments) */
|
||||
mov r4, r2 /* function address */
|
||||
mov r8, #0
|
||||
|
||||
mov r0, r3 /* r0 explicitly set */
|
||||
mov r1, r5 /* objlast. might get overwritten */
|
||||
|
||||
beq nomoreargsarmFuncR0ObjLast
|
||||
|
||||
/* Load the first 3 arguments into r1-r3 */
|
||||
cmp r7, #1*4
|
||||
ldrge r1, [r6],#4
|
||||
cmp r7, #2*4
|
||||
ldrge r2, [r6],#4
|
||||
movlt r2, r5
|
||||
cmp r7, #3*4
|
||||
ldrge r3, [r6],#4
|
||||
movlt r3, r5
|
||||
blt nomoreargsarmFuncR0ObjLast
|
||||
|
||||
/* Load the rest of the arguments onto the stack */
|
||||
sub r7, r7, #3*4 /* skip the 3 registers already loaded into r1-r3 */
|
||||
add r8, r7, #8 /* account for the objlast pointer, ensure 8-byte stack alignment */
|
||||
bic r8, r8, #4
|
||||
str r5, [sp,#-4] /* store the objlast on stack, twice in case we adjusted alignment */
|
||||
str r5, [sp,#-8]
|
||||
sub sp, sp, r8 /* adjust frame */
|
||||
cmp r7, #0 /* we may also have come here with no extra params */
|
||||
beq nomoreargsarmFuncR0ObjLast
|
||||
mov r12, sp /* copy size != frame size, so store frame start sp */
|
||||
stackargslooparmFuncR0ObjLast:
|
||||
ldr r5, [r6], #4
|
||||
str r5, [sp], #4
|
||||
subs r7, r7, #4
|
||||
bne stackargslooparmFuncR0ObjLast
|
||||
mov sp, r12
|
||||
nomoreargsarmFuncR0ObjLast:
|
||||
blx r4
|
||||
add sp, sp, r8
|
||||
ldmia sp!, {r4-r8, pc}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------*/
|
||||
armFuncR0:
|
||||
stmdb sp!, {r4-r8, lr}
|
||||
mov r6, r0 /* arg table */
|
||||
movs r7, r1 /* arg size (also set the condition code flags so that we detect if there are no arguments) */
|
||||
mov r4, r2 /* function address */
|
||||
mov r8, #0
|
||||
|
||||
mov r0, r3 /* r0 explicitly set */
|
||||
|
||||
beq nomoreargsarmFuncR0
|
||||
|
||||
/* Load the first 3 arguments into r1-r3 */
|
||||
cmp r7, #1*4
|
||||
ldrge r1, [r6],#4
|
||||
cmp r7, #2*4
|
||||
ldrge r2, [r6],#4
|
||||
cmp r7, #3*4
|
||||
ldrge r3, [r6],#4
|
||||
ble nomoreargsarmFuncR0
|
||||
|
||||
/* Load the rest of the arguments onto the stack */
|
||||
sub r7, r7, #3*4 /* skip the 3 registers already loaded into r1-r3 */
|
||||
add r8, r7, #4 /* ensure 8-byte stack alignment */
|
||||
bic r8, r8, #4
|
||||
sub sp, sp, r8
|
||||
mov r12, sp /* copy size != frame size, so store frame start sp */
|
||||
stackargslooparmFuncR0:
|
||||
ldr r5, [r6], #4
|
||||
str r5, [sp], #4
|
||||
subs r7, r7, #4
|
||||
bne stackargslooparmFuncR0
|
||||
mov sp, r12
|
||||
nomoreargsarmFuncR0:
|
||||
blx r4
|
||||
add sp, sp, r8
|
||||
ldmia sp!, {r4-r8, pc}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------*/
|
||||
armFuncR0R1:
|
||||
stmdb sp!, {r4-r8, lr}
|
||||
mov r6, r0 /* arg table */
|
||||
movs r7, r1 /* arg size (also set the condition code flags so that we detect if there are no arguments) */
|
||||
mov r4, r2 /* function address */
|
||||
mov r8, #0
|
||||
|
||||
mov r0, r3 /* r0 explicitly set */
|
||||
ldr r1, [sp, #6*4] /* r1 explicitly set too */
|
||||
|
||||
beq nomoreargsarmFuncR0R1
|
||||
|
||||
/* Load the first 2 arguments into r2-r3 */
|
||||
cmp r7, #1*4
|
||||
ldrge r2, [r6],#4
|
||||
cmp r7, #2*4
|
||||
ldrge r3, [r6],#4
|
||||
ble nomoreargsarmFuncR0R1
|
||||
|
||||
/* Load the rest of the arguments onto the stack */
|
||||
sub r7, r7, #2*4 /* skip the 2 registers already loaded into r2-r3 */
|
||||
add r8, r7, #4 /* ensure 8-byte stack alignment */
|
||||
bic r8, r8, #4
|
||||
sub sp, sp, r8
|
||||
mov r12, sp /* copy size != frame size, so store frame start sp */
|
||||
stackargslooparmFuncR0R1:
|
||||
ldr r5, [r6], #4
|
||||
str r5, [sp], #4
|
||||
subs r7, r7, #4
|
||||
bne stackargslooparmFuncR0R1
|
||||
mov sp, r12
|
||||
nomoreargsarmFuncR0R1:
|
||||
blx r4
|
||||
add sp, sp, r8
|
||||
ldmia sp!, {r4-r8, pc}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------*/
|
||||
#elif defined(__linux__) && !defined(__SOFTFP__)
|
||||
|
||||
/* The Linux code goes here */
|
||||
|
||||
|
||||
/* These codes are suitable for armeabi + vfp / armeabihf */
|
||||
/* when using armeabi + vfp, please set C_FLAGS -mfloat-abi=softfp -mfpu=vfp */
|
||||
/* using armeabihf, please set C_FLAGS -mfloat-abi=hard -mfpu=vfpv3-d16 */
|
||||
|
||||
/* if you prefer to run in ARM mode, please add -marm to C_FLAGS */
|
||||
/* while using thumb mode, please add -mthumb -Wa,-mimplicit-it=thumb */
|
||||
|
||||
|
||||
/* SP is a multiple of 8 when control first enters a program.*/
|
||||
/* This places an obligation on authors of low level OS, RTOS, and runtime library code to align SP at all points */
|
||||
/* at which control first enters a body of (AAPCS-conforming) code. (please read "ARM IHI 0046B" document)*/
|
||||
|
||||
|
||||
.section .text
|
||||
|
||||
.align 2 /* Align the function code to a 4-byte (2^n) word boundary. */
|
||||
#if defined(__thumb__) || defined(__thumb2__)
|
||||
.thumb
|
||||
.syntax unified
|
||||
#else
|
||||
.arm /* Use ARM instructions instead of Thumb.*/
|
||||
#endif
|
||||
.globl armFunc /* Make the function globally accessible.*/
|
||||
armFunc:
|
||||
push {r4-r8, r10, r11, lr} /* sp must be 8-byte alignment for ABI compliance, so the pushed registers must be even */
|
||||
|
||||
mov r6, r0 /* arg table */
|
||||
movs r7, r1 /* arg size (also set the condition code flags so that we detect if there are no arguments) */
|
||||
mov r4, r2 /* function address */
|
||||
|
||||
/* Load float and double args into d0-d7 and s0-s15 */
|
||||
add r10, r6, #272 /* r10 (r6 + 272) points to the first value for the VFP registers */
|
||||
mov r8, #0
|
||||
vldmia.64 r10, {d0-d7} /* Load contents starting at r10 into registers d0-d7 */
|
||||
|
||||
/* If there are no arguments to set into r0-r3 */
|
||||
/* go check if there are arguments for the stack */
|
||||
beq stackargs
|
||||
|
||||
/* Load the first 4 arguments into r0-r3 */
|
||||
cmp r7, #4
|
||||
ldrge r0, [r6]
|
||||
cmp r7, #8
|
||||
ldrge r1, [r6, #4]
|
||||
cmp r7, #12
|
||||
ldrge r2, [r6, #8]
|
||||
cmp r7, #16
|
||||
ldrge r3, [r6, #12]
|
||||
|
||||
stackargs:
|
||||
ldr r5, [r6, #268] /* Load stack size into r5 */
|
||||
movs r7, r5 /* Load stack size into r7, checking for 0 args */
|
||||
|
||||
/* If there are no args for the stack, branch */
|
||||
beq nomoreargs
|
||||
|
||||
/* Load the rest of the arguments onto the stack */
|
||||
/* Ensure 8-byte stack alignment */
|
||||
mov r8, sp
|
||||
sub sp, sp, r7
|
||||
add r6, r6, #16 /* Set r6 to point to the first arg to be placed on the stack */
|
||||
|
||||
sub r12, sp, #8
|
||||
bic r12, r12, #7 /* thumb mode couldn't support "bic sp, sp, #7" instruction */
|
||||
sub r8, r8, r12
|
||||
mov sp, r12 /* copy size != frame size, so store frame start sp, r12(ip) is not callee saved register */
|
||||
|
||||
stackargsloop:
|
||||
ldr r5, [r6], #4
|
||||
subs r7, r7, #4
|
||||
str r5, [sp], #4
|
||||
bne stackargsloop
|
||||
mov sp, r12
|
||||
|
||||
nomoreargs:
|
||||
#if defined (___ARM_ARCH_4T__) || defined (__ARM_ARCH_4__)
|
||||
mov lr, pc /* older ARM didn't support blx */
|
||||
mov pc, r4
|
||||
#else
|
||||
blx r4
|
||||
#endif
|
||||
add sp, sp, r8
|
||||
vstmia.64 r10, {d0-d7} /* Copy contents of registers d0-d7 to the address stored in r10 */
|
||||
|
||||
pop {r4-r8, r10, r11, pc}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------*/
|
||||
.align 2 /* Align the function code to a 4-byte (2^n) word boundary. */
|
||||
#if defined(__thumb__) || defined(__thumb2__)
|
||||
.thumb
|
||||
.syntax unified
|
||||
#else
|
||||
.arm /* Use ARM instructions instead of Thumb.*/
|
||||
#endif
|
||||
.globl armFuncObjLast /* Make the function globally accessible.*/
|
||||
armFuncObjLast:
|
||||
push {r4-r8, r10, r11, lr} /* We´re storing r11 just to keep the stack aligned to an 8 byte boundary */
|
||||
|
||||
mov r6, r0 /* arg table */
|
||||
movs r7, r1 /* arg size (also set the condition code flags so that we detect if there are no arguments) */
|
||||
mov r4, r2 /* function address */
|
||||
|
||||
mov r0, r3 /* objlast. might get overwritten */
|
||||
mov r5, #0 /* This will hold an offset of #4 only if objlast couldn´t be placed into an "r" register */
|
||||
|
||||
/* Load float and double args into d0-d7 and s0-s15 (r10 holds pointer to first float value) */
|
||||
add r10, r6, #272 /* r10 (r6 + 272) points to the first value for the VFP registers */
|
||||
mov r8, #0
|
||||
vldmia.64 r10, {d0-d7} /* Load contents starting at r10 into registers d0-d7 */
|
||||
|
||||
/* If there are no arguments to set into r0-r3 */
|
||||
/* go check if there are arguments for the stack */
|
||||
beq stackargsFuncObjLast
|
||||
|
||||
mov r5, r3 /* store objlast in r5 temporarily */
|
||||
|
||||
/* Load the first 4 arguments into r0-r3 */
|
||||
cmp r7, #4
|
||||
ldrge r0, [r6]
|
||||
cmp r7, #8
|
||||
ldrge r1, [r6,#4]
|
||||
movlt r1, r5
|
||||
cmp r7, #12
|
||||
ldrge r2, [r6,#8]
|
||||
movlt r2, r5
|
||||
cmp r7, #16
|
||||
ldrge r3, [r6,#12]
|
||||
movlt r3, r5
|
||||
movlt r5, #0 /* If objlast got placed into a register, r5 = 0 */
|
||||
blt stackargsFuncObjLast /* If objlast got placed into a register, go to stackargsFuncObjLast */
|
||||
|
||||
str r5, [r6, #12] /* Put objlast in r6 + 12 */
|
||||
mov r5, #4 /* Set r5 with an offset of #4, so objlast can be loaded into the stack */
|
||||
|
||||
stackargsFuncObjLast:
|
||||
ldr r7, [r6, #268] /* Load stack size into r7 */
|
||||
add r7, r7, r5 /* Add the offset placed in r5 (could be #0 or #4) */
|
||||
cmp r7, #0 /* Check for 0 args */
|
||||
|
||||
/* If there are no args for the stack, branch */
|
||||
beq nomoreargsarmFuncObjLast
|
||||
|
||||
/* Load the rest of the arguments onto the stack */
|
||||
/* Ensure 8-byte stack alignment */
|
||||
mov r8, sp
|
||||
sub sp, sp, r7
|
||||
add r6, r6, #16 /* Set r6 to point to the first arg to be placed on the stack */
|
||||
|
||||
sub r12, sp, #8
|
||||
sub r6, r6, r5 /* r6 = r6 - r5 (r5 can be #0 or #4) */
|
||||
bic r12, r12, #7 /* thumb mode couldn't support "bic sp, sp, #7" instruction */
|
||||
sub r8, r8, r12
|
||||
mov sp, r12 /* copy size != frame size, so store frame start sp, r12(ip) is not callee saved register */
|
||||
|
||||
stackargslooparmFuncObjLast:
|
||||
ldr r5, [r6], #4
|
||||
subs r7, r7, #4
|
||||
str r5, [sp], #4
|
||||
bne stackargslooparmFuncObjLast
|
||||
mov sp, r12
|
||||
|
||||
nomoreargsarmFuncObjLast:
|
||||
#if defined (___ARM_ARCH_4T__) || defined (__ARM_ARCH_4__)
|
||||
mov lr, pc
|
||||
mov pc, r4
|
||||
#else
|
||||
blx r4
|
||||
#endif
|
||||
add sp, sp, r8
|
||||
vstmia.64 r10, {d0-d7} /* Copy contents of registers d0-d10 to the address stored in r10 */
|
||||
|
||||
pop {r4-r8, r10,r11, pc}
|
||||
|
||||
/* ------------------------------------------------------------------------------------------- */
|
||||
.align 2 /* Align the function code to a 4-byte (2^n) word boundary. */
|
||||
#if defined(__thumb__) || defined(__thumb2__)
|
||||
.thumb
|
||||
.syntax unified
|
||||
#else
|
||||
.arm /* Use ARM instructions instead of Thumb.*/
|
||||
#endif
|
||||
.globl armFuncR0ObjLast /* Make the function globally accessible.*/
|
||||
armFuncR0ObjLast:
|
||||
push {r4-r8, r10, r11, lr}
|
||||
|
||||
ldr r5, [sp,#32] /* objlast to temp reg */
|
||||
|
||||
mov r6, r0 /* arg table */
|
||||
movs r7, r1 /* arg size (also set the condition code flags so that we detect if there are no arguments) */
|
||||
mov r4, r2 /* function address */
|
||||
|
||||
mov r0, r3 /* r0 explicitly set */
|
||||
mov r1, r5 /* objlast. might get overwritten */
|
||||
mov r5, #0 /* This will hold an offset of #4 or #8 if objlast or one arg couldn´t be placed into an "r" register */
|
||||
|
||||
/* Load float and double args into d0-d7 and s0-s15 (r10 holds pointer to first float value) */
|
||||
add r10, r6, #272 /* r10 (r6 + 272) points to the first value for the VFP registers */
|
||||
mov r8, #0
|
||||
vldmia.64 r10, {d0-d7} /* Load contents starting at r10 into registers d0-d7 */
|
||||
|
||||
/* If there are no arguments to set into r0-r3 */
|
||||
/* go check if there are arguments for the stack */
|
||||
beq stackargsFuncR0ObjLast
|
||||
|
||||
mov r5, r1 /* store objlast in r5 temporarily */
|
||||
|
||||
/* Load the first 3 arguments into r1-r3 */
|
||||
cmp r7, #4
|
||||
ldrge r1, [r6]
|
||||
cmp r7, #8
|
||||
ldrge r2, [r6,#4]
|
||||
movlt r2, r5
|
||||
cmp r7, #12
|
||||
ldrge r3, [r6,#8]
|
||||
movlt r3, r5
|
||||
movlt r5, #0 /* If objlast got placed into a register, r5 = 0 */
|
||||
blt stackargsFuncR0ObjLast /* If objlast got placed into a register, go to stackargsFuncR0ObjLast */
|
||||
|
||||
cmp r7, #16 /* Else if we have one last arg set the offset accordingly and store the arg in the array */
|
||||
ldrge r7, [r6, #12]
|
||||
strge r7, [r6, #8]
|
||||
|
||||
str r5, [r6, #12] /* Put objlast in r6 + 12 */
|
||||
|
||||
movge r5, #4 /* Set r5 with an offset of #4 if there´s one last arg that couldn´t be placed in r registers */
|
||||
add r5, r5, #4 /* Set r5 with an offset of + #4, so objlast can be loaded into the stack */
|
||||
|
||||
stackargsFuncR0ObjLast:
|
||||
ldr r7, [r6, #268] /* Load stack size into r7 */
|
||||
add r7, r7, r5 /* Add the offset placed in r5 (could be #0 or #4) */
|
||||
cmp r7, #0 /* Check for 0 args */
|
||||
|
||||
/* If there are no args for the stack, branch */
|
||||
beq nomoreargsarmFuncR0ObjLast
|
||||
|
||||
/* Load the rest of the arguments onto the stack */
|
||||
/* Ensure 8-byte stack alignment */
|
||||
mov r8, sp
|
||||
sub sp, sp, r7
|
||||
add r6, r6, #16 /* Set r6 to point to the first arg to be placed on the stack */
|
||||
|
||||
sub r12, sp, #8
|
||||
sub r6, r6, r5 /* r6 = r6 - r5 (r5 can be #0 or #4) */
|
||||
bic r12, r12, #7 /* thumb mode couldn't support "bic sp, sp, #7" instruction */
|
||||
sub r8, r8, r12
|
||||
mov sp, r12 /* copy size != frame size, so store frame start sp, r12(ip) is not callee saved register */
|
||||
|
||||
stackargslooparmFuncR0ObjLast:
|
||||
ldr r5, [r6], #4
|
||||
subs r7, r7, #4
|
||||
str r5, [sp], #4
|
||||
bne stackargslooparmFuncR0ObjLast
|
||||
mov sp, r12
|
||||
|
||||
nomoreargsarmFuncR0ObjLast:
|
||||
#if defined (___ARM_ARCH_4T__) || defined (__ARM_ARCH_4__)
|
||||
mov lr, pc
|
||||
mov pc, r4
|
||||
#else
|
||||
blx r4
|
||||
#endif
|
||||
add sp, sp, r8
|
||||
vstmia.64 r10, {d0-d7} /* Copy contents of registers d0-d10 to the address stored in r10 */
|
||||
|
||||
pop {r4-r8, r10, r11, pc}
|
||||
|
||||
/* ------------------------------------------------------------------------------------------- */
|
||||
.align 2 /* Align the function code to a 4-byte (2^n) word boundary. */
|
||||
#if defined(__thumb__) || defined(__thumb2__)
|
||||
.thumb
|
||||
.syntax unified
|
||||
#else
|
||||
.arm /* Use ARM instructions instead of Thumb.*/
|
||||
#endif
|
||||
.globl armFuncR0 /* Make the function globally accessible.*/
|
||||
armFuncR0:
|
||||
push {r4-r8, r10, r11, lr}
|
||||
|
||||
mov r6, r0 /* arg table */
|
||||
movs r7, r1 /* arg size (also set the condition code flags so that we detect if there are no arguments) */
|
||||
mov r4, r2 /* function address */
|
||||
mov r11, #0 /* This will hold an offset of #4 only if the last arg that should have been placed into an "r" reg needs to go to the stack */
|
||||
mov r0, r3 /* r0 explicitly set */
|
||||
|
||||
/* Load float and double args into d0-d7 and s0-s15 (r10 holds pointer to first float value) */
|
||||
add r10, r6, #272 /* r10 (r6 + 272) points to the first value for the VFP registers */
|
||||
mov r8, #0
|
||||
vldmia.64 r10, {d0-d7} /* Load contents starting at r10 into registers d0-d7 */
|
||||
|
||||
/* If there are no arguments to set into r0-r3 */
|
||||
/* go check if there are arguments for the stack */
|
||||
beq stackargsarmFuncR0
|
||||
|
||||
/* Load the first 3 arguments into r1-r3 */
|
||||
cmp r7, #4
|
||||
ldrge r1, [r6]
|
||||
cmp r7, #8
|
||||
ldrge r2, [r6, #4]
|
||||
cmp r7, #12
|
||||
ldrge r3, [r6, #8]
|
||||
cmp r7, #16
|
||||
movge r11, #4 /* If there is still one arg to be placed, set the offset in r11 to #4 */
|
||||
|
||||
stackargsarmFuncR0:
|
||||
ldr r5, [r6, #268] /* Load stack size into r5 */
|
||||
add r5, r11 /* Add the offset placed in r11 (could be #0 or #4) */
|
||||
movs r7, r5 /* Load stack size into r7, checking for 0 args */
|
||||
|
||||
/* If there are no args for the stack, branch */
|
||||
beq nomoreargsarmFuncR0
|
||||
|
||||
/* Load the rest of the arguments onto the stack */
|
||||
/* Ensure 8-byte stack alignment */
|
||||
mov r8, sp
|
||||
sub sp, sp, r7
|
||||
add r6, r6, #16 /* Set r6 to point to the first arg to be placed on the stack */
|
||||
|
||||
sub r12, sp, #8
|
||||
sub r6, r6, r11 /* r6 = r6 - r11 (r11 can be #0 or #4) */
|
||||
bic r12, r12, #7 /* thumb mode couldn't support "bic sp, sp, #7" instruction */
|
||||
sub r8, r8, r12
|
||||
mov sp, r12 /* copy size != frame size, so store frame start sp, r12(ip) is not callee saved register */
|
||||
|
||||
stackargslooparmFuncR0:
|
||||
ldr r5, [r6], #4
|
||||
subs r7, r7, #4
|
||||
str r5, [sp], #4
|
||||
bne stackargslooparmFuncR0
|
||||
mov sp, r12
|
||||
|
||||
nomoreargsarmFuncR0:
|
||||
#if defined (___ARM_ARCH_4T__) || defined (__ARM_ARCH_4__)
|
||||
mov lr, pc
|
||||
mov pc, r4
|
||||
#else
|
||||
blx r4
|
||||
#endif
|
||||
add sp, sp, r8
|
||||
vstmia.64 r10, {d0-d7} /* Copy contents of registers d0-d10 to the address stored in r10 */
|
||||
|
||||
pop {r4-r8, r10, r11, pc}
|
||||
|
||||
/* ------------------------------------------------------------------------------------------- */
|
||||
.align 2 /* Align the function code to a 4-byte (2^n) word boundary. */
|
||||
#if defined(__thumb__) || defined(__thumb2__)
|
||||
.thumb
|
||||
.syntax unified
|
||||
#else
|
||||
.arm /* Use ARM instructions instead of Thumb.*/
|
||||
#endif
|
||||
.globl armFuncR0R1 /* Make the function globally accessible.*/
|
||||
armFuncR0R1:
|
||||
push {r4-r8, r10, r11, lr}
|
||||
|
||||
mov r6, r0 /* arg table */
|
||||
movs r7, r1 /* arg size (also set the condition code flags so that we detect if there are no arguments) */
|
||||
mov r4, r2 /* function address */
|
||||
mov r11, #0 /* This will hold an offset of #4 or #8 only if the last arg (or last 2 args) that should have been placed into "r" regs need to go to the stack */
|
||||
|
||||
mov r0, r3 /* r0 explicitly set */
|
||||
ldr r1, [sp, #32] /* r1 explicitly set too */
|
||||
|
||||
/* Load float and double args into d0-d7 and s0-s15 (r10 holds pointer to first float value) */
|
||||
add r10, r6, #272 /* r10 (r6 + 272) points to the first value for the VFP registers */
|
||||
mov r8, #0
|
||||
vldmia.64 r10, {d0-d7} /* Load contents starting at r10 into registers d0-d7 */
|
||||
|
||||
/* If there are no arguments to set into r2-r3 */
|
||||
/* go check if there are arguments for the stack */
|
||||
beq stackargsarmFuncR0R1
|
||||
|
||||
/* Load the first 2 arguments into r2-r3 */
|
||||
cmp r7, #4
|
||||
ldrge r2, [r6]
|
||||
cmp r7, #8
|
||||
ldrge r3, [r6, #4]
|
||||
cmp r7, #12
|
||||
movge r11, #4 /* If there is a third arg to be placed, set the offset in r11 to #4 */
|
||||
cmp r7, #16
|
||||
movge r11, #8 /* If there is a fourth arg to be placed, set the offset in r11 to #8 */
|
||||
ldrlt r7, [r6, #8] /* Else copy the third arg to the correct place in the array */
|
||||
strlt r7, [r6, #12]
|
||||
|
||||
stackargsarmFuncR0R1:
|
||||
ldr r5, [r6, #268] /* Load stack size into r5 */
|
||||
add r5, r11 /* Add the offset placed in r11 (could be #0 or #4 or #8) */
|
||||
movs r7, r5 /* Load stack size into r7, checking for 0 args */
|
||||
|
||||
/* If there are no args for the stack, branch */
|
||||
beq nomoreargsarmFuncR0R1
|
||||
|
||||
/* Load the rest of the arguments onto the stack */
|
||||
/* Ensure 8-byte stack alignment */
|
||||
mov r8, sp
|
||||
sub sp, sp, r7
|
||||
add r6, r6, #16 /* Set r6 to point to the first arg to be placed on the stack */
|
||||
|
||||
sub r12, sp, #8
|
||||
sub r6, r6, r11 /* r6 = r6 - r11 (r11 can be #0 or #4 or #8) */
|
||||
bic r12, r12, #7 /* thumb mode couldn't support "bic sp, sp, #7" instruction */
|
||||
sub r8, r8, r12
|
||||
mov sp, r12 /* copy size != frame size, so store frame start sp, r12(ip) is not callee saved register */
|
||||
|
||||
stackargslooparmFuncR0R1:
|
||||
ldr r5, [r6], #4
|
||||
subs r7, r7, #4
|
||||
str r5, [sp], #4
|
||||
bne stackargslooparmFuncR0R1
|
||||
mov sp, r12
|
||||
|
||||
nomoreargsarmFuncR0R1:
|
||||
#if defined (___ARM_ARCH_4T__) || defined (__ARM_ARCH_4__)
|
||||
mov lr, pc
|
||||
mov pc, r4
|
||||
#else
|
||||
blx r4
|
||||
#endif
|
||||
add sp, sp, r8
|
||||
vstmia.64 r10, {d0-d7} /* Copy contents of registers d0-d10 to the address stored in r10 */
|
||||
|
||||
pop {r4-r8, r10, r11, pc}
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
249
lib/angelscript/source/as_callfunc_arm_msvc.asm
Normal file
249
lib/angelscript/source/as_callfunc_arm_msvc.asm
Normal file
@ -0,0 +1,249 @@
|
||||
;
|
||||
; AngelCode Scripting Library
|
||||
; Copyright (c) 2003-2013 Andreas Jonsson
|
||||
;
|
||||
; This software is provided 'as-is', without any express or implied
|
||||
; warranty. In no event will the authors be held liable for any
|
||||
; damages arising from the use of this software.
|
||||
;
|
||||
; Permission is granted to anyone to use this software for any
|
||||
; purpose, including commercial applications, and to alter it and
|
||||
; redistribute it freely, subject to the following restrictions:
|
||||
;
|
||||
; 1. The origin of this software must not be misrepresented; you
|
||||
; must not claim that you wrote the original software. If you use
|
||||
; this software in a product, an acknowledgment in the product
|
||||
; documentation would be appreciated but is not required.
|
||||
;
|
||||
; 2. Altered source versions must be plainly marked as such, and
|
||||
; must not be misrepresented as being the original software.
|
||||
;
|
||||
; 3. This notice may not be removed or altered from any source
|
||||
; distribution.
|
||||
;
|
||||
; The original version of this library can be located at:
|
||||
; http://www.angelcode.com/angelscript/
|
||||
;
|
||||
; Andreas Jonsson
|
||||
; andreas@angelcode.com
|
||||
;
|
||||
|
||||
|
||||
; Assembly routines for the ARM call convention
|
||||
; Written by Fredrik Ehnbom in June 2009
|
||||
|
||||
; MSVC currently doesn't support inline assembly for the ARM platform
|
||||
; so this separate file is needed.
|
||||
|
||||
; Compile with Microsoft ARM assembler (armasm)
|
||||
; http://msdn.microsoft.com/en-us/library/hh873190.aspx
|
||||
|
||||
|
||||
AREA |.rdata|, DATA, READONLY
|
||||
EXPORT armFunc
|
||||
EXPORT armFuncR0
|
||||
EXPORT armFuncR0R1
|
||||
EXPORT armFuncObjLast
|
||||
EXPORT armFuncR0ObjLast
|
||||
|
||||
AREA |.text|, CODE, ARM, ALIGN=3
|
||||
|
||||
ALIGN 8
|
||||
armFunc PROC
|
||||
stmdb sp!, {r4-r8, lr}
|
||||
mov r6, r0 ; arg table
|
||||
movs r7, r1 ; arg size (also set the condition code flags so that we detect if there are no arguments)
|
||||
mov r4, r2 ; function address
|
||||
mov r8, #0
|
||||
|
||||
beq |nomoreargs|
|
||||
|
||||
; Load the first 4 arguments into r0-r3
|
||||
cmp r7, #4
|
||||
ldrge r0, [r6],#4
|
||||
cmp r7, #2*4
|
||||
ldrge r1, [r6],#4
|
||||
cmp r7, #3*4
|
||||
ldrge r2, [r6],#4
|
||||
cmp r7, #4*4
|
||||
ldrge r3, [r6],#4
|
||||
ble |nomoreargs|
|
||||
|
||||
; Load the rest of the arguments onto the stack
|
||||
sub r7, r7, #4*4 ; skip the 4 registers already loaded into r0-r3
|
||||
sub sp, sp, r7
|
||||
mov r8, r7
|
||||
|stackargsloop|
|
||||
ldr r5, [r6], #4
|
||||
str r5, [sp], #4
|
||||
subs r7, r7, #4
|
||||
bne |stackargsloop|
|
||||
|nomoreargs|
|
||||
sub sp, sp, r8
|
||||
blx r4
|
||||
add sp, sp, r8
|
||||
ldmia sp!, {r4-r8, pc}
|
||||
ENDP
|
||||
|
||||
ALIGN 8
|
||||
armFuncObjLast PROC
|
||||
stmdb sp!, {r4-r8, lr}
|
||||
mov r6, r0 ; arg table
|
||||
movs r7, r1 ; arg size (also set the condition code flags so that we detect if there are no arguments)
|
||||
mov r4, r2 ; function address
|
||||
mov r8, #0
|
||||
|
||||
mov r0, r3 ; objlast. might get overwritten
|
||||
str r3, [sp, #-4]! ; objlast again.
|
||||
|
||||
beq |nomoreargs@armFuncObjLast|
|
||||
|
||||
; Load the first 4 arguments into r0-r3
|
||||
cmp r7, #4
|
||||
ldrge r0, [r6],#4
|
||||
cmp r7, #2*4
|
||||
ldrge r1, [r6],#4
|
||||
ldrlt r1, [sp]
|
||||
cmp r7, #3*4
|
||||
ldrge r2, [r6],#4
|
||||
ldrlt r2, [sp]
|
||||
cmp r7, #4*4
|
||||
ldrge r3, [r6],#4
|
||||
ldrlt r3, [sp]
|
||||
ble |nomoreargs@armFuncObjLast|
|
||||
|
||||
; Load the rest of the arguments onto the stack
|
||||
sub r7, r7, #4*4 ; skip the 4 registers already loaded into r0-r3
|
||||
sub sp, sp, r7
|
||||
mov r8, r7
|
||||
|stackargsloop@armFuncObjLast|
|
||||
ldr r5, [r6], #4
|
||||
str r5, [sp], #4
|
||||
subs r7, r7, #4
|
||||
bne |stackargsloop@armFuncObjLast|
|
||||
|nomoreargs@armFuncObjLast|
|
||||
sub sp, sp, r8
|
||||
blx r4
|
||||
add sp, sp, r8
|
||||
add sp, sp, #4
|
||||
ldmia sp!, {r4-r8, pc}
|
||||
ENDP
|
||||
|
||||
ALIGN 8
|
||||
armFuncR0ObjLast PROC
|
||||
stmdb sp!, {r4-r8, lr}
|
||||
ldr r7, [sp,#6*4]
|
||||
str r7, [sp,#-4]!
|
||||
|
||||
mov r6, r0 ; arg table
|
||||
movs r7, r1 ; arg size (also set the condition code flags so that we detect if there are no arguments)
|
||||
mov r4, r2 ; function address
|
||||
mov r8, #0
|
||||
|
||||
mov r0, r3 ; r0 explicitly set
|
||||
ldr r1, [sp] ; objlast. might get overwritten
|
||||
|
||||
beq |nomoreargs@armFuncR0ObjLast|
|
||||
|
||||
; Load the first 3 arguments into r1-r3
|
||||
cmp r7, #1*4
|
||||
ldrge r1, [r6],#4
|
||||
cmp r7, #2*4
|
||||
ldrge r2, [r6],#4
|
||||
ldrlt r2, [sp]
|
||||
cmp r7, #3*4
|
||||
ldrge r3, [r6],#4
|
||||
ldrlt r3, [sp]
|
||||
ble |nomoreargs@armFuncR0ObjLast|
|
||||
|
||||
; Load the rest of the arguments onto the stack
|
||||
sub r7, r7, #3*4 ; skip the 3 registers already loaded into r1-r3
|
||||
sub sp, sp, r7
|
||||
mov r8, r7
|
||||
|stackargsloop@armFuncR0ObjLast|
|
||||
ldr r5, [r6], #4
|
||||
str r5, [sp], #4
|
||||
subs r7, r7, #4
|
||||
bne |stackargsloop@armFuncR0ObjLast|
|
||||
|nomoreargs@armFuncR0ObjLast|
|
||||
sub sp, sp, r8
|
||||
blx r4
|
||||
add sp, sp, r8
|
||||
add sp, sp, #4
|
||||
ldmia sp!, {r4-r8, pc}
|
||||
ENDP
|
||||
|
||||
ALIGN 8
|
||||
armFuncR0 PROC
|
||||
stmdb sp!, {r4-r8, lr}
|
||||
mov r6, r0 ; arg table
|
||||
movs r7, r1 ; arg size (also set the condition code flags so that we detect if there are no arguments)
|
||||
mov r4, r2 ; function address
|
||||
mov r8, #0
|
||||
|
||||
mov r0, r3 ; r0 explicitly set
|
||||
|
||||
beq |nomoreargs@armFuncR0|
|
||||
|
||||
; Load the first 3 arguments into r1-r3
|
||||
cmp r7, #1*4
|
||||
ldrge r1, [r6],#4
|
||||
cmp r7, #2*4
|
||||
ldrge r2, [r6],#4
|
||||
cmp r7, #3*4
|
||||
ldrge r3, [r6],#4
|
||||
ble |nomoreargs@armFuncR0|
|
||||
|
||||
; Load the rest of the arguments onto the stack
|
||||
sub r7, r7, #3*4 ; skip the 3 registers already loaded into r1-r3
|
||||
sub sp, sp, r7
|
||||
mov r8, r7
|
||||
|stackargsloop@armFuncR0|
|
||||
ldr r5, [r6], #4
|
||||
str r5, [sp], #4
|
||||
subs r7, r7, #4
|
||||
bne |stackargsloop@armFuncR0|
|
||||
|nomoreargs@armFuncR0|
|
||||
sub sp, sp, r8
|
||||
blx r4
|
||||
add sp, sp, r8
|
||||
ldmia sp!, {r4-r8, pc}
|
||||
ENDP
|
||||
|
||||
ALIGN 8
|
||||
armFuncR0R1 PROC
|
||||
stmdb sp!, {r4-r8, lr}
|
||||
mov r6, r0 ; arg table
|
||||
movs r7, r1 ; arg size (also set the condition code flags so that we detect if there are no arguments)
|
||||
mov r4, r2 ; function address
|
||||
mov r8, #0
|
||||
|
||||
mov r0, r3 ; r0 explicitly set
|
||||
ldr r1, [sp, #6*4] ; r1 explicitly set too
|
||||
|
||||
beq |nomoreargs@armFuncR0R1|
|
||||
|
||||
; Load the first 2 arguments into r2-r3
|
||||
cmp r7, #1*4
|
||||
ldrge r2, [r6],#4
|
||||
cmp r7, #2*4
|
||||
ldrge r3, [r6],#4
|
||||
ble |nomoreargs@armFuncR0R1|
|
||||
|
||||
; Load the rest of the arguments onto the stack
|
||||
sub r7, r7, #2*4 ; skip the 2 registers already loaded into r2-r3
|
||||
sub sp, sp, r7
|
||||
mov r8, r7
|
||||
|stackargsloop@armFuncR0R1|
|
||||
ldr r5, [r6], #4
|
||||
str r5, [sp], #4
|
||||
subs r7, r7, #4
|
||||
bne |stackargsloop@armFuncR0R1|
|
||||
|nomoreargs@armFuncR0R1|
|
||||
sub sp, sp, r8
|
||||
blx r4
|
||||
add sp, sp, r8
|
||||
ldmia sp!, {r4-r8, pc}
|
||||
ENDP
|
||||
|
||||
END
|
237
lib/angelscript/source/as_callfunc_arm_xcode.S
Normal file
237
lib/angelscript/source/as_callfunc_arm_xcode.S
Normal file
@ -0,0 +1,237 @@
|
||||
/*
|
||||
AngelCode Scripting Library
|
||||
Copyright (c) 2003-2009 Andreas Jonsson
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any
|
||||
damages arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any
|
||||
purpose, including commercial applications, and to alter it and
|
||||
redistribute it freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you
|
||||
must not claim that you wrote the original software. If you use
|
||||
this software in a product, an acknowledgment in the product
|
||||
documentation would be appreciated but is not required.
|
||||
|
||||
2. Altered source versions must be plainly marked as such, and
|
||||
must not be misrepresented as being the original software.
|
||||
|
||||
3. This notice may not be removed or altered from any source
|
||||
distribution.
|
||||
|
||||
The original version of this library can be located at:
|
||||
http://www.angelcode.com/angelscript/
|
||||
|
||||
Andreas Jonsson
|
||||
andreas@angelcode.com
|
||||
*/
|
||||
|
||||
|
||||
// Assembly routines for the ARM call convention
|
||||
// Written by Fredrik Ehnbom in June 2009
|
||||
|
||||
// Adapted to GNUC by darktemplar216 in September 2009
|
||||
// Small fixed to work under XCode GCC by Gilad Novik in October 2009
|
||||
|
||||
#if defined(__arm__) || defined(__ARM__)
|
||||
|
||||
.align 2
|
||||
.globl _armFunc
|
||||
.globl _armFuncR0
|
||||
.globl _armFuncR0R1
|
||||
.globl _armFuncObjLast
|
||||
.globl _armFuncR0ObjLast
|
||||
|
||||
_armFunc:
|
||||
stmdb sp!, {r4-r8, lr}
|
||||
mov r6, r0 // arg table
|
||||
movs r7, r1 // arg size (also set the condition code flags so that we detect if there are no arguments)
|
||||
mov r4, r2 // function address
|
||||
mov r8, #0
|
||||
|
||||
beq nomoreargs
|
||||
|
||||
// Load the first 4 arguments into r0-r3
|
||||
cmp r7, #4
|
||||
ldrge r0, [r6],#4
|
||||
cmp r7, #2*4
|
||||
ldrge r1, [r6],#4
|
||||
cmp r7, #3*4
|
||||
ldrge r2, [r6],#4
|
||||
cmp r7, #4*4
|
||||
ldrge r3, [r6],#4
|
||||
ble nomoreargs
|
||||
|
||||
// Load the rest of the arguments onto the stack
|
||||
sub r7, r7, #4*4 // skip the 4 registers already loaded into r0-r3
|
||||
sub sp, sp, r7
|
||||
mov r8, r7
|
||||
stackargsloop:
|
||||
ldr r5, [r6], #4
|
||||
str r5, [sp], #4
|
||||
subs r7, r7, #4
|
||||
bne stackargsloop
|
||||
nomoreargs:
|
||||
sub sp, sp, r8
|
||||
blx r4
|
||||
add sp, sp, r8
|
||||
ldmia sp!, {r4-r8, pc}
|
||||
|
||||
_armFuncObjLast:
|
||||
stmdb sp!, {r4-r8, lr}
|
||||
mov r6, r0 // arg table
|
||||
movs r7, r1 // arg size (also set the condition code flags so that we detect if there are no arguments)
|
||||
mov r4, r2 // function address
|
||||
mov r8, #0
|
||||
|
||||
mov r0, r3 // objlast. might get overwritten
|
||||
str r3, [sp, #-4]! // objlast again.
|
||||
|
||||
beq nomoreargsarmFuncObjLast
|
||||
|
||||
// Load the first 4 arguments into r0-r3
|
||||
cmp r7, #4
|
||||
ldrge r0, [r6],#4
|
||||
cmp r7, #2*4
|
||||
ldrge r1, [r6],#4
|
||||
ldrlt r1, [sp]
|
||||
cmp r7, #3*4
|
||||
ldrge r2, [r6],#4
|
||||
ldrlt r2, [sp]
|
||||
cmp r7, #4*4
|
||||
ldrge r3, [r6],#4
|
||||
ldrlt r3, [sp]
|
||||
ble nomoreargsarmFuncObjLast
|
||||
|
||||
// Load the rest of the arguments onto the stack
|
||||
sub r7, r7, #4*4 // skip the 4 registers already loaded into r0-r3
|
||||
sub sp, sp, r7
|
||||
mov r8, r7
|
||||
stackargslooparmFuncObjLast:
|
||||
ldr r5, [r6], #4
|
||||
str r5, [sp], #4
|
||||
subs r7, r7, #4
|
||||
bne stackargslooparmFuncObjLast
|
||||
nomoreargsarmFuncObjLast:
|
||||
sub sp, sp, r8
|
||||
blx r4
|
||||
add sp, sp, r8
|
||||
add sp, sp, #4
|
||||
ldmia sp!, {r4-r8, pc}
|
||||
|
||||
_armFuncR0ObjLast:
|
||||
stmdb sp!, {r4-r8, lr}
|
||||
ldr r7, [sp,#6*4]
|
||||
str r7, [sp,#-4]!
|
||||
|
||||
mov r6, r0 // arg table
|
||||
movs r7, r1 // arg size (also set the condition code flags so that we detect if there are no arguments)
|
||||
mov r4, r2 // function address
|
||||
mov r8, #0
|
||||
|
||||
mov r0, r3 // r0 explicitly set
|
||||
ldr r1, [sp] // objlast. might get overwritten
|
||||
|
||||
beq nomoreargsarmFuncR0ObjLast
|
||||
|
||||
// Load the first 3 arguments into r1-r3
|
||||
cmp r7, #1*4
|
||||
ldrge r1, [r6],#4
|
||||
cmp r7, #2*4
|
||||
ldrge r2, [r6],#4
|
||||
ldrlt r2, [sp]
|
||||
cmp r7, #3*4
|
||||
ldrge r3, [r6],#4
|
||||
ldrlt r3, [sp]
|
||||
ble nomoreargsarmFuncR0ObjLast
|
||||
|
||||
// Load the rest of the arguments onto the stack
|
||||
sub r7, r7, #3*4 // skip the 3 registers already loaded into r1-r3
|
||||
sub sp, sp, r7
|
||||
mov r8, r7
|
||||
stackargslooparmFuncR0ObjLast:
|
||||
ldr r5, [r6], #4
|
||||
str r5, [sp], #4
|
||||
subs r7, r7, #4
|
||||
bne stackargslooparmFuncR0ObjLast
|
||||
nomoreargsarmFuncR0ObjLast:
|
||||
sub sp, sp, r8
|
||||
blx r4
|
||||
add sp, sp, r8
|
||||
add sp, sp, #4
|
||||
ldmia sp!, {r4-r8, pc}
|
||||
|
||||
|
||||
_armFuncR0:
|
||||
stmdb sp!, {r4-r8, lr}
|
||||
mov r6, r0 // arg table
|
||||
movs r7, r1 // arg size (also set the condition code flags so that we detect if there are no arguments)
|
||||
mov r4, r2 // function address
|
||||
mov r8, #0
|
||||
|
||||
mov r0, r3 // r0 explicitly set
|
||||
|
||||
beq nomoreargsarmFuncR0
|
||||
|
||||
// Load the first 3 arguments into r1-r3
|
||||
cmp r7, #1*4
|
||||
ldrge r1, [r6],#4
|
||||
cmp r7, #2*4
|
||||
ldrge r2, [r6],#4
|
||||
cmp r7, #3*4
|
||||
ldrge r3, [r6],#4
|
||||
ble nomoreargsarmFuncR0
|
||||
|
||||
// Load the rest of the arguments onto the stack
|
||||
sub r7, r7, #3*4 // skip the 3 registers already loaded into r1-r3
|
||||
sub sp, sp, r7
|
||||
mov r8, r7
|
||||
stackargslooparmFuncR0:
|
||||
ldr r5, [r6], #4
|
||||
str r5, [sp], #4
|
||||
subs r7, r7, #4
|
||||
bne stackargslooparmFuncR0
|
||||
nomoreargsarmFuncR0:
|
||||
sub sp, sp, r8
|
||||
blx r4
|
||||
add sp, sp, r8
|
||||
ldmia sp!, {r4-r8, pc}
|
||||
|
||||
|
||||
_armFuncR0R1:
|
||||
stmdb sp!, {r4-r8, lr}
|
||||
mov r6, r0 // arg table
|
||||
movs r7, r1 // arg size (also set the condition code flags so that we detect if there are no arguments)
|
||||
mov r4, r2 // function address
|
||||
mov r8, #0
|
||||
|
||||
mov r0, r3 // r0 explicitly set
|
||||
ldr r1, [sp, #6*4] // r1 explicitly set too
|
||||
|
||||
beq nomoreargsarmFuncR0R1
|
||||
|
||||
// Load the first 2 arguments into r2-r3
|
||||
cmp r7, #1*4
|
||||
ldrge r2, [r6],#4
|
||||
cmp r7, #2*4
|
||||
ldrge r3, [r6],#4
|
||||
ble nomoreargsarmFuncR0R1
|
||||
|
||||
// Load the rest of the arguments onto the stack
|
||||
sub r7, r7, #2*4 // skip the 2 registers already loaded into r2-r3
|
||||
sub sp, sp, r7
|
||||
mov r8, r7
|
||||
stackargslooparmFuncR0R1:
|
||||
ldr r5, [r6], #4
|
||||
str r5, [sp], #4
|
||||
subs r7, r7, #4
|
||||
bne stackargslooparmFuncR0R1
|
||||
nomoreargsarmFuncR0R1:
|
||||
sub sp, sp, r8
|
||||
blx r4
|
||||
add sp, sp, r8
|
||||
ldmia sp!, {r4-r8, pc}
|
||||
|
||||
#endif
|
440
lib/angelscript/source/as_callfunc_mips.cpp
Normal file
440
lib/angelscript/source/as_callfunc_mips.cpp
Normal file
@ -0,0 +1,440 @@
|
||||
/*
|
||||
AngelCode Scripting Library
|
||||
Copyright (c) 2003-2013 Andreas Jonsson
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any
|
||||
damages arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any
|
||||
purpose, including commercial applications, and to alter it and
|
||||
redistribute it freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you
|
||||
must not claim that you wrote the original software. If you use
|
||||
this software in a product, an acknowledgment in the product
|
||||
documentation would be appreciated but is not required.
|
||||
|
||||
2. Altered source versions must be plainly marked as such, and
|
||||
must not be misrepresented as being the original software.
|
||||
|
||||
3. This notice may not be removed or altered from any source
|
||||
distribution.
|
||||
|
||||
The original version of this library can be located at:
|
||||
http://www.angelcode.com/angelscript/
|
||||
|
||||
Andreas Jonsson
|
||||
andreas@angelcode.com
|
||||
*/
|
||||
|
||||
|
||||
//
|
||||
// as_callfunc_mips.cpp
|
||||
//
|
||||
// These functions handle the actual calling of system functions
|
||||
//
|
||||
// This version is MIPS specific and was originally written
|
||||
// by Manu Evans in April, 2006
|
||||
//
|
||||
|
||||
|
||||
#include "as_config.h"
|
||||
|
||||
#ifndef AS_MAX_PORTABILITY
|
||||
#ifdef AS_MIPS
|
||||
|
||||
#include "as_callfunc.h"
|
||||
#include "as_scriptengine.h"
|
||||
#include "as_texts.h"
|
||||
#include "as_tokendef.h"
|
||||
#include "as_context.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <regdef.h>
|
||||
|
||||
BEGIN_AS_NAMESPACE
|
||||
|
||||
#define AS_MIPS_MAX_ARGS 32
|
||||
#define AS_NUM_REG_FLOATS 8
|
||||
#define AS_NUM_REG_INTS 8
|
||||
|
||||
// The array used to send values to the correct places.
|
||||
// first 0-8 regular values to load into the a0-a3, t0-t3 registers
|
||||
// then 0-8 float values to load into the f12-f19 registers
|
||||
// then (AS_MIPS_MAX_ARGS - 16) values to load onto the stack
|
||||
// the +1 is for when CallThis (object methods) is used
|
||||
// extra +1 when returning in memory
|
||||
extern "C" {
|
||||
// TODO: This array shouldn't be global. It should be a local array in CallSystemFunctionNative
|
||||
asDWORD mipsArgs[AS_MIPS_MAX_ARGS + 1 + 1];
|
||||
}
|
||||
|
||||
// Loads all data into the correct places and calls the function.
|
||||
// intArgSize is the size in bytes for how much data to put in int registers
|
||||
// floatArgSize is the size in bytes for how much data to put in float registers
|
||||
// stackArgSize is the size in bytes for how much data to put on the callstack
|
||||
extern "C" asQWORD mipsFunc(int intArgSize, int floatArgSize, int stackArgSize, asDWORD func);
|
||||
|
||||
// puts the arguments in the correct place in the mipsArgs-array. See comments above.
|
||||
// This could be done better.
|
||||
inline void splitArgs(const asDWORD *args, int argNum, int &numRegIntArgs, int &numRegFloatArgs, int &numRestArgs, int hostFlags)
|
||||
{
|
||||
int i;
|
||||
|
||||
int argBit = 1;
|
||||
for (i = 0; i < argNum; i++)
|
||||
{
|
||||
if (hostFlags & argBit)
|
||||
{
|
||||
if (numRegFloatArgs < AS_NUM_REG_FLOATS)
|
||||
{
|
||||
// put in float register
|
||||
mipsArgs[AS_NUM_REG_INTS + numRegFloatArgs] = args[i];
|
||||
numRegFloatArgs++;
|
||||
}
|
||||
else
|
||||
{
|
||||
// put in stack
|
||||
mipsArgs[AS_NUM_REG_INTS + AS_NUM_REG_FLOATS + numRestArgs] = args[i];
|
||||
numRestArgs++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (numRegIntArgs < AS_NUM_REG_INTS)
|
||||
{
|
||||
// put in int register
|
||||
mipsArgs[numRegIntArgs] = args[i];
|
||||
numRegIntArgs++;
|
||||
}
|
||||
else
|
||||
{
|
||||
// put in stack
|
||||
mipsArgs[AS_NUM_REG_INTS + AS_NUM_REG_FLOATS + numRestArgs] = args[i];
|
||||
numRestArgs++;
|
||||
}
|
||||
}
|
||||
argBit <<= 1;
|
||||
}
|
||||
}
|
||||
|
||||
asQWORD CallCDeclFunction(const asDWORD *args, int argSize, asDWORD func, int flags)
|
||||
{
|
||||
int argNum = argSize >> 2;
|
||||
|
||||
int intArgs = 0;
|
||||
int floatArgs = 0;
|
||||
int restArgs = 0;
|
||||
|
||||
// put the arguments in the correct places in the mipsArgs array
|
||||
if(argNum > 0)
|
||||
splitArgs(args, argNum, intArgs, floatArgs, restArgs, flags);
|
||||
|
||||
return mipsFunc(intArgs << 2, floatArgs << 2, restArgs << 2, func);
|
||||
}
|
||||
|
||||
// This function is identical to CallCDeclFunction, with the only difference that
|
||||
// the value in the first parameter is the object
|
||||
asQWORD CallThisCallFunction(const void *obj, const asDWORD *args, int argSize, asDWORD func, int flags)
|
||||
{
|
||||
int argNum = argSize >> 2;
|
||||
|
||||
int intArgs = 1;
|
||||
int floatArgs = 0;
|
||||
int restArgs = 0;
|
||||
|
||||
mipsArgs[0] = (asDWORD) obj;
|
||||
|
||||
// put the arguments in the correct places in the mipsArgs array
|
||||
if (argNum > 0)
|
||||
splitArgs(args, argNum, intArgs, floatArgs, restArgs, flags);
|
||||
|
||||
return mipsFunc(intArgs << 2, floatArgs << 2, restArgs << 2, func);
|
||||
}
|
||||
|
||||
// This function is identical to CallCDeclFunction, with the only difference that
|
||||
// the value in the last parameter is the object
|
||||
asQWORD CallThisCallFunction_objLast(const void *obj, const asDWORD *args, int argSize, asDWORD func, int flags)
|
||||
{
|
||||
int argNum = argSize >> 2;
|
||||
|
||||
int intArgs = 0;
|
||||
int floatArgs = 0;
|
||||
int restArgs = 0;
|
||||
|
||||
// put the arguments in the correct places in the mipsArgs array
|
||||
if(argNum > 0)
|
||||
splitArgs(args, argNum, intArgs, floatArgs, restArgs, flags);
|
||||
|
||||
if(intArgs < AS_NUM_REG_INTS)
|
||||
{
|
||||
mipsArgs[intArgs] = (asDWORD) obj;
|
||||
intArgs++;
|
||||
}
|
||||
else
|
||||
{
|
||||
mipsArgs[AS_NUM_REG_INTS + AS_NUM_REG_FLOATS + restArgs] = (asDWORD) obj;
|
||||
restArgs++;
|
||||
}
|
||||
|
||||
return mipsFunc(intArgs << 2, floatArgs << 2, restArgs << 2, func);
|
||||
}
|
||||
|
||||
asDWORD GetReturnedFloat()
|
||||
{
|
||||
asDWORD f;
|
||||
|
||||
asm("swc1 $f0, %0\n" : "=m"(f));
|
||||
|
||||
return f;
|
||||
}
|
||||
|
||||
/*
|
||||
asDWORD GetReturnedFloat();
|
||||
|
||||
asm(
|
||||
" .align 4\n"
|
||||
" .global GetReturnedFloat\n"
|
||||
"GetReturnedFloat:\n"
|
||||
" .set noreorder\n"
|
||||
" .set nomacro\n"
|
||||
" j $ra\n"
|
||||
" mfc1 $v0, $f0\n"
|
||||
" .set macro\n"
|
||||
" .set reorder\n"
|
||||
" .end Func\n"
|
||||
*/
|
||||
|
||||
|
||||
// sizeof(double) == 4 with sh-elf-gcc (3.4.0) -m4
|
||||
// so this isn't really used...
|
||||
asQWORD GetReturnedDouble()
|
||||
{
|
||||
asQWORD d = 0;
|
||||
|
||||
printf("Broken!!!");
|
||||
/*
|
||||
asm("sw $v0, %0\n" : "=m"(d));
|
||||
*/
|
||||
return d;
|
||||
}
|
||||
|
||||
asQWORD CallSystemFunctionNative(asCContext *context, asCScriptFunction *descr, void *obj, asDWORD *args, void *retPointer, asQWORD &/*retQW2*/)
|
||||
{
|
||||
asCScriptEngine *engine = context->m_engine;
|
||||
asSSystemFunctionInterface *sysFunc = descr->sysFuncIntf;
|
||||
int callConv = sysFunc->callConv;
|
||||
|
||||
asQWORD retQW = 0;
|
||||
|
||||
void *func = (void*)sysFunc->func;
|
||||
int paramSize = sysFunc->paramSize;
|
||||
asDWORD *vftable;
|
||||
|
||||
if( descr->returnType.IsObject() && !descr->returnType.IsReference() && !descr->returnType.IsObjectHandle() )
|
||||
{
|
||||
mipsArgs[AS_MIPS_MAX_ARGS+1] = (asDWORD) retPointer;
|
||||
}
|
||||
|
||||
asASSERT(descr->parameterTypes.GetLength() <= AS_MIPS_MAX_ARGS);
|
||||
|
||||
// mark all float arguments
|
||||
int argBit = 1;
|
||||
int hostFlags = 0;
|
||||
int intArgs = 0;
|
||||
for( size_t a = 0; a < descr->parameterTypes.GetLength(); a++ )
|
||||
{
|
||||
if (descr->parameterTypes[a].IsFloatType())
|
||||
hostFlags |= argBit;
|
||||
else
|
||||
intArgs++;
|
||||
argBit <<= 1;
|
||||
}
|
||||
|
||||
asDWORD paramBuffer[64];
|
||||
if( sysFunc->takesObjByVal )
|
||||
{
|
||||
paramSize = 0;
|
||||
int spos = 0;
|
||||
int dpos = 1;
|
||||
for( asUINT n = 0; n < descr->parameterTypes.GetLength(); n++ )
|
||||
{
|
||||
if( descr->parameterTypes[n].IsObject() && !descr->parameterTypes[n].IsObjectHandle() && !descr->parameterTypes[n].IsReference() )
|
||||
{
|
||||
#ifdef COMPLEX_OBJS_PASSED_BY_REF
|
||||
if( descr->parameterTypes[n].GetObjectType()->flags & COMPLEX_MASK )
|
||||
{
|
||||
paramBuffer[dpos++] = args[spos++];
|
||||
paramSize++;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
// Copy the object's memory to the buffer
|
||||
memcpy(¶mBuffer[dpos], *(void**)(args+spos), descr->parameterTypes[n].GetSizeInMemoryBytes());
|
||||
// Delete the original memory
|
||||
engine->CallFree(*(char**)(args+spos));
|
||||
spos++;
|
||||
dpos += descr->parameterTypes[n].GetSizeInMemoryDWords();
|
||||
paramSize += descr->parameterTypes[n].GetSizeInMemoryDWords();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Copy the value directly
|
||||
paramBuffer[dpos++] = args[spos++];
|
||||
if( descr->parameterTypes[n].GetSizeOnStackDWords() > 1 )
|
||||
paramBuffer[dpos++] = args[spos++];
|
||||
paramSize += descr->parameterTypes[n].GetSizeOnStackDWords();
|
||||
}
|
||||
}
|
||||
// Keep a free location at the beginning
|
||||
args = ¶mBuffer[1];
|
||||
}
|
||||
|
||||
switch( callConv )
|
||||
{
|
||||
case ICC_CDECL:
|
||||
case ICC_CDECL_RETURNINMEM:
|
||||
case ICC_STDCALL:
|
||||
case ICC_STDCALL_RETURNINMEM:
|
||||
retQW = CallCDeclFunction(args, paramSize<<2, (asDWORD)func, hostFlags);
|
||||
break;
|
||||
case ICC_THISCALL:
|
||||
case ICC_THISCALL_RETURNINMEM:
|
||||
retQW = CallThisCallFunction(obj, args, paramSize<<2, (asDWORD)func, hostFlags);
|
||||
break;
|
||||
case ICC_VIRTUAL_THISCALL:
|
||||
case ICC_VIRTUAL_THISCALL_RETURNINMEM:
|
||||
// Get virtual function table from the object pointer
|
||||
vftable = *(asDWORD**)obj;
|
||||
retQW = CallThisCallFunction(obj, args, paramSize<<2, vftable[asDWORD(func)>>2], hostFlags);
|
||||
break;
|
||||
case ICC_CDECL_OBJLAST:
|
||||
case ICC_CDECL_OBJLAST_RETURNINMEM:
|
||||
retQW = CallThisCallFunction_objLast(obj, args, paramSize<<2, (asDWORD)func, hostFlags);
|
||||
break;
|
||||
case ICC_CDECL_OBJFIRST:
|
||||
case ICC_CDECL_OBJFIRST_RETURNINMEM:
|
||||
retQW = CallThisCallFunction(obj, args, paramSize<<2, (asDWORD)func, hostFlags);
|
||||
break;
|
||||
default:
|
||||
context->SetInternalException(TXT_INVALID_CALLING_CONVENTION);
|
||||
}
|
||||
|
||||
// If the return is a float value we need to get the value from the FP register
|
||||
if( sysFunc->hostReturnFloat )
|
||||
{
|
||||
if( sysFunc->hostReturnSize == 1 )
|
||||
*(asDWORD*)&retQW = GetReturnedFloat();
|
||||
else
|
||||
retQW = GetReturnedDouble();
|
||||
}
|
||||
|
||||
return retQW;
|
||||
}
|
||||
|
||||
|
||||
asm(
|
||||
" .text\n"
|
||||
//" .align 2\n"
|
||||
" .global mipsFunc\n"
|
||||
" .ent mipsFunc\n"
|
||||
"mipsFunc:\n"
|
||||
//" .frame $fp,64,$31 # vars= 0, regs= 0/0, args= 0, gp= 0\n"
|
||||
//" .mask 0x00000000,0\n"
|
||||
//" .fmask 0x00000000,0\n"
|
||||
" .set noreorder\n"
|
||||
" .set nomacro\n"
|
||||
// align the stack frame to 8 bytes
|
||||
" addiu $12, $6, 7\n"
|
||||
" li $13, -8\n" // 0xfffffffffffffffc
|
||||
" and $12, $12, $13\n" // t4 holds the size of the argument block
|
||||
// and add 8 bytes for the return pointer and s0 backup
|
||||
" addiu $13, $12, 8\n" // t5 holds the total size of the stack frame (including return pointer)
|
||||
// save the s0 register (so we can use it to remember where our return pointer is lives)
|
||||
" sw $16, -4($sp)\n" // store the s0 register (so we can use it to remember how big our stack frame is)
|
||||
// push the stack
|
||||
" subu $sp, $sp, $13\n"
|
||||
// find the return address, place in s0
|
||||
" addu $16, $sp, $12\n"
|
||||
// store the return pointer
|
||||
" sw $31, 0($16)\n"
|
||||
|
||||
// backup our function params
|
||||
" addiu $2, $7, 0\n"
|
||||
" addiu $3, $6, 0\n"
|
||||
|
||||
// get global mipsArgs[] array pointer
|
||||
//" lui $15, %hi(mipsArgs)\n"
|
||||
//" addiu $15, $15, %lo(mipsArgs)\n"
|
||||
// we'll use the macro instead because SN Systems doesnt like %hi/%lo
|
||||
".set macro\n"
|
||||
" la $15, mipsArgs\n"
|
||||
".set nomacro\n"
|
||||
// load register params
|
||||
" lw $4, 0($15)\n"
|
||||
" lw $5, 4($15)\n"
|
||||
" lw $6, 8($15)\n"
|
||||
" lw $7, 12($15)\n"
|
||||
" lw $8, 16($15)\n"
|
||||
" lw $9, 20($15)\n"
|
||||
" lw $10, 24($15)\n"
|
||||
" lw $11, 28($15)\n"
|
||||
|
||||
// load float params
|
||||
" lwc1 $f12, 32($15)\n"
|
||||
" lwc1 $f13, 36($15)\n"
|
||||
" lwc1 $f14, 40($15)\n"
|
||||
" lwc1 $f15, 44($15)\n"
|
||||
" lwc1 $f16, 48($15)\n"
|
||||
" lwc1 $f17, 52($15)\n"
|
||||
" lwc1 $f18, 56($15)\n"
|
||||
" lwc1 $f19, 60($15)\n"
|
||||
|
||||
// skip stack paramaters if there are none
|
||||
" beq $3, $0, andCall\n"
|
||||
|
||||
// push stack paramaters
|
||||
" addiu $15, $15, 64\n"
|
||||
"pushArgs:\n"
|
||||
" addiu $3, -4\n"
|
||||
// load from $15 + stack bytes ($3)
|
||||
" addu $14, $15, $3\n"
|
||||
" lw $14, 0($14)\n"
|
||||
// store to $sp + stack bytes ($3)
|
||||
" addu $13, $sp, $3\n"
|
||||
" sw $14, 0($13)\n"
|
||||
// if there are more, loop...
|
||||
" bne $3, $0, pushArgs\n"
|
||||
" nop\n"
|
||||
|
||||
// and call the function
|
||||
"andCall:\n"
|
||||
" jal $2\n"
|
||||
" nop\n"
|
||||
|
||||
// restore the return pointer
|
||||
" lw $31, 0($16)\n"
|
||||
// pop the stack pointer (remembering the return pointer was 8 bytes below the top)
|
||||
" addiu $sp, $16, 8\n"
|
||||
// and return from the function
|
||||
" jr $31\n"
|
||||
// restore the s0 register (in the branch delay slot)
|
||||
" lw $16, -4($sp)\n"
|
||||
" .set macro\n"
|
||||
" .set reorder\n"
|
||||
" .end mipsFunc\n"
|
||||
" .size mipsFunc, .-mipsFunc\n"
|
||||
);
|
||||
|
||||
END_AS_NAMESPACE
|
||||
|
||||
#endif // AS_MIPS
|
||||
#endif // AS_MAX_PORTABILITY
|
||||
|
||||
|
||||
|
||||
|
672
lib/angelscript/source/as_callfunc_ppc.cpp
Normal file
672
lib/angelscript/source/as_callfunc_ppc.cpp
Normal file
@ -0,0 +1,672 @@
|
||||
/*
|
||||
AngelCode Scripting Library
|
||||
Copyright (c) 2003-2013 Andreas Jonsson
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any
|
||||
damages arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any
|
||||
purpose, including commercial applications, and to alter it and
|
||||
redistribute it freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you
|
||||
must not claim that you wrote the original software. If you use
|
||||
this software in a product, an acknowledgment in the product
|
||||
documentation would be appreciated but is not required.
|
||||
|
||||
2. Altered source versions must be plainly marked as such, and
|
||||
must not be misrepresented as being the original software.
|
||||
|
||||
3. This notice may not be removed or altered from any source
|
||||
distribution.
|
||||
|
||||
The original version of this library can be located at:
|
||||
http://www.angelcode.com/angelscript/
|
||||
|
||||
Andreas Jonsson
|
||||
andreas@angelcode.com
|
||||
*/
|
||||
|
||||
|
||||
//
|
||||
// as_callfunc_ppc.cpp
|
||||
//
|
||||
// These functions handle the actual calling of system functions
|
||||
//
|
||||
// This version is PPC specific
|
||||
//
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "as_config.h"
|
||||
|
||||
#ifndef AS_MAX_PORTABILITY
|
||||
#ifdef AS_PPC
|
||||
|
||||
#include "as_callfunc.h"
|
||||
#include "as_scriptengine.h"
|
||||
#include "as_texts.h"
|
||||
#include "as_tokendef.h"
|
||||
#include "as_context.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
BEGIN_AS_NAMESPACE
|
||||
|
||||
// This part was originally written by Pecan Heber, June 2006, for
|
||||
// use on MacOS X with 32bit PPC processor. He based the code on the
|
||||
// code in as_callfunc_sh4.cpp
|
||||
|
||||
#define AS_PPC_MAX_ARGS 32
|
||||
|
||||
// The array used to send values to the correct places.
|
||||
// Contains a byte of argTypes to indicate the register tYpe to load
|
||||
// or zero if end of arguments
|
||||
// The +1 is for when CallThis (object methods) is used
|
||||
// Extra +1 when returning in memory
|
||||
// Extra +1 in ppcArgsType to ensure zero end-of-args marker
|
||||
|
||||
// TODO: multithread: We need to remove these global variables for thread-safety
|
||||
|
||||
enum argTypes { ppcENDARG, ppcINTARG, ppcFLOATARG, ppcDOUBLEARG };
|
||||
static asDWORD ppcArgs[2*AS_PPC_MAX_ARGS + 1 + 1];
|
||||
|
||||
// Using extern "C" because we use this symbol name in the assembly code
|
||||
extern "C"
|
||||
{
|
||||
static asBYTE ppcArgsType[2*AS_PPC_MAX_ARGS + 1 + 1 + 1];
|
||||
}
|
||||
|
||||
// NOTE: these values are for PowerPC 32 bit.
|
||||
#define PPC_LINKAGE_SIZE (24) // how big the PPC linkage area is in a stack frame
|
||||
#define PPC_NUM_REGSTORE (9) // how many registers of the PPC we need to store/restore for ppcFunc()
|
||||
#define PPC_REGSTORE_SIZE (4*PPC_NUM_REGSTORE) // how many bytes are required for register store/restore
|
||||
#define EXTRA_STACK_SIZE (PPC_LINKAGE_SIZE + PPC_REGSTORE_SIZE) // memory required, not including parameters, for the stack frame
|
||||
#define PPC_STACK_SIZE(numParams) (-( ( ((((numParams)<8)?8:(numParams))<<2) + EXTRA_STACK_SIZE + 15 ) & ~15 )) // calculates the total stack size needed for ppcFunc64, must pad to 16bytes
|
||||
|
||||
// Loads all data into the correct places and calls the function.
|
||||
// ppcArgsType is an array containing a byte type (enum argTypes) for each argument.
|
||||
// stackArgSize is the size in bytes for how much data to put on the stack frame
|
||||
extern "C" asQWORD ppcFunc(const asDWORD* argsPtr, int StackArgSize, asDWORD func);
|
||||
|
||||
asm(" .text\n"
|
||||
" .align 2\n" // align the code to 1 << 2 = 4 bytes
|
||||
" .globl _ppcFunc\n"
|
||||
"_ppcFunc:\n"
|
||||
|
||||
// We're receiving the following parameters
|
||||
|
||||
// r3 : argsPtr
|
||||
// r4 : StackArgSize
|
||||
// r5 : func
|
||||
|
||||
// The following registers are used through out the function
|
||||
|
||||
// r31 : the address of the label address, as reference for all other labels
|
||||
// r30 : temporary variable
|
||||
// r29 : arg list pointer
|
||||
// r28 : number of FPR registers used by the parameters
|
||||
// r27 : the function pointer that will be called
|
||||
// r26 : the location of the parameters for the call
|
||||
// r25 : arg type list pointer
|
||||
// r24 : temporary variable
|
||||
// r23 : number of GPR registers used by the parameters
|
||||
// r1 : this is stack pointer
|
||||
// r0 : temporary variable
|
||||
// f0 : temporary variable
|
||||
|
||||
// We need to store some of the registers for restoral before returning to caller
|
||||
|
||||
// lr - always stored in 8(r1) - this is the return address
|
||||
// cr - not required to be stored, but if it is, its place is in 4(r1) - this is the condition register
|
||||
// r1 - always stored in 0(r1) - this is the stack pointer
|
||||
// r11
|
||||
// r13 to r31
|
||||
// f14 to f31
|
||||
|
||||
// Store register values and setup our stack frame
|
||||
" mflr r0 \n" // move the return address into r0
|
||||
" stw r0, 8(r1) \n" // Store the return address on the stack
|
||||
" stmw r23, -36(r1) \n" // Store registers r23 to r31 on the stack
|
||||
" stwux r1, r1, r4 \n" // Increase the stack with the needed space and store the original value in the destination
|
||||
|
||||
// Obtain an address that we'll use as our position of reference when obtaining addresses of other labels
|
||||
" bl address \n"
|
||||
"address: \n"
|
||||
" mflr r31 \n"
|
||||
|
||||
// initial registers for the function
|
||||
" mr r29, r3 \n" // (r29) args list
|
||||
" mr r27, r5 \n" // load the function pointer to call. func actually holds the pointer to our function
|
||||
" addi r26, r1, 24 \n" // setup the pointer to the parameter area to the function we're going to call
|
||||
" sub r0, r0, r0 \n" // zero out r0
|
||||
" mr r23, r0 \n" // zero out r23, which holds the number of used GPR registers
|
||||
" mr r28, r0 \n" // zero our r22, which holds the number of used float registers
|
||||
|
||||
// load the global ppcArgsType which holds the types of arguments for each argument
|
||||
" addis r25, r31, ha16(_ppcArgsType - address) \n" // load the upper 16 bits of the address to r25
|
||||
" la r25, lo16(_ppcArgsType - address)(r25) \n" // load the lower 16 bits of the address to r25
|
||||
" subi r25, r25, 1 \n" // since we increment r25 on its use, we'll pre-decrement it
|
||||
|
||||
// loop through the arguments
|
||||
"ppcNextArg: \n"
|
||||
" addi r25, r25, 1 \n" // increment r25, our arg type pointer
|
||||
// switch based on the current argument type (0:end, 1:int, 2:float 3:double)
|
||||
" lbz r24, 0(r25) \n" // load the current argument type (it's a byte)
|
||||
" mulli r24, r24, 4 \n" // our jump table has 4 bytes per case (1 instruction)
|
||||
" addis r30, r31, ha16(ppcTypeSwitch - address) \n" // load the address of the jump table for the switch
|
||||
" la r30, lo16(ppcTypeSwitch - address)(r30) \n"
|
||||
|
||||
" add r0, r30, r24 \n" // offset by our argument type
|
||||
" mtctr r0 \n" // load the jump address into CTR
|
||||
" bctr \n" // jump into the jump table/switch
|
||||
" nop \n"
|
||||
|
||||
// the jump table/switch based on the current argument type
|
||||
"ppcTypeSwitch: \n"
|
||||
" b ppcArgsEnd \n"
|
||||
" b ppcArgIsInteger \n"
|
||||
" b ppcArgIsFloat \n"
|
||||
" b ppcArgIsDouble \n"
|
||||
|
||||
// when we get here we have finished processing all the arguments
|
||||
// everything is ready to go to call the function
|
||||
"ppcArgsEnd: \n"
|
||||
" mtctr r27 \n" // the function pointer is stored in r27, load that into CTR
|
||||
" bctrl \n" // call the function. We have to do it this way so that the LR gets the proper
|
||||
" nop \n" // return value (the next instruction below). So we have to branch from CTR instead of LR.
|
||||
|
||||
// Restore registers and caller's stack frame, then return to caller
|
||||
" lwz r1, 0(r1) \n" // restore the caller's stack pointer
|
||||
" lwz r0, 8(r1) \n" // load in the caller's LR
|
||||
" mtlr r0 \n" // restore the caller's LR
|
||||
" lmw r23, -36(r1) \n" // restore registers r23 to r31 from the stack
|
||||
" blr \n" // return back to the caller
|
||||
" nop \n"
|
||||
|
||||
// Integer argument (GPR register)
|
||||
"ppcArgIsInteger: \n"
|
||||
" addis r30, r31, ha16(ppcLoadIntReg - address) \n" // load the address to the jump table for integer registers
|
||||
" la r30, lo16(ppcLoadIntReg - address)(r30) \n"
|
||||
" mulli r0, r23, 8 \n" // each item in the jump table is 2 instructions (8 bytes)
|
||||
" add r0, r0, r30 \n" // calculate ppcLoadIntReg[numUsedGPRRegs]
|
||||
" lwz r30, 0(r29) \n" // load the next argument from the argument list into r30
|
||||
" cmpwi r23, 8 \n" // we can only load GPR3 through GPR10 (8 registers)
|
||||
" bgt ppcLoadIntRegUpd \n" // if we're beyond 8 GPR registers, we're in the stack, go there
|
||||
" mtctr r0 \n" // load the address of our ppcLoadIntReg jump table (we're below 8 GPR registers)
|
||||
" bctr \n" // load the argument into a GPR register
|
||||
" nop \n"
|
||||
// jump table for GPR registers, for the first 8 GPR arguments
|
||||
"ppcLoadIntReg: \n"
|
||||
" mr r3, r30 \n" // arg0 (to r3)
|
||||
" b ppcLoadIntRegUpd \n"
|
||||
" mr r4, r30 \n" // arg1 (to r4)
|
||||
" b ppcLoadIntRegUpd \n"
|
||||
" mr r5, r30 \n" // arg2 (to r5)
|
||||
" b ppcLoadIntRegUpd \n"
|
||||
" mr r6, r30 \n" // arg3 (to r6)
|
||||
" b ppcLoadIntRegUpd \n"
|
||||
" mr r7, r30 \n" // arg4 (to r7)
|
||||
" b ppcLoadIntRegUpd \n"
|
||||
" mr r8, r30 \n" // arg5 (to r8)
|
||||
" b ppcLoadIntRegUpd \n"
|
||||
" mr r9, r30 \n" // arg6 (to r9)
|
||||
" b ppcLoadIntRegUpd \n"
|
||||
" mr r10, r30 \n" // arg7 (to r10)
|
||||
" b ppcLoadIntRegUpd \n"
|
||||
// all GPR arguments still go on the stack
|
||||
"ppcLoadIntRegUpd: \n"
|
||||
" stw r30, 0(r26) \n" // store the argument into the next slot on the stack's argument list
|
||||
" addi r23, r23, 1 \n" // count a used GPR register
|
||||
" addi r29, r29, 4 \n" // move to the next argument on the list
|
||||
" addi r26, r26, 4 \n" // adjust our argument stack pointer for the next
|
||||
" b ppcNextArg \n" // next argument
|
||||
|
||||
// single Float argument
|
||||
"ppcArgIsFloat:\n"
|
||||
" addis r30, r31, ha16(ppcLoadFloatReg - address) \n" // get the base address of the float register jump table
|
||||
" la r30, lo16(ppcLoadFloatReg - address)(r30) \n"
|
||||
" mulli r0, r28, 8 \n" // each jump table entry is 8 bytes
|
||||
" add r0, r0, r30 \n" // calculate the offset to ppcLoadFloatReg[numUsedFloatReg]
|
||||
" lfs f0, 0(r29) \n" // load the next argument as a float into f0
|
||||
" cmpwi r28, 13 \n" // can't load more than 13 float/double registers
|
||||
" bgt ppcLoadFloatRegUpd \n" // if we're beyond 13 registers, just fall to inserting into the stack
|
||||
" mtctr r0 \n" // jump into the float jump table
|
||||
" bctr \n"
|
||||
" nop \n"
|
||||
// jump table for float registers, for the first 13 float arguments
|
||||
"ppcLoadFloatReg: \n"
|
||||
" fmr f1, f0 \n" // arg0 (f1)
|
||||
" b ppcLoadFloatRegUpd \n"
|
||||
" fmr f2, f0 \n" // arg1 (f2)
|
||||
" b ppcLoadFloatRegUpd \n"
|
||||
" fmr f3, f0 \n" // arg2 (f3)
|
||||
" b ppcLoadFloatRegUpd \n"
|
||||
" fmr f4, f0 \n" // arg3 (f4)
|
||||
" b ppcLoadFloatRegUpd \n"
|
||||
" fmr f5, f0 \n" // arg4 (f5)
|
||||
" b ppcLoadFloatRegUpd \n"
|
||||
" fmr f6, f0 \n" // arg5 (f6)
|
||||
" b ppcLoadFloatRegUpd \n"
|
||||
" fmr f7, f0 \n" // arg6 (f7)
|
||||
" b ppcLoadFloatRegUpd \n"
|
||||
" fmr f8, f0 \n" // arg7 (f8)
|
||||
" b ppcLoadFloatRegUpd \n"
|
||||
" fmr f9, f0 \n" // arg8 (f9)
|
||||
" b ppcLoadFloatRegUpd \n"
|
||||
" fmr f10, f0 \n" // arg9 (f10)
|
||||
" b ppcLoadFloatRegUpd \n"
|
||||
" fmr f11, f0 \n" // arg10 (f11)
|
||||
" b ppcLoadFloatRegUpd \n"
|
||||
" fmr f12, f0 \n" // arg11 (f12)
|
||||
" b ppcLoadFloatRegUpd \n"
|
||||
" fmr f13, f0 \n" // arg12 (f13)
|
||||
" b ppcLoadFloatRegUpd \n"
|
||||
" nop \n"
|
||||
// all float arguments still go on the stack
|
||||
"ppcLoadFloatRegUpd: \n"
|
||||
" stfs f0, 0(r26) \n" // store, as a single float, f0 (current argument) on to the stack argument list
|
||||
" addi r23, r23, 1 \n" // a float register eats up a GPR register
|
||||
" addi r28, r28, 1 \n" // ...and, of course, a float register
|
||||
" addi r29, r29, 4 \n" // move to the next argument in the list
|
||||
" addi r26, r26, 4 \n" // move to the next stack slot
|
||||
" b ppcNextArg \n" // on to the next argument
|
||||
" nop \n"
|
||||
|
||||
// double Float argument
|
||||
"ppcArgIsDouble: \n"
|
||||
" addis r30, r31, ha16(ppcLoadDoubleReg - address) \n" // load the base address of the jump table for double registers
|
||||
" la r30, lo16(ppcLoadDoubleReg - address)(r30) \n"
|
||||
" mulli r0, r28, 8 \n" // each slot of the jump table is 8 bytes
|
||||
" add r0, r0, r30 \n" // calculate ppcLoadDoubleReg[numUsedFloatReg]
|
||||
" lfd f0, 0(r29) \n" // load the next argument, as a double float, into f0
|
||||
" cmpwi r28, 13 \n" // the first 13 floats must go into float registers also
|
||||
" bgt ppcLoadDoubleRegUpd \n" // if we're beyond 13, then just put on to the stack
|
||||
" mtctr r0 \n" // we're under 13, first load our register
|
||||
" bctr \n" // jump into the jump table
|
||||
" nop \n"
|
||||
// jump table for float registers, for the first 13 float arguments
|
||||
"ppcLoadDoubleReg: \n"
|
||||
" fmr f1, f0 \n" // arg0 (f1)
|
||||
" b ppcLoadDoubleRegUpd \n"
|
||||
" fmr f2, f0 \n" // arg1 (f2)
|
||||
" b ppcLoadDoubleRegUpd \n"
|
||||
" fmr f3, f0 \n" // arg2 (f3)
|
||||
" b ppcLoadDoubleRegUpd \n"
|
||||
" fmr f4, f0 \n" // arg3 (f4)
|
||||
" b ppcLoadDoubleRegUpd \n"
|
||||
" fmr f5, f0 \n" // arg4 (f5)
|
||||
" b ppcLoadDoubleRegUpd \n"
|
||||
" fmr f6, f0 \n" // arg5 (f6)
|
||||
" b ppcLoadDoubleRegUpd \n"
|
||||
" fmr f7, f0 \n" // arg6 (f7)
|
||||
" b ppcLoadDoubleRegUpd \n"
|
||||
" fmr f8, f0 \n" // arg7 (f8)
|
||||
" b ppcLoadDoubleRegUpd \n"
|
||||
" fmr f9, f0 \n" // arg8 (f9)
|
||||
" b ppcLoadDoubleRegUpd \n"
|
||||
" fmr f10, f0 \n" // arg9 (f10)
|
||||
" b ppcLoadDoubleRegUpd \n"
|
||||
" fmr f11, f0 \n" // arg10 (f11)
|
||||
" b ppcLoadDoubleRegUpd \n"
|
||||
" fmr f12, f0 \n" // arg11 (f12)
|
||||
" b ppcLoadDoubleRegUpd \n"
|
||||
" fmr f13, f0 \n" // arg12 (f13)
|
||||
" b ppcLoadDoubleRegUpd \n"
|
||||
" nop \n"
|
||||
// all float arguments still go on the stack
|
||||
"ppcLoadDoubleRegUpd: \n"
|
||||
" stfd f0, 0(r26) \n" // store f0, as a double, into the argument list on the stack
|
||||
" addi r23, r23, 2 \n" // a double float eats up two GPRs
|
||||
" addi r28, r28, 1 \n" // ...and, of course, a float
|
||||
" addi r29, r29, 8 \n" // increment to our next argument we need to process (8 bytes for the 64bit float)
|
||||
" addi r26, r26, 8 \n" // increment to the next slot on the argument list on the stack (8 bytes)
|
||||
" b ppcNextArg \n" // on to the next argument
|
||||
" nop \n"
|
||||
);
|
||||
|
||||
asDWORD GetReturnedFloat()
|
||||
{
|
||||
asDWORD f;
|
||||
asm(" stfs f1, %0\n" : "=m"(f));
|
||||
return f;
|
||||
}
|
||||
|
||||
asQWORD GetReturnedDouble()
|
||||
{
|
||||
asQWORD f;
|
||||
asm(" stfd f1, %0\n" : "=m"(f));
|
||||
return f;
|
||||
}
|
||||
|
||||
// puts the arguments in the correct place in the stack array. See comments above.
|
||||
void stackArgs(const asDWORD *args, const asBYTE *argsType, int& numIntArgs, int& numFloatArgs, int& numDoubleArgs)
|
||||
{
|
||||
int i;
|
||||
int argWordPos = numIntArgs + numFloatArgs + (numDoubleArgs*2);
|
||||
int typeOffset = numIntArgs + numFloatArgs + numDoubleArgs;
|
||||
|
||||
int typeIndex;
|
||||
for( i = 0, typeIndex = 0; ; i++, typeIndex++ )
|
||||
{
|
||||
// store the type
|
||||
ppcArgsType[typeOffset++] = argsType[typeIndex];
|
||||
if( argsType[typeIndex] == ppcENDARG )
|
||||
break;
|
||||
|
||||
switch( argsType[typeIndex] )
|
||||
{
|
||||
case ppcFLOATARG:
|
||||
// stow float
|
||||
ppcArgs[argWordPos] = args[i]; // it's just a bit copy
|
||||
numFloatArgs++;
|
||||
argWordPos++; //add one word
|
||||
break;
|
||||
|
||||
case ppcDOUBLEARG:
|
||||
// stow double
|
||||
memcpy( &ppcArgs[argWordPos], &args[i], sizeof(double) ); // we have to do this because of alignment
|
||||
numDoubleArgs++;
|
||||
argWordPos+=2; //add two words
|
||||
i++;//doubles take up 2 argument slots
|
||||
break;
|
||||
|
||||
case ppcINTARG:
|
||||
// stow register
|
||||
ppcArgs[argWordPos] = args[i];
|
||||
numIntArgs++;
|
||||
argWordPos++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// close off the argument list (if we have max args we won't close it off until here)
|
||||
ppcArgsType[typeOffset] = ppcENDARG;
|
||||
}
|
||||
|
||||
static asQWORD CallCDeclFunction(const asDWORD* pArgs, const asBYTE *pArgsType, int argSize, asDWORD func, void *retInMemory)
|
||||
{
|
||||
int baseArgCount = 0;
|
||||
if( retInMemory )
|
||||
{
|
||||
// the first argument is the 'return in memory' pointer
|
||||
ppcArgs[0] = (asDWORD)retInMemory;
|
||||
ppcArgsType[0] = ppcINTARG;
|
||||
ppcArgsType[1] = ppcENDARG;
|
||||
baseArgCount = 1;
|
||||
}
|
||||
|
||||
// put the arguments in the correct places in the ppcArgs array
|
||||
int numTotalArgs = baseArgCount;
|
||||
if( argSize > 0 )
|
||||
{
|
||||
int intArgs = baseArgCount, floatArgs = 0, doubleArgs = 0;
|
||||
stackArgs( pArgs, pArgsType, intArgs, floatArgs, doubleArgs );
|
||||
numTotalArgs = intArgs + floatArgs + 2*doubleArgs; // doubles occupy two slots
|
||||
}
|
||||
else
|
||||
{
|
||||
// no arguments, cap the type list
|
||||
ppcArgsType[baseArgCount] = ppcENDARG;
|
||||
}
|
||||
|
||||
// call the function with the arguments
|
||||
return ppcFunc( ppcArgs, PPC_STACK_SIZE(numTotalArgs), func );
|
||||
}
|
||||
|
||||
// This function is identical to CallCDeclFunction, with the only difference that
|
||||
// the value in the first parameter is the object (unless we are returning in memory)
|
||||
static asQWORD CallThisCallFunction(const void *obj, const asDWORD* pArgs, const asBYTE *pArgsType, int argSize, asDWORD func, void *retInMemory )
|
||||
{
|
||||
int baseArgCount = 0;
|
||||
if( retInMemory )
|
||||
{
|
||||
// the first argument is the 'return in memory' pointer
|
||||
ppcArgs[0] = (asDWORD)retInMemory;
|
||||
ppcArgsType[0] = ppcINTARG;
|
||||
ppcArgsType[1] = ppcENDARG;
|
||||
baseArgCount = 1;
|
||||
}
|
||||
|
||||
// the first argument is the 'this' of the object
|
||||
ppcArgs[baseArgCount] = (asDWORD)obj;
|
||||
ppcArgsType[baseArgCount++] = ppcINTARG;
|
||||
ppcArgsType[baseArgCount] = ppcENDARG;
|
||||
|
||||
// put the arguments in the correct places in the ppcArgs array
|
||||
int numTotalArgs = baseArgCount;
|
||||
if( argSize > 0 )
|
||||
{
|
||||
int intArgs = baseArgCount, floatArgs = 0, doubleArgs = 0;
|
||||
stackArgs( pArgs, pArgsType, intArgs, floatArgs, doubleArgs );
|
||||
numTotalArgs = intArgs + floatArgs + 2*doubleArgs; // doubles occupy two slots
|
||||
}
|
||||
|
||||
// call the function with the arguments
|
||||
return ppcFunc( ppcArgs, PPC_STACK_SIZE(numTotalArgs), func);
|
||||
}
|
||||
|
||||
// This function is identical to CallCDeclFunction, with the only difference that
|
||||
// the value in the last parameter is the object
|
||||
// NOTE: on PPC the order for the args is reversed
|
||||
static asQWORD CallThisCallFunction_objLast(const void *obj, const asDWORD* pArgs, const asBYTE *pArgsType, int argSize, asDWORD func, void *retInMemory)
|
||||
{
|
||||
UNUSED_VAR(argSize);
|
||||
int baseArgCount = 0;
|
||||
if( retInMemory )
|
||||
{
|
||||
// the first argument is the 'return in memory' pointer
|
||||
ppcArgs[0] = (asDWORD)retInMemory;
|
||||
ppcArgsType[0] = ppcINTARG;
|
||||
ppcArgsType[1] = ppcENDARG;
|
||||
baseArgCount = 1;
|
||||
}
|
||||
|
||||
// stack any of the arguments
|
||||
int intArgs = baseArgCount, floatArgs = 0, doubleArgs = 0;
|
||||
stackArgs( pArgs, pArgsType, intArgs, floatArgs, doubleArgs );
|
||||
int numTotalArgs = intArgs + floatArgs + doubleArgs;
|
||||
|
||||
// can we fit the object in at the end?
|
||||
if( numTotalArgs < AS_PPC_MAX_ARGS )
|
||||
{
|
||||
// put the object pointer at the end
|
||||
int argPos = intArgs + floatArgs + (doubleArgs * 2);
|
||||
ppcArgs[argPos] = (asDWORD)obj;
|
||||
ppcArgsType[numTotalArgs++] = ppcINTARG;
|
||||
ppcArgsType[numTotalArgs] = ppcENDARG;
|
||||
}
|
||||
|
||||
// call the function with the arguments
|
||||
return ppcFunc( ppcArgs, PPC_STACK_SIZE(numTotalArgs), func );
|
||||
}
|
||||
|
||||
asQWORD CallSystemFunctionNative(asCContext *context, asCScriptFunction *descr, void *obj, asDWORD *args, void *retPointer, asQWORD &/*retQW2*/)
|
||||
{
|
||||
// use a working array of types, we'll configure the final one in stackArgs
|
||||
asBYTE argsType[2*AS_PPC_MAX_ARGS + 1 + 1 + 1];
|
||||
memset( argsType, 0, sizeof(argsType));
|
||||
|
||||
asCScriptEngine *engine = context->m_engine;
|
||||
asSSystemFunctionInterface *sysFunc = descr->sysFuncIntf;
|
||||
|
||||
asQWORD retQW = 0;
|
||||
void *func = (void*)sysFunc->func;
|
||||
int paramSize = sysFunc->paramSize;
|
||||
asDWORD *vftable = NULL;
|
||||
int a, s;
|
||||
|
||||
// convert the parameters that are < 4 bytes from little endian to big endian
|
||||
int argDwordOffset = 0;
|
||||
for( a = 0; a < (int)descr->parameterTypes.GetLength(); a++ )
|
||||
{
|
||||
int numBytes = descr->parameterTypes[a].GetSizeInMemoryBytes();
|
||||
if( numBytes >= 4 || descr->parameterTypes[a].IsReference() || descr->parameterTypes[a].IsObjectHandle() )
|
||||
{
|
||||
argDwordOffset += descr->parameterTypes[a].GetSizeOnStackDWords();
|
||||
continue;
|
||||
}
|
||||
|
||||
// flip
|
||||
asASSERT( numBytes == 1 || numBytes == 2 );
|
||||
switch( numBytes )
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
volatile asBYTE *bPtr = (asBYTE*)ARG_DW(args[argDwordOffset]);
|
||||
asBYTE t = bPtr[0];
|
||||
bPtr[0] = bPtr[3];
|
||||
bPtr[3] = t;
|
||||
t = bPtr[1];
|
||||
bPtr[1] = bPtr[2];
|
||||
bPtr[2] = t;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
{
|
||||
volatile asWORD *wPtr = (asWORD*)ARG_DW(args[argDwordOffset]);
|
||||
asWORD t = wPtr[0];
|
||||
wPtr[0] = wPtr[1];
|
||||
wPtr[1] = t;
|
||||
}
|
||||
break;
|
||||
}
|
||||
argDwordOffset++;
|
||||
}
|
||||
|
||||
// mark all float/double/int arguments
|
||||
if( !sysFunc->takesObjByVal )
|
||||
{
|
||||
for( s = 0, a = 0; s < (int)descr->parameterTypes.GetLength(); s++, a++ )
|
||||
{
|
||||
if( descr->parameterTypes[s].IsFloatType() && !descr->parameterTypes[s].IsReference() )
|
||||
{
|
||||
argsType[a] = ppcFLOATARG;
|
||||
}
|
||||
else if( descr->parameterTypes[s].IsDoubleType() && !descr->parameterTypes[s].IsReference() )
|
||||
{
|
||||
argsType[a] = ppcDOUBLEARG;
|
||||
}
|
||||
else
|
||||
{
|
||||
argsType[a] = ppcINTARG;
|
||||
if( descr->parameterTypes[s].GetSizeOnStackDWords() == 2 )
|
||||
{
|
||||
// Add an extra integer argument for the extra size
|
||||
a++;
|
||||
argsType[a] = ppcINTARG;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
asDWORD paramBuffer[64];
|
||||
if( sysFunc->takesObjByVal )
|
||||
{
|
||||
paramSize = 0;
|
||||
int spos = 0;
|
||||
int dpos = 1;
|
||||
|
||||
int a = 0;
|
||||
for( asUINT n = 0; n < descr->parameterTypes.GetLength(); n++ )
|
||||
{
|
||||
if( descr->parameterTypes[n].IsObject() && !descr->parameterTypes[n].IsObjectHandle() && !descr->parameterTypes[n].IsReference() )
|
||||
{
|
||||
#ifdef COMPLEX_OBJS_PASSED_BY_REF
|
||||
if( descr->parameterTypes[n].GetObjectType()->flags & COMPLEX_MASK )
|
||||
{
|
||||
argsType[a++] = ppcINTARG;
|
||||
paramBuffer[dpos++] = args[spos++];
|
||||
paramSize++;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
// TODO: Probably have to handle asOBJ_APP_FLOAT as a primitive
|
||||
|
||||
// Copy the object's memory to the buffer
|
||||
memcpy( ¶mBuffer[dpos], *(void**)(args+spos), descr->parameterTypes[n].GetSizeInMemoryBytes() );
|
||||
|
||||
// Delete the original memory
|
||||
engine->CallFree(*(char**)(args+spos) );
|
||||
spos++;
|
||||
asUINT dwords = descr->parameterTypes[n].GetSizeInMemoryDWords();
|
||||
dpos += dwords;
|
||||
paramSize += dwords;
|
||||
for( asUINT i = 0; i < dwords; i++ )
|
||||
argsType[a++] = ppcINTARG;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Copy the value directly
|
||||
paramBuffer[dpos++] = args[spos++];
|
||||
if( descr->parameterTypes[n].IsFloatType() && !descr->parameterTypes[n].IsReference() )
|
||||
argsType[a++] = ppcFLOATARG;
|
||||
else if( descr->parameterTypes[n].IsDoubleType() && !descr->parameterTypes[n].IsReference() )
|
||||
argsType[a++] = ppcDOUBLEARG;
|
||||
else
|
||||
argsType[a++] = ppcINTARG;
|
||||
if( descr->parameterTypes[n].GetSizeOnStackDWords() > 1 )
|
||||
{
|
||||
paramBuffer[dpos++] = args[spos++];
|
||||
if( !descr->parameterTypes[n].IsDoubleType() ) // Double already knows it is 2 dwords
|
||||
argsType[a++] = ppcINTARG;
|
||||
}
|
||||
paramSize += descr->parameterTypes[n].GetSizeOnStackDWords();
|
||||
}
|
||||
}
|
||||
|
||||
// Keep a free location at the beginning
|
||||
args = ¶mBuffer[1];
|
||||
}
|
||||
|
||||
int callConv = sysFunc->callConv;
|
||||
switch( callConv )
|
||||
{
|
||||
case ICC_CDECL:
|
||||
case ICC_CDECL_RETURNINMEM:
|
||||
case ICC_STDCALL:
|
||||
case ICC_STDCALL_RETURNINMEM:
|
||||
retQW = CallCDeclFunction( args, argsType, paramSize, (asDWORD)func, retPointer );
|
||||
break;
|
||||
case ICC_THISCALL:
|
||||
case ICC_THISCALL_RETURNINMEM:
|
||||
retQW = CallThisCallFunction(obj, args, argsType, paramSize, (asDWORD)func, retPointer );
|
||||
break;
|
||||
case ICC_VIRTUAL_THISCALL:
|
||||
case ICC_VIRTUAL_THISCALL_RETURNINMEM:
|
||||
// Get virtual function table from the object pointer
|
||||
vftable = *(asDWORD**)obj;
|
||||
retQW = CallThisCallFunction( obj, args, argsType, paramSize, vftable[asDWORD(func)>>2], retPointer );
|
||||
break;
|
||||
case ICC_CDECL_OBJLAST:
|
||||
case ICC_CDECL_OBJLAST_RETURNINMEM:
|
||||
retQW = CallThisCallFunction_objLast( obj, args, argsType, paramSize, (asDWORD)func, retPointer );
|
||||
break;
|
||||
case ICC_CDECL_OBJFIRST:
|
||||
case ICC_CDECL_OBJFIRST_RETURNINMEM:
|
||||
retQW = CallThisCallFunction( obj, args, argsType, paramSize, (asDWORD)func, retPointer );
|
||||
break;
|
||||
default:
|
||||
context->SetInternalException(TXT_INVALID_CALLING_CONVENTION);
|
||||
}
|
||||
|
||||
// If the return is a float value we need to get the value from the FP register
|
||||
if( sysFunc->hostReturnFloat )
|
||||
{
|
||||
if( sysFunc->hostReturnSize == 1 )
|
||||
*(asDWORD*)&retQW = GetReturnedFloat();
|
||||
else
|
||||
retQW = GetReturnedDouble();
|
||||
}
|
||||
|
||||
return retQW;
|
||||
}
|
||||
|
||||
END_AS_NAMESPACE
|
||||
|
||||
#endif // AS_PPC
|
||||
#endif // AS_MAX_PORTABILITY
|
||||
|
765
lib/angelscript/source/as_callfunc_ppc_64.cpp
Normal file
765
lib/angelscript/source/as_callfunc_ppc_64.cpp
Normal file
@ -0,0 +1,765 @@
|
||||
/*
|
||||
AngelCode Scripting Library
|
||||
Copyright (c) 2003-2013 Andreas Jonsson
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any
|
||||
damages arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any
|
||||
purpose, including commercial applications, and to alter it and
|
||||
redistribute it freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you
|
||||
must not claim that you wrote the original software. If you use
|
||||
this software in a product, an acknowledgment in the product
|
||||
documentation would be appreciated but is not required.
|
||||
|
||||
2. Altered source versions must be plainly marked as such, and
|
||||
must not be misrepresented as being the original software.
|
||||
|
||||
3. This notice may not be removed or altered from any source
|
||||
distribution.
|
||||
|
||||
The original version of this library can be located at:
|
||||
http://www.angelcode.com/angelscript/
|
||||
|
||||
Andreas Jonsson
|
||||
andreas@angelcode.com
|
||||
*/
|
||||
|
||||
|
||||
//
|
||||
// as_callfunc_ppc_64.cpp
|
||||
//
|
||||
// These functions handle the actual calling of system functions
|
||||
//
|
||||
// This version is 64 bit PPC specific
|
||||
//
|
||||
|
||||
#include "as_config.h"
|
||||
|
||||
#ifndef AS_MAX_PORTABILITY
|
||||
#ifdef AS_PPC_64
|
||||
|
||||
#include "as_callfunc.h"
|
||||
#include "as_scriptengine.h"
|
||||
#include "as_texts.h"
|
||||
#include "as_tokendef.h"
|
||||
#include "as_context.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef __SNC__
|
||||
#include "ppu_asm_intrinsics.h"
|
||||
#endif
|
||||
|
||||
|
||||
BEGIN_AS_NAMESPACE
|
||||
|
||||
// This part was written and tested by Jeff Slutter
|
||||
// from Reactor Zero, Abril, 2007, for PlayStation 3, which
|
||||
// is a PowerPC 64bit based architecture. Even though it is
|
||||
// 64bit it seems the pointer size is still 32bit.
|
||||
|
||||
// It still remains to be seen how well this code works
|
||||
// on other PPC platforms, such as XBox 360, GameCube.
|
||||
|
||||
#define AS_PPC_MAX_ARGS 32
|
||||
|
||||
// The array used to send values to the correct places.
|
||||
// Contains a byte of argTypes to indicate the register type to load
|
||||
// or zero if end of arguments
|
||||
// The +1 is for when CallThis (object methods) is used
|
||||
// Extra +1 when returning in memory
|
||||
// Extra +1 in ppcArgsType to ensure zero end-of-args marker
|
||||
|
||||
// TODO: multithread: The global variables must be removed to make the code thread safe
|
||||
|
||||
extern "C"
|
||||
{
|
||||
enum argTypes { ppcENDARG = 0, ppcINTARG = 1, ppcFLOATARG = 2, ppcDOUBLEARG = 3, ppcLONGARG = 4 };
|
||||
static asBYTE ppcArgsType[AS_PPC_MAX_ARGS + 1 + 1 + 1];
|
||||
static asDWORD ppcArgs[2*AS_PPC_MAX_ARGS + 1 + 1];
|
||||
}
|
||||
|
||||
// NOTE: these values are for PowerPC 64 bit. I'm sure things are different for PowerPC 32bit, but I don't have one.
|
||||
// I'm pretty sure that PPC 32bit sets up a stack frame slightly different (only 24 bytes for linkage area for instance)
|
||||
#define PPC_LINKAGE_SIZE (0x30) // how big the PPC linkage area is in a stack frame
|
||||
#define PPC_NUM_REGSTORE (10) // how many registers of the PPC we need to store/restore for ppcFunc64()
|
||||
#define PPC_REGSTORE_SIZE (8*PPC_NUM_REGSTORE) // how many bytes are required for register store/restore
|
||||
#define EXTRA_STACK_SIZE (PPC_LINKAGE_SIZE + PPC_REGSTORE_SIZE) // memory required, not including parameters, for the stack frame
|
||||
#define PPC_STACK_SIZE(numParams) ( -(( ( (((numParams)<8)?8:(numParams))<<3) + EXTRA_STACK_SIZE + 15 ) & ~15) ) // calculates the total stack size needed for ppcFunc64, must pad to 16bytes
|
||||
|
||||
// This is PowerPC 64 bit specific
|
||||
// Loads all data into the correct places and calls the function.
|
||||
// ppcArgsType is an array containing a byte type (enum argTypes) for each argument.
|
||||
// StackArgSizeInBytes is the size in bytes of the stack frame (takes into account linkage area, etc. must be multiple of 16)
|
||||
extern "C" asQWORD ppcFunc64(const asDWORD* argsPtr, int StackArgSizeInBytes, asDWORD func);
|
||||
asm(""
|
||||
".text\n"
|
||||
".align 4\n"
|
||||
".p2align 4,,15\n"
|
||||
".globl .ppcFunc64\n"
|
||||
".ppcFunc64:\n"
|
||||
|
||||
// function prolog
|
||||
"std %r22, -0x08(%r1)\n" // we need a register other than r0, to store the old stack pointer
|
||||
"mr %r22, %r1\n" // store the old stack pointer, for now (to make storing registers easier)
|
||||
"stdux %r1, %r1, %r4\n" // atomically store and update the stack pointer for the new stack frame (in case of a signal/interrupt)
|
||||
"mflr %r0\n" // get the caller's LR register
|
||||
"std %r0, 0x10(%r22)\n" // store the caller's LR register
|
||||
"std %r23, -0x10(%r22)\n" //
|
||||
"std %r24, -0x18(%r22)\n" //
|
||||
"std %r25, -0x20(%r22)\n" //
|
||||
"std %r26, -0x28(%r22)\n" //
|
||||
"std %r27, -0x30(%r22)\n" //
|
||||
"std %r28, -0x38(%r22)\n" //
|
||||
"std %r29, -0x40(%r22)\n" //
|
||||
"std %r30, -0x48(%r22)\n" //
|
||||
"std %r31, -0x50(%r22)\n" //
|
||||
"std %r3, 0x30(%r22)\n" // save our parameters
|
||||
"std %r4, 0x38(%r22)\n" //
|
||||
"std %r5, 0x40(%r22)\n" //
|
||||
"mr %r31, %r1\n" // functions tend to store the stack pointer here too
|
||||
|
||||
// initial registers for the function
|
||||
"mr %r29, %r3\n" // (r29) args list
|
||||
"lwz %r27, 0(%r5)\n" // load the function pointer to call. func actually holds the pointer to our function
|
||||
"addi %r26, %r1, 0x30\n" // setup the pointer to the parameter area to the function we're going to call
|
||||
"sub %r0,%r0,%r0\n" // zero out r0
|
||||
"mr %r23,%r0\n" // zero out r23, which holds the number of used GPR registers
|
||||
"mr %r22,%r0\n" // zero our r22, which holds the number of used float registers
|
||||
|
||||
// load the global ppcArgsType which holds the types of arguments for each argument
|
||||
"lis %r25, ppcArgsType@ha\n" // load the upper 16 bits of the address to r25
|
||||
"addi %r25, %r25, ppcArgsType@l\n" // load the lower 16 bits of the address to r25
|
||||
"subi %r25, %r25, 1\n" // since we increment r25 on its use, we'll pre-decrement it
|
||||
|
||||
// loop through the arguments
|
||||
"ppcNextArg:\n"
|
||||
"addi %r25, %r25, 1\n" // increment r25, our arg type pointer
|
||||
// switch based on the current argument type (0:end, 1:int, 2:float 3:double)
|
||||
"lbz %r24, 0(%r25)\n" // load the current argument type (it's a byte)
|
||||
"mulli %r24, %r24, 4\n" // our jump table has 4 bytes per case (1 instruction)
|
||||
"lis %r30, ppcTypeSwitch@ha\n" // load the address of the jump table for the switch
|
||||
"addi %r30, %r30, ppcTypeSwitch@l\n"
|
||||
"add %r0, %r30, %r24\n" // offset by our argument type
|
||||
"mtctr %r0\n" // load the jump address into CTR
|
||||
"bctr\n" // jump into the jump table/switch
|
||||
"nop\n"
|
||||
// the jump table/switch based on the current argument type
|
||||
"ppcTypeSwitch:\n"
|
||||
"b ppcArgsEnd\n"
|
||||
"b ppcArgIsInteger\n"
|
||||
"b ppcArgIsFloat\n"
|
||||
"b ppcArgIsDouble\n"
|
||||
"b ppcArgIsLong\n"
|
||||
|
||||
// when we get here we have finished processing all the arguments
|
||||
// everything is ready to go to call the function
|
||||
"ppcArgsEnd:\n"
|
||||
"mtctr %r27\n" // the function pointer is stored in r27, load that into CTR
|
||||
"bctrl\n" // call the function. We have to do it this way so that the LR gets the proper
|
||||
"nop\n" // return value (the next instruction below). So we have to branch from CTR instead of LR.
|
||||
// when we get here, the function has returned, this is the function epilog
|
||||
"ld %r11,0x00(%r1)\n" // load in the caller's stack pointer
|
||||
"ld %r0,0x10(%r11)\n" // load in the caller's LR
|
||||
"mtlr %r0\n" // restore the caller's LR
|
||||
"ld %r22, -0x08(%r11)\n" // load registers
|
||||
"ld %r23, -0x10(%r11)\n" //
|
||||
"ld %r24, -0x18(%r11)\n" //
|
||||
"ld %r25, -0x20(%r11)\n" //
|
||||
"ld %r26, -0x28(%r11)\n" //
|
||||
"ld %r27, -0x30(%r11)\n" //
|
||||
"ld %r28, -0x38(%r11)\n" //
|
||||
"ld %r29, -0x40(%r11)\n" //
|
||||
"ld %r30, -0x48(%r11)\n" //
|
||||
"ld %r31, -0x50(%r11)\n" //
|
||||
"mr %r1, %r11\n" // restore the caller's SP
|
||||
"blr\n" // return back to the caller
|
||||
"nop\n"
|
||||
// Integer argument (GPR register)
|
||||
"ppcArgIsInteger:\n"
|
||||
"lis %r30,ppcLoadIntReg@ha\n" // load the address to the jump table for integer registers
|
||||
"addi %r30, %r30, ppcLoadIntReg@l\n"
|
||||
"mulli %r0, %r23, 8\n" // each item in the jump table is 2 instructions (8 bytes)
|
||||
"add %r0, %r0, %r30\n" // calculate ppcLoadIntReg[numUsedGPRRegs]
|
||||
"lwz %r30,0(%r29)\n" // load the next argument from the argument list into r30
|
||||
"cmpwi %r23, 8\n" // we can only load GPR3 through GPR10 (8 registers)
|
||||
"bgt ppcLoadIntRegUpd\n" // if we're beyond 8 GPR registers, we're in the stack, go there
|
||||
"mtctr %r0\n" // load the address of our ppcLoadIntReg jump table (we're below 8 GPR registers)
|
||||
"bctr\n" // load the argument into a GPR register
|
||||
"nop\n"
|
||||
// jump table for GPR registers, for the first 8 GPR arguments
|
||||
"ppcLoadIntReg:\n"
|
||||
"mr %r3,%r30\n" // arg0 (to r3)
|
||||
"b ppcLoadIntRegUpd\n"
|
||||
"mr %r4,%r30\n" // arg1 (to r4)
|
||||
"b ppcLoadIntRegUpd\n"
|
||||
"mr %r5,%r30\n" // arg2 (to r5)
|
||||
"b ppcLoadIntRegUpd\n"
|
||||
"mr %r6,%r30\n" // arg3 (to r6)
|
||||
"b ppcLoadIntRegUpd\n"
|
||||
"mr %r7,%r30\n" // arg4 (to r7)
|
||||
"b ppcLoadIntRegUpd\n"
|
||||
"mr %r8,%r30\n" // arg5 (to r8)
|
||||
"b ppcLoadIntRegUpd\n"
|
||||
"mr %r9,%r30\n" // arg6 (to r9)
|
||||
"b ppcLoadIntRegUpd\n"
|
||||
"mr %r10,%r30\n" // arg7 (to r10)
|
||||
"b ppcLoadIntRegUpd\n"
|
||||
|
||||
// all GPR arguments still go on the stack
|
||||
"ppcLoadIntRegUpd:\n"
|
||||
"std %r30,0(%r26)\n" // store the argument into the next slot on the stack's argument list
|
||||
"addi %r23, %r23, 1\n" // count a used GPR register
|
||||
"addi %r29, %r29, 4\n" // move to the next argument on the list
|
||||
"addi %r26, %r26, 8\n" // adjust our argument stack pointer for the next
|
||||
"b ppcNextArg\n" // next argument
|
||||
|
||||
// single Float argument
|
||||
"ppcArgIsFloat:\n"
|
||||
"lis %r30,ppcLoadFloatReg@ha\n" // get the base address of the float register jump table
|
||||
"addi %r30, %r30, ppcLoadFloatReg@l\n"
|
||||
"mulli %r0, %r22 ,8\n" // each jump table entry is 8 bytes
|
||||
"add %r0, %r0, %r30\n" // calculate the offset to ppcLoadFloatReg[numUsedFloatReg]
|
||||
"lfs 0, 0(%r29)\n" // load the next argument as a float into f0
|
||||
"cmpwi %r22, 13\n" // can't load more than 13 float/double registers
|
||||
"bgt ppcLoadFloatRegUpd\n" // if we're beyond 13 registers, just fall to inserting into the stack
|
||||
"mtctr %r0\n" // jump into the float jump table
|
||||
"bctr\n"
|
||||
"nop\n"
|
||||
// jump table for float registers, for the first 13 float arguments
|
||||
"ppcLoadFloatReg:\n"
|
||||
"fmr 1,0\n" // arg0 (f1)
|
||||
"b ppcLoadFloatRegUpd\n"
|
||||
"fmr 2,0\n" // arg1 (f2)
|
||||
"b ppcLoadFloatRegUpd\n"
|
||||
"fmr 3,0\n" // arg2 (f3)
|
||||
"b ppcLoadFloatRegUpd\n"
|
||||
"fmr 4,0\n" // arg3 (f4)
|
||||
"b ppcLoadFloatRegUpd\n"
|
||||
"fmr 5,0\n" // arg4 (f5)
|
||||
"b ppcLoadFloatRegUpd\n"
|
||||
"fmr 6,0\n" // arg5 (f6)
|
||||
"b ppcLoadFloatRegUpd\n"
|
||||
"fmr 7,0\n" // arg6 (f7)
|
||||
"b ppcLoadFloatRegUpd\n"
|
||||
"fmr 8,0\n" // arg7 (f8)
|
||||
"b ppcLoadFloatRegUpd\n"
|
||||
"fmr 9,0\n" // arg8 (f9)
|
||||
"b ppcLoadFloatRegUpd\n"
|
||||
"fmr 10,0\n" // arg9 (f10)
|
||||
"b ppcLoadFloatRegUpd\n"
|
||||
"fmr 11,0\n" // arg10 (f11)
|
||||
"b ppcLoadFloatRegUpd\n"
|
||||
"fmr 12,0\n" // arg11 (f12)
|
||||
"b ppcLoadFloatRegUpd\n"
|
||||
"fmr 13,0\n" // arg12 (f13)
|
||||
"b ppcLoadFloatRegUpd\n"
|
||||
"nop\n"
|
||||
// all float arguments still go on the stack
|
||||
"ppcLoadFloatRegUpd:\n"
|
||||
"stfs 0, 0x04(%r26)\n" // store, as a single float, f0 (current argument) on to the stack argument list
|
||||
"addi %r23, %r23, 1\n" // a float register eats up a GPR register
|
||||
"addi %r22, %r22, 1\n" // ...and, of course, a float register
|
||||
"addi %r29, %r29, 4\n" // move to the next argument in the list
|
||||
"addi %r26, %r26, 8\n" // move to the next stack slot
|
||||
"b ppcNextArg\n" // on to the next argument
|
||||
"nop\n"
|
||||
// double Float argument
|
||||
"ppcArgIsDouble:\n"
|
||||
"lis %r30, ppcLoadDoubleReg@ha\n" // load the base address of the jump table for double registers
|
||||
"addi %r30, %r30, ppcLoadDoubleReg@l\n"
|
||||
"mulli %r0, %r22, 8\n" // each slot of the jump table is 8 bytes
|
||||
"add %r0, %r0, %r30\n" // calculate ppcLoadDoubleReg[numUsedFloatReg]
|
||||
"lfd 0, 0(%r29)\n" // load the next argument, as a double float, into f0
|
||||
"cmpwi %r22,13\n" // the first 13 floats must go into float registers also
|
||||
"bgt ppcLoadDoubleRegUpd\n" // if we're beyond 13, then just put on to the stack
|
||||
"mtctr %r0\n" // we're under 13, first load our register
|
||||
"bctr\n" // jump into the jump table
|
||||
"nop\n"
|
||||
// jump table for float registers, for the first 13 float arguments
|
||||
"ppcLoadDoubleReg:\n"
|
||||
"fmr 1,0\n" // arg0 (f1)
|
||||
"b ppcLoadDoubleRegUpd\n"
|
||||
"fmr 2,0\n" // arg1 (f2)
|
||||
"b ppcLoadDoubleRegUpd\n"
|
||||
"fmr 3,0\n" // arg2 (f3)
|
||||
"b ppcLoadDoubleRegUpd\n"
|
||||
"fmr 4,0\n" // arg3 (f4)
|
||||
"b ppcLoadDoubleRegUpd\n"
|
||||
"fmr 5,0\n" // arg4 (f5)
|
||||
"b ppcLoadDoubleRegUpd\n"
|
||||
"fmr 6,0\n" // arg5 (f6)
|
||||
"b ppcLoadDoubleRegUpd\n"
|
||||
"fmr 7,0\n" // arg6 (f7)
|
||||
"b ppcLoadDoubleRegUpd\n"
|
||||
"fmr 8,0\n" // arg7 (f8)
|
||||
"b ppcLoadDoubleRegUpd\n"
|
||||
"fmr 9,0\n" // arg8 (f9)
|
||||
"b ppcLoadDoubleRegUpd\n"
|
||||
"fmr 10,0\n" // arg9 (f10)
|
||||
"b ppcLoadDoubleRegUpd\n"
|
||||
"fmr 11,0\n" // arg10 (f11)
|
||||
"b ppcLoadDoubleRegUpd\n"
|
||||
"fmr 12,0\n" // arg11 (f12)
|
||||
"b ppcLoadDoubleRegUpd\n"
|
||||
"fmr 13,0\n" // arg12 (f13)
|
||||
"b ppcLoadDoubleRegUpd\n"
|
||||
"nop\n"
|
||||
// all float arguments still go on the stack
|
||||
"ppcLoadDoubleRegUpd:\n"
|
||||
"stfd 0,0(%r26)\n" // store f0, as a double, into the argument list on the stack
|
||||
"addi %r23, %r23, 1\n" // a double float eats up one GPR
|
||||
"addi %r22, %r22, 1\n" // ...and, of course, a float
|
||||
"addi %r29, %r29, 8\n" // increment to our next argument we need to process (8 bytes for the 64bit float)
|
||||
"addi %r26, %r26, 8\n" // increment to the next slot on the argument list on the stack (8 bytes)
|
||||
"b ppcNextArg\n" // on to the next argument
|
||||
"nop\n"
|
||||
|
||||
// Long (64 bit int) argument
|
||||
"ppcArgIsLong:\n"
|
||||
"lis %r30,ppcLoadLongReg@ha\n" // load the address to the jump table for integer64
|
||||
"addi %r30, %r30, ppcLoadLongReg@l\n"
|
||||
"mulli %r0, %r23, 8\n" // each item in the jump table is 2 instructions (8 bytes)
|
||||
"add %r0, %r0, %r30\n" // calculate ppcLoadLongReg[numUsedGPRRegs]
|
||||
"ld %r30,0(%r29)\n" // load the next argument from the argument list into r30
|
||||
"cmpwi %r23, 8\n" // we can only load GPR3 through GPR10 (8 registers)
|
||||
"bgt ppcLoadLongRegUpd\n" // if we're beyond 8 GPR registers, we're in the stack, go there
|
||||
"mtctr %r0\n" // load the address of our ppcLoadLongReg jump table (we're below 8 GPR registers)
|
||||
"bctr\n" // load the argument into a GPR register
|
||||
"nop\n"
|
||||
// jump table for GPR registers, for the first 8 GPR arguments
|
||||
"ppcLoadLongReg:\n"
|
||||
"mr %r3,%r30\n" // arg0 (to r3)
|
||||
"b ppcLoadLongRegUpd\n"
|
||||
"mr %r4,%r30\n" // arg1 (to r4)
|
||||
"b ppcLoadLongRegUpd\n"
|
||||
"mr %r5,%r30\n" // arg2 (to r5)
|
||||
"b ppcLoadLongRegUpd\n"
|
||||
"mr %r6,%r30\n" // arg3 (to r6)
|
||||
"b ppcLoadLongRegUpd\n"
|
||||
"mr %r7,%r30\n" // arg4 (to r7)
|
||||
"b ppcLoadLongRegUpd\n"
|
||||
"mr %r8,%r30\n" // arg5 (to r8)
|
||||
"b ppcLoadLongRegUpd\n"
|
||||
"mr %r9,%r30\n" // arg6 (to r9)
|
||||
"b ppcLoadLongRegUpd\n"
|
||||
"mr %r10,%r30\n" // arg7 (to r10)
|
||||
"b ppcLoadLongRegUpd\n"
|
||||
|
||||
// all GPR arguments still go on the stack
|
||||
"ppcLoadLongRegUpd:\n"
|
||||
"std %r30,0(%r26)\n" // store the argument into the next slot on the stack's argument list
|
||||
"addi %r23, %r23, 1\n" // count a used GPR register
|
||||
"addi %r29, %r29, 8\n" // move to the next argument on the list
|
||||
"addi %r26, %r26, 8\n" // adjust our argument stack pointer for the next
|
||||
"b ppcNextArg\n" // next argument
|
||||
);
|
||||
|
||||
static asDWORD GetReturnedFloat(void)
|
||||
{
|
||||
asDWORD f;
|
||||
#ifdef __SNC__
|
||||
__stfs( __freg(1), 0, (void*)&f);
|
||||
#else
|
||||
asm(" stfs 1, %0\n" : "=m"(f));
|
||||
#endif
|
||||
return f;
|
||||
}
|
||||
|
||||
static asQWORD GetReturnedDouble(void)
|
||||
{
|
||||
asQWORD f;
|
||||
#ifdef __SNC__
|
||||
__stfd( __freg(1), 0, (void*)&f);
|
||||
#else
|
||||
asm(" stfd 1, %0\n" : "=m"(f));
|
||||
#endif
|
||||
return f;
|
||||
}
|
||||
|
||||
// puts the arguments in the correct place in the stack array. See comments above.
|
||||
static void stackArgs( const asDWORD *args, const asBYTE *argsType, int &numIntArgs, int &numFloatArgs, int &numDoubleArgs, int &numLongArgs )
|
||||
{
|
||||
// initialize our offset based on any already placed arguments
|
||||
int i;
|
||||
int argWordPos = numIntArgs + numFloatArgs + (numDoubleArgs*2) + (numLongArgs*2);
|
||||
int typeOffset = numIntArgs + numFloatArgs + numDoubleArgs + numLongArgs;
|
||||
|
||||
int typeIndex;
|
||||
for( i = 0, typeIndex = 0; ; i++, typeIndex++ )
|
||||
{
|
||||
// store the type
|
||||
ppcArgsType[typeOffset++] = argsType[typeIndex];
|
||||
if( argsType[typeIndex] == ppcENDARG )
|
||||
break;
|
||||
|
||||
switch( argsType[typeIndex] )
|
||||
{
|
||||
case ppcFLOATARG:
|
||||
{
|
||||
// stow float
|
||||
ppcArgs[argWordPos] = args[i]; // it's just a bit copy
|
||||
numFloatArgs++;
|
||||
argWordPos++; //add one word
|
||||
}
|
||||
break;
|
||||
|
||||
case ppcDOUBLEARG:
|
||||
{
|
||||
// stow double
|
||||
memcpy( &ppcArgs[argWordPos], &args[i], sizeof(double) ); // we have to do this because of alignment
|
||||
numDoubleArgs++;
|
||||
argWordPos+=2; //add two words
|
||||
i++;//doubles take up 2 argument slots
|
||||
}
|
||||
break;
|
||||
|
||||
case ppcINTARG:
|
||||
{
|
||||
// stow register
|
||||
ppcArgs[argWordPos] = args[i];
|
||||
numIntArgs++;
|
||||
argWordPos++;
|
||||
}
|
||||
break;
|
||||
|
||||
case ppcLONGARG:
|
||||
{
|
||||
// stow long
|
||||
memcpy( &ppcArgs[argWordPos], &args[i], 8 ); // for alignment purposes, we use memcpy
|
||||
numLongArgs++;
|
||||
argWordPos += 2; // add two words
|
||||
i++; // longs take up 2 argument slots
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// close off the argument list (if we have max args we won't close it off until here)
|
||||
ppcArgsType[typeOffset] = ppcENDARG;
|
||||
}
|
||||
|
||||
static asQWORD CallCDeclFunction(const asDWORD* pArgs, const asBYTE *pArgsType, int argSize, asDWORD func, void *retInMemory)
|
||||
{
|
||||
int baseArgCount = 0;
|
||||
if( retInMemory )
|
||||
{
|
||||
// the first argument is the 'return in memory' pointer
|
||||
ppcArgs[0] = (asDWORD)retInMemory;
|
||||
ppcArgsType[0] = ppcINTARG;
|
||||
ppcArgsType[1] = ppcENDARG;
|
||||
baseArgCount = 1;
|
||||
}
|
||||
|
||||
// put the arguments in the correct places in the ppcArgs array
|
||||
int numTotalArgs = baseArgCount;
|
||||
if( argSize > 0 )
|
||||
{
|
||||
int intArgs = baseArgCount, floatArgs = 0, doubleArgs = 0, longArgs = 0;
|
||||
stackArgs( pArgs, pArgsType, intArgs, floatArgs, doubleArgs, longArgs );
|
||||
numTotalArgs = intArgs + floatArgs + doubleArgs + longArgs;
|
||||
}
|
||||
else
|
||||
{
|
||||
// no arguments, cap the type list
|
||||
ppcArgsType[baseArgCount] = ppcENDARG;
|
||||
}
|
||||
|
||||
// call the function with the arguments
|
||||
return ppcFunc64( ppcArgs, PPC_STACK_SIZE(numTotalArgs), func );
|
||||
}
|
||||
|
||||
// This function is identical to CallCDeclFunction, with the only difference that
|
||||
// the value in the first parameter is the object (unless we are returning in memory)
|
||||
static asQWORD CallThisCallFunction(const void *obj, const asDWORD* pArgs, const asBYTE *pArgsType, int argSize, asDWORD func, void *retInMemory )
|
||||
{
|
||||
int baseArgCount = 0;
|
||||
if( retInMemory )
|
||||
{
|
||||
// the first argument is the 'return in memory' pointer
|
||||
ppcArgs[0] = (asDWORD)retInMemory;
|
||||
ppcArgsType[0] = ppcINTARG;
|
||||
ppcArgsType[1] = ppcENDARG;
|
||||
baseArgCount = 1;
|
||||
}
|
||||
|
||||
// the first argument is the 'this' of the object
|
||||
ppcArgs[baseArgCount] = (asDWORD)obj;
|
||||
ppcArgsType[baseArgCount++] = ppcINTARG;
|
||||
ppcArgsType[baseArgCount] = ppcENDARG;
|
||||
|
||||
// put the arguments in the correct places in the ppcArgs array
|
||||
int numTotalArgs = baseArgCount;
|
||||
if( argSize > 0 )
|
||||
{
|
||||
int intArgs = baseArgCount, floatArgs = 0, doubleArgs = 0, longArgs = 0;
|
||||
stackArgs( pArgs, pArgsType, intArgs, floatArgs, doubleArgs, longArgs );
|
||||
numTotalArgs = intArgs + floatArgs + doubleArgs + longArgs;
|
||||
}
|
||||
|
||||
// call the function with the arguments
|
||||
return ppcFunc64( ppcArgs, PPC_STACK_SIZE(numTotalArgs), func);
|
||||
}
|
||||
|
||||
// This function is identical to CallCDeclFunction, with the only difference that
|
||||
// the value in the last parameter is the object
|
||||
// NOTE: on PPC the order for the args is reversed
|
||||
static asQWORD CallThisCallFunction_objLast(const void *obj, const asDWORD* pArgs, const asBYTE *pArgsType, int argSize, asDWORD func, void *retInMemory)
|
||||
{
|
||||
UNUSED_VAR(argSize);
|
||||
int baseArgCount = 0;
|
||||
if( retInMemory )
|
||||
{
|
||||
// the first argument is the 'return in memory' pointer
|
||||
ppcArgs[0] = (asDWORD)retInMemory;
|
||||
ppcArgsType[0] = ppcINTARG;
|
||||
ppcArgsType[1] = ppcENDARG;
|
||||
baseArgCount = 1;
|
||||
}
|
||||
|
||||
// stack any of the arguments
|
||||
int intArgs = baseArgCount, floatArgs = 0, doubleArgs = 0, longArgs = 0;
|
||||
stackArgs( pArgs, pArgsType, intArgs, floatArgs, doubleArgs, longArgs );
|
||||
int numTotalArgs = intArgs + floatArgs + doubleArgs;
|
||||
|
||||
// can we fit the object in at the end?
|
||||
if( numTotalArgs < AS_PPC_MAX_ARGS )
|
||||
{
|
||||
// put the object pointer at the end
|
||||
int argPos = intArgs + floatArgs + (doubleArgs * 2) + (longArgs *2);
|
||||
ppcArgs[argPos] = (asDWORD)obj;
|
||||
ppcArgsType[numTotalArgs++] = ppcINTARG;
|
||||
ppcArgsType[numTotalArgs] = ppcENDARG;
|
||||
}
|
||||
|
||||
// call the function with the arguments
|
||||
return ppcFunc64( ppcArgs, PPC_STACK_SIZE(numTotalArgs), func );
|
||||
}
|
||||
|
||||
// returns true if the given parameter is a 'variable argument'
|
||||
inline bool IsVariableArgument( asCDataType type )
|
||||
{
|
||||
return (type.GetTokenType() == ttQuestion) ? true : false;
|
||||
}
|
||||
|
||||
asQWORD CallSystemFunctionNative(asCContext *context, asCScriptFunction *descr, void *obj, asDWORD *args, void *retPointer, asQWORD &/*retQW2*/)
|
||||
{
|
||||
// use a working array of types, we'll configure the final one in stackArgs
|
||||
asBYTE argsType[AS_PPC_MAX_ARGS + 1 + 1 + 1];
|
||||
memset( argsType, 0, sizeof(argsType));
|
||||
|
||||
asCScriptEngine *engine = context->m_engine;
|
||||
asSSystemFunctionInterface *sysFunc = descr->sysFuncIntf;
|
||||
|
||||
int callConv = sysFunc->callConv;
|
||||
|
||||
asQWORD retQW = 0;
|
||||
void *func = (void*)sysFunc->func;
|
||||
int paramSize = sysFunc->paramSize;
|
||||
asDWORD *vftable = NULL;
|
||||
int a;
|
||||
|
||||
// convert the parameters that are < 4 bytes from little endian to big endian
|
||||
int argDwordOffset = 0;
|
||||
int totalArgumentCount = 0;
|
||||
|
||||
for( a = 0; a < (int)descr->parameterTypes.GetLength(); ++a )
|
||||
{
|
||||
// get the size for the parameter
|
||||
int numBytes = descr->parameterTypes[a].GetSizeInMemoryBytes();
|
||||
++totalArgumentCount;
|
||||
|
||||
// is this a variable argument?
|
||||
// for variable arguments, the typeID will always follow...but we know it is 4 bytes
|
||||
// so we can skip that parameter automatically.
|
||||
bool isVarArg = IsVariableArgument( descr->parameterTypes[a] );
|
||||
if( isVarArg )
|
||||
{
|
||||
++totalArgumentCount;
|
||||
}
|
||||
|
||||
if( numBytes >= 4 || descr->parameterTypes[a].IsReference() || descr->parameterTypes[a].IsObjectHandle() )
|
||||
{
|
||||
// DWORD or larger parameter --- no flipping needed
|
||||
argDwordOffset += descr->parameterTypes[a].GetSizeOnStackDWords();
|
||||
}
|
||||
else
|
||||
{
|
||||
// flip
|
||||
asASSERT( numBytes == 1 || numBytes == 2 );
|
||||
switch( numBytes )
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
volatile asBYTE *bPtr = (asBYTE*)ARG_DW(args[argDwordOffset]);
|
||||
asBYTE t = bPtr[0];
|
||||
bPtr[0] = bPtr[3];
|
||||
bPtr[3] = t;
|
||||
t = bPtr[1];
|
||||
bPtr[1] = bPtr[2];
|
||||
bPtr[2] = t;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
{
|
||||
volatile asWORD *wPtr = (asWORD*)ARG_DW(args[argDwordOffset]);
|
||||
asWORD t = wPtr[0];
|
||||
wPtr[0] = wPtr[1];
|
||||
wPtr[1] = t;
|
||||
}
|
||||
break;
|
||||
}
|
||||
++argDwordOffset;
|
||||
}
|
||||
|
||||
if( isVarArg )
|
||||
{
|
||||
// skip the implicit typeID
|
||||
++argDwordOffset;
|
||||
}
|
||||
}
|
||||
|
||||
asASSERT( totalArgumentCount <= AS_PPC_MAX_ARGS );
|
||||
|
||||
// mark all float/double/int arguments
|
||||
int argIndex = 0;
|
||||
for( a = 0; a < (int)descr->parameterTypes.GetLength(); ++a, ++argIndex )
|
||||
{
|
||||
// get the base type
|
||||
argsType[argIndex] = ppcINTARG;
|
||||
if( descr->parameterTypes[a].IsFloatType() && !descr->parameterTypes[a].IsReference() )
|
||||
{
|
||||
argsType[argIndex] = ppcFLOATARG;
|
||||
}
|
||||
if( descr->parameterTypes[a].IsDoubleType() && !descr->parameterTypes[a].IsReference() )
|
||||
{
|
||||
argsType[argIndex] = ppcDOUBLEARG;
|
||||
}
|
||||
if( descr->parameterTypes[a].GetSizeOnStackDWords() == 2 && !descr->parameterTypes[a].IsDoubleType() && !descr->parameterTypes[a].IsReference() )
|
||||
{
|
||||
argsType[argIndex] = ppcLONGARG;
|
||||
}
|
||||
|
||||
// if it is a variable argument, account for the typeID
|
||||
if( IsVariableArgument(descr->parameterTypes[a]) )
|
||||
{
|
||||
// implicitly add another parameter (AFTER the parameter above), for the TypeID
|
||||
argsType[++argIndex] = ppcINTARG;
|
||||
}
|
||||
}
|
||||
asASSERT( argIndex == totalArgumentCount );
|
||||
|
||||
asDWORD paramBuffer[64];
|
||||
if( sysFunc->takesObjByVal )
|
||||
{
|
||||
paramSize = 0;
|
||||
int spos = 0;
|
||||
int dpos = 1;
|
||||
|
||||
for( asUINT n = 0; n < descr->parameterTypes.GetLength(); n++ )
|
||||
{
|
||||
if( descr->parameterTypes[n].IsObject() && !descr->parameterTypes[n].IsObjectHandle() && !descr->parameterTypes[n].IsReference() )
|
||||
{
|
||||
#ifdef COMPLEX_OBJS_PASSED_BY_REF
|
||||
if( descr->parameterTypes[n].GetObjectType()->flags & COMPLEX_MASK )
|
||||
{
|
||||
paramBuffer[dpos++] = args[spos++];
|
||||
++paramSize;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
// NOTE: we may have to do endian flipping here
|
||||
|
||||
// Copy the object's memory to the buffer
|
||||
memcpy( ¶mBuffer[dpos], *(void**)(args+spos), descr->parameterTypes[n].GetSizeInMemoryBytes() );
|
||||
|
||||
// Delete the original memory
|
||||
engine->CallFree( *(char**)(args+spos) );
|
||||
spos++;
|
||||
dpos += descr->parameterTypes[n].GetSizeInMemoryDWords();
|
||||
paramSize += descr->parameterTypes[n].GetSizeInMemoryDWords();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Copy the value directly
|
||||
paramBuffer[dpos++] = args[spos++];
|
||||
if( descr->parameterTypes[n].GetSizeOnStackDWords() > 1 )
|
||||
{
|
||||
paramBuffer[dpos++] = args[spos++];
|
||||
}
|
||||
paramSize += descr->parameterTypes[n].GetSizeOnStackDWords();
|
||||
}
|
||||
|
||||
// if this was a variable argument parameter, then account for the implicit typeID
|
||||
if( IsVariableArgument( descr->parameterTypes[n] ) )
|
||||
{
|
||||
// the TypeID is just a DWORD
|
||||
paramBuffer[dpos++] = args[spos++];
|
||||
++paramSize;
|
||||
}
|
||||
}
|
||||
|
||||
// Keep a free location at the beginning
|
||||
args = ¶mBuffer[1];
|
||||
}
|
||||
|
||||
// one last verification to make sure things are how we expect
|
||||
switch( callConv )
|
||||
{
|
||||
case ICC_CDECL:
|
||||
case ICC_CDECL_RETURNINMEM:
|
||||
case ICC_STDCALL:
|
||||
case ICC_STDCALL_RETURNINMEM:
|
||||
retQW = CallCDeclFunction( args, argsType, paramSize, (asDWORD)func, retPointer );
|
||||
break;
|
||||
case ICC_THISCALL:
|
||||
case ICC_THISCALL_RETURNINMEM:
|
||||
retQW = CallThisCallFunction(obj, args, argsType, paramSize, (asDWORD)func, retPointer );
|
||||
break;
|
||||
case ICC_VIRTUAL_THISCALL:
|
||||
case ICC_VIRTUAL_THISCALL_RETURNINMEM:
|
||||
// Get virtual function table from the object pointer
|
||||
vftable = *(asDWORD**)obj;
|
||||
retQW = CallThisCallFunction( obj, args, argsType, paramSize, vftable[asDWORD(func)>>2], retPointer );
|
||||
break;
|
||||
case ICC_CDECL_OBJLAST:
|
||||
case ICC_CDECL_OBJLAST_RETURNINMEM:
|
||||
retQW = CallThisCallFunction_objLast( obj, args, argsType, paramSize, (asDWORD)func, retPointer );
|
||||
break;
|
||||
case ICC_CDECL_OBJFIRST:
|
||||
case ICC_CDECL_OBJFIRST_RETURNINMEM:
|
||||
retQW = CallThisCallFunction( obj, args, argsType, paramSize, (asDWORD)func, retPointer );
|
||||
break;
|
||||
default:
|
||||
context->SetInternalException(TXT_INVALID_CALLING_CONVENTION);
|
||||
}
|
||||
|
||||
if( sysFunc->hostReturnFloat )
|
||||
{
|
||||
// If the return is a float value we need to get the value from the FP register
|
||||
if( sysFunc->hostReturnSize == 1 )
|
||||
*(asDWORD*)&retQW = GetReturnedFloat();
|
||||
else
|
||||
retQW = GetReturnedDouble();
|
||||
}
|
||||
else if( sysFunc->hostReturnSize == 1 )
|
||||
{
|
||||
// Move the bits to the higher value to compensate for the adjustment that the caller does
|
||||
retQW <<= 32;
|
||||
}
|
||||
|
||||
return retQW;
|
||||
}
|
||||
|
||||
END_AS_NAMESPACE
|
||||
|
||||
#endif // AS_PPC_64
|
||||
#endif // AS_MAX_PORTABILITY
|
||||
|
391
lib/angelscript/source/as_callfunc_sh4.cpp
Normal file
391
lib/angelscript/source/as_callfunc_sh4.cpp
Normal file
@ -0,0 +1,391 @@
|
||||
/*
|
||||
AngelCode Scripting Library
|
||||
Copyright (c) 2003-2013 Andreas Jonsson
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any
|
||||
damages arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any
|
||||
purpose, including commercial applications, and to alter it and
|
||||
redistribute it freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you
|
||||
must not claim that you wrote the original software. If you use
|
||||
this software in a product, an acknowledgment in the product
|
||||
documentation would be appreciated but is not required.
|
||||
|
||||
2. Altered source versions must be plainly marked as such, and
|
||||
must not be misrepresented as being the original software.
|
||||
|
||||
3. This notice may not be removed or altered from any source
|
||||
distribution.
|
||||
|
||||
The original version of this library can be located at:
|
||||
http://www.angelcode.com/angelscript/
|
||||
|
||||
Andreas Jonsson
|
||||
andreas@angelcode.com
|
||||
*/
|
||||
|
||||
|
||||
//
|
||||
// as_callfunc_sh4.cpp
|
||||
//
|
||||
// These functions handle the actual calling of system functions
|
||||
//
|
||||
// This version is SH4 specific and was originally written
|
||||
// by Fredrik Ehnbom in May, 2004
|
||||
// Later updated for angelscript 2.0.0 by Fredrik Ehnbom in Jan, 2005
|
||||
|
||||
// References:
|
||||
// * http://www.renesas.com/avs/resource/japan/eng/pdf/mpumcu/e602156_sh4.pdf
|
||||
// * http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wcechp40/html/_callsh4_SH_4_Calling_Standard.asp
|
||||
|
||||
|
||||
#include "as_config.h"
|
||||
|
||||
#ifndef AS_MAX_PORTABILITY
|
||||
#ifdef AS_SH4
|
||||
|
||||
#include "as_callfunc.h"
|
||||
#include "as_scriptengine.h"
|
||||
#include "as_texts.h"
|
||||
#include "as_tokendef.h"
|
||||
#include "as_context.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
BEGIN_AS_NAMESPACE
|
||||
|
||||
#define AS_SH4_MAX_ARGS 32
|
||||
// The array used to send values to the correct places.
|
||||
// first 0-4 regular values to load into the r4-r7 registers
|
||||
// then 0-8 float values to load into the fr4-fr11 registers
|
||||
// then (AS_SH4_MAX_ARGS - 12) values to load onto the stack
|
||||
// the +1 is for when CallThis (object methods) is used
|
||||
// extra +1 when returning in memory
|
||||
extern "C" {
|
||||
static asDWORD sh4Args[AS_SH4_MAX_ARGS + 1 + 1];
|
||||
}
|
||||
|
||||
// Loads all data into the correct places and calls the function.
|
||||
// intArgSize is the size in bytes for how much data to put in int registers
|
||||
// floatArgSize is the size in bytes for how much data to put in float registers
|
||||
// stackArgSize is the size in bytes for how much data to put on the callstack
|
||||
extern "C" asQWORD sh4Func(int intArgSize, int floatArgSize, int stackArgSize, asDWORD func);
|
||||
|
||||
asm(""
|
||||
" .align 4\n"
|
||||
" .global _sh4Func\n"
|
||||
"_sh4Func:\n"
|
||||
" mov.l r14,@-r15\n"
|
||||
" mov.l r13,@-r15\n"
|
||||
" mov.l r12,@-r15\n"
|
||||
" sts.l pr,@-r15\n" // must be saved since we call a subroutine
|
||||
" mov r7, r14\n" // func
|
||||
" mov r6, r13\n" // stackArgSize
|
||||
" mov.l r5,@-r15\n" // floatArgSize
|
||||
" mov.l sh4Args,r0\n"
|
||||
" pref @r0\n"
|
||||
" mov r4, r1\n" // intArgsize
|
||||
" mov #33*4,r2\n"
|
||||
" extu.b r2,r2\n" // make unsigned (33*4 = 132 => 128)
|
||||
" mov.l @(r0,r2), r2\n" // r2 has adress for when returning in memory
|
||||
"_sh4f_intarguments:\n" // copy all the int arguments to the respective registers
|
||||
" mov #4*2*2,r3\n" // calculate how many bytes to skip
|
||||
" sub r1,r3\n"
|
||||
" braf r3\n"
|
||||
" add #-4,r1\n" // we are indexing the array backwards, so subtract one (delayed slot)
|
||||
" mov.l @(r0,r1),r7\n" // 4 arguments
|
||||
" add #-4,r1\n"
|
||||
" mov.l @(r0,r1),r6\n" // 3 arguments
|
||||
" add #-4,r1\n"
|
||||
" mov.l @(r0,r1),r5\n" // 2 arguments
|
||||
" add #-4,r1\n"
|
||||
" mov.l @(r0,r1),r4\n" // 1 argument
|
||||
" nop\n"
|
||||
"_sh4f_floatarguments:\n" // copy all the float arguments to the respective registers
|
||||
" add #4*4, r0\n"
|
||||
" mov.l @r15+,r1\n" // floatArgSize
|
||||
" mov #8*2*2,r3\n" // calculate how many bytes to skip
|
||||
" sub r1,r3\n"
|
||||
" braf r3\n"
|
||||
" add #-4,r1\n" // we are indexing the array backwards, so subtract one (delayed slot)
|
||||
" fmov.s @(r0,r1),fr11\n" // 8 arguments
|
||||
" add #-4,r1\n"
|
||||
" fmov.s @(r0,r1),fr10\n" // 7 arguments
|
||||
" add #-4,r1\n"
|
||||
" fmov.s @(r0,r1),fr9\n" // 6 arguments
|
||||
" add #-4,r1\n"
|
||||
" fmov.s @(r0,r1),fr8\n" // 5 arguments
|
||||
" add #-4,r1\n"
|
||||
" fmov.s @(r0,r1),fr7\n" // 4 arguments
|
||||
" add #-4,r1\n"
|
||||
" fmov.s @(r0,r1),fr6\n" // 3 arguments
|
||||
" add #-4,r1\n"
|
||||
" fmov.s @(r0,r1),fr5\n" // 2 arguments
|
||||
" add #-4,r1\n"
|
||||
" fmov.s @(r0,r1),fr4\n" // 1 argument
|
||||
" nop\n"
|
||||
"_sh4f_stackarguments:\n" // copy all the stack argument onto the stack
|
||||
" add #8*4, r0\n"
|
||||
" mov r0, r1\n"
|
||||
" mov #0, r0\n" // init position counter (also used as a 0-check on the line after)
|
||||
" cmp/eq r0, r13\n"
|
||||
" bt _sh4f_functioncall\n" // no arguments to push onto the stack
|
||||
" mov r13, r3\n" // stackArgSize
|
||||
" sub r3,r15\n" // "allocate" space on the stack
|
||||
" shlr2 r3\n" // make into a counter
|
||||
"_sh4f_stackloop:\n"
|
||||
" mov.l @r1+, r12\n"
|
||||
" mov.l r12, @(r0, r15)\n"
|
||||
" add #4, r0\n"
|
||||
" dt r3\n"
|
||||
" bf _sh4f_stackloop\n"
|
||||
"_sh4f_functioncall:\n"
|
||||
" jsr @r14\n" // no arguments
|
||||
" nop\n"
|
||||
" add r13, r15\n" // restore stack position
|
||||
" lds.l @r15+,pr\n"
|
||||
" mov.l @r15+, r12\n"
|
||||
" mov.l @r15+, r13\n"
|
||||
" rts\n"
|
||||
" mov.l @r15+, r14\n" // delayed slot
|
||||
"\n"
|
||||
" .align 4\n"
|
||||
"sh4Args:\n"
|
||||
" .long _sh4Args\n"
|
||||
);
|
||||
|
||||
// puts the arguments in the correct place in the sh4Args-array. See comments above.
|
||||
// This could be done better.
|
||||
inline void splitArgs(const asDWORD *args, int argNum, int &numRegIntArgs, int &numRegFloatArgs, int &numRestArgs, int hostFlags) {
|
||||
int i;
|
||||
|
||||
int argBit = 1;
|
||||
for (i = 0; i < argNum; i++) {
|
||||
if (hostFlags & argBit) {
|
||||
if (numRegFloatArgs < 12 - 4) {
|
||||
// put in float register
|
||||
sh4Args[4 + numRegFloatArgs] = args[i];
|
||||
numRegFloatArgs++;
|
||||
} else {
|
||||
// put in stack
|
||||
sh4Args[4 + 8 + numRestArgs] = args[i];
|
||||
numRestArgs++;
|
||||
}
|
||||
} else {
|
||||
if (numRegIntArgs < 8 - 4) {
|
||||
// put in int register
|
||||
sh4Args[numRegIntArgs] = args[i];
|
||||
numRegIntArgs++;
|
||||
} else {
|
||||
// put in stack
|
||||
sh4Args[4 + 8 + numRestArgs] = args[i];
|
||||
numRestArgs++;
|
||||
}
|
||||
}
|
||||
argBit <<= 1;
|
||||
}
|
||||
}
|
||||
asQWORD CallCDeclFunction(const asDWORD *args, int argSize, asDWORD func, int flags)
|
||||
{
|
||||
int argNum = argSize >> 2;
|
||||
|
||||
int intArgs = 0;
|
||||
int floatArgs = 0;
|
||||
int restArgs = 0;
|
||||
|
||||
// put the arguments in the correct places in the sh4Args array
|
||||
if (argNum > 0)
|
||||
splitArgs(args, argNum, intArgs, floatArgs, restArgs, flags);
|
||||
|
||||
return sh4Func(intArgs << 2, floatArgs << 2, restArgs << 2, func);
|
||||
}
|
||||
|
||||
// This function is identical to CallCDeclFunction, with the only difference that
|
||||
// the value in the first parameter is the object
|
||||
asQWORD CallThisCallFunction(const void *obj, const asDWORD *args, int argSize, asDWORD func, int flags)
|
||||
{
|
||||
int argNum = argSize >> 2;
|
||||
|
||||
int intArgs = 1;
|
||||
int floatArgs = 0;
|
||||
int restArgs = 0;
|
||||
|
||||
sh4Args[0] = (asDWORD) obj;
|
||||
|
||||
// put the arguments in the correct places in the sh4Args array
|
||||
if (argNum >= 1)
|
||||
splitArgs(args, argNum, intArgs, floatArgs, restArgs, flags);
|
||||
|
||||
return sh4Func(intArgs << 2, floatArgs << 2, restArgs << 2, func);
|
||||
}
|
||||
// This function is identical to CallCDeclFunction, with the only difference that
|
||||
// the value in the last parameter is the object
|
||||
asQWORD CallThisCallFunction_objLast(const void *obj, const asDWORD *args, int argSize, asDWORD func, int flags)
|
||||
{
|
||||
int argNum = argSize >> 2;
|
||||
|
||||
int intArgs = 0;
|
||||
int floatArgs = 0;
|
||||
int restArgs = 0;
|
||||
|
||||
|
||||
// put the arguments in the correct places in the sh4Args array
|
||||
if (argNum >= 1)
|
||||
splitArgs(args, argNum, intArgs, floatArgs, restArgs, flags);
|
||||
|
||||
if (intArgs < 4) {
|
||||
sh4Args[intArgs] = (asDWORD) obj;
|
||||
intArgs++;
|
||||
} else {
|
||||
sh4Args[4 + 8 + restArgs] = (asDWORD) obj;
|
||||
restArgs++;
|
||||
}
|
||||
|
||||
|
||||
return sh4Func(intArgs << 2, floatArgs << 2, restArgs << 2, func);
|
||||
}
|
||||
|
||||
asDWORD GetReturnedFloat()
|
||||
{
|
||||
asDWORD f;
|
||||
|
||||
asm("fmov.s fr0, %0\n" : "=m"(f));
|
||||
|
||||
return f;
|
||||
}
|
||||
|
||||
// sizeof(double) == 4 with sh-elf-gcc (3.4.0) -m4
|
||||
// so this isn't really used...
|
||||
asQWORD GetReturnedDouble()
|
||||
{
|
||||
asQWORD d;
|
||||
|
||||
asm("fmov dr0, %0\n" : "=m"(d));
|
||||
|
||||
return d;
|
||||
}
|
||||
|
||||
asQWORD CallSystemFunctionNative(asCContext *context, asCScriptFunction *descr, void *obj, asDWORD *args, void *retPointer, asQWORD &/*retQW2*/)
|
||||
{
|
||||
asCScriptEngine *engine = context->m_engine;
|
||||
asSSystemFunctionInterface *sysFunc = descr->sysFuncIntf;
|
||||
int callConv = sysFunc->callConv;
|
||||
|
||||
asQWORD retQW = 0;
|
||||
|
||||
void *func = (void*)sysFunc->func;
|
||||
int paramSize = sysFunc->paramSize;
|
||||
asDWORD *vftable;
|
||||
|
||||
if( descr->returnType.IsObject() && !descr->returnType.IsReference() && !descr->returnType.IsObjectHandle() )
|
||||
{
|
||||
sh4Args[AS_SH4_MAX_ARGS+1] = (asDWORD) retPointer;
|
||||
}
|
||||
|
||||
asASSERT(descr->parameterTypes.GetLength() <= 32);
|
||||
|
||||
// mark all float arguments
|
||||
int argBit = 1;
|
||||
int hostFlags = 0;
|
||||
int intArgs = 0;
|
||||
for( asUINT a = 0; a < descr->parameterTypes.GetLength(); a++ ) {
|
||||
if (descr->parameterTypes[a].IsFloatType()) {
|
||||
hostFlags |= argBit;
|
||||
} else intArgs++;
|
||||
argBit <<= 1;
|
||||
}
|
||||
|
||||
asDWORD paramBuffer[64];
|
||||
if( sysFunc->takesObjByVal )
|
||||
{
|
||||
paramSize = 0;
|
||||
int spos = 0;
|
||||
int dpos = 1;
|
||||
for( asUINT n = 0; n < descr->parameterTypes.GetLength(); n++ )
|
||||
{
|
||||
if( descr->parameterTypes[n].IsObject() && !descr->parameterTypes[n].IsObjectHandle() && !descr->parameterTypes[n].IsReference() )
|
||||
{
|
||||
#ifdef COMPLEX_OBJS_PASSED_BY_REF
|
||||
if( descr->parameterTypes[n].GetObjectType()->flags & COMPLEX_MASK )
|
||||
{
|
||||
paramBuffer[dpos++] = args[spos++];
|
||||
paramSize++;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
// Copy the object's memory to the buffer
|
||||
memcpy(¶mBuffer[dpos], *(void**)(args+spos), descr->parameterTypes[n].GetSizeInMemoryBytes());
|
||||
// Delete the original memory
|
||||
engine->CallFree(*(char**)(args+spos));
|
||||
spos++;
|
||||
dpos += descr->parameterTypes[n].GetSizeInMemoryDWords();
|
||||
paramSize += descr->parameterTypes[n].GetSizeInMemoryDWords();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Copy the value directly
|
||||
paramBuffer[dpos++] = args[spos++];
|
||||
if( descr->parameterTypes[n].GetSizeOnStackDWords() > 1 )
|
||||
paramBuffer[dpos++] = args[spos++];
|
||||
paramSize += descr->parameterTypes[n].GetSizeOnStackDWords();
|
||||
}
|
||||
}
|
||||
// Keep a free location at the beginning
|
||||
args = ¶mBuffer[1];
|
||||
}
|
||||
|
||||
switch( callConv )
|
||||
{
|
||||
case ICC_CDECL:
|
||||
case ICC_CDECL_RETURNINMEM:
|
||||
case ICC_STDCALL:
|
||||
case ICC_STDCALL_RETURNINMEM:
|
||||
retQW = CallCDeclFunction(args, paramSize<<2, (asDWORD)func, hostFlags);
|
||||
break;
|
||||
case ICC_THISCALL:
|
||||
case ICC_THISCALL_RETURNINMEM:
|
||||
retQW = CallThisCallFunction(obj, args, paramSize<<2, (asDWORD)func, hostFlags);
|
||||
break;
|
||||
case ICC_VIRTUAL_THISCALL:
|
||||
case ICC_VIRTUAL_THISCALL_RETURNINMEM:
|
||||
// Get virtual function table from the object pointer
|
||||
vftable = *(asDWORD**)obj;
|
||||
retQW = CallThisCallFunction(obj, args, paramSize<<2, vftable[asDWORD(func)>>2], hostFlags);
|
||||
break;
|
||||
case ICC_CDECL_OBJLAST:
|
||||
case ICC_CDECL_OBJLAST_RETURNINMEM:
|
||||
retQW = CallThisCallFunction_objLast(obj, args, paramSize<<2, (asDWORD)func, hostFlags);
|
||||
break;
|
||||
case ICC_CDECL_OBJFIRST:
|
||||
case ICC_CDECL_OBJFIRST_RETURNINMEM:
|
||||
retQW = CallThisCallFunction(obj, args, paramSize<<2, (asDWORD)func, hostFlags);
|
||||
break;
|
||||
default:
|
||||
context->SetInternalException(TXT_INVALID_CALLING_CONVENTION);
|
||||
}
|
||||
|
||||
// If the return is a float value we need to get the value from the FP register
|
||||
if( sysFunc->hostReturnFloat )
|
||||
{
|
||||
if( sysFunc->hostReturnSize == 1 )
|
||||
*(asDWORD*)&retQW = GetReturnedFloat();
|
||||
else
|
||||
retQW = GetReturnedDouble();
|
||||
}
|
||||
|
||||
return retQW;
|
||||
}
|
||||
|
||||
END_AS_NAMESPACE
|
||||
|
||||
#endif // AS_SH4
|
||||
#endif // AS_MAX_PORTABILITY
|
||||
|
||||
|
410
lib/angelscript/source/as_callfunc_x64_gcc.cpp
Normal file
410
lib/angelscript/source/as_callfunc_x64_gcc.cpp
Normal file
@ -0,0 +1,410 @@
|
||||
/*
|
||||
AngelCode Scripting Library
|
||||
Copyright (c) 2003-2013 Andreas Jonsson
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any
|
||||
damages arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any
|
||||
purpose, including commercial applications, and to alter it and
|
||||
redistribute it freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you
|
||||
must not claim that you wrote the original software. If you use
|
||||
this software in a product, an acknowledgment in the product
|
||||
documentation would be appreciated but is not required.
|
||||
|
||||
2. Altered source versions must be plainly marked as such, and
|
||||
must not be misrepresented as being the original software.
|
||||
|
||||
3. This notice may not be removed or altered from any source
|
||||
distribution.
|
||||
|
||||
The original version of this library can be located at:
|
||||
http://www.angelcode.com/angelscript/
|
||||
|
||||
Andreas Jonsson
|
||||
andreas@angelcode.com
|
||||
*/
|
||||
|
||||
/*
|
||||
* Implements the AMD64 calling convention for gcc-based 64bit Unices
|
||||
*
|
||||
* Author: Ionut "gargltk" Leonte <ileonte@bitdefender.com>
|
||||
*
|
||||
* Initial author: niteice
|
||||
*/
|
||||
|
||||
#include "as_config.h"
|
||||
|
||||
#ifndef AS_MAX_PORTABILITY
|
||||
#ifdef AS_X64_GCC
|
||||
|
||||
#include "as_scriptengine.h"
|
||||
#include "as_texts.h"
|
||||
#include "as_context.h"
|
||||
|
||||
BEGIN_AS_NAMESPACE
|
||||
|
||||
enum argTypes { x64INTARG = 0, x64FLOATARG = 1 };
|
||||
typedef asQWORD ( *funcptr_t )( void );
|
||||
|
||||
#define X64_MAX_ARGS 32
|
||||
#define MAX_CALL_INT_REGISTERS 6
|
||||
#define MAX_CALL_SSE_REGISTERS 8
|
||||
#define X64_CALLSTACK_SIZE ( X64_MAX_ARGS + MAX_CALL_SSE_REGISTERS + 3 )
|
||||
|
||||
// Note to self: Always remember to inform the used registers on the clobber line,
|
||||
// so that the gcc optimizer doesn't try to use them for other things
|
||||
|
||||
static asQWORD __attribute__((noinline)) X64_CallFunction(const asQWORD *args, int cnt, funcptr_t func, asQWORD &retQW2, bool returnFloat)
|
||||
{
|
||||
// Need to flag the variable as volatile so the compiler doesn't optimize out the variable
|
||||
volatile asQWORD retQW1 = 0;
|
||||
|
||||
// Reference: http://www.x86-64.org/documentation/abi.pdf
|
||||
|
||||
__asm__ __volatile__ (
|
||||
|
||||
" movq %0, %%rcx \n" // rcx = cnt
|
||||
" movq %1, %%r10 \n" // r10 = args
|
||||
" movq %2, %%r11 \n" // r11 = func
|
||||
|
||||
// Backup stack pointer in R15 that is guaranteed to maintain its value over function calls
|
||||
" movq %%rsp, %%r15 \n"
|
||||
|
||||
// Skip the first 128 bytes on the stack frame, called "red zone",
|
||||
// that might be used by the compiler to store temporary values
|
||||
" sub $128, %%rsp \n"
|
||||
|
||||
// Make sure the stack pointer will be aligned to 16 bytes when the function is called
|
||||
" movq %%rcx, %%rdx \n"
|
||||
" salq $3, %%rdx \n"
|
||||
" movq %%rsp, %%rax \n"
|
||||
" sub %%rdx, %%rax \n"
|
||||
" and $15, %%rax \n"
|
||||
" sub %%rax, %%rsp \n"
|
||||
|
||||
// Push the stack parameters, i.e. the arguments that won't be loaded into registers
|
||||
" movq %%rcx, %%rsi \n"
|
||||
" testl %%esi, %%esi \n"
|
||||
" jle endstack \n"
|
||||
" subl $1, %%esi \n"
|
||||
" xorl %%edx, %%edx \n"
|
||||
" leaq 8(, %%rsi, 8), %%rcx \n"
|
||||
"loopstack: \n"
|
||||
" movq 112(%%r10, %%rdx), %%rax \n"
|
||||
" pushq %%rax \n"
|
||||
" addq $8, %%rdx \n"
|
||||
" cmpq %%rcx, %%rdx \n"
|
||||
" jne loopstack \n"
|
||||
"endstack: \n"
|
||||
|
||||
// Populate integer and floating point parameters
|
||||
" movq %%r10, %%rax \n"
|
||||
" mov (%%rax), %%rdi \n"
|
||||
" mov 8(%%rax), %%rsi \n"
|
||||
" mov 16(%%rax), %%rdx \n"
|
||||
" mov 24(%%rax), %%rcx \n"
|
||||
" mov 32(%%rax), %%r8 \n"
|
||||
" mov 40(%%rax), %%r9 \n"
|
||||
" add $48, %%rax \n"
|
||||
" movsd (%%rax), %%xmm0 \n"
|
||||
" movsd 8(%%rax), %%xmm1 \n"
|
||||
" movsd 16(%%rax), %%xmm2 \n"
|
||||
" movsd 24(%%rax), %%xmm3 \n"
|
||||
" movsd 32(%%rax), %%xmm4 \n"
|
||||
" movsd 40(%%rax), %%xmm5 \n"
|
||||
" movsd 48(%%rax), %%xmm6 \n"
|
||||
" movsd 56(%%rax), %%xmm7 \n"
|
||||
|
||||
// Call the function
|
||||
" call *%%r11 \n"
|
||||
|
||||
// Restore stack pointer
|
||||
" mov %%r15, %%rsp \n"
|
||||
|
||||
// Put return value in retQW1 and retQW2, using either RAX:RDX or XMM0:XMM1 depending on type of return value
|
||||
" movl %5, %%ecx \n"
|
||||
" testb %%cl, %%cl \n"
|
||||
" je intret \n"
|
||||
" lea %3, %%rax \n"
|
||||
" movq %%xmm0, (%%rax) \n"
|
||||
" lea %4, %%rdx \n"
|
||||
" movq %%xmm1, (%%rdx) \n"
|
||||
" jmp endcall \n"
|
||||
"intret: \n"
|
||||
" movq %%rax, %3 \n"
|
||||
" movq %%rdx, %4 \n"
|
||||
"endcall: \n"
|
||||
|
||||
: : "r" ((asQWORD)cnt), "r" (args), "r" (func), "m" (retQW1), "m" (retQW2), "m" (returnFloat)
|
||||
: "%xmm0", "%xmm1", "%xmm2", "%xmm3", "%xmm4", "%xmm5", "%xmm6", "%xmm7",
|
||||
"%rdi", "%rsi", "%rax", "%rdx", "%rcx", "%r8", "%r9", "%r10", "%r11", "%r15");
|
||||
|
||||
return retQW1;
|
||||
}
|
||||
|
||||
// returns true if the given parameter is a 'variable argument'
|
||||
static inline bool IsVariableArgument( asCDataType type )
|
||||
{
|
||||
return ( type.GetTokenType() == ttQuestion ) ? true : false;
|
||||
}
|
||||
|
||||
asQWORD CallSystemFunctionNative(asCContext *context, asCScriptFunction *descr, void *obj, asDWORD *args, void *retPointer, asQWORD &retQW2)
|
||||
{
|
||||
asCScriptEngine *engine = context->m_engine;
|
||||
asSSystemFunctionInterface *sysFunc = descr->sysFuncIntf;
|
||||
int callConv = sysFunc->callConv;
|
||||
asQWORD retQW = 0;
|
||||
asDWORD *stack_pointer = args;
|
||||
funcptr_t *vftable = NULL;
|
||||
int totalArgumentCount = 0;
|
||||
int n = 0;
|
||||
int param_post = 0;
|
||||
int argIndex = 0;
|
||||
funcptr_t func = (funcptr_t)sysFunc->func;
|
||||
|
||||
if( sysFunc->hostReturnInMemory )
|
||||
{
|
||||
// The return is made in memory
|
||||
callConv++;
|
||||
}
|
||||
|
||||
// Determine the real function pointer in case of virtual method
|
||||
if ( obj && ( callConv == ICC_VIRTUAL_THISCALL || callConv == ICC_VIRTUAL_THISCALL_RETURNINMEM ) )
|
||||
{
|
||||
vftable = *((funcptr_t**)obj);
|
||||
func = vftable[FuncPtrToUInt(asFUNCTION_t(func)) >> 3];
|
||||
}
|
||||
|
||||
// Determine the type of the arguments, and prepare the input array for the X64_CallFunction
|
||||
asQWORD paramBuffer[X64_CALLSTACK_SIZE] = { 0 };
|
||||
asBYTE argsType[X64_CALLSTACK_SIZE] = { 0 };
|
||||
|
||||
switch ( callConv )
|
||||
{
|
||||
case ICC_CDECL_RETURNINMEM:
|
||||
case ICC_STDCALL_RETURNINMEM:
|
||||
{
|
||||
paramBuffer[0] = (asPWORD)retPointer;
|
||||
argsType[0] = x64INTARG;
|
||||
|
||||
argIndex = 1;
|
||||
|
||||
break;
|
||||
}
|
||||
case ICC_THISCALL:
|
||||
case ICC_VIRTUAL_THISCALL:
|
||||
case ICC_CDECL_OBJFIRST:
|
||||
{
|
||||
paramBuffer[0] = (asPWORD)obj;
|
||||
argsType[0] = x64INTARG;
|
||||
|
||||
argIndex = 1;
|
||||
|
||||
break;
|
||||
}
|
||||
case ICC_THISCALL_RETURNINMEM:
|
||||
case ICC_VIRTUAL_THISCALL_RETURNINMEM:
|
||||
case ICC_CDECL_OBJFIRST_RETURNINMEM:
|
||||
{
|
||||
paramBuffer[0] = (asPWORD)retPointer;
|
||||
paramBuffer[1] = (asPWORD)obj;
|
||||
argsType[0] = x64INTARG;
|
||||
argsType[1] = x64INTARG;
|
||||
|
||||
argIndex = 2;
|
||||
|
||||
break;
|
||||
}
|
||||
case ICC_CDECL_OBJLAST:
|
||||
param_post = 1;
|
||||
break;
|
||||
case ICC_CDECL_OBJLAST_RETURNINMEM:
|
||||
{
|
||||
paramBuffer[0] = (asPWORD)retPointer;
|
||||
argsType[0] = x64INTARG;
|
||||
|
||||
argIndex = 1;
|
||||
param_post = 1;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
int argumentCount = ( int )descr->parameterTypes.GetLength();
|
||||
for( int a = 0; a < argumentCount; ++a )
|
||||
{
|
||||
const asCDataType &parmType = descr->parameterTypes[a];
|
||||
if( parmType.IsFloatType() && !parmType.IsReference() )
|
||||
{
|
||||
argsType[argIndex] = x64FLOATARG;
|
||||
memcpy(paramBuffer + argIndex, stack_pointer, sizeof(float));
|
||||
argIndex++;
|
||||
stack_pointer++;
|
||||
}
|
||||
else if( parmType.IsDoubleType() && !parmType.IsReference() )
|
||||
{
|
||||
argsType[argIndex] = x64FLOATARG;
|
||||
memcpy(paramBuffer + argIndex, stack_pointer, sizeof(double));
|
||||
argIndex++;
|
||||
stack_pointer += 2;
|
||||
}
|
||||
else if( IsVariableArgument( parmType ) )
|
||||
{
|
||||
// The variable args are really two, one pointer and one type id
|
||||
argsType[argIndex] = x64INTARG;
|
||||
argsType[argIndex+1] = x64INTARG;
|
||||
memcpy(paramBuffer + argIndex, stack_pointer, sizeof(void*));
|
||||
memcpy(paramBuffer + argIndex + 1, stack_pointer + 2, sizeof(asDWORD));
|
||||
argIndex += 2;
|
||||
stack_pointer += 3;
|
||||
}
|
||||
else if( parmType.IsPrimitive() ||
|
||||
parmType.IsReference() ||
|
||||
parmType.IsObjectHandle() )
|
||||
{
|
||||
argsType[argIndex] = x64INTARG;
|
||||
if( parmType.GetSizeOnStackDWords() == 1 )
|
||||
{
|
||||
memcpy(paramBuffer + argIndex, stack_pointer, sizeof(asDWORD));
|
||||
stack_pointer++;
|
||||
}
|
||||
else
|
||||
{
|
||||
memcpy(paramBuffer + argIndex, stack_pointer, sizeof(asQWORD));
|
||||
stack_pointer += 2;
|
||||
}
|
||||
argIndex++;
|
||||
}
|
||||
else
|
||||
{
|
||||
// An object is being passed by value
|
||||
if( (parmType.GetObjectType()->flags & COMPLEX_MASK) ||
|
||||
parmType.GetSizeInMemoryDWords() > 4 )
|
||||
{
|
||||
// Copy the address of the object
|
||||
argsType[argIndex] = x64INTARG;
|
||||
memcpy(paramBuffer + argIndex, stack_pointer, sizeof(asQWORD));
|
||||
argIndex++;
|
||||
}
|
||||
else if( (parmType.GetObjectType()->flags & asOBJ_APP_CLASS_ALLINTS) ||
|
||||
(parmType.GetObjectType()->flags & asOBJ_APP_PRIMITIVE) )
|
||||
{
|
||||
// Copy the value of the object
|
||||
if( parmType.GetSizeInMemoryDWords() > 2 )
|
||||
{
|
||||
argsType[argIndex] = x64INTARG;
|
||||
argsType[argIndex+1] = x64INTARG;
|
||||
memcpy(paramBuffer + argIndex, *(asDWORD**)stack_pointer, parmType.GetSizeInMemoryBytes());
|
||||
argIndex += 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
argsType[argIndex] = x64INTARG;
|
||||
memcpy(paramBuffer + argIndex, *(asDWORD**)stack_pointer, parmType.GetSizeInMemoryBytes());
|
||||
argIndex++;
|
||||
}
|
||||
// Delete the original memory
|
||||
engine->CallFree(*(void**)stack_pointer);
|
||||
}
|
||||
else if( (parmType.GetObjectType()->flags & asOBJ_APP_CLASS_ALLFLOATS) ||
|
||||
(parmType.GetObjectType()->flags & asOBJ_APP_FLOAT) )
|
||||
{
|
||||
// Copy the value of the object
|
||||
if( parmType.GetSizeInMemoryDWords() > 2 )
|
||||
{
|
||||
argsType[argIndex] = x64FLOATARG;
|
||||
argsType[argIndex+1] = x64FLOATARG;
|
||||
memcpy(paramBuffer + argIndex, *(asDWORD**)stack_pointer, parmType.GetSizeInMemoryBytes());
|
||||
argIndex += 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
argsType[argIndex] = x64FLOATARG;
|
||||
memcpy(paramBuffer + argIndex, *(asDWORD**)stack_pointer, parmType.GetSizeInMemoryBytes());
|
||||
argIndex++;
|
||||
}
|
||||
// Delete the original memory
|
||||
engine->CallFree(*(void**)stack_pointer);
|
||||
}
|
||||
stack_pointer += 2;
|
||||
}
|
||||
}
|
||||
|
||||
// For the CDECL_OBJ_LAST calling convention we need to add the object pointer as the last argument
|
||||
if( param_post )
|
||||
{
|
||||
paramBuffer[argIndex] = (asPWORD)obj;
|
||||
argsType[argIndex] = x64INTARG;
|
||||
argIndex++;
|
||||
}
|
||||
|
||||
totalArgumentCount = argIndex;
|
||||
|
||||
/*
|
||||
* Q: WTF is going on here !?
|
||||
*
|
||||
* A: The idea is to pre-arange the parameters so that X64_CallFunction() can do
|
||||
* it's little magic which must work regardless of how the compiler decides to
|
||||
* allocate registers. Basically:
|
||||
* - the first MAX_CALL_INT_REGISTERS entries in tempBuff will
|
||||
* contain the values/types of the x64INTARG parameters - that is the ones who
|
||||
* go into the registers. If the function has less then MAX_CALL_INT_REGISTERS
|
||||
* integer parameters then the last entries will be set to 0
|
||||
* - the next MAX_CALL_SSE_REGISTERS entries will contain the float/double arguments
|
||||
* that go into the floating point registers. If the function has less than
|
||||
* MAX_CALL_SSE_REGISTERS floating point parameters then the last entries will
|
||||
* be set to 0
|
||||
* - index MAX_CALL_INT_REGISTERS + MAX_CALL_SSE_REGISTERS marks the start of the
|
||||
* parameters which will get passed on the stack. These are added to the array
|
||||
* in reverse order so that X64_CallFunction() can simply push them to the stack
|
||||
* without the need to perform further tests
|
||||
*/
|
||||
asQWORD tempBuff[X64_CALLSTACK_SIZE] = { 0 };
|
||||
asBYTE argsSet[X64_CALLSTACK_SIZE] = { 0 };
|
||||
int used_int_regs = 0;
|
||||
int used_sse_regs = 0;
|
||||
int used_stack_args = 0;
|
||||
int idx = 0;
|
||||
for ( n = 0; ( n < totalArgumentCount ) && ( used_int_regs < MAX_CALL_INT_REGISTERS ); n++ )
|
||||
{
|
||||
if ( argsType[n] == x64INTARG )
|
||||
{
|
||||
argsSet[n] = 1;
|
||||
tempBuff[idx++] = paramBuffer[n];
|
||||
used_int_regs++;
|
||||
}
|
||||
}
|
||||
idx = MAX_CALL_INT_REGISTERS;
|
||||
for ( n = 0; ( n < totalArgumentCount ) && ( used_sse_regs < MAX_CALL_SSE_REGISTERS ); n++ )
|
||||
{
|
||||
if ( argsType[n] == x64FLOATARG )
|
||||
{
|
||||
argsSet[n] = 1;
|
||||
tempBuff[idx++] = paramBuffer[n];
|
||||
used_sse_regs++;
|
||||
}
|
||||
}
|
||||
idx = MAX_CALL_INT_REGISTERS + MAX_CALL_SSE_REGISTERS;
|
||||
for ( n = totalArgumentCount - 1; n >= 0; n-- )
|
||||
{
|
||||
if ( !argsSet[n] )
|
||||
{
|
||||
tempBuff[idx++] = paramBuffer[n];
|
||||
used_stack_args++;
|
||||
}
|
||||
}
|
||||
|
||||
retQW = X64_CallFunction( tempBuff, used_stack_args, func, retQW2, sysFunc->hostReturnFloat );
|
||||
|
||||
return retQW;
|
||||
}
|
||||
|
||||
END_AS_NAMESPACE
|
||||
|
||||
#endif // AS_X64_GCC
|
||||
#endif // AS_MAX_PORTABILITY
|
||||
|
310
lib/angelscript/source/as_callfunc_x64_mingw.cpp
Normal file
310
lib/angelscript/source/as_callfunc_x64_mingw.cpp
Normal file
@ -0,0 +1,310 @@
|
||||
/*
|
||||
AngelCode Scripting Library
|
||||
Copyright (c) 2003-2013 Andreas Jonsson
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any
|
||||
damages arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any
|
||||
purpose, including commercial applications, and to alter it and
|
||||
redistribute it freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you
|
||||
must not claim that you wrote the original software. If you use
|
||||
this software in a product, an acknowledgment in the product
|
||||
documentation would be appreciated but is not required.
|
||||
|
||||
2. Altered source versions must be plainly marked as such, and
|
||||
must not be misrepresented as being the original software.
|
||||
|
||||
3. This notice may not be removed or altered from any source
|
||||
distribution.
|
||||
|
||||
The original version of this library can be located at:
|
||||
http://www.angelcode.com/angelscript/
|
||||
|
||||
Andreas Jonsson
|
||||
andreas@angelcode.com
|
||||
*/
|
||||
|
||||
//
|
||||
// This code was adapted from as_callfunc_x64_msvc by _Vicious_ on August 20th, 2011.
|
||||
//
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "as_config.h"
|
||||
|
||||
#ifndef AS_MAX_PORTABILITY
|
||||
#ifdef AS_X64_MINGW
|
||||
|
||||
#include "as_callfunc.h"
|
||||
#include "as_scriptengine.h"
|
||||
#include "as_texts.h"
|
||||
#include "as_context.h"
|
||||
|
||||
BEGIN_AS_NAMESPACE
|
||||
|
||||
static asQWORD __attribute__((noinline)) CallX64(const asQWORD *args, const asQWORD *floatArgs, const int paramSize, asQWORD func)
|
||||
{
|
||||
volatile asQWORD ret = 0;
|
||||
|
||||
__asm__ __volatile__ (
|
||||
"# Move the parameters into registers before the rsp is modified\n"
|
||||
"mov %1, %%r10\n" // r10 = args
|
||||
"mov %2, %%r11\n" // r11 = floatArgs
|
||||
"xor %%r12, %%r12\n"
|
||||
"mov %3, %%r12d\n"
|
||||
"mov %4, %%r14\n" // r14 = func
|
||||
|
||||
"# Store the stack pointer in r15 since it is guaranteed not to change over a function call\n"
|
||||
"mov %%rsp, %%r15\n"
|
||||
|
||||
"# Allocate space on the stack for the arguments\n"
|
||||
"# Make room for at least 4 arguments even if there are less. When\n"
|
||||
"# the compiler does optimizations for speed it may use these for \n"
|
||||
"# temporary storage.\n"
|
||||
"mov %%r12, %%rdi\n"
|
||||
"add $32,%%edi\n"
|
||||
|
||||
"# Make sure the stack pointer is 16byte aligned so the\n"
|
||||
"# whole program optimizations will work properly\n"
|
||||
"# TODO: runtime optimize: Can this be optimized with fewer instructions?\n"
|
||||
"mov %%rsp,%%rsi\n"
|
||||
"sub %%rdi,%%rsi\n"
|
||||
"and $0x8,%%rsi\n"
|
||||
"add %%rsi,%%rdi\n"
|
||||
"sub %%rdi,%%rsp\n"
|
||||
|
||||
"# Jump straight to calling the function if no parameters\n"
|
||||
"cmp $0,%%r12 # Compare paramSize with 0\n"
|
||||
"je callfunc # Jump to call funtion if (paramSize == 0)\n"
|
||||
|
||||
"# Copy arguments from script stack to application stack\n"
|
||||
"# Order is (first to last):\n"
|
||||
"# rcx, rdx, r8, r9 & everything else goes on stack\n"
|
||||
"movq (%%r10),%%rcx\n"
|
||||
"movq 8(%%r10),%%rdx\n"
|
||||
"movq 16(%%r10),%%r8\n"
|
||||
"movq 24(%%r10),%%r9\n"
|
||||
|
||||
"# Negate the 4 params from the size to be copied\n"
|
||||
"sub $32,%%r12d\n"
|
||||
"js copyfloat # Jump if negative result\n"
|
||||
"jz copyfloat # Jump if zero result\n"
|
||||
|
||||
"# Now copy all remaining params onto stack allowing space for first four\n"
|
||||
"# params to be flushed back to the stack if required by the callee.\n"
|
||||
"add $32,%%r10 # Position input pointer 4 args ahead\n"
|
||||
"mov %%rsp,%%r13 # Put the stack pointer into r13\n"
|
||||
"add $32,%%r13 # Leave space for first 4 args on stack\n"
|
||||
|
||||
"copyoverflow:\n"
|
||||
"movq (%%r10),%%rdi # Read param from source stack into rdi\n"
|
||||
"movq %%rdi,(%%r13) # Copy param to real stack\n"
|
||||
"add $8,%%r13 # Move virtual stack pointer\n"
|
||||
"add $8,%%r10 # Move source stack pointer\n"
|
||||
"sub $8,%%r12d # Decrement remaining count\n"
|
||||
"jnz copyoverflow # Continue if more params\n"
|
||||
|
||||
"copyfloat:\n"
|
||||
"# Any floating point params?\n"
|
||||
"cmp $0,%%r11\n"
|
||||
"je callfunc\n"
|
||||
|
||||
"movlpd (%%r11),%%xmm0\n"
|
||||
"movlpd 8(%%r11),%%xmm1\n"
|
||||
"movlpd 16(%%r11),%%xmm2\n"
|
||||
"movlpd 24(%%r11),%%xmm3\n"
|
||||
|
||||
"callfunc:\n"
|
||||
"call *%%r14\n"
|
||||
|
||||
"# restore stack pointer\n"
|
||||
"mov %%r15, %%rsp\n"
|
||||
|
||||
"lea %0, %%rbx\n" // Load the address of the ret variable into rbx
|
||||
"movq %%rax,(%%rbx)\n" // Copy the returned value into the ret variable
|
||||
|
||||
: // no output
|
||||
: "m" (ret), "r" (args), "r" (floatArgs), "r" (paramSize), "r" (func)
|
||||
: "rdi", "rsi", "rsp", "rbx", "r10", "r11", "%r12", "r13", "r14", "r15"
|
||||
);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static asDWORD GetReturnedFloat()
|
||||
{
|
||||
volatile asDWORD ret = 0;
|
||||
|
||||
__asm__ __volatile__ (
|
||||
"lea %0, %%rax\n"
|
||||
"movss %%xmm0, (%%rax)"
|
||||
: /* no output */
|
||||
: "m" (ret)
|
||||
: "%rax"
|
||||
);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static asQWORD GetReturnedDouble()
|
||||
{
|
||||
volatile asQWORD ret = 0;
|
||||
|
||||
__asm__ __volatile__ (
|
||||
"lea %0, %%rax\n"
|
||||
"movlpd %%xmm0, (%%rax)"
|
||||
: /* no optput */
|
||||
: "m" (ret)
|
||||
: "%rax"
|
||||
);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
asQWORD CallSystemFunctionNative(asCContext *context, asCScriptFunction *descr, void *obj, asDWORD *args, void *retPointer, asQWORD &/*retQW2*/)
|
||||
{
|
||||
asCScriptEngine *engine = context->m_engine;
|
||||
asSSystemFunctionInterface *sysFunc = descr->sysFuncIntf;
|
||||
|
||||
asQWORD retQW = 0;
|
||||
void *func = (void*)sysFunc->func;
|
||||
asUINT paramSize = 0; // QWords
|
||||
void **vftable;
|
||||
|
||||
asQWORD allArgBuffer[64];
|
||||
asQWORD floatArgBuffer[4];
|
||||
|
||||
int callConv = sysFunc->callConv;
|
||||
|
||||
if( sysFunc->hostReturnInMemory )
|
||||
{
|
||||
// The return is made in memory
|
||||
callConv++;
|
||||
|
||||
// Set the return pointer as the first argument
|
||||
allArgBuffer[paramSize++] = (asQWORD)retPointer;
|
||||
}
|
||||
|
||||
if( callConv == ICC_THISCALL ||
|
||||
callConv == ICC_THISCALL_RETURNINMEM ||
|
||||
callConv == ICC_VIRTUAL_THISCALL ||
|
||||
callConv == ICC_VIRTUAL_THISCALL_RETURNINMEM )
|
||||
{
|
||||
// Add the object pointer as the first parameter
|
||||
allArgBuffer[paramSize++] = (asQWORD)obj;
|
||||
}
|
||||
|
||||
if( callConv == ICC_CDECL_OBJFIRST ||
|
||||
callConv == ICC_CDECL_OBJFIRST_RETURNINMEM )
|
||||
{
|
||||
// Add the object pointer as the first parameter
|
||||
allArgBuffer[paramSize++] = (asQWORD)obj;
|
||||
}
|
||||
if( callConv == ICC_VIRTUAL_THISCALL ||
|
||||
callConv == ICC_VIRTUAL_THISCALL_RETURNINMEM )
|
||||
{
|
||||
// Get the true function pointer from the virtual function table
|
||||
vftable = *(void***)obj;
|
||||
func = vftable[asPWORD(func)>>3];
|
||||
}
|
||||
|
||||
// Move the arguments to the buffer
|
||||
asUINT dpos = paramSize;
|
||||
asUINT spos = 0;
|
||||
for( asUINT n = 0; n < descr->parameterTypes.GetLength(); n++ )
|
||||
{
|
||||
if( descr->parameterTypes[n].IsObject() && !descr->parameterTypes[n].IsObjectHandle() && !descr->parameterTypes[n].IsReference() )
|
||||
{
|
||||
if( descr->parameterTypes[n].GetSizeInMemoryDWords() >= AS_LARGE_OBJ_MIN_SIZE ||
|
||||
(descr->parameterTypes[n].GetObjectType()->flags & COMPLEX_MASK) )
|
||||
{
|
||||
allArgBuffer[dpos++] = *(asQWORD*)&args[spos];
|
||||
spos += AS_PTR_SIZE;
|
||||
paramSize++;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Copy the object's memory to the buffer
|
||||
memcpy(&allArgBuffer[dpos], *(void**)(args+spos), descr->parameterTypes[n].GetSizeInMemoryBytes());
|
||||
|
||||
// Delete the original memory
|
||||
engine->CallFree(*(char**)(args+spos));
|
||||
spos += AS_PTR_SIZE;
|
||||
asUINT dwords = descr->parameterTypes[n].GetSizeInMemoryDWords();
|
||||
asUINT qwords = (dwords >> 1) + (dwords & 1);
|
||||
dpos += qwords;
|
||||
paramSize += qwords;
|
||||
}
|
||||
}
|
||||
else if( descr->parameterTypes[n].GetTokenType() == ttQuestion )
|
||||
{
|
||||
// Copy the reference and the type id
|
||||
allArgBuffer[dpos++] = *(asQWORD*)&args[spos];
|
||||
spos += 2;
|
||||
allArgBuffer[dpos++] = args[spos++];
|
||||
paramSize += 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Copy the value directly
|
||||
asUINT dwords = descr->parameterTypes[n].GetSizeOnStackDWords();
|
||||
if( dwords > 1 )
|
||||
{
|
||||
allArgBuffer[dpos] = *(asQWORD*)&args[spos];
|
||||
|
||||
// Double arguments are moved to a separate buffer in order to be placed in the XMM registers,
|
||||
// though this is only done for first 4 arguments, the rest are placed on the stack
|
||||
if( paramSize < 4 && descr->parameterTypes[n].IsDoubleType() )
|
||||
floatArgBuffer[dpos] = *(asQWORD*)&args[spos];
|
||||
|
||||
dpos++;
|
||||
spos += 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
allArgBuffer[dpos] = args[spos];
|
||||
|
||||
// Float arguments are moved to a separate buffer in order to be placed in the XMM registers,
|
||||
// though this is only done for first 4 arguments, the rest are placed on the stack
|
||||
if( paramSize < 4 && descr->parameterTypes[n].IsFloatType() )
|
||||
floatArgBuffer[dpos] = args[spos];
|
||||
|
||||
dpos++;
|
||||
spos++;
|
||||
}
|
||||
|
||||
paramSize++;
|
||||
}
|
||||
}
|
||||
|
||||
if( callConv == ICC_CDECL_OBJLAST ||
|
||||
callConv == ICC_CDECL_OBJLAST_RETURNINMEM )
|
||||
{
|
||||
// Add the object pointer as the last parameter
|
||||
allArgBuffer[paramSize++] = (asQWORD)obj;
|
||||
}
|
||||
|
||||
retQW = CallX64(allArgBuffer, floatArgBuffer, paramSize*8, (asPWORD)func);
|
||||
|
||||
// If the return is a float value we need to get the value from the FP register
|
||||
if( sysFunc->hostReturnFloat )
|
||||
{
|
||||
if( sysFunc->hostReturnSize == 1 )
|
||||
*(asDWORD*)&retQW = GetReturnedFloat();
|
||||
else
|
||||
retQW = GetReturnedDouble();
|
||||
}
|
||||
|
||||
return retQW;
|
||||
}
|
||||
|
||||
END_AS_NAMESPACE
|
||||
|
||||
#endif // AS_X64_MSVC
|
||||
#endif // AS_MAX_PORTABILITY
|
||||
|
||||
|
193
lib/angelscript/source/as_callfunc_x64_msvc.cpp
Normal file
193
lib/angelscript/source/as_callfunc_x64_msvc.cpp
Normal file
@ -0,0 +1,193 @@
|
||||
/*
|
||||
AngelCode Scripting Library
|
||||
Copyright (c) 2003-2013 Andreas Jonsson
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any
|
||||
damages arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any
|
||||
purpose, including commercial applications, and to alter it and
|
||||
redistribute it freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you
|
||||
must not claim that you wrote the original software. If you use
|
||||
this software in a product, an acknowledgment in the product
|
||||
documentation would be appreciated but is not required.
|
||||
|
||||
2. Altered source versions must be plainly marked as such, and
|
||||
must not be misrepresented as being the original software.
|
||||
|
||||
3. This notice may not be removed or altered from any source
|
||||
distribution.
|
||||
|
||||
The original version of this library can be located at:
|
||||
http://www.angelcode.com/angelscript/
|
||||
|
||||
Andreas Jonsson
|
||||
andreas@angelcode.com
|
||||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "as_config.h"
|
||||
|
||||
#ifndef AS_MAX_PORTABILITY
|
||||
#ifdef AS_X64_MSVC
|
||||
|
||||
#include "as_callfunc.h"
|
||||
#include "as_scriptengine.h"
|
||||
#include "as_texts.h"
|
||||
#include "as_context.h"
|
||||
|
||||
BEGIN_AS_NAMESPACE
|
||||
|
||||
// These functions are implemented in as_callfunc_x64_msvc.asm
|
||||
extern "C" asQWORD CallX64(const asQWORD *args, const asQWORD *floatArgs, int paramSize, asQWORD func);
|
||||
extern "C" asDWORD GetReturnedFloat();
|
||||
extern "C" asQWORD GetReturnedDouble();
|
||||
|
||||
asQWORD CallSystemFunctionNative(asCContext *context, asCScriptFunction *descr, void *obj, asDWORD *args, void *retPointer, asQWORD &/*retQW2*/)
|
||||
{
|
||||
asCScriptEngine *engine = context->m_engine;
|
||||
asSSystemFunctionInterface *sysFunc = descr->sysFuncIntf;
|
||||
|
||||
asQWORD retQW = 0;
|
||||
void *func = (void*)sysFunc->func;
|
||||
asUINT paramSize = 0; // QWords
|
||||
void **vftable;
|
||||
|
||||
asQWORD allArgBuffer[64];
|
||||
asQWORD floatArgBuffer[4];
|
||||
|
||||
int callConv = sysFunc->callConv;
|
||||
if( callConv == ICC_THISCALL ||
|
||||
callConv == ICC_THISCALL_RETURNINMEM ||
|
||||
callConv == ICC_VIRTUAL_THISCALL ||
|
||||
callConv == ICC_VIRTUAL_THISCALL_RETURNINMEM )
|
||||
{
|
||||
// Add the object pointer as the first parameter
|
||||
allArgBuffer[paramSize++] = (asQWORD)obj;
|
||||
}
|
||||
|
||||
if( sysFunc->hostReturnInMemory )
|
||||
{
|
||||
// The return is made in memory
|
||||
callConv++;
|
||||
|
||||
// Set the return pointer as the first argument
|
||||
allArgBuffer[paramSize++] = (asQWORD)retPointer;
|
||||
}
|
||||
|
||||
if( callConv == ICC_CDECL_OBJFIRST ||
|
||||
callConv == ICC_CDECL_OBJFIRST_RETURNINMEM )
|
||||
{
|
||||
// Add the object pointer as the first parameter
|
||||
allArgBuffer[paramSize++] = (asQWORD)obj;
|
||||
}
|
||||
|
||||
if( callConv == ICC_VIRTUAL_THISCALL ||
|
||||
callConv == ICC_VIRTUAL_THISCALL_RETURNINMEM )
|
||||
{
|
||||
// Get the true function pointer from the virtual function table
|
||||
vftable = *(void***)obj;
|
||||
func = vftable[asPWORD(func)>>2];
|
||||
}
|
||||
|
||||
// Move the arguments to the buffer
|
||||
asUINT dpos = paramSize;
|
||||
asUINT spos = 0;
|
||||
for( asUINT n = 0; n < descr->parameterTypes.GetLength(); n++ )
|
||||
{
|
||||
if( descr->parameterTypes[n].IsObject() && !descr->parameterTypes[n].IsObjectHandle() && !descr->parameterTypes[n].IsReference() )
|
||||
{
|
||||
if( descr->parameterTypes[n].GetSizeInMemoryDWords() >= AS_LARGE_OBJ_MIN_SIZE ||
|
||||
(descr->parameterTypes[n].GetObjectType()->flags & COMPLEX_MASK) )
|
||||
{
|
||||
allArgBuffer[dpos++] = *(asQWORD*)&args[spos];
|
||||
spos += AS_PTR_SIZE;
|
||||
paramSize++;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Copy the object's memory to the buffer
|
||||
memcpy(&allArgBuffer[dpos], *(void**)(args+spos), descr->parameterTypes[n].GetSizeInMemoryBytes());
|
||||
|
||||
// Delete the original memory
|
||||
engine->CallFree(*(char**)(args+spos));
|
||||
spos += AS_PTR_SIZE;
|
||||
asUINT dwords = descr->parameterTypes[n].GetSizeInMemoryDWords();
|
||||
asUINT qwords = (dwords >> 1) + (dwords & 1);
|
||||
dpos += qwords;
|
||||
paramSize += qwords;
|
||||
}
|
||||
}
|
||||
else if( descr->parameterTypes[n].GetTokenType() == ttQuestion )
|
||||
{
|
||||
// Copy the reference and the type id
|
||||
allArgBuffer[dpos++] = *(asQWORD*)&args[spos];
|
||||
spos += 2;
|
||||
allArgBuffer[dpos++] = args[spos++];
|
||||
paramSize += 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Copy the value directly
|
||||
asUINT dwords = descr->parameterTypes[n].GetSizeOnStackDWords();
|
||||
if( dwords > 1 )
|
||||
{
|
||||
allArgBuffer[dpos] = *(asQWORD*)&args[spos];
|
||||
|
||||
// Double arguments are moved to a separate buffer in order to be placed in the XMM registers,
|
||||
// though this is only done for first 4 arguments, the rest are placed on the stack
|
||||
if( paramSize < 4 && descr->parameterTypes[n].IsDoubleType() )
|
||||
floatArgBuffer[dpos] = *(asQWORD*)&args[spos];
|
||||
|
||||
dpos++;
|
||||
spos += 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
allArgBuffer[dpos] = args[spos];
|
||||
|
||||
// Float arguments are moved to a separate buffer in order to be placed in the XMM registers,
|
||||
// though this is only done for first 4 arguments, the rest are placed on the stack
|
||||
if( paramSize < 4 && descr->parameterTypes[n].IsFloatType() )
|
||||
floatArgBuffer[dpos] = args[spos];
|
||||
|
||||
dpos++;
|
||||
spos++;
|
||||
}
|
||||
|
||||
paramSize++;
|
||||
}
|
||||
}
|
||||
|
||||
if( callConv == ICC_CDECL_OBJLAST ||
|
||||
callConv == ICC_CDECL_OBJLAST_RETURNINMEM )
|
||||
{
|
||||
// Add the object pointer as the last parameter
|
||||
allArgBuffer[paramSize++] = (asQWORD)obj;
|
||||
}
|
||||
|
||||
retQW = CallX64(allArgBuffer, floatArgBuffer, paramSize*8, (asPWORD)func);
|
||||
|
||||
// If the return is a float value we need to get the value from the FP register
|
||||
if( sysFunc->hostReturnFloat )
|
||||
{
|
||||
if( sysFunc->hostReturnSize == 1 )
|
||||
*(asDWORD*)&retQW = GetReturnedFloat();
|
||||
else
|
||||
retQW = GetReturnedDouble();
|
||||
}
|
||||
|
||||
return retQW;
|
||||
}
|
||||
|
||||
END_AS_NAMESPACE
|
||||
|
||||
#endif // AS_X64_MSVC
|
||||
#endif // AS_MAX_PORTABILITY
|
||||
|
||||
|
208
lib/angelscript/source/as_callfunc_x64_msvc_asm.asm
Normal file
208
lib/angelscript/source/as_callfunc_x64_msvc_asm.asm
Normal file
@ -0,0 +1,208 @@
|
||||
;
|
||||
; AngelCode Scripting Library
|
||||
; Copyright (c) 2003-2011 Andreas Jonsson
|
||||
;
|
||||
; This software is provided 'as-is', without any express or implied
|
||||
; warranty. In no event will the authors be held liable for any
|
||||
; damages arising from the use of this software.
|
||||
;
|
||||
; Permission is granted to anyone to use this software for any
|
||||
; purpose, including commercial applications, and to alter it and
|
||||
; redistribute it freely, subject to the following restrictions:
|
||||
;
|
||||
; 1. The origin of this software must not be misrepresented; you
|
||||
; must not claim that you wrote the original software. If you use
|
||||
; this software in a product, an acknowledgment in the product
|
||||
; documentation would be appreciated but is not required.
|
||||
;
|
||||
; 2. Altered source versions must be plainly marked as such, and
|
||||
; must not be misrepresented as being the original software.
|
||||
;
|
||||
; 3. This notice may not be removed or altered from any source
|
||||
; distribution.
|
||||
;
|
||||
; The original version of this library can be located at:
|
||||
; http://www.angelcode.com/angelscript/
|
||||
;
|
||||
; Andreas Jonsson
|
||||
; andreas@angelcode.com
|
||||
;
|
||||
|
||||
.code
|
||||
PUBLIC CallX64
|
||||
|
||||
; asQWORD CallX64(const asQWORD *args, const asQWORD *floatArgs, int paramSize, asQWORD func)
|
||||
|
||||
CallX64 PROC FRAME
|
||||
|
||||
; PROLOG
|
||||
|
||||
; We must save preserved registers that are used
|
||||
; TODO: No need to save unused registers
|
||||
|
||||
push rbp
|
||||
.pushreg rbp
|
||||
push rsi
|
||||
.pushreg rsi
|
||||
push r11
|
||||
.pushreg r11
|
||||
push rdi
|
||||
.pushreg rdi
|
||||
push r12
|
||||
.pushreg r12
|
||||
push r13
|
||||
.pushreg r13
|
||||
push r14
|
||||
.pushreg r14
|
||||
push r15
|
||||
.pushreg r15
|
||||
push rbx
|
||||
.pushreg rbx
|
||||
sub rsp, 050h
|
||||
.allocstack 050h
|
||||
mov rbp, rsp
|
||||
.setframe rbp, 0
|
||||
.endprolog
|
||||
|
||||
; Move function param to non-scratch register
|
||||
mov r14, r9 ; r14 = function
|
||||
|
||||
; Allocate space on the stack for the arguments
|
||||
; Make room for at least 4 arguments even if there are less. When
|
||||
; the compiler does optimizations for speed it may use these for
|
||||
; temporary storage.
|
||||
mov rdi, r8
|
||||
add rdi, 32
|
||||
|
||||
; Make sure the stack pointer is 16byte aligned so the
|
||||
; whole program optimizations will work properly
|
||||
; TODO: optimize: Can this be optimized with fewer instructions?
|
||||
mov rsi, rsp
|
||||
sub rsi, rdi
|
||||
and rsi, 8h
|
||||
add rdi, rsi
|
||||
sub rsp, rdi
|
||||
|
||||
; Jump straight to calling the function if no parameters
|
||||
cmp r8d, 0 ; Compare paramSize with 0
|
||||
je callfunc ; Jump to call funtion if (paramSize == 0)
|
||||
|
||||
; Move params to non-scratch registers
|
||||
mov rsi, rcx ; rsi = pArgs
|
||||
mov r11, rdx ; r11 = pFloatArgs (can be NULL)
|
||||
mov r12d, r8d ; r12 = paramSize
|
||||
|
||||
; Copy arguments from script stack to application stack
|
||||
; Order is (first to last):
|
||||
; rcx, rdx, r8, r9 & everything else goes on stack
|
||||
mov rcx, qword ptr [rsi]
|
||||
mov rdx, qword ptr [rsi + 8]
|
||||
mov r8, qword ptr [rsi + 16]
|
||||
mov r9, qword ptr [rsi + 24]
|
||||
|
||||
; Negate the 4 params from the size to be copied
|
||||
sub r12d, 32
|
||||
js copyfloat ; Jump if negative result
|
||||
jz copyfloat ; Jump if zero result
|
||||
|
||||
; Now copy all remaining params onto stack allowing space for first four
|
||||
; params to be flushed back to the stack if required by the callee.
|
||||
|
||||
add rsi, 32 ; Position input pointer 4 args ahead
|
||||
mov r13, rsp ; Put the stack pointer into r13
|
||||
add r13, 32 ; Leave space for first 4 args on stack
|
||||
|
||||
copyoverflow:
|
||||
mov r15, qword ptr [rsi] ; Read param from source stack into r15
|
||||
mov qword ptr [r13], r15 ; Copy param to real stack
|
||||
add r13, 8 ; Move virtual stack pointer
|
||||
add rsi, 8 ; Move source stack pointer
|
||||
sub r12d, 8 ; Decrement remaining count
|
||||
jnz copyoverflow ; Continue if more params
|
||||
|
||||
copyfloat:
|
||||
; Any floating point params?
|
||||
cmp r11, 0
|
||||
je callfunc
|
||||
|
||||
movlpd xmm0, qword ptr [r11]
|
||||
movlpd xmm1, qword ptr [r11 + 8]
|
||||
movlpd xmm2, qword ptr [r11 + 16]
|
||||
movlpd xmm3, qword ptr [r11 + 24]
|
||||
|
||||
callfunc:
|
||||
|
||||
; Call function
|
||||
call r14
|
||||
|
||||
; Restore the stack
|
||||
mov rsp, rbp
|
||||
|
||||
; EPILOG: Restore stack & preserved registers
|
||||
add rsp, 050h
|
||||
pop rbx
|
||||
pop r15
|
||||
pop r14
|
||||
pop r13
|
||||
pop r12
|
||||
pop rdi
|
||||
pop r11
|
||||
pop rsi
|
||||
pop rbp
|
||||
|
||||
; return value in RAX
|
||||
ret
|
||||
|
||||
CallX64 ENDP
|
||||
|
||||
|
||||
PUBLIC GetReturnedFloat
|
||||
|
||||
; asDWORD GetReturnedFloat()
|
||||
|
||||
GetReturnedFloat PROC FRAME
|
||||
|
||||
; PROLOG: Store registers and allocate stack space
|
||||
|
||||
sub rsp, 8 ; We'll need 4 bytes for temporary storage (8 bytes with alignment)
|
||||
.allocstack 8
|
||||
.endprolog
|
||||
|
||||
; Move the float value from the XMM0 register to RAX register
|
||||
movss dword ptr [rsp], xmm0
|
||||
mov eax, dword ptr [rsp]
|
||||
|
||||
; EPILOG: Clean up
|
||||
|
||||
add rsp, 8
|
||||
|
||||
ret
|
||||
|
||||
GetReturnedFloat ENDP
|
||||
|
||||
|
||||
PUBLIC GetReturnedDouble
|
||||
|
||||
; asDWORD GetReturnedDouble()
|
||||
|
||||
GetReturnedDouble PROC FRAME
|
||||
|
||||
; PROLOG: Store registers and allocate stack space
|
||||
|
||||
sub rsp, 8 ; We'll need 8 bytes for temporary storage
|
||||
.allocstack 8
|
||||
.endprolog
|
||||
|
||||
; Move the double value from the XMM0 register to the RAX register
|
||||
movlpd qword ptr [rsp], xmm0
|
||||
mov rax, qword ptr [rsp]
|
||||
|
||||
; EPILOG: Clean up
|
||||
|
||||
add rsp, 8
|
||||
|
||||
ret
|
||||
|
||||
GetReturnedDouble ENDP
|
||||
|
||||
END
|
1317
lib/angelscript/source/as_callfunc_x86.cpp
Normal file
1317
lib/angelscript/source/as_callfunc_x86.cpp
Normal file
File diff suppressed because it is too large
Load Diff
735
lib/angelscript/source/as_callfunc_xenon.cpp
Normal file
735
lib/angelscript/source/as_callfunc_xenon.cpp
Normal file
@ -0,0 +1,735 @@
|
||||
/*
|
||||
AngelCode Scripting Library
|
||||
Copyright (c) 2003-2013 Andreas Jonsson
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any
|
||||
damages arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any
|
||||
purpose, including commercial applications, and to alter it and
|
||||
redistribute it freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you
|
||||
must not claim that you wrote the original software. If you use
|
||||
this software in a product, an acknowledgment in the product
|
||||
documentation would be appreciated but is not required.
|
||||
|
||||
2. Altered source versions must be plainly marked as such, and
|
||||
must not be misrepresented as being the original software.
|
||||
|
||||
3. This notice may not be removed or altered from any source
|
||||
distribution.
|
||||
|
||||
The original version of this library can be located at:
|
||||
http://www.angelcode.com/angelscript/
|
||||
|
||||
Andreas Jonsson
|
||||
andreas@angelcode.com
|
||||
*/
|
||||
|
||||
|
||||
//
|
||||
// as_callfunc_xenon.cpp
|
||||
//
|
||||
// These functions handle the actual calling of system functions
|
||||
//
|
||||
// This version is Xenon specific
|
||||
// Modified from as_callfunc_ppc.cpp by Laszlo Perneky February 2007
|
||||
//
|
||||
// Modified by Cyril Tissier March 2010:
|
||||
// various fixes in 'float' args passing / function return
|
||||
// properly handling 'double' type
|
||||
// various fixes in asm ppcFunc
|
||||
// fix for variable arguments
|
||||
//
|
||||
|
||||
|
||||
|
||||
// XBox 360 calling convention
|
||||
// ===========================
|
||||
// I've yet to find an official document with the ABI for XBox 360,
|
||||
// but I'll describe what I've gathered from the code and tests
|
||||
// performed by the AngelScript community.
|
||||
//
|
||||
// Arguments are passed in the following registers:
|
||||
// r3 - r10 : integer/pointer arguments (each register is 64bit)
|
||||
// fr1 - fr13 : float/double arguments (each register is 64bit)
|
||||
//
|
||||
// Arguments that don't fit in the registers will be pushed on the stack.
|
||||
//
|
||||
// When a float or double is passed as argument, its value will be placed
|
||||
// in the next available float register, but it will also reserve general
|
||||
// purpose register.
|
||||
//
|
||||
// Example: void foo(float a, int b). a will be passed in fr1 and b in r4.
|
||||
//
|
||||
// For each argument passed to a function an 8byte slot is reserved on the
|
||||
// stack, so that the function can offload the value there if needed. The
|
||||
// first slot is at r1+20, the next at r1+28, etc.
|
||||
//
|
||||
// If the function is a class method, the this pointer is passed as hidden
|
||||
// first argument. If the function returns an object in memory, the address
|
||||
// for that memory is passed as hidden first argument.
|
||||
//
|
||||
// Return value are placed in the following registers:
|
||||
// r3 : integer/pointer values
|
||||
// fr1 : float/double values
|
||||
//
|
||||
// Rules for registers
|
||||
// r1 : stack pointer
|
||||
// r14-r31 : nonvolatile, i.e. their values must be preserved
|
||||
// fr14-fr31 : nonvolatile, i.e. their values must be preserved
|
||||
// r0, r2, r13 : dedicated. I'm not sure what it means, but it is probably best not to use them
|
||||
//
|
||||
// The stack pointer must always be aligned at 8 bytes.
|
||||
//
|
||||
// References:
|
||||
// https://www-01.ibm.com/chips/techlib/techlib.nsf/techdocs/852569B20050FF77852569970071B0D6/$file/eabi_app.pdf
|
||||
//
|
||||
// TODO: The code doesn't handle int64 and uint64 parameters
|
||||
// TODO: The code doesn't handle objects passed by value (unless they are max 4 bytes in size)
|
||||
|
||||
|
||||
|
||||
#include "as_config.h"
|
||||
|
||||
#ifndef AS_MAX_PORTABILITY
|
||||
#if defined(AS_XENON)
|
||||
|
||||
#include "as_callfunc.h"
|
||||
#include "as_scriptengine.h"
|
||||
#include "as_texts.h"
|
||||
#include "as_tokendef.h"
|
||||
#include "as_context.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <xtl.h>
|
||||
|
||||
BEGIN_AS_NAMESPACE
|
||||
|
||||
#define AS_PPC_MAX_ARGS 32
|
||||
#define AS_PPC_THISCALL_REG 1
|
||||
#define AS_PPC_RETURNINMEM_REG 1
|
||||
#define AS_PPC_ENDOFARGS 1
|
||||
|
||||
// The array used to send values to the correct places.
|
||||
// Contains a byte of argTypes to indicate the register type to load, or zero if end of arguments
|
||||
enum argTypes
|
||||
{
|
||||
ppcENDARG = 0,
|
||||
ppcINTARG = 1,
|
||||
ppcFLOATARG = 2,
|
||||
ppcDOUBLEARG = 3
|
||||
};
|
||||
|
||||
// Loads all data into the correct places and calls the function.
|
||||
// pArgs is the array of the argument values
|
||||
// pArgTypes is an array containing a byte indicating the type (enum argTypes) for each argument.
|
||||
// dwFunc is the address of the function that will be called
|
||||
asQWORD __declspec( naked ) ppcFunc(const asDWORD* pArgs, asDWORD dwFunc, const asBYTE* pArgTypes)
|
||||
{
|
||||
__asm
|
||||
{
|
||||
_ppcFunc:
|
||||
// Prologue
|
||||
// Read and stack the link register (return address)
|
||||
mflr r12
|
||||
stw r12,-8(r1)
|
||||
|
||||
// Backup all non-volatile registers we use in this function
|
||||
std r31,-10h(r1) // stack pointer for pushing arguments
|
||||
std r27,-18h(r1) // dwFunc
|
||||
std r26,-20h(r1) // pArgs
|
||||
std r25,-28h(r1) // pArgTypes
|
||||
std r24,-30h(r1) // current arg type
|
||||
std r23,-38h(r1) // counter for used GPRs
|
||||
std r22,-40h(r1) // counter for used float registers
|
||||
|
||||
// Setup the stack frame to make room for the backup of registers
|
||||
// and the arguments that will be passed to the application function.
|
||||
// 512 bytes is enough for about 50 arguments plus backup of 8
|
||||
// TODO: Should perhaps make this dynamic based on number of arguments
|
||||
stwu r1,-200h(r1)
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Initialize local variables
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// r31 is our pointer into the stack where the arguments will be place
|
||||
// The MSVC optimizer seems to rely on nobody copying the r1 register directly
|
||||
// so we can't just do a simple 'addi r31, r1, 14h' as the optimizer may
|
||||
// end up moving this instruction to before the update of r1 above.
|
||||
// Instead we'll read the previous stack pointer from the stack, and then
|
||||
// subtract to get the correct offset.
|
||||
lwz r31, 0(r1)
|
||||
subi r31, r31, 1ECh // prev r1 - 512 + 20 = curr r1 + 20
|
||||
|
||||
mr r26, r3 // pArgs
|
||||
mr r27, r4 // dwFunc
|
||||
mr r25, r5 // pArgTypes
|
||||
|
||||
// Counting of used/assigned GPR's
|
||||
sub r23, r23, r23
|
||||
// Counting of used/assigned Float Registers
|
||||
sub r22, r22, r22
|
||||
|
||||
// Begin loading and stacking registers
|
||||
subi r25, r25, 1
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Fetch the next argument
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
ppcNextArg:
|
||||
// Increment rArgTypePtr
|
||||
addi r25, r25, 1
|
||||
// Get data type
|
||||
lbz r24, 0(r25)
|
||||
|
||||
// r24 holds the data type
|
||||
cmplwi cr6, r24, 0
|
||||
beq cr6, ppcArgsEnd
|
||||
cmplwi cr6, r24, 1
|
||||
beq cr6, ppcArgIsInteger
|
||||
cmplwi cr6, r24, 2
|
||||
beq cr6, ppcArgIsFloat
|
||||
cmplwi cr6, r24, 3
|
||||
beq cr6, ppcArgIsDouble
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Load and stack integer arguments
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
ppcArgIsInteger:
|
||||
// Get the arg from the stack
|
||||
lwz r12, 0(r26)
|
||||
|
||||
// r23 holds the integer arg count so far
|
||||
cmplwi cr6, r23, 0
|
||||
beq cr6, ppcLoadIntReg0
|
||||
cmplwi cr6, r23, 1
|
||||
beq cr6, ppcLoadIntReg1
|
||||
cmplwi cr6, r23, 2
|
||||
beq cr6, ppcLoadIntReg2
|
||||
cmplwi cr6, r23, 3
|
||||
beq cr6, ppcLoadIntReg3
|
||||
cmplwi cr6, r23, 4
|
||||
beq cr6, ppcLoadIntReg4
|
||||
cmplwi cr6, r23, 5
|
||||
beq cr6, ppcLoadIntReg5
|
||||
cmplwi cr6, r23, 6
|
||||
beq cr6, ppcLoadIntReg6
|
||||
cmplwi cr6, r23, 7
|
||||
beq cr6, ppcLoadIntReg7
|
||||
|
||||
// no more than 8 parameters
|
||||
b ppcLoadIntRegUpd
|
||||
|
||||
ppcLoadIntReg0:
|
||||
mr r3, r12
|
||||
b ppcLoadIntRegUpd
|
||||
ppcLoadIntReg1:
|
||||
mr r4, r12
|
||||
b ppcLoadIntRegUpd
|
||||
ppcLoadIntReg2:
|
||||
mr r5, r12
|
||||
b ppcLoadIntRegUpd
|
||||
ppcLoadIntReg3:
|
||||
mr r6, r12
|
||||
b ppcLoadIntRegUpd
|
||||
ppcLoadIntReg4:
|
||||
mr r7, r12
|
||||
b ppcLoadIntRegUpd
|
||||
ppcLoadIntReg5:
|
||||
mr r8, r12
|
||||
b ppcLoadIntRegUpd
|
||||
ppcLoadIntReg6:
|
||||
mr r9, r12
|
||||
b ppcLoadIntRegUpd
|
||||
ppcLoadIntReg7:
|
||||
mr r10, r12
|
||||
b ppcLoadIntRegUpd
|
||||
|
||||
ppcLoadIntRegUpd:
|
||||
stw r12, 0(r31) // push on the stack
|
||||
addi r31, r31, 8 // inc stack by 1 reg
|
||||
|
||||
addi r23, r23, 1 // Increment used int register count
|
||||
addi r26, r26, 4 // Increment pArgs
|
||||
b ppcNextArg // Call next arg
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Load and stack float arguments
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
ppcArgIsFloat:
|
||||
// Get the arg from the stack
|
||||
lfs fr0, 0(r26)
|
||||
|
||||
// r22 holds the float arg count so far
|
||||
cmplwi cr6, r22, 0
|
||||
beq cr6, ppcLoadFloatReg0
|
||||
cmplwi cr6, r22, 1
|
||||
beq cr6, ppcLoadFloatReg1
|
||||
cmplwi cr6, r22, 2
|
||||
beq cr6, ppcLoadFloatReg2
|
||||
cmplwi cr6, r22, 3
|
||||
beq cr6, ppcLoadFloatReg3
|
||||
cmplwi cr6, r22, 4
|
||||
beq cr6, ppcLoadFloatReg4
|
||||
cmplwi cr6, r22, 5
|
||||
beq cr6, ppcLoadFloatReg5
|
||||
cmplwi cr6, r22, 6
|
||||
beq cr6, ppcLoadFloatReg6
|
||||
cmplwi cr6, r22, 7
|
||||
beq cr6, ppcLoadFloatReg7
|
||||
cmplwi cr6, r22, 8
|
||||
beq cr6, ppcLoadFloatReg8
|
||||
cmplwi cr6, r22, 9
|
||||
beq cr6, ppcLoadFloatReg9
|
||||
cmplwi cr6, r22, 10
|
||||
beq cr6, ppcLoadFloatReg10
|
||||
cmplwi cr6, r22, 11
|
||||
beq cr6, ppcLoadFloatReg11
|
||||
cmplwi cr6, r22, 12
|
||||
beq cr6, ppcLoadFloatReg12
|
||||
|
||||
// no more than 12 parameters
|
||||
b ppcLoadFloatRegUpd
|
||||
|
||||
ppcLoadFloatReg0:
|
||||
fmr fr1, fr0
|
||||
b ppcLoadFloatRegUpd
|
||||
ppcLoadFloatReg1:
|
||||
fmr fr2, fr0
|
||||
b ppcLoadFloatRegUpd
|
||||
ppcLoadFloatReg2:
|
||||
fmr fr3, fr0
|
||||
b ppcLoadFloatRegUpd
|
||||
ppcLoadFloatReg3:
|
||||
fmr fr4, fr0
|
||||
b ppcLoadFloatRegUpd
|
||||
ppcLoadFloatReg4:
|
||||
fmr fr5, fr0
|
||||
b ppcLoadFloatRegUpd
|
||||
ppcLoadFloatReg5:
|
||||
fmr fr6, fr0
|
||||
b ppcLoadFloatRegUpd
|
||||
ppcLoadFloatReg6:
|
||||
fmr fr7, fr0
|
||||
b ppcLoadFloatRegUpd
|
||||
ppcLoadFloatReg7:
|
||||
fmr fr8, fr0
|
||||
b ppcLoadFloatRegUpd
|
||||
ppcLoadFloatReg8:
|
||||
fmr fr9, fr0
|
||||
b ppcLoadFloatRegUpd
|
||||
ppcLoadFloatReg9:
|
||||
fmr fr10, fr0
|
||||
b ppcLoadFloatRegUpd
|
||||
ppcLoadFloatReg10:
|
||||
fmr fr11, fr0
|
||||
b ppcLoadFloatRegUpd
|
||||
ppcLoadFloatReg11:
|
||||
fmr fr12, fr0
|
||||
b ppcLoadFloatRegUpd
|
||||
ppcLoadFloatReg12:
|
||||
fmr fr13, fr0
|
||||
b ppcLoadFloatRegUpd
|
||||
|
||||
ppcLoadFloatRegUpd:
|
||||
stfs fr0, 0(r31) // push on the stack
|
||||
addi r31, r31, 8 // inc stack by 1 reg
|
||||
|
||||
addi r22, r22, 1 // Increment used float register count
|
||||
addi r23, r23, 1 // Increment used int register count - a float reg eats up a GPR
|
||||
addi r26, r26, 4 // Increment pArgs
|
||||
b ppcNextArg // Call next arg
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Load and stack double float arguments
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
ppcArgIsDouble:
|
||||
// Get the arg from the stack
|
||||
lfd fr0, 0(r26)
|
||||
|
||||
// r22 holds the float arg count so far
|
||||
cmplwi cr6, r22, 0
|
||||
beq cr6, ppcLoadDoubleReg0
|
||||
cmplwi cr6, r22, 1
|
||||
beq cr6, ppcLoadDoubleReg1
|
||||
cmplwi cr6, r22, 2
|
||||
beq cr6, ppcLoadDoubleReg2
|
||||
cmplwi cr6, r22, 3
|
||||
beq cr6, ppcLoadDoubleReg3
|
||||
cmplwi cr6, r22, 4
|
||||
beq cr6, ppcLoadDoubleReg4
|
||||
cmplwi cr6, r22, 5
|
||||
beq cr6, ppcLoadDoubleReg5
|
||||
cmplwi cr6, r22, 6
|
||||
beq cr6, ppcLoadDoubleReg6
|
||||
cmplwi cr6, r22, 7
|
||||
beq cr6, ppcLoadDoubleReg7
|
||||
cmplwi cr6, r22, 8
|
||||
beq cr6, ppcLoadDoubleReg8
|
||||
cmplwi cr6, r22, 9
|
||||
beq cr6, ppcLoadDoubleReg9
|
||||
cmplwi cr6, r22, 10
|
||||
beq cr6, ppcLoadDoubleReg10
|
||||
cmplwi cr6, r22, 11
|
||||
beq cr6, ppcLoadDoubleReg11
|
||||
cmplwi cr6, r22, 12
|
||||
beq cr6, ppcLoadDoubleReg12
|
||||
|
||||
// no more than 12 parameters
|
||||
b ppcLoadDoubleRegUpd
|
||||
|
||||
ppcLoadDoubleReg0:
|
||||
fmr fr1, fr0
|
||||
b ppcLoadDoubleRegUpd
|
||||
ppcLoadDoubleReg1:
|
||||
fmr fr2, fr0
|
||||
b ppcLoadDoubleRegUpd
|
||||
ppcLoadDoubleReg2:
|
||||
fmr fr3, fr0
|
||||
b ppcLoadDoubleRegUpd
|
||||
ppcLoadDoubleReg3:
|
||||
fmr fr4, fr0
|
||||
b ppcLoadDoubleRegUpd
|
||||
ppcLoadDoubleReg4:
|
||||
fmr fr5, fr0
|
||||
b ppcLoadDoubleRegUpd
|
||||
ppcLoadDoubleReg5:
|
||||
fmr fr6, fr0
|
||||
b ppcLoadDoubleRegUpd
|
||||
ppcLoadDoubleReg6:
|
||||
fmr fr7, fr0
|
||||
b ppcLoadDoubleRegUpd
|
||||
ppcLoadDoubleReg7:
|
||||
fmr fr8, fr0
|
||||
b ppcLoadDoubleRegUpd
|
||||
ppcLoadDoubleReg8:
|
||||
fmr fr9, fr0
|
||||
b ppcLoadDoubleRegUpd
|
||||
ppcLoadDoubleReg9:
|
||||
fmr fr10, fr0
|
||||
b ppcLoadDoubleRegUpd
|
||||
ppcLoadDoubleReg10:
|
||||
fmr fr11, fr0
|
||||
b ppcLoadDoubleRegUpd
|
||||
ppcLoadDoubleReg11:
|
||||
fmr fr12, fr0
|
||||
b ppcLoadDoubleRegUpd
|
||||
ppcLoadDoubleReg12:
|
||||
fmr fr13, fr0
|
||||
b ppcLoadDoubleRegUpd
|
||||
|
||||
ppcLoadDoubleRegUpd:
|
||||
stfd fr0, 0(r31) // push on the stack
|
||||
addi r31, r31, 8 // inc stack by 1 reg
|
||||
|
||||
addi r22, r22, 1 // Increment used float register count
|
||||
addi r23, r23, 1 // Increment used int register count
|
||||
addi r26, r26, 8 // Increment pArgs
|
||||
b ppcNextArg
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Finished
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
ppcArgsEnd:
|
||||
// Call the function
|
||||
mtctr r27
|
||||
bctrl
|
||||
|
||||
// Epilogue
|
||||
// Restore callers stack
|
||||
addi r1, r1, 200h
|
||||
|
||||
// restore all registers we used in this fct
|
||||
ld r22,-40h(r1)
|
||||
ld r23,-38h(r1)
|
||||
ld r24,-30h(r1)
|
||||
ld r25,-28h(r1)
|
||||
ld r26,-20h(r1)
|
||||
ld r27,-18h(r1)
|
||||
ld r31,-10h(r1)
|
||||
|
||||
// Fetch return link to caller
|
||||
lwz r12,-8(r1)
|
||||
mtlr r12
|
||||
blr
|
||||
}
|
||||
}
|
||||
|
||||
asDWORD GetReturnedFloat()
|
||||
{
|
||||
// This variable must be declared volatile so that the
|
||||
// compiler optimizations do not remove its initialization
|
||||
// with the fr1 register due to believing the fr1 register
|
||||
// isn't initialized.
|
||||
volatile asDWORD f;
|
||||
|
||||
__asm
|
||||
{
|
||||
stfs fr1, f
|
||||
}
|
||||
|
||||
return f;
|
||||
}
|
||||
|
||||
asQWORD GetReturnedDouble()
|
||||
{
|
||||
// This variable must be declared volatile so that the
|
||||
// compiler optimizations do not remove its initialization
|
||||
// with the fr1 register due to believing the fr1 register
|
||||
// isn't initialized.
|
||||
volatile asQWORD f;
|
||||
|
||||
__asm
|
||||
{
|
||||
stfd fr1, f
|
||||
}
|
||||
|
||||
return f;
|
||||
}
|
||||
|
||||
// returns true if the given parameter is a 'variable argument'
|
||||
inline bool IsVariableArgument( asCDataType type )
|
||||
{
|
||||
return (type.GetTokenType() == ttQuestion) ? true : false;
|
||||
}
|
||||
|
||||
asQWORD CallSystemFunctionNative(asCContext *context, asCScriptFunction *descr, void *obj, asDWORD *args, void *retPointer, asQWORD &/*retQW2*/)
|
||||
{
|
||||
asCScriptEngine *engine = context->m_engine;
|
||||
asSSystemFunctionInterface *sysFunc = descr->sysFuncIntf;
|
||||
int callConv = sysFunc->callConv;
|
||||
asQWORD retQW = 0;
|
||||
void *func = (void*)sysFunc->func;
|
||||
asDWORD *vftable;
|
||||
|
||||
// Pack the arguments into an array that ppcFunc() can use to load each CPU register properly
|
||||
asBYTE ppcArgsType[AS_PPC_MAX_ARGS + AS_PPC_RETURNINMEM_REG + AS_PPC_THISCALL_REG + AS_PPC_ENDOFARGS];
|
||||
asDWORD ppcArgs[AS_PPC_MAX_ARGS + AS_PPC_RETURNINMEM_REG + AS_PPC_THISCALL_REG];
|
||||
int argsCnt = 0;
|
||||
|
||||
// If the function returns an object in memory, we allocate the memory and put the ptr to the front (will go to r3)
|
||||
if( sysFunc->hostReturnInMemory )
|
||||
{
|
||||
ppcArgs[argsCnt] = (asDWORD)retPointer;
|
||||
ppcArgsType[argsCnt] = ppcINTARG;
|
||||
argsCnt++;
|
||||
}
|
||||
|
||||
// If we have an object and it's not objectlast, then we put it as the first arg
|
||||
if ( obj &&
|
||||
callConv != ICC_CDECL_OBJLAST &&
|
||||
callConv != ICC_CDECL_OBJLAST_RETURNINMEM )
|
||||
{
|
||||
ppcArgs[argsCnt] = (asDWORD)obj;
|
||||
ppcArgsType[argsCnt] = ppcINTARG;
|
||||
argsCnt++;
|
||||
}
|
||||
|
||||
// If the function takes any objects by value, they must be copied
|
||||
// to the stack, shifting the other arguments as necessary. paramBuffer
|
||||
// will then replace the args pointer that was received from the VM.
|
||||
// TODO: Is this really how XBox 360 passes objects by value?
|
||||
asDWORD paramBuffer[AS_PPC_MAX_ARGS];
|
||||
if( sysFunc->takesObjByVal )
|
||||
{
|
||||
int paramSize = 0;
|
||||
int spos = 0;
|
||||
int dpos = 1;
|
||||
|
||||
for( asUINT n = 0; n < descr->parameterTypes.GetLength(); n++ )
|
||||
{
|
||||
// Parameter object by value
|
||||
if( descr->parameterTypes[n].IsObject() &&
|
||||
!descr->parameterTypes[n].IsObjectHandle() &&
|
||||
!descr->parameterTypes[n].IsReference() )
|
||||
{
|
||||
#ifdef COMPLEX_OBJS_PASSED_BY_REF
|
||||
if( descr->parameterTypes[n].GetObjectType()->flags & COMPLEX_MASK )
|
||||
{
|
||||
paramBuffer[dpos++] = args[spos++];
|
||||
paramSize++;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
// Copy the object's memory to the buffer
|
||||
memcpy( ¶mBuffer[dpos], *(void**)(args + spos), descr->parameterTypes[n].GetSizeInMemoryBytes() );
|
||||
|
||||
// Delete the original memory
|
||||
engine->CallFree(*(char**)(args + spos));
|
||||
|
||||
spos++;
|
||||
dpos += descr->parameterTypes[n].GetSizeInMemoryDWords();
|
||||
paramSize += descr->parameterTypes[n].GetSizeInMemoryDWords();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Copy the value directly
|
||||
paramBuffer[dpos++] = args[spos++];
|
||||
if( descr->parameterTypes[n].GetSizeOnStackDWords() > 1 )
|
||||
paramBuffer[dpos++] = args[spos++];
|
||||
paramSize += descr->parameterTypes[n].GetSizeOnStackDWords();
|
||||
}
|
||||
|
||||
// If this was a variable argument parameter, then account for the implicit typeId
|
||||
if( IsVariableArgument( descr->parameterTypes[n] ) )
|
||||
{
|
||||
// the TypeId is just a DWORD
|
||||
paramBuffer[dpos++] = args[spos++];
|
||||
++paramSize;
|
||||
}
|
||||
}
|
||||
|
||||
// Keep a free location at the beginning
|
||||
args = ¶mBuffer[1];
|
||||
|
||||
asASSERT( paramSize <= AS_PPC_MAX_ARGS );
|
||||
}
|
||||
|
||||
|
||||
const asUINT paramCount = (asUINT)descr->parameterTypes.GetLength();
|
||||
|
||||
asBYTE * pCurArgType = (asBYTE*)&ppcArgsType[argsCnt];
|
||||
asBYTE * pCurFixedArgValue = (asBYTE*)&ppcArgs[argsCnt];
|
||||
asBYTE * pCurStackArgValue = (asBYTE*)args;
|
||||
|
||||
for( asUINT n = 0; n < paramCount; n++ )
|
||||
{
|
||||
argsCnt++;
|
||||
|
||||
if (descr->parameterTypes[n].IsFloatType() && !descr->parameterTypes[n].IsReference())
|
||||
{
|
||||
*pCurArgType++ = ppcFLOATARG;
|
||||
|
||||
*((float*) pCurFixedArgValue) = *((float*) pCurStackArgValue);
|
||||
|
||||
pCurFixedArgValue += 4;
|
||||
pCurStackArgValue += 4;
|
||||
}
|
||||
else if (descr->parameterTypes[n].IsDoubleType() && !descr->parameterTypes[n].IsReference())
|
||||
{
|
||||
*pCurArgType++ = ppcDOUBLEARG;
|
||||
|
||||
*((double*) pCurFixedArgValue) = *((double*) pCurStackArgValue);
|
||||
|
||||
pCurFixedArgValue += 8;
|
||||
pCurStackArgValue += 8;
|
||||
}
|
||||
else
|
||||
{
|
||||
// TODO: How should int64 and uint64 be passed natively?
|
||||
// Currently the code doesn't handle these types
|
||||
|
||||
// TODO: The code also ignore the fact that large objects
|
||||
// passed by value has been copied to the stack
|
||||
// in the above loop.
|
||||
|
||||
*pCurArgType++ = ppcINTARG;
|
||||
|
||||
*((int*) pCurFixedArgValue) = *((int*) pCurStackArgValue);
|
||||
|
||||
if( !descr->parameterTypes[n].IsReference() )
|
||||
{
|
||||
// If the arg is less that 4 bytes, then move the
|
||||
// bytes to the higher bytes within the dword
|
||||
asUINT numBytes = descr->parameterTypes[n].GetSizeInMemoryBytes();
|
||||
if( numBytes == 1 )
|
||||
{
|
||||
pCurFixedArgValue[3] = pCurFixedArgValue[0];
|
||||
pCurFixedArgValue[0] = 0;
|
||||
}
|
||||
else if( numBytes == 2 )
|
||||
{
|
||||
*(asWORD*)&pCurFixedArgValue[2] = *(asWORD*)&pCurFixedArgValue[0];
|
||||
*(asWORD*)&pCurFixedArgValue[0] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
pCurFixedArgValue += 4;
|
||||
pCurStackArgValue += 4;
|
||||
|
||||
// if it is a variable argument, account for the typeId
|
||||
// implicitly add another parameter (AFTER the parameter above) for the typeId
|
||||
if( IsVariableArgument(descr->parameterTypes[n]) )
|
||||
{
|
||||
argsCnt++;
|
||||
|
||||
*pCurArgType++ = ppcINTARG;
|
||||
|
||||
*((int*) pCurFixedArgValue) = *((int*) pCurStackArgValue);
|
||||
|
||||
pCurFixedArgValue += 4;
|
||||
pCurStackArgValue += 4;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Add the arg list end indicator
|
||||
ppcArgsType[argsCnt] = ppcENDARG;
|
||||
|
||||
switch( callConv )
|
||||
{
|
||||
case ICC_CDECL:
|
||||
case ICC_CDECL_RETURNINMEM:
|
||||
case ICC_STDCALL:
|
||||
case ICC_STDCALL_RETURNINMEM:
|
||||
case ICC_THISCALL:
|
||||
case ICC_THISCALL_RETURNINMEM:
|
||||
case ICC_CDECL_OBJFIRST:
|
||||
case ICC_CDECL_OBJFIRST_RETURNINMEM:
|
||||
{
|
||||
retQW = ppcFunc( ppcArgs, (asDWORD)func, ppcArgsType );
|
||||
break;
|
||||
}
|
||||
case ICC_VIRTUAL_THISCALL:
|
||||
case ICC_VIRTUAL_THISCALL_RETURNINMEM:
|
||||
{
|
||||
// Get virtual function table from the object pointer
|
||||
vftable = *(asDWORD**)obj;
|
||||
retQW = ppcFunc( ppcArgs, vftable[asDWORD(func)>>2], ppcArgsType );
|
||||
break;
|
||||
}
|
||||
case ICC_CDECL_OBJLAST:
|
||||
case ICC_CDECL_OBJLAST_RETURNINMEM:
|
||||
{
|
||||
// Add the object pointer as the last argument
|
||||
ppcArgsType[argsCnt++] = ppcINTARG;
|
||||
ppcArgsType[argsCnt] = ppcENDARG;
|
||||
*((asPWORD*)pCurFixedArgValue) = (asPWORD)obj;
|
||||
retQW = ppcFunc( ppcArgs, (asDWORD)func, ppcArgsType );
|
||||
break;
|
||||
}
|
||||
default:
|
||||
context->SetInternalException( TXT_INVALID_CALLING_CONVENTION );
|
||||
}
|
||||
|
||||
// If the return is a float value we need to get the value from the FP register
|
||||
if( sysFunc->hostReturnFloat )
|
||||
{
|
||||
if( sysFunc->hostReturnSize == 1 )
|
||||
*(asDWORD*)&retQW = GetReturnedFloat();
|
||||
else
|
||||
retQW = GetReturnedDouble();
|
||||
}
|
||||
else if( sysFunc->hostReturnSize == 1 )
|
||||
{
|
||||
// Move the bits to the higher value to compensate for the adjustment that the caller does
|
||||
retQW <<= 32;
|
||||
}
|
||||
|
||||
return retQW;
|
||||
}
|
||||
|
||||
END_AS_NAMESPACE
|
||||
|
||||
#endif // AS_XENON
|
||||
#endif // AS_MAX_PORTABILITY
|
||||
|
||||
|
||||
|
13034
lib/angelscript/source/as_compiler.cpp
Normal file
13034
lib/angelscript/source/as_compiler.cpp
Normal file
File diff suppressed because it is too large
Load Diff
350
lib/angelscript/source/as_compiler.h
Normal file
350
lib/angelscript/source/as_compiler.h
Normal file
@ -0,0 +1,350 @@
|
||||
/*
|
||||
AngelCode Scripting Library
|
||||
Copyright (c) 2003-2013 Andreas Jonsson
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any
|
||||
damages arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any
|
||||
purpose, including commercial applications, and to alter it and
|
||||
redistribute it freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you
|
||||
must not claim that you wrote the original software. If you use
|
||||
this software in a product, an acknowledgment in the product
|
||||
documentation would be appreciated but is not required.
|
||||
|
||||
2. Altered source versions must be plainly marked as such, and
|
||||
must not be misrepresented as being the original software.
|
||||
|
||||
3. This notice may not be removed or altered from any source
|
||||
distribution.
|
||||
|
||||
The original version of this library can be located at:
|
||||
http://www.angelcode.com/angelscript/
|
||||
|
||||
Andreas Jonsson
|
||||
andreas@angelcode.com
|
||||
*/
|
||||
|
||||
|
||||
//
|
||||
// as_compiler.h
|
||||
//
|
||||
// The class that does the actual compilation of the functions
|
||||
//
|
||||
|
||||
|
||||
|
||||
#ifndef AS_COMPILER_H
|
||||
#define AS_COMPILER_H
|
||||
|
||||
#include "as_config.h"
|
||||
|
||||
#ifndef AS_NO_COMPILER
|
||||
|
||||
#include "as_builder.h"
|
||||
#include "as_scriptfunction.h"
|
||||
#include "as_variablescope.h"
|
||||
#include "as_bytecode.h"
|
||||
#include "as_array.h"
|
||||
#include "as_datatype.h"
|
||||
#include "as_typeinfo.h"
|
||||
|
||||
BEGIN_AS_NAMESPACE
|
||||
|
||||
struct asSExprContext;
|
||||
|
||||
struct asSDeferredParam
|
||||
{
|
||||
asSDeferredParam() {argNode = 0; origExpr = 0;}
|
||||
|
||||
asCScriptNode *argNode;
|
||||
asCTypeInfo argType;
|
||||
int argInOutFlags;
|
||||
asSExprContext *origExpr;
|
||||
};
|
||||
|
||||
// TODO: refactor: asSExprContext should have indicators to inform where the value is,
|
||||
// i.e. if the reference to an object is pushed on the stack or not, etc
|
||||
|
||||
struct asSExprContext
|
||||
{
|
||||
asSExprContext(asCScriptEngine *engine) : bc(engine)
|
||||
{
|
||||
exprNode = 0;
|
||||
origExpr = 0;
|
||||
property_get = 0;
|
||||
property_set = 0;
|
||||
property_const = false;
|
||||
property_handle = false;
|
||||
property_ref = false;
|
||||
property_arg = 0;
|
||||
}
|
||||
~asSExprContext()
|
||||
{
|
||||
if( property_arg )
|
||||
asDELETE(property_arg, asSExprContext);
|
||||
}
|
||||
void Clear()
|
||||
{
|
||||
bc.ClearAll();
|
||||
type.SetDummy();
|
||||
if( property_arg )
|
||||
asDELETE(property_arg, asSExprContext);
|
||||
property_arg = 0;
|
||||
deferredParams.SetLength(0);
|
||||
exprNode = 0;
|
||||
origExpr = 0;
|
||||
property_get = 0;
|
||||
property_set = 0;
|
||||
property_const = false;
|
||||
property_handle = false;
|
||||
property_ref = false;
|
||||
methodName = "";
|
||||
}
|
||||
bool IsClassMethod()
|
||||
{
|
||||
if( type.dataType.GetObjectType() == 0 ) return false;
|
||||
if( methodName == "" ) return false;
|
||||
if( type.dataType.GetObjectType() == &type.dataType.GetObjectType()->engine->functionBehaviours ) return false;
|
||||
return true;
|
||||
}
|
||||
bool IsGlobalFunc()
|
||||
{
|
||||
if( type.dataType.GetObjectType() == 0 ) return false;
|
||||
if( methodName == "" ) return false;
|
||||
if( type.dataType.GetObjectType() != &type.dataType.GetObjectType()->engine->functionBehaviours ) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
asCByteCode bc;
|
||||
asCTypeInfo type;
|
||||
int property_get;
|
||||
int property_set;
|
||||
bool property_const; // If the object that is being accessed through property accessor is read-only
|
||||
bool property_handle; // If the property accessor is called on an object stored in a handle
|
||||
bool property_ref; // If the property accessor is called on a reference
|
||||
asSExprContext *property_arg;
|
||||
asCArray<asSDeferredParam> deferredParams;
|
||||
asCScriptNode *exprNode;
|
||||
asSExprContext *origExpr;
|
||||
// TODO: cleanup: use ambiguousName and an enum to say if it is a method, global func, or enum value
|
||||
asCString methodName;
|
||||
asCString enumValue;
|
||||
};
|
||||
|
||||
struct asSOverloadCandidate
|
||||
{
|
||||
asSOverloadCandidate() : funcId(0), cost(0) {}
|
||||
asSOverloadCandidate(int _id, asUINT _cost ) : funcId(_id), cost(_cost) {}
|
||||
int funcId;
|
||||
asUINT cost;
|
||||
};
|
||||
|
||||
enum EImplicitConv
|
||||
{
|
||||
asIC_IMPLICIT_CONV,
|
||||
asIC_EXPLICIT_REF_CAST,
|
||||
asIC_EXPLICIT_VAL_CAST
|
||||
};
|
||||
|
||||
enum EConvCost
|
||||
{
|
||||
asCC_NO_CONV = 0,
|
||||
asCC_CONST_CONV = 1,
|
||||
asCC_PRIMITIVE_SIZE_CONV = 2,
|
||||
asCC_SIGNED_CONV = 3,
|
||||
asCC_INT_FLOAT_CONV = 4,
|
||||
asCC_REF_CONV = 5,
|
||||
asCC_OBJ_TO_PRIMITIVE_CONV = 6,
|
||||
asCC_TO_OBJECT_CONV = 7,
|
||||
asCC_VARIABLE_CONV = 8
|
||||
};
|
||||
|
||||
class asCCompiler
|
||||
{
|
||||
public:
|
||||
asCCompiler(asCScriptEngine *engine);
|
||||
~asCCompiler();
|
||||
|
||||
int CompileFunction(asCBuilder *builder, asCScriptCode *script, asCArray<asCString> ¶meterNames, asCScriptNode *func, asCScriptFunction *outFunc, sClassDeclaration *classDecl);
|
||||
int CompileDefaultConstructor(asCBuilder *builder, asCScriptCode *script, asCScriptNode *node, asCScriptFunction *outFunc, sClassDeclaration *classDecl);
|
||||
int CompileFactory(asCBuilder *builder, asCScriptCode *script, asCScriptFunction *outFunc);
|
||||
int CompileGlobalVariable(asCBuilder *builder, asCScriptCode *script, asCScriptNode *expr, sGlobalVariableDescription *gvar, asCScriptFunction *outFunc);
|
||||
|
||||
protected:
|
||||
friend class asCBuilder;
|
||||
|
||||
void Reset(asCBuilder *builder, asCScriptCode *script, asCScriptFunction *outFunc);
|
||||
|
||||
// Statements
|
||||
void CompileStatementBlock(asCScriptNode *block, bool ownVariableScope, bool *hasReturn, asCByteCode *bc);
|
||||
void CompileDeclaration(asCScriptNode *decl, asCByteCode *bc);
|
||||
void CompileStatement(asCScriptNode *statement, bool *hasReturn, asCByteCode *bc);
|
||||
void CompileIfStatement(asCScriptNode *node, bool *hasReturn, asCByteCode *bc);
|
||||
void CompileSwitchStatement(asCScriptNode *node, bool *hasReturn, asCByteCode *bc);
|
||||
void CompileCase(asCScriptNode *node, asCByteCode *bc);
|
||||
void CompileForStatement(asCScriptNode *node, asCByteCode *bc);
|
||||
void CompileWhileStatement(asCScriptNode *node, asCByteCode *bc);
|
||||
void CompileDoWhileStatement(asCScriptNode *node, asCByteCode *bc);
|
||||
void CompileBreakStatement(asCScriptNode *node, asCByteCode *bc);
|
||||
void CompileContinueStatement(asCScriptNode *node, asCByteCode *bc);
|
||||
void CompileReturnStatement(asCScriptNode *node, asCByteCode *bc);
|
||||
void CompileExpressionStatement(asCScriptNode *node, asCByteCode *bc);
|
||||
|
||||
// Expressions
|
||||
int CompileAssignment(asCScriptNode *expr, asSExprContext *out);
|
||||
int CompileCondition(asCScriptNode *expr, asSExprContext *out);
|
||||
int CompileExpression(asCScriptNode *expr, asSExprContext *out);
|
||||
int CompilePostFixExpression(asCArray<asCScriptNode *> *postfix, asSExprContext *out);
|
||||
int CompileExpressionTerm(asCScriptNode *node, asSExprContext *out);
|
||||
int CompileExpressionPreOp(asCScriptNode *node, asSExprContext *out);
|
||||
int CompileExpressionPostOp(asCScriptNode *node, asSExprContext *out);
|
||||
int CompileExpressionValue(asCScriptNode *node, asSExprContext *out);
|
||||
int CompileFunctionCall(asCScriptNode *node, asSExprContext *out, asCObjectType *objectType, bool objIsConst, const asCString &scope = "");
|
||||
void CompileConstructCall(asCScriptNode *node, asSExprContext *out);
|
||||
void CompileConversion(asCScriptNode *node, asSExprContext *out);
|
||||
int CompileOperator(asCScriptNode *node, asSExprContext *l, asSExprContext *r, asSExprContext *out);
|
||||
void CompileOperatorOnHandles(asCScriptNode *node, asSExprContext *l, asSExprContext *r, asSExprContext *out);
|
||||
void CompileMathOperator(asCScriptNode *node, asSExprContext *l, asSExprContext *r, asSExprContext *out);
|
||||
void CompileBitwiseOperator(asCScriptNode *node, asSExprContext *l, asSExprContext *r, asSExprContext *out);
|
||||
void CompileComparisonOperator(asCScriptNode *node, asSExprContext *l, asSExprContext *r, asSExprContext *out);
|
||||
void CompileBooleanOperator(asCScriptNode *node, asSExprContext *l, asSExprContext *r, asSExprContext *out);
|
||||
bool CompileOverloadedDualOperator(asCScriptNode *node, asSExprContext *l, asSExprContext *r, asSExprContext *out);
|
||||
int CompileOverloadedDualOperator2(asCScriptNode *node, const char *methodName, asSExprContext *l, asSExprContext *r, asSExprContext *out, bool specificReturn = false, const asCDataType &returnType = asCDataType::CreatePrimitive(ttVoid, false));
|
||||
|
||||
void CompileInitList(asCTypeInfo *var, asCScriptNode *node, asCByteCode *bc, int isVarGlobOrMem);
|
||||
int CompileInitListElement(asSListPatternNode *&patternNode, asCScriptNode *&valueNode, int bufferTypeId, short bufferVar, asUINT &bufferSize, asCByteCode &byteCode);
|
||||
|
||||
int CallDefaultConstructor(asCDataType &type, int offset, bool isObjectOnHeap, asCByteCode *bc, asCScriptNode *node, int isVarGlobOrMem = 0, bool derefDest = false);
|
||||
int CallCopyConstructor(asCDataType &type, int offset, bool isObjectOnHeap, asCByteCode *bc, asSExprContext *arg, asCScriptNode *node, bool isGlobalVar = false, bool derefDestination = false);
|
||||
void CallDestructor(asCDataType &type, int offset, bool isObjectOnHeap, asCByteCode *bc);
|
||||
int CompileArgumentList(asCScriptNode *node, asCArray<asSExprContext *> &args);
|
||||
int CompileDefaultArgs(asCScriptNode *node, asCArray<asSExprContext*> &args, asCScriptFunction *func);
|
||||
asUINT MatchFunctions(asCArray<int> &funcs, asCArray<asSExprContext*> &args, asCScriptNode *node, const char *name, asCObjectType *objectType = NULL, bool isConstMethod = false, bool silent = false, bool allowObjectConstruct = true, const asCString &scope = "");
|
||||
int CompileVariableAccess(const asCString &name, const asCString &scope, asSExprContext *ctx, asCScriptNode *errNode, bool isOptional = false, bool noFunction = false, bool noGlobal = false, asCObjectType *objType = 0);
|
||||
void CompileMemberInitialization(asCByteCode *bc, bool onlyDefaults);
|
||||
bool CompileInitialization(asCScriptNode *node, asCByteCode *bc, asCDataType &type, asCScriptNode *errNode, int offset, asQWORD *constantValue, int isVarGlobOrMem);
|
||||
|
||||
// Helper functions
|
||||
void ProcessPropertyGetAccessor(asSExprContext *ctx, asCScriptNode *node);
|
||||
int ProcessPropertySetAccessor(asSExprContext *ctx, asSExprContext *arg, asCScriptNode *node);
|
||||
int FindPropertyAccessor(const asCString &name, asSExprContext *ctx, asCScriptNode *node, asSNameSpace *ns, bool isThisAccess = false);
|
||||
int FindPropertyAccessor(const asCString &name, asSExprContext *ctx, asSExprContext *arg, asCScriptNode *node, asSNameSpace *ns, bool isThisAccess = false);
|
||||
void PrepareTemporaryObject(asCScriptNode *node, asSExprContext *ctx, bool forceOnHeap = false);
|
||||
void PrepareOperand(asSExprContext *ctx, asCScriptNode *node);
|
||||
void PrepareForAssignment(asCDataType *lvalue, asSExprContext *rvalue, asCScriptNode *node, bool toTemporary, asSExprContext *lvalueExpr = 0);
|
||||
int PerformAssignment(asCTypeInfo *lvalue, asCTypeInfo *rvalue, asCByteCode *bc, asCScriptNode *node);
|
||||
bool IsVariableInitialized(asCTypeInfo *type, asCScriptNode *node);
|
||||
void Dereference(asSExprContext *ctx, bool generateCode);
|
||||
bool CompileRefCast(asSExprContext *ctx, const asCDataType &to, bool isExplicit, asCScriptNode *node, bool generateCode = true);
|
||||
asUINT MatchArgument(asCArray<int> &funcs, asCArray<asSOverloadCandidate> &matches, const asSExprContext *argExpr, int paramNum, bool allowObjectConstruct = true);
|
||||
void PerformFunctionCall(int funcId, asSExprContext *out, bool isConstructor = false, asCArray<asSExprContext*> *args = 0, asCObjectType *objTypeForConstruct = 0, bool useVariable = false, int varOffset = 0, int funcPtrVar = 0);
|
||||
void MoveArgsToStack(int funcId, asCByteCode *bc, asCArray<asSExprContext *> &args, bool addOneToOffset);
|
||||
void MakeFunctionCall(asSExprContext *ctx, int funcId, asCObjectType *objectType, asCArray<asSExprContext*> &args, asCScriptNode *node, bool useVariable = false, int stackOffset = 0, int funcPtrVar = 0);
|
||||
void PrepareFunctionCall(int funcId, asCByteCode *bc, asCArray<asSExprContext *> &args);
|
||||
void AfterFunctionCall(int funcId, asCArray<asSExprContext*> &args, asSExprContext *ctx, bool deferAll);
|
||||
void ProcessDeferredParams(asSExprContext *ctx);
|
||||
void PrepareArgument(asCDataType *paramType, asSExprContext *ctx, asCScriptNode *node, bool isFunction = false, int refType = 0, bool isMakingCopy = false);
|
||||
void PrepareArgument2(asSExprContext *ctx, asSExprContext *arg, asCDataType *paramType, bool isFunction = false, int refType = 0, bool isMakingCopy = false);
|
||||
bool IsLValue(asCTypeInfo &type);
|
||||
int DoAssignment(asSExprContext *out, asSExprContext *lctx, asSExprContext *rctx, asCScriptNode *lexpr, asCScriptNode *rexpr, int op, asCScriptNode *opNode);
|
||||
void MergeExprBytecode(asSExprContext *before, asSExprContext *after);
|
||||
void MergeExprBytecodeAndType(asSExprContext *before, asSExprContext *after);
|
||||
void FilterConst(asCArray<int> &funcs, bool removeConst = true);
|
||||
void ConvertToVariable(asSExprContext *ctx);
|
||||
void ConvertToVariableNotIn(asSExprContext *ctx, asSExprContext *exclude);
|
||||
void ConvertToTempVariable(asSExprContext *ctx);
|
||||
void ConvertToTempVariableNotIn(asSExprContext *ctx, asSExprContext *exclude);
|
||||
void ConvertToReference(asSExprContext *ctx);
|
||||
void PushVariableOnStack(asSExprContext *ctx, bool asReference);
|
||||
void DestroyVariables(asCByteCode *bc);
|
||||
asSNameSpace *DetermineNameSpace(const asCString &scope);
|
||||
int SetupParametersAndReturnVariable(asCArray<asCString> ¶meterNames, asCScriptNode *func);
|
||||
|
||||
void DetermineSingleFunc(asSExprContext *ctx, asCScriptNode *node);
|
||||
|
||||
// Returns the cost of the conversion (the sum of the EConvCost performed)
|
||||
asUINT ImplicitConversion(asSExprContext *ctx, const asCDataType &to, asCScriptNode *node, EImplicitConv convType, bool generateCode = true, bool allowObjectConstruct = true);
|
||||
asUINT ImplicitConvPrimitiveToPrimitive(asSExprContext *ctx, const asCDataType &to, asCScriptNode *node, EImplicitConv convType, bool generateCode = true);
|
||||
asUINT ImplicitConvObjectToPrimitive(asSExprContext *ctx, const asCDataType &to, asCScriptNode *node, EImplicitConv convType, bool generateCode = true);
|
||||
asUINT ImplicitConvPrimitiveToObject(asSExprContext *ctx, const asCDataType &to, asCScriptNode *node, EImplicitConv convType, bool generateCode = true, bool allowObjectConstruct = true);
|
||||
asUINT ImplicitConvObjectToObject(asSExprContext *ctx, const asCDataType &to, asCScriptNode *node, EImplicitConv convType, bool generateCode = true, bool allowObjectConstruct = true);
|
||||
asUINT ImplicitConvObjectRef(asSExprContext *ctx, const asCDataType &to, asCScriptNode *node, EImplicitConv convType, bool generateCode);
|
||||
asUINT ImplicitConvObjectValue(asSExprContext *ctx, const asCDataType &to, asCScriptNode *node, EImplicitConv convType, bool generateCode);
|
||||
void ImplicitConversionConstant(asSExprContext *ctx, const asCDataType &to, asCScriptNode *node, EImplicitConv convType);
|
||||
|
||||
void LineInstr(asCByteCode *bc, size_t pos);
|
||||
|
||||
asUINT ProcessStringConstant(asCString &str, asCScriptNode *node, bool processEscapeSequences = true);
|
||||
void ProcessHeredocStringConstant(asCString &str, asCScriptNode *node);
|
||||
int GetPrecedence(asCScriptNode *op);
|
||||
void Error(const asCString &msg, asCScriptNode *node);
|
||||
void Warning(const asCString &msg, asCScriptNode *node);
|
||||
void Information(const asCString &msg, asCScriptNode *node);
|
||||
void PrintMatchingFuncs(asCArray<int> &funcs, asCScriptNode *node);
|
||||
void AddVariableScope(bool isBreakScope = false, bool isContinueScope = false);
|
||||
void RemoveVariableScope();
|
||||
void FinalizeFunction();
|
||||
|
||||
asCByteCode byteCode;
|
||||
|
||||
bool hasCompileErrors;
|
||||
|
||||
int nextLabel;
|
||||
|
||||
asCVariableScope *variables;
|
||||
asCBuilder *builder;
|
||||
asCScriptEngine *engine;
|
||||
asCScriptCode *script;
|
||||
asCScriptFunction *outFunc;
|
||||
|
||||
bool m_isConstructor;
|
||||
bool m_isConstructorCalled;
|
||||
sClassDeclaration *m_classDecl;
|
||||
|
||||
asCArray<int> breakLabels;
|
||||
asCArray<int> continueLabels;
|
||||
|
||||
int AllocateVariable(const asCDataType &type, bool isTemporary, bool forceOnHeap = false);
|
||||
int AllocateVariableNotIn(const asCDataType &type, bool isTemporary, bool forceOnHeap, asSExprContext *ctx);
|
||||
int GetVariableOffset(int varIndex);
|
||||
int GetVariableSlot(int varOffset);
|
||||
void DeallocateVariable(int pos);
|
||||
void ReleaseTemporaryVariable(asCTypeInfo &t, asCByteCode *bc);
|
||||
void ReleaseTemporaryVariable(int offset, asCByteCode *bc);
|
||||
bool IsVariableOnHeap(int offset);
|
||||
|
||||
// This ordered array indicates the type of each variable
|
||||
asCArray<asCDataType> variableAllocations;
|
||||
|
||||
// This ordered array indicates which variables are temporaries or not
|
||||
asCArray<bool> variableIsTemporary;
|
||||
|
||||
// This unordered array gives the offsets of all temporary variables, whether currently allocated or not
|
||||
asCArray<int> tempVariableOffsets;
|
||||
|
||||
// This ordered array indicated if the variable is on the heap or not
|
||||
asCArray<bool> variableIsOnHeap;
|
||||
|
||||
// This unordered array gives the indexes of the currently unused variables
|
||||
asCArray<int> freeVariables;
|
||||
|
||||
// This array holds the offsets of the currently allocated temporary variables
|
||||
asCArray<int> tempVariables;
|
||||
|
||||
// This array holds the indices of variables that must not be used in an allocation
|
||||
asCArray<int> reservedVariables;
|
||||
|
||||
bool isCompilingDefaultArg;
|
||||
bool isProcessingDeferredParams;
|
||||
int noCodeOutput;
|
||||
};
|
||||
|
||||
END_AS_NAMESPACE
|
||||
|
||||
#endif // AS_NO_COMPILER
|
||||
|
||||
#endif
|
1102
lib/angelscript/source/as_config.h
Normal file
1102
lib/angelscript/source/as_config.h
Normal file
File diff suppressed because it is too large
Load Diff
257
lib/angelscript/source/as_configgroup.cpp
Normal file
257
lib/angelscript/source/as_configgroup.cpp
Normal file
@ -0,0 +1,257 @@
|
||||
/*
|
||||
AngelCode Scripting Library
|
||||
Copyright (c) 2003-2013 Andreas Jonsson
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any
|
||||
damages arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any
|
||||
purpose, including commercial applications, and to alter it and
|
||||
redistribute it freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you
|
||||
must not claim that you wrote the original software. If you use
|
||||
this software in a product, an acknowledgment in the product
|
||||
documentation would be appreciated but is not required.
|
||||
|
||||
2. Altered source versions must be plainly marked as such, and
|
||||
must not be misrepresented as being the original software.
|
||||
|
||||
3. This notice may not be removed or altered from any source
|
||||
distribution.
|
||||
|
||||
The original version of this library can be located at:
|
||||
http://www.angelcode.com/angelscript/
|
||||
|
||||
Andreas Jonsson
|
||||
andreas@angelcode.com
|
||||
*/
|
||||
|
||||
|
||||
//
|
||||
// as_configgroup.cpp
|
||||
//
|
||||
// This class holds configuration groups for the engine
|
||||
//
|
||||
|
||||
|
||||
|
||||
#include "as_config.h"
|
||||
#include "as_configgroup.h"
|
||||
#include "as_scriptengine.h"
|
||||
#include "as_texts.h"
|
||||
|
||||
BEGIN_AS_NAMESPACE
|
||||
|
||||
asCConfigGroup::asCConfigGroup()
|
||||
{
|
||||
refCount = 0;
|
||||
}
|
||||
|
||||
asCConfigGroup::~asCConfigGroup()
|
||||
{
|
||||
}
|
||||
|
||||
int asCConfigGroup::AddRef()
|
||||
{
|
||||
refCount++;
|
||||
return refCount;
|
||||
}
|
||||
|
||||
int asCConfigGroup::Release()
|
||||
{
|
||||
// Don't delete the object here, the engine will delete the object when ready
|
||||
refCount--;
|
||||
return refCount;
|
||||
}
|
||||
|
||||
asCObjectType *asCConfigGroup::FindType(const char *obj)
|
||||
{
|
||||
for( asUINT n = 0; n < objTypes.GetLength(); n++ )
|
||||
if( objTypes[n]->name == obj )
|
||||
return objTypes[n];
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void asCConfigGroup::RefConfigGroup(asCConfigGroup *group)
|
||||
{
|
||||
if( group == this || group == 0 ) return;
|
||||
|
||||
// Verify if the group is already referenced
|
||||
for( asUINT n = 0; n < referencedConfigGroups.GetLength(); n++ )
|
||||
if( referencedConfigGroups[n] == group )
|
||||
return;
|
||||
|
||||
referencedConfigGroups.PushLast(group);
|
||||
group->AddRef();
|
||||
}
|
||||
|
||||
bool asCConfigGroup::HasLiveObjects()
|
||||
{
|
||||
for( asUINT n = 0; n < objTypes.GetLength(); n++ )
|
||||
if( objTypes[n]->GetRefCount() != 0 )
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void asCConfigGroup::RemoveConfiguration(asCScriptEngine *engine, bool notUsed)
|
||||
{
|
||||
asASSERT( refCount == 0 );
|
||||
|
||||
asUINT n;
|
||||
|
||||
// Remove global variables
|
||||
for( n = 0; n < globalProps.GetLength(); n++ )
|
||||
{
|
||||
int index = engine->registeredGlobalProps.GetIndex(globalProps[n]);
|
||||
if( index >= 0 )
|
||||
{
|
||||
globalProps[n]->Release();
|
||||
|
||||
// TODO: global: Should compact the registeredGlobalProps array
|
||||
engine->registeredGlobalProps.Erase(index);
|
||||
}
|
||||
}
|
||||
globalProps.SetLength(0);
|
||||
|
||||
// Remove global functions
|
||||
for( n = 0; n < scriptFunctions.GetLength(); n++ )
|
||||
{
|
||||
int index = engine->registeredGlobalFuncs.GetIndex(scriptFunctions[n]);
|
||||
if( index >= 0 )
|
||||
engine->registeredGlobalFuncs.Erase(index);
|
||||
scriptFunctions[n]->Release();
|
||||
if( engine->stringFactory == scriptFunctions[n] )
|
||||
engine->stringFactory = 0;
|
||||
}
|
||||
scriptFunctions.SetLength(0);
|
||||
|
||||
// Remove behaviours and members of object types
|
||||
for( n = 0; n < objTypes.GetLength(); n++ )
|
||||
{
|
||||
asCObjectType *obj = objTypes[n];
|
||||
|
||||
obj->ReleaseAllFunctions();
|
||||
}
|
||||
|
||||
// Remove function definitions
|
||||
for( n = 0; n < funcDefs.GetLength(); n++ )
|
||||
{
|
||||
engine->registeredFuncDefs.RemoveValue(funcDefs[n]);
|
||||
funcDefs[n]->Release();
|
||||
}
|
||||
funcDefs.SetLength(0);
|
||||
|
||||
engine->ClearUnusedTypes();
|
||||
|
||||
// Remove object types (skip this if it is possible other groups are still using the types)
|
||||
if( !notUsed )
|
||||
{
|
||||
for( n = 0; n < objTypes.GetLength(); n++ )
|
||||
{
|
||||
asCObjectType *t = objTypes[n];
|
||||
asSMapNode<asSNameSpaceNamePair, asCObjectType*> *cursor;
|
||||
if( engine->allRegisteredTypes.MoveTo(&cursor, asSNameSpaceNamePair(t->nameSpace, t->name)) &&
|
||||
cursor->value == t )
|
||||
{
|
||||
#ifdef AS_DEBUG
|
||||
ValidateNoUsage(engine, t);
|
||||
#endif
|
||||
|
||||
engine->allRegisteredTypes.Erase(cursor);
|
||||
if( engine->defaultArrayObjectType == t )
|
||||
engine->defaultArrayObjectType = 0;
|
||||
|
||||
if( t->flags & asOBJ_TYPEDEF )
|
||||
engine->registeredTypeDefs.RemoveValue(t);
|
||||
else if( t->flags & asOBJ_ENUM )
|
||||
engine->registeredEnums.RemoveValue(t);
|
||||
else if( t->flags & asOBJ_TEMPLATE )
|
||||
engine->registeredTemplateTypes.RemoveValue(t);
|
||||
else
|
||||
engine->registeredObjTypes.RemoveValue(t);
|
||||
|
||||
asDELETE(t, asCObjectType);
|
||||
}
|
||||
else
|
||||
{
|
||||
int idx = engine->templateInstanceTypes.IndexOf(t);
|
||||
if( idx >= 0 )
|
||||
{
|
||||
#ifdef AS_DEBUG
|
||||
ValidateNoUsage(engine, t);
|
||||
#endif
|
||||
|
||||
engine->templateInstanceTypes.RemoveIndexUnordered(idx);
|
||||
t->templateSubTypes.SetLength(0);
|
||||
|
||||
asDELETE(t, asCObjectType);
|
||||
}
|
||||
}
|
||||
}
|
||||
objTypes.SetLength(0);
|
||||
}
|
||||
|
||||
// Release other config groups
|
||||
for( n = 0; n < referencedConfigGroups.GetLength(); n++ )
|
||||
referencedConfigGroups[n]->refCount--;
|
||||
referencedConfigGroups.SetLength(0);
|
||||
}
|
||||
|
||||
#ifdef AS_DEBUG
|
||||
void asCConfigGroup::ValidateNoUsage(asCScriptEngine *engine, asCObjectType *type)
|
||||
{
|
||||
for( asUINT n = 0; n < engine->scriptFunctions.GetLength(); n++ )
|
||||
{
|
||||
asCScriptFunction *func = engine->scriptFunctions[n];
|
||||
if( func == 0 ) continue;
|
||||
|
||||
// Ignore factory, list factory, and members
|
||||
if( func->name == "_beh_3_" || func->name == "_beh_4_" || func->objectType == type )
|
||||
continue;
|
||||
|
||||
// Ignore function definitions too, as they aren't released until the engine is destroyed
|
||||
if( func->funcType == asFUNC_FUNCDEF )
|
||||
continue;
|
||||
|
||||
// Ignore functions whose object type has already reached refCount 0 as they are to be removed
|
||||
if( func->objectType && func->objectType->GetRefCount() == 0 )
|
||||
continue;
|
||||
|
||||
if( func->returnType.GetObjectType() == type )
|
||||
{
|
||||
asCString msg;
|
||||
// We can only use the function name here, because the types used by the function may have been deleted already
|
||||
msg.Format(TXT_TYPE_s_IS_STILL_USED_BY_FUNC_s, type->name.AddressOf(), func->GetDeclaration());
|
||||
engine->WriteMessage("", 0, 0, asMSGTYPE_ERROR, msg.AddressOf());
|
||||
}
|
||||
else
|
||||
{
|
||||
for( asUINT p = 0; p < func->parameterTypes.GetLength(); p++ )
|
||||
{
|
||||
if( func->parameterTypes[p].GetObjectType() == type )
|
||||
{
|
||||
asCString msg;
|
||||
// We can only use the function name here, because the types used by the function may have been deleted already
|
||||
msg.Format(TXT_TYPE_s_IS_STILL_USED_BY_FUNC_s, type->name.AddressOf(), func->GetDeclaration());
|
||||
engine->WriteMessage("", 0, 0, asMSGTYPE_ERROR, msg.AddressOf());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: Check also usage of the type in global variables
|
||||
|
||||
// TODO: Check also usage of the type in local variables in script functions
|
||||
|
||||
// TODO: Check also usage of the type as members of classes
|
||||
|
||||
// TODO: Check also usage of the type as sub types in other types
|
||||
}
|
||||
#endif
|
||||
|
||||
END_AS_NAMESPACE
|
82
lib/angelscript/source/as_configgroup.h
Normal file
82
lib/angelscript/source/as_configgroup.h
Normal file
@ -0,0 +1,82 @@
|
||||
/*
|
||||
AngelCode Scripting Library
|
||||
Copyright (c) 2003-2012 Andreas Jonsson
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any
|
||||
damages arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any
|
||||
purpose, including commercial applications, and to alter it and
|
||||
redistribute it freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you
|
||||
must not claim that you wrote the original software. If you use
|
||||
this software in a product, an acknowledgment in the product
|
||||
documentation would be appreciated but is not required.
|
||||
|
||||
2. Altered source versions must be plainly marked as such, and
|
||||
must not be misrepresented as being the original software.
|
||||
|
||||
3. This notice may not be removed or altered from any source
|
||||
distribution.
|
||||
|
||||
The original version of this library can be located at:
|
||||
http://www.angelcode.com/angelscript/
|
||||
|
||||
Andreas Jonsson
|
||||
andreas@angelcode.com
|
||||
*/
|
||||
|
||||
|
||||
//
|
||||
// as_configgroup.h
|
||||
//
|
||||
// This class holds configuration groups for the engine
|
||||
//
|
||||
|
||||
|
||||
|
||||
#ifndef AS_CONFIGGROUP_H
|
||||
#define AS_CONFIGGROUP_H
|
||||
|
||||
#include "as_config.h"
|
||||
#include "as_string.h"
|
||||
#include "as_array.h"
|
||||
#include "as_objecttype.h"
|
||||
|
||||
BEGIN_AS_NAMESPACE
|
||||
|
||||
class asCConfigGroup
|
||||
{
|
||||
public:
|
||||
asCConfigGroup();
|
||||
~asCConfigGroup();
|
||||
|
||||
// Memory management
|
||||
int AddRef();
|
||||
int Release();
|
||||
|
||||
asCObjectType *FindType(const char *obj);
|
||||
void RefConfigGroup(asCConfigGroup *group);
|
||||
|
||||
bool HasLiveObjects();
|
||||
void RemoveConfiguration(asCScriptEngine *engine, bool notUsed = false);
|
||||
|
||||
#ifdef AS_DEBUG
|
||||
void ValidateNoUsage(asCScriptEngine *engine, asCObjectType *type);
|
||||
#endif
|
||||
|
||||
asCString groupName;
|
||||
int refCount;
|
||||
|
||||
asCArray<asCObjectType*> objTypes;
|
||||
asCArray<asCScriptFunction*> scriptFunctions;
|
||||
asCArray<asCGlobalProperty*> globalProps;
|
||||
asCArray<asCConfigGroup*> referencedConfigGroups;
|
||||
asCArray<asCScriptFunction*> funcDefs;
|
||||
};
|
||||
|
||||
END_AS_NAMESPACE
|
||||
|
||||
#endif
|
5470
lib/angelscript/source/as_context.cpp
Normal file
5470
lib/angelscript/source/as_context.cpp
Normal file
File diff suppressed because it is too large
Load Diff
244
lib/angelscript/source/as_context.h
Normal file
244
lib/angelscript/source/as_context.h
Normal file
@ -0,0 +1,244 @@
|
||||
/*
|
||||
AngelCode Scripting Library
|
||||
Copyright (c) 2003-2014 Andreas Jonsson
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any
|
||||
damages arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any
|
||||
purpose, including commercial applications, and to alter it and
|
||||
redistribute it freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you
|
||||
must not claim that you wrote the original software. If you use
|
||||
this software in a product, an acknowledgment in the product
|
||||
documentation would be appreciated but is not required.
|
||||
|
||||
2. Altered source versions must be plainly marked as such, and
|
||||
must not be misrepresented as being the original software.
|
||||
|
||||
3. This notice may not be removed or altered from any source
|
||||
distribution.
|
||||
|
||||
The original version of this library can be located at:
|
||||
http://www.angelcode.com/angelscript/
|
||||
|
||||
Andreas Jonsson
|
||||
andreas@angelcode.com
|
||||
*/
|
||||
|
||||
|
||||
//
|
||||
// as_context.h
|
||||
//
|
||||
// This class handles the execution of the byte code
|
||||
//
|
||||
|
||||
|
||||
#ifndef AS_CONTEXT_H
|
||||
#define AS_CONTEXT_H
|
||||
|
||||
#include "as_config.h"
|
||||
#include "as_atomic.h"
|
||||
#include "as_array.h"
|
||||
#include "as_string.h"
|
||||
#include "as_objecttype.h"
|
||||
#include "as_callfunc.h"
|
||||
|
||||
BEGIN_AS_NAMESPACE
|
||||
|
||||
class asCScriptFunction;
|
||||
class asCScriptEngine;
|
||||
|
||||
class asCContext : public asIScriptContext
|
||||
{
|
||||
public:
|
||||
// Memory management
|
||||
int AddRef() const;
|
||||
int Release() const;
|
||||
|
||||
// Miscellaneous
|
||||
asIScriptEngine *GetEngine() const;
|
||||
|
||||
// Execution
|
||||
int Prepare(asIScriptFunction *func);
|
||||
int Unprepare();
|
||||
int Execute();
|
||||
int Abort();
|
||||
int Suspend();
|
||||
asEContextState GetState() const;
|
||||
int PushState();
|
||||
int PopState();
|
||||
bool IsNested(asUINT *nestCount = 0) const;
|
||||
|
||||
// Object pointer for calling class methods
|
||||
int SetObject(void *obj);
|
||||
|
||||
// Arguments
|
||||
int SetArgByte(asUINT arg, asBYTE value);
|
||||
int SetArgWord(asUINT arg, asWORD value);
|
||||
int SetArgDWord(asUINT arg, asDWORD value);
|
||||
int SetArgQWord(asUINT arg, asQWORD value);
|
||||
int SetArgFloat(asUINT arg, float value);
|
||||
int SetArgDouble(asUINT arg, double value);
|
||||
int SetArgAddress(asUINT arg, void *addr);
|
||||
int SetArgObject(asUINT arg, void *obj);
|
||||
void *GetAddressOfArg(asUINT arg);
|
||||
|
||||
// Return value
|
||||
asBYTE GetReturnByte();
|
||||
asWORD GetReturnWord();
|
||||
asDWORD GetReturnDWord();
|
||||
asQWORD GetReturnQWord();
|
||||
float GetReturnFloat();
|
||||
double GetReturnDouble();
|
||||
void *GetReturnAddress();
|
||||
void *GetReturnObject();
|
||||
void *GetAddressOfReturnValue();
|
||||
|
||||
// Exception handling
|
||||
int SetException(const char *descr);
|
||||
int GetExceptionLineNumber(int *column, const char **sectionName);
|
||||
asIScriptFunction *GetExceptionFunction();
|
||||
const char * GetExceptionString();
|
||||
int SetExceptionCallback(asSFuncPtr callback, void *obj, int callConv);
|
||||
void ClearExceptionCallback();
|
||||
|
||||
// Debugging
|
||||
int SetLineCallback(asSFuncPtr callback, void *obj, int callConv);
|
||||
void ClearLineCallback();
|
||||
asUINT GetCallstackSize() const;
|
||||
asIScriptFunction *GetFunction(asUINT stackLevel);
|
||||
int GetLineNumber(asUINT stackLevel, int *column, const char **sectionName);
|
||||
int GetVarCount(asUINT stackLevel);
|
||||
const char *GetVarName(asUINT varIndex, asUINT stackLevel);
|
||||
const char *GetVarDeclaration(asUINT varIndex, asUINT stackLevel, bool includeNamespace);
|
||||
int GetVarTypeId(asUINT varIndex, asUINT stackLevel);
|
||||
void *GetAddressOfVar(asUINT varIndex, asUINT stackLevel);
|
||||
bool IsVarInScope(asUINT varIndex, asUINT stackLevel);
|
||||
int GetThisTypeId(asUINT stackLevel);
|
||||
void *GetThisPointer(asUINT stackLevel);
|
||||
asIScriptFunction *GetSystemFunction();
|
||||
|
||||
// User data
|
||||
void *SetUserData(void *data);
|
||||
void *GetUserData() const;
|
||||
|
||||
public:
|
||||
// Internal public functions
|
||||
asCContext(asCScriptEngine *engine, bool holdRef);
|
||||
virtual ~asCContext();
|
||||
|
||||
//protected:
|
||||
friend class asCScriptEngine;
|
||||
|
||||
void CallLineCallback();
|
||||
void CallExceptionCallback();
|
||||
|
||||
int CallGeneric(int funcID, void *objectPointer);
|
||||
|
||||
void DetachEngine();
|
||||
|
||||
void ExecuteNext();
|
||||
void CleanStack();
|
||||
void CleanStackFrame();
|
||||
void CleanArgsOnStack();
|
||||
void CleanReturnObject();
|
||||
void DetermineLiveObjects(asCArray<int> &liveObjects, asUINT stackLevel);
|
||||
|
||||
void PushCallState();
|
||||
void PopCallState();
|
||||
void CallScriptFunction(asCScriptFunction *func);
|
||||
void CallInterfaceMethod(asCScriptFunction *func);
|
||||
void PrepareScriptFunction();
|
||||
|
||||
bool ReserveStackSpace(asUINT size);
|
||||
|
||||
void SetInternalException(const char *descr);
|
||||
|
||||
// Must be protected for multiple accesses
|
||||
mutable asCAtomic m_refCount;
|
||||
|
||||
bool m_holdEngineRef;
|
||||
asCScriptEngine *m_engine;
|
||||
|
||||
asEContextState m_status;
|
||||
bool m_doSuspend;
|
||||
bool m_doAbort;
|
||||
bool m_externalSuspendRequest;
|
||||
|
||||
asCScriptFunction *m_currentFunction;
|
||||
asCScriptFunction *m_callingSystemFunction;
|
||||
|
||||
// The call stack holds program pointer, stack pointer, etc for caller functions
|
||||
asCArray<size_t> m_callStack;
|
||||
|
||||
// Dynamically growing local stack
|
||||
asCArray<asDWORD *> m_stackBlocks;
|
||||
asUINT m_stackBlockSize;
|
||||
asUINT m_stackIndex;
|
||||
asDWORD *m_originalStackPointer;
|
||||
|
||||
// Exception handling
|
||||
bool m_isStackMemoryNotAllocated;
|
||||
bool m_needToCleanupArgs;
|
||||
bool m_inExceptionHandler;
|
||||
asCString m_exceptionString;
|
||||
int m_exceptionFunction;
|
||||
int m_exceptionSectionIdx;
|
||||
int m_exceptionLine;
|
||||
int m_exceptionColumn;
|
||||
|
||||
// The last prepared function, and some cached values related to it
|
||||
asCScriptFunction *m_initialFunction;
|
||||
int m_returnValueSize;
|
||||
int m_argumentsSize;
|
||||
|
||||
// callbacks
|
||||
bool m_lineCallback;
|
||||
asSSystemFunctionInterface m_lineCallbackFunc;
|
||||
void * m_lineCallbackObj;
|
||||
|
||||
bool m_exceptionCallback;
|
||||
asSSystemFunctionInterface m_exceptionCallbackFunc;
|
||||
void * m_exceptionCallbackObj;
|
||||
|
||||
void *m_userData;
|
||||
|
||||
// Registers available to JIT compiler functions
|
||||
asSVMRegisters m_regs;
|
||||
};
|
||||
|
||||
// TODO: Move these to as_utils.h
|
||||
int as_powi(int base, int exponent, bool& isOverflow);
|
||||
asDWORD as_powu(asDWORD base, asDWORD exponent, bool& isOverflow);
|
||||
asINT64 as_powi64(asINT64 base, asINT64 exponent, bool& isOverflow);
|
||||
asQWORD as_powu64(asQWORD base, asQWORD exponent, bool& isOverflow);
|
||||
|
||||
// Optional template version of powi if overflow detection is not used.
|
||||
#if 0
|
||||
template <class T>
|
||||
T as_powi(T base, T exponent)
|
||||
{
|
||||
// Test for sign bit (huge number is OK)
|
||||
if( exponent & (T(1)<<(sizeof(T)*8-1)) )
|
||||
return 0;
|
||||
else
|
||||
{
|
||||
int result = 1;
|
||||
while( exponent )
|
||||
{
|
||||
if( exponent & 1 )
|
||||
result *= base;
|
||||
exponent >>= 1;
|
||||
base *= base;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
END_AS_NAMESPACE
|
||||
|
||||
#endif
|
187
lib/angelscript/source/as_criticalsection.h
Normal file
187
lib/angelscript/source/as_criticalsection.h
Normal file
@ -0,0 +1,187 @@
|
||||
/*
|
||||
AngelCode Scripting Library
|
||||
Copyright (c) 2003-2014 Andreas Jonsson
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any
|
||||
damages arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any
|
||||
purpose, including commercial applications, and to alter it and
|
||||
redistribute it freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you
|
||||
must not claim that you wrote the original software. If you use
|
||||
this software in a product, an acknowledgment in the product
|
||||
documentation would be appreciated but is not required.
|
||||
|
||||
2. Altered source versions must be plainly marked as such, and
|
||||
must not be misrepresented as being the original software.
|
||||
|
||||
3. This notice may not be removed or altered from any source
|
||||
distribution.
|
||||
|
||||
The original version of this library can be located at:
|
||||
http://www.angelcode.com/angelscript/
|
||||
|
||||
Andreas Jonsson
|
||||
andreas@angelcode.com
|
||||
*/
|
||||
|
||||
|
||||
|
||||
//
|
||||
// as_criticalsection.h
|
||||
//
|
||||
// Classes for multi threading support
|
||||
//
|
||||
|
||||
#ifndef AS_CRITICALSECTION_H
|
||||
#define AS_CRITICALSECTION_H
|
||||
|
||||
#include "as_config.h"
|
||||
|
||||
BEGIN_AS_NAMESPACE
|
||||
|
||||
#ifdef AS_NO_THREADS
|
||||
|
||||
#define DECLARECRITICALSECTION(x)
|
||||
#define ENTERCRITICALSECTION(x)
|
||||
#define LEAVECRITICALSECTION(x)
|
||||
|
||||
inline bool tryEnter() { return true; }
|
||||
#define TRYENTERCRITICALSECTION(x) tryEnter()
|
||||
|
||||
#define DECLAREREADWRITELOCK(x)
|
||||
#define ACQUIREEXCLUSIVE(x)
|
||||
#define RELEASEEXCLUSIVE(x)
|
||||
#define ACQUIRESHARED(x)
|
||||
#define RELEASESHARED(x)
|
||||
|
||||
#else
|
||||
|
||||
#define DECLARECRITICALSECTION(x) asCThreadCriticalSection x;
|
||||
#define ENTERCRITICALSECTION(x) x.Enter()
|
||||
#define LEAVECRITICALSECTION(x) x.Leave()
|
||||
#define TRYENTERCRITICALSECTION(x) x.TryEnter()
|
||||
|
||||
#define DECLAREREADWRITELOCK(x) asCThreadReadWriteLock x;
|
||||
#define ACQUIREEXCLUSIVE(x) x.AcquireExclusive()
|
||||
#define RELEASEEXCLUSIVE(x) x.ReleaseExclusive()
|
||||
#define ACQUIRESHARED(x) x.AcquireShared()
|
||||
#define RELEASESHARED(x) x.ReleaseShared()
|
||||
|
||||
#ifdef AS_POSIX_THREADS
|
||||
|
||||
END_AS_NAMESPACE
|
||||
#include <pthread.h>
|
||||
BEGIN_AS_NAMESPACE
|
||||
|
||||
class asCThreadCriticalSection
|
||||
{
|
||||
public:
|
||||
asCThreadCriticalSection();
|
||||
~asCThreadCriticalSection();
|
||||
|
||||
void Enter();
|
||||
void Leave();
|
||||
bool TryEnter();
|
||||
|
||||
protected:
|
||||
pthread_mutex_t cs;
|
||||
};
|
||||
|
||||
class asCThreadReadWriteLock
|
||||
{
|
||||
public:
|
||||
asCThreadReadWriteLock();
|
||||
~asCThreadReadWriteLock();
|
||||
|
||||
void AcquireExclusive();
|
||||
void ReleaseExclusive();
|
||||
bool TryAcquireExclusive();
|
||||
|
||||
void AcquireShared();
|
||||
void ReleaseShared();
|
||||
bool TryAcquireShared();
|
||||
|
||||
protected:
|
||||
pthread_rwlock_t lock;
|
||||
};
|
||||
|
||||
#elif defined(AS_WINDOWS_THREADS)
|
||||
|
||||
END_AS_NAMESPACE
|
||||
#ifdef AS_XBOX360
|
||||
#include <xtl.h>
|
||||
#else
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#ifndef _WIN32_WINNT
|
||||
#define _WIN32_WINNT 0x0600 // We need this to get the declaration for Windows Phone compatible Ex functions
|
||||
#endif
|
||||
#include <windows.h>
|
||||
#endif
|
||||
BEGIN_AS_NAMESPACE
|
||||
|
||||
// Undefine macros that cause problems in our code
|
||||
#undef GetObject
|
||||
#undef RegisterClass
|
||||
|
||||
class asCThreadCriticalSection
|
||||
{
|
||||
public:
|
||||
asCThreadCriticalSection();
|
||||
~asCThreadCriticalSection();
|
||||
|
||||
void Enter();
|
||||
void Leave();
|
||||
bool TryEnter();
|
||||
|
||||
protected:
|
||||
CRITICAL_SECTION cs;
|
||||
};
|
||||
|
||||
class asCThreadReadWriteLock
|
||||
{
|
||||
public:
|
||||
asCThreadReadWriteLock();
|
||||
~asCThreadReadWriteLock();
|
||||
|
||||
void AcquireExclusive();
|
||||
void ReleaseExclusive();
|
||||
|
||||
void AcquireShared();
|
||||
void ReleaseShared();
|
||||
|
||||
protected:
|
||||
// The Slim Read Write Lock object, SRWLOCK, is more efficient
|
||||
// but it is only available from Windows Vista so we cannot use it and
|
||||
// maintain compatibility with olders versions of Windows.
|
||||
|
||||
// Critical sections and semaphores are available on Windows XP and onwards.
|
||||
// Windows XP is oldest version we support with multithreading.
|
||||
|
||||
// The implementation is based on the following article, that shows
|
||||
// how to implement a fair read/write lock that doesn't risk starving
|
||||
// the writers:
|
||||
|
||||
// http://doc.qt.nokia.com/qq/qq11-mutex.html
|
||||
|
||||
// TODO: Allow use of SRWLOCK through configuration in as_config.h
|
||||
|
||||
CRITICAL_SECTION writeLock;
|
||||
HANDLE readLocks;
|
||||
};
|
||||
|
||||
// This constant really should be a member of asCThreadReadWriteLock,
|
||||
// but it gives a compiler error on MSVC6 so I'm leaving it outside
|
||||
static const asUINT maxReaders = 10;
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
END_AS_NAMESPACE
|
||||
|
||||
#endif
|
||||
|
586
lib/angelscript/source/as_datatype.cpp
Normal file
586
lib/angelscript/source/as_datatype.cpp
Normal file
@ -0,0 +1,586 @@
|
||||
/*
|
||||
AngelCode Scripting Library
|
||||
Copyright (c) 2003-2013 Andreas Jonsson
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any
|
||||
damages arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any
|
||||
purpose, including commercial applications, and to alter it and
|
||||
redistribute it freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you
|
||||
must not claim that you wrote the original software. If you use
|
||||
this software in a product, an acknowledgment in the product
|
||||
documentation would be appreciated but is not required.
|
||||
|
||||
2. Altered source versions must be plainly marked as such, and
|
||||
must not be misrepresented as being the original software.
|
||||
|
||||
3. This notice may not be removed or altered from any source
|
||||
distribution.
|
||||
|
||||
The original version of this library can be located at:
|
||||
http://www.angelcode.com/angelscript/
|
||||
|
||||
Andreas Jonsson
|
||||
andreas@angelcode.com
|
||||
*/
|
||||
|
||||
|
||||
//
|
||||
// as_datatype.cpp
|
||||
//
|
||||
// This class describes the datatype for expressions during compilation
|
||||
//
|
||||
|
||||
#include "as_config.h"
|
||||
#include "as_datatype.h"
|
||||
#include "as_tokendef.h"
|
||||
#include "as_objecttype.h"
|
||||
#include "as_scriptengine.h"
|
||||
#include "as_tokenizer.h"
|
||||
|
||||
BEGIN_AS_NAMESPACE
|
||||
|
||||
asCDataType::asCDataType()
|
||||
{
|
||||
tokenType = ttUnrecognizedToken;
|
||||
objectType = 0;
|
||||
isReference = false;
|
||||
isReadOnly = false;
|
||||
isObjectHandle = false;
|
||||
isConstHandle = false;
|
||||
funcDef = 0;
|
||||
}
|
||||
|
||||
asCDataType::asCDataType(const asCDataType &dt)
|
||||
{
|
||||
tokenType = dt.tokenType;
|
||||
objectType = dt.objectType;
|
||||
isReference = dt.isReference;
|
||||
isReadOnly = dt.isReadOnly;
|
||||
isObjectHandle = dt.isObjectHandle;
|
||||
isConstHandle = dt.isConstHandle;
|
||||
funcDef = dt.funcDef;
|
||||
}
|
||||
|
||||
asCDataType::~asCDataType()
|
||||
{
|
||||
}
|
||||
|
||||
bool asCDataType::IsValid() const
|
||||
{
|
||||
if( tokenType == ttUnrecognizedToken &&
|
||||
!isObjectHandle )
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
asCDataType asCDataType::CreateObject(asCObjectType *ot, bool isConst)
|
||||
{
|
||||
asCDataType dt;
|
||||
|
||||
dt.tokenType = ttIdentifier;
|
||||
dt.objectType = ot;
|
||||
dt.isReadOnly = isConst;
|
||||
|
||||
return dt;
|
||||
}
|
||||
|
||||
asCDataType asCDataType::CreateObjectHandle(asCObjectType *ot, bool isConst)
|
||||
{
|
||||
asCDataType dt;
|
||||
|
||||
dt.tokenType = ttIdentifier;
|
||||
dt.objectType = ot;
|
||||
dt.isObjectHandle = true;
|
||||
dt.isConstHandle = isConst;
|
||||
|
||||
return dt;
|
||||
}
|
||||
|
||||
asCDataType asCDataType::CreateFuncDef(asCScriptFunction *func)
|
||||
{
|
||||
asCDataType dt;
|
||||
dt.tokenType = ttIdentifier;
|
||||
dt.funcDef = func;
|
||||
dt.objectType = &func->engine->functionBehaviours;
|
||||
|
||||
return dt;
|
||||
}
|
||||
|
||||
asCDataType asCDataType::CreatePrimitive(eTokenType tt, bool isConst)
|
||||
{
|
||||
asCDataType dt;
|
||||
|
||||
dt.tokenType = tt;
|
||||
dt.isReadOnly = isConst;
|
||||
|
||||
return dt;
|
||||
}
|
||||
|
||||
asCDataType asCDataType::CreateNullHandle()
|
||||
{
|
||||
asCDataType dt;
|
||||
|
||||
dt.tokenType = ttUnrecognizedToken;
|
||||
dt.isReadOnly = true;
|
||||
dt.isObjectHandle = true;
|
||||
dt.isConstHandle = true;
|
||||
|
||||
return dt;
|
||||
}
|
||||
|
||||
bool asCDataType::IsNullHandle() const
|
||||
{
|
||||
if( tokenType == ttUnrecognizedToken &&
|
||||
objectType == 0 &&
|
||||
isObjectHandle )
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
asCString asCDataType::Format(bool includeNamespace) const
|
||||
{
|
||||
if( IsNullHandle() )
|
||||
return "<null handle>";
|
||||
|
||||
asCString str;
|
||||
|
||||
if( isReadOnly )
|
||||
str = "const ";
|
||||
|
||||
if( includeNamespace )
|
||||
{
|
||||
if( objectType )
|
||||
str += objectType->nameSpace->name + "::";
|
||||
else if( funcDef )
|
||||
str += funcDef->nameSpace->name + "::";
|
||||
}
|
||||
|
||||
if( tokenType != ttIdentifier )
|
||||
{
|
||||
str += asCTokenizer::GetDefinition(tokenType);
|
||||
}
|
||||
else if( IsArrayType() && objectType && !objectType->engine->ep.expandDefaultArrayToTemplate )
|
||||
{
|
||||
asASSERT( objectType->templateSubTypes.GetLength() == 1 );
|
||||
str += objectType->templateSubTypes[0].Format(includeNamespace);
|
||||
str += "[]";
|
||||
}
|
||||
else if( funcDef )
|
||||
{
|
||||
str += funcDef->name;
|
||||
}
|
||||
else if( objectType )
|
||||
{
|
||||
str += objectType->name;
|
||||
if( objectType->templateSubTypes.GetLength() > 0 )
|
||||
{
|
||||
str += "<";
|
||||
for( asUINT subtypeIndex = 0; subtypeIndex < objectType->templateSubTypes.GetLength(); subtypeIndex++ )
|
||||
{
|
||||
str += objectType->templateSubTypes[subtypeIndex].Format(includeNamespace);
|
||||
if( subtypeIndex != objectType->templateSubTypes.GetLength()-1 )
|
||||
str += ",";
|
||||
}
|
||||
str += ">";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
str = "<unknown>";
|
||||
}
|
||||
|
||||
if( isObjectHandle )
|
||||
{
|
||||
str += "@";
|
||||
if( isConstHandle )
|
||||
str += "const";
|
||||
}
|
||||
|
||||
if( isReference )
|
||||
str += "&";
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
asCDataType &asCDataType::operator =(const asCDataType &dt)
|
||||
{
|
||||
tokenType = dt.tokenType;
|
||||
isReference = dt.isReference;
|
||||
objectType = dt.objectType;
|
||||
isReadOnly = dt.isReadOnly;
|
||||
isObjectHandle = dt.isObjectHandle;
|
||||
isConstHandle = dt.isConstHandle;
|
||||
funcDef = dt.funcDef;
|
||||
|
||||
return (asCDataType &)*this;
|
||||
}
|
||||
|
||||
int asCDataType::MakeHandle(bool b, bool acceptHandleForScope)
|
||||
{
|
||||
if( !b )
|
||||
{
|
||||
isObjectHandle = b;
|
||||
isConstHandle = false;
|
||||
}
|
||||
else if( b && !isObjectHandle )
|
||||
{
|
||||
// Only reference types are allowed to be handles,
|
||||
// but not nohandle reference types, and not scoped references
|
||||
// (except when returned from registered function)
|
||||
// funcdefs are special reference types and support handles
|
||||
// value types with asOBJ_ASHANDLE are treated as a handle
|
||||
if( !funcDef &&
|
||||
(!objectType ||
|
||||
!((objectType->flags & asOBJ_REF) || (objectType->flags & asOBJ_TEMPLATE_SUBTYPE) || (objectType->flags & asOBJ_ASHANDLE)) ||
|
||||
(objectType->flags & asOBJ_NOHANDLE) ||
|
||||
((objectType->flags & asOBJ_SCOPED) && !acceptHandleForScope)) )
|
||||
return -1;
|
||||
|
||||
isObjectHandle = b;
|
||||
isConstHandle = false;
|
||||
|
||||
// ASHANDLE supports being handle, but as it really is a value type it will not be marked as a handle
|
||||
if( (objectType->flags & asOBJ_ASHANDLE) )
|
||||
isObjectHandle = false;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int asCDataType::MakeArray(asCScriptEngine *engine)
|
||||
{
|
||||
if( engine->defaultArrayObjectType == 0 )
|
||||
return asINVALID_TYPE;
|
||||
|
||||
bool tmpIsReadOnly = isReadOnly;
|
||||
isReadOnly = false;
|
||||
asCArray<asCDataType> subTypes;
|
||||
subTypes.PushLast(*this);
|
||||
asCObjectType *at = engine->GetTemplateInstanceType(engine->defaultArrayObjectType, subTypes);
|
||||
isReadOnly = tmpIsReadOnly;
|
||||
|
||||
isObjectHandle = false;
|
||||
isConstHandle = false;
|
||||
|
||||
objectType = at;
|
||||
tokenType = ttIdentifier;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int asCDataType::MakeReference(bool b)
|
||||
{
|
||||
isReference = b;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int asCDataType::MakeReadOnly(bool b)
|
||||
{
|
||||
if( isObjectHandle )
|
||||
{
|
||||
isConstHandle = b;
|
||||
return 0;
|
||||
}
|
||||
|
||||
isReadOnly = b;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int asCDataType::MakeHandleToConst(bool b)
|
||||
{
|
||||
if( !isObjectHandle ) return -1;
|
||||
|
||||
isReadOnly = b;
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool asCDataType::SupportHandles() const
|
||||
{
|
||||
if( objectType &&
|
||||
(objectType->flags & asOBJ_REF) &&
|
||||
!(objectType->flags & asOBJ_NOHANDLE) &&
|
||||
!isObjectHandle )
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool asCDataType::CanBeInstanciated() const
|
||||
{
|
||||
if( GetSizeOnStackDWords() == 0 ||
|
||||
(IsObject() &&
|
||||
(objectType->flags & asOBJ_REF) && // It's a ref type and
|
||||
((objectType->flags & asOBJ_NOHANDLE) || // the ref type doesn't support handles or
|
||||
(!IsObjectHandle() && // it's not a handle and
|
||||
objectType->beh.factories.GetLength() == 0))) ) // the ref type cannot be instanciated
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool asCDataType::CanBeCopied() const
|
||||
{
|
||||
// All primitives can be copied
|
||||
if( IsPrimitive() ) return true;
|
||||
|
||||
// Plain-old-data structures can always be copied
|
||||
if( objectType->flags & asOBJ_POD ) return true;
|
||||
|
||||
// It must be possible to instanciate the type
|
||||
if( !CanBeInstanciated() ) return false;
|
||||
|
||||
// It must have a default constructor or factory
|
||||
if( objectType->beh.construct == 0 &&
|
||||
objectType->beh.factory == 0 ) return false;
|
||||
|
||||
// It must be possible to copy the type
|
||||
if( objectType->beh.copy == 0 ) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool asCDataType::IsReadOnly() const
|
||||
{
|
||||
if( isObjectHandle )
|
||||
return isConstHandle;
|
||||
|
||||
return isReadOnly;
|
||||
}
|
||||
|
||||
bool asCDataType::IsHandleToConst() const
|
||||
{
|
||||
if( !isObjectHandle ) return false;
|
||||
return isReadOnly;
|
||||
}
|
||||
|
||||
// TODO: 3.0.0: This should be removed
|
||||
bool asCDataType::IsArrayType() const
|
||||
{
|
||||
// This is only true if the type used is the default array type, i.e. the one used for the [] syntax form
|
||||
if( objectType && objectType->engine->defaultArrayObjectType )
|
||||
return objectType->name == objectType->engine->defaultArrayObjectType->name;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool asCDataType::IsTemplate() const
|
||||
{
|
||||
if( objectType && (objectType->flags & asOBJ_TEMPLATE) )
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool asCDataType::IsScriptObject() const
|
||||
{
|
||||
if( objectType && (objectType->flags & asOBJ_SCRIPT_OBJECT) )
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
asCDataType asCDataType::GetSubType(asUINT subtypeIndex) const
|
||||
{
|
||||
asASSERT(objectType);
|
||||
return objectType->templateSubTypes[subtypeIndex];
|
||||
}
|
||||
|
||||
|
||||
bool asCDataType::operator !=(const asCDataType &dt) const
|
||||
{
|
||||
return !(*this == dt);
|
||||
}
|
||||
|
||||
bool asCDataType::operator ==(const asCDataType &dt) const
|
||||
{
|
||||
if( !IsEqualExceptRefAndConst(dt) ) return false;
|
||||
if( isReference != dt.isReference ) return false;
|
||||
if( isReadOnly != dt.isReadOnly ) return false;
|
||||
if( isConstHandle != dt.isConstHandle ) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool asCDataType::IsEqualExceptRef(const asCDataType &dt) const
|
||||
{
|
||||
if( !IsEqualExceptRefAndConst(dt) ) return false;
|
||||
if( isReadOnly != dt.isReadOnly ) return false;
|
||||
if( isConstHandle != dt.isConstHandle ) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool asCDataType::IsEqualExceptRefAndConst(const asCDataType &dt) const
|
||||
{
|
||||
// Check base type
|
||||
if( tokenType != dt.tokenType ) return false;
|
||||
if( objectType != dt.objectType ) return false;
|
||||
if( isObjectHandle != dt.isObjectHandle ) return false;
|
||||
if( isObjectHandle )
|
||||
if( isReadOnly != dt.isReadOnly ) return false;
|
||||
if( funcDef != dt.funcDef ) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool asCDataType::IsEqualExceptConst(const asCDataType &dt) const
|
||||
{
|
||||
if( !IsEqualExceptRefAndConst(dt) ) return false;
|
||||
if( isReference != dt.isReference ) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool asCDataType::IsPrimitive() const
|
||||
{
|
||||
// Enumerations are primitives
|
||||
if( IsEnumType() )
|
||||
return true;
|
||||
|
||||
// A registered object is never a primitive neither is a pointer, nor an array
|
||||
if( objectType || funcDef )
|
||||
return false;
|
||||
|
||||
// Null handle doesn't have an objectType, but it is not a primitive
|
||||
if( tokenType == ttUnrecognizedToken )
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool asCDataType::IsIntegerType() const
|
||||
{
|
||||
if( tokenType == ttInt ||
|
||||
tokenType == ttInt8 ||
|
||||
tokenType == ttInt16 ||
|
||||
tokenType == ttInt64 )
|
||||
return true;
|
||||
|
||||
// Enums are also integer types
|
||||
return IsEnumType();
|
||||
}
|
||||
|
||||
bool asCDataType::IsUnsignedType() const
|
||||
{
|
||||
if( tokenType == ttUInt ||
|
||||
tokenType == ttUInt8 ||
|
||||
tokenType == ttUInt16 ||
|
||||
tokenType == ttUInt64 )
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool asCDataType::IsFloatType() const
|
||||
{
|
||||
if( tokenType == ttFloat )
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool asCDataType::IsDoubleType() const
|
||||
{
|
||||
if( tokenType == ttDouble )
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool asCDataType::IsBooleanType() const
|
||||
{
|
||||
if( tokenType == ttBool )
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool asCDataType::IsObject() const
|
||||
{
|
||||
// Enumerations are not objects, even though they are described with an objectType.
|
||||
if( IsEnumType() )
|
||||
return false;
|
||||
|
||||
if( objectType ) return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
int asCDataType::GetSizeInMemoryBytes() const
|
||||
{
|
||||
if( objectType != 0 )
|
||||
return objectType->size;
|
||||
|
||||
if( tokenType == ttVoid )
|
||||
return 0;
|
||||
|
||||
if( tokenType == ttInt8 ||
|
||||
tokenType == ttUInt8 )
|
||||
return 1;
|
||||
|
||||
if( tokenType == ttInt16 ||
|
||||
tokenType == ttUInt16 )
|
||||
return 2;
|
||||
|
||||
if( tokenType == ttDouble ||
|
||||
tokenType == ttInt64 ||
|
||||
tokenType == ttUInt64 )
|
||||
return 8;
|
||||
|
||||
if( tokenType == ttBool )
|
||||
return AS_SIZEOF_BOOL;
|
||||
|
||||
// null handle
|
||||
if( tokenType == ttUnrecognizedToken )
|
||||
return 4*AS_PTR_SIZE;
|
||||
|
||||
return 4;
|
||||
}
|
||||
|
||||
int asCDataType::GetSizeInMemoryDWords() const
|
||||
{
|
||||
int s = GetSizeInMemoryBytes();
|
||||
if( s == 0 ) return 0;
|
||||
if( s <= 4 ) return 1;
|
||||
|
||||
// Pad the size to 4 bytes
|
||||
if( s & 0x3 )
|
||||
s += 4 - (s & 0x3);
|
||||
|
||||
return s/4;
|
||||
}
|
||||
|
||||
int asCDataType::GetSizeOnStackDWords() const
|
||||
{
|
||||
// If the type is the variable type then the typeid is stored on the stack too
|
||||
int size = tokenType == ttQuestion ? 1 : 0;
|
||||
|
||||
if( isReference ) return AS_PTR_SIZE + size;
|
||||
if( objectType && !IsEnumType() ) return AS_PTR_SIZE + size;
|
||||
|
||||
return GetSizeInMemoryDWords() + size;
|
||||
}
|
||||
|
||||
asSTypeBehaviour *asCDataType::GetBehaviour() const
|
||||
{
|
||||
return objectType ? &objectType->beh : 0;
|
||||
}
|
||||
|
||||
bool asCDataType::IsEnumType() const
|
||||
{
|
||||
if( objectType && (objectType->flags & asOBJ_ENUM) )
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
END_AS_NAMESPACE
|
||||
|
143
lib/angelscript/source/as_datatype.h
Normal file
143
lib/angelscript/source/as_datatype.h
Normal file
@ -0,0 +1,143 @@
|
||||
/*
|
||||
AngelCode Scripting Library
|
||||
Copyright (c) 2003-2013 Andreas Jonsson
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any
|
||||
damages arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any
|
||||
purpose, including commercial applications, and to alter it and
|
||||
redistribute it freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you
|
||||
must not claim that you wrote the original software. If you use
|
||||
this software in a product, an acknowledgment in the product
|
||||
documentation would be appreciated but is not required.
|
||||
|
||||
2. Altered source versions must be plainly marked as such, and
|
||||
must not be misrepresented as being the original software.
|
||||
|
||||
3. This notice may not be removed or altered from any source
|
||||
distribution.
|
||||
|
||||
The original version of this library can be located at:
|
||||
http://www.angelcode.com/angelscript/
|
||||
|
||||
Andreas Jonsson
|
||||
andreas@angelcode.com
|
||||
*/
|
||||
|
||||
|
||||
//
|
||||
// as_datatype.h
|
||||
//
|
||||
// This class describes the datatype for expressions during compilation
|
||||
//
|
||||
|
||||
|
||||
|
||||
#ifndef AS_DATATYPE_H
|
||||
#define AS_DATATYPE_H
|
||||
|
||||
#include "as_tokendef.h"
|
||||
#include "as_string.h"
|
||||
|
||||
BEGIN_AS_NAMESPACE
|
||||
|
||||
struct asSTypeBehaviour;
|
||||
class asCScriptEngine;
|
||||
class asCObjectType;
|
||||
class asCScriptFunction;
|
||||
|
||||
// TODO: refactor: Reference should not be part of the datatype. This should be stored separately, e.g. in asCTypeInfo
|
||||
// MakeReference, MakeReadOnly, IsReference, IsReadOnly should be removed
|
||||
|
||||
class asCDataType
|
||||
{
|
||||
public:
|
||||
asCDataType();
|
||||
asCDataType(const asCDataType &);
|
||||
~asCDataType();
|
||||
|
||||
bool IsValid() const;
|
||||
|
||||
asCString Format(bool includeNamespace = false) const;
|
||||
|
||||
static asCDataType CreatePrimitive(eTokenType tt, bool isConst);
|
||||
static asCDataType CreateObject(asCObjectType *ot, bool isConst);
|
||||
static asCDataType CreateObjectHandle(asCObjectType *ot, bool isConst);
|
||||
static asCDataType CreateFuncDef(asCScriptFunction *ot);
|
||||
static asCDataType CreateNullHandle();
|
||||
|
||||
int MakeHandle(bool b, bool acceptHandleForScope = false);
|
||||
int MakeArray(asCScriptEngine *engine);
|
||||
int MakeReference(bool b);
|
||||
int MakeReadOnly(bool b);
|
||||
int MakeHandleToConst(bool b);
|
||||
|
||||
bool IsTemplate() const;
|
||||
bool IsScriptObject() const;
|
||||
bool IsPrimitive() const;
|
||||
bool IsObject() const;
|
||||
bool IsReference() const {return isReference;}
|
||||
bool IsReadOnly() const;
|
||||
bool IsIntegerType() const;
|
||||
bool IsUnsignedType() const;
|
||||
bool IsFloatType() const;
|
||||
bool IsDoubleType() const;
|
||||
bool IsBooleanType() const;
|
||||
bool IsObjectHandle() const {return isObjectHandle;}
|
||||
bool IsHandleToConst() const;
|
||||
bool IsArrayType() const;
|
||||
bool IsEnumType() const;
|
||||
bool IsAnyType() const {return tokenType == ttQuestion;}
|
||||
|
||||
bool IsEqualExceptRef(const asCDataType &) const;
|
||||
bool IsEqualExceptRefAndConst(const asCDataType &) const;
|
||||
bool IsEqualExceptConst(const asCDataType &) const;
|
||||
bool IsNullHandle() const;
|
||||
|
||||
bool SupportHandles() const;
|
||||
bool CanBeInstanciated() const;
|
||||
bool CanBeCopied() const;
|
||||
|
||||
bool operator ==(const asCDataType &) const;
|
||||
bool operator !=(const asCDataType &) const;
|
||||
|
||||
asCDataType GetSubType(asUINT subtypeIndex = 0) const;
|
||||
eTokenType GetTokenType() const {return tokenType;}
|
||||
asCObjectType *GetObjectType() const {return objectType;}
|
||||
asCScriptFunction *GetFuncDef() const {return funcDef;}
|
||||
|
||||
int GetSizeOnStackDWords() const;
|
||||
int GetSizeInMemoryBytes() const;
|
||||
int GetSizeInMemoryDWords() const;
|
||||
|
||||
void SetTokenType(eTokenType tt) {tokenType = tt;}
|
||||
void SetObjectType(asCObjectType *obj) {objectType = obj;}
|
||||
void SetFuncDef(asCScriptFunction *func) {asASSERT(funcDef); funcDef = func; }
|
||||
|
||||
asCDataType &operator =(const asCDataType &);
|
||||
|
||||
asSTypeBehaviour *GetBehaviour() const;
|
||||
|
||||
protected:
|
||||
// Base object type
|
||||
eTokenType tokenType;
|
||||
|
||||
// Behaviour type
|
||||
asCObjectType *objectType;
|
||||
asCScriptFunction *funcDef;
|
||||
|
||||
// Top level
|
||||
bool isReference:1;
|
||||
bool isReadOnly:1;
|
||||
bool isObjectHandle:1;
|
||||
bool isConstHandle:1;
|
||||
char dummy:4;
|
||||
};
|
||||
|
||||
END_AS_NAMESPACE
|
||||
|
||||
#endif
|
265
lib/angelscript/source/as_debug.h
Normal file
265
lib/angelscript/source/as_debug.h
Normal file
@ -0,0 +1,265 @@
|
||||
/*
|
||||
AngelCode Scripting Library
|
||||
Copyright (c) 2003-2012 Andreas Jonsson
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any
|
||||
damages arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any
|
||||
purpose, including commercial applications, and to alter it and
|
||||
redistribute it freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you
|
||||
must not claim that you wrote the original software. If you use
|
||||
this software in a product, an acknowledgment in the product
|
||||
documentation would be appreciated but is not required.
|
||||
|
||||
2. Altered source versions must be plainly marked as such, and
|
||||
must not be misrepresented as being the original software.
|
||||
|
||||
3. This notice may not be removed or altered from any source
|
||||
distribution.
|
||||
|
||||
The original version of this library can be located at:
|
||||
http://www.angelcode.com/angelscript/
|
||||
|
||||
Andreas Jonsson
|
||||
andreas@angelcode.com
|
||||
*/
|
||||
|
||||
|
||||
//
|
||||
// as_debug.h
|
||||
//
|
||||
|
||||
#ifndef AS_DEBUG_H
|
||||
#define AS_DEBUG_H
|
||||
|
||||
#include "as_config.h"
|
||||
|
||||
#ifndef AS_WII
|
||||
// The Wii SDK doesn't have these, we'll survive without AS_DEBUG
|
||||
|
||||
#ifndef _WIN32_WCE
|
||||
// Neither does WinCE
|
||||
|
||||
|
||||
#if defined(__GNUC__) || defined( AS_MARMALADE )
|
||||
|
||||
#ifdef __ghs__
|
||||
// WIIU defines __GNUC__ but types are not defined here in 'conventional' way
|
||||
#include <types.h>
|
||||
typedef signed char int8_t;
|
||||
typedef unsigned char uint8_t;
|
||||
typedef signed short int16_t;
|
||||
typedef unsigned short uint16_t;
|
||||
typedef signed int int32_t;
|
||||
typedef unsigned int uint32_t;
|
||||
typedef signed long long int64_t;
|
||||
typedef unsigned long long uint64_t;
|
||||
typedef float float32_t;
|
||||
typedef double float64_t;
|
||||
#else
|
||||
// Define mkdir for GNUC
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#define _mkdir(dirname) mkdir(dirname, S_IRWXU)
|
||||
#endif
|
||||
#else
|
||||
#include <direct.h>
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(_MSC_VER) && defined(AS_PROFILE)
|
||||
// Currently only do profiling with MSVC++
|
||||
|
||||
#include <mmsystem.h>
|
||||
#include "as_string.h"
|
||||
#include "as_map.h"
|
||||
#include "as_string_util.h"
|
||||
|
||||
BEGIN_AS_NAMESPACE
|
||||
|
||||
struct TimeCount
|
||||
{
|
||||
double time;
|
||||
int count;
|
||||
double max;
|
||||
double min;
|
||||
};
|
||||
|
||||
class CProfiler
|
||||
{
|
||||
public:
|
||||
CProfiler()
|
||||
{
|
||||
// We need to know how often the clock is updated
|
||||
__int64 tps;
|
||||
if( !QueryPerformanceFrequency((LARGE_INTEGER *)&tps) )
|
||||
usePerformance = false;
|
||||
else
|
||||
{
|
||||
usePerformance = true;
|
||||
ticksPerSecond = double(tps);
|
||||
}
|
||||
|
||||
timeOffset = GetTime();
|
||||
}
|
||||
|
||||
~CProfiler()
|
||||
{
|
||||
WriteSummary();
|
||||
}
|
||||
|
||||
double GetTime()
|
||||
{
|
||||
if( usePerformance )
|
||||
{
|
||||
__int64 ticks;
|
||||
QueryPerformanceCounter((LARGE_INTEGER *)&ticks);
|
||||
|
||||
return double(ticks)/ticksPerSecond - timeOffset;
|
||||
}
|
||||
|
||||
return double(timeGetTime())/1000.0 - timeOffset;
|
||||
}
|
||||
|
||||
double Begin(const char *name)
|
||||
{
|
||||
double time = GetTime();
|
||||
|
||||
// Add the scope to the key
|
||||
if( key.GetLength() )
|
||||
key += "|";
|
||||
key += name;
|
||||
|
||||
// Compensate for the time spent writing to the file
|
||||
timeOffset += GetTime() - time;
|
||||
|
||||
return time;
|
||||
}
|
||||
|
||||
void End(const char *name, double beginTime)
|
||||
{
|
||||
double time = GetTime();
|
||||
|
||||
double elapsed = time - beginTime;
|
||||
|
||||
// Update the profile info for this scope
|
||||
asSMapNode<asCString, TimeCount> *cursor;
|
||||
if( map.MoveTo(&cursor, key) )
|
||||
{
|
||||
cursor->value.time += elapsed;
|
||||
cursor->value.count++;
|
||||
if( cursor->value.max < elapsed )
|
||||
cursor->value.max = elapsed;
|
||||
if( cursor->value.min > elapsed )
|
||||
cursor->value.min = elapsed;
|
||||
}
|
||||
else
|
||||
{
|
||||
TimeCount tc = {elapsed, 1, elapsed, elapsed};
|
||||
map.Insert(key, tc);
|
||||
}
|
||||
|
||||
// Remove the inner most scope from the key
|
||||
int n = key.FindLast("|");
|
||||
if( n > 0 )
|
||||
key.SetLength(n);
|
||||
else
|
||||
key.SetLength(0);
|
||||
|
||||
// Compensate for the time spent writing to the file
|
||||
timeOffset += GetTime() - time;
|
||||
}
|
||||
|
||||
protected:
|
||||
void WriteSummary()
|
||||
{
|
||||
// Write the analyzed info into a file for inspection
|
||||
_mkdir("AS_DEBUG");
|
||||
FILE *fp;
|
||||
#if _MSC_VER >= 1500 && !defined(AS_MARMALADE)
|
||||
fopen_s(&fp, "AS_DEBUG/profiling_summary.txt", "wt");
|
||||
#else
|
||||
fp = fopen("AS_DEBUG/profiling_summary.txt", "wt");
|
||||
#endif
|
||||
if( fp == 0 )
|
||||
return;
|
||||
|
||||
fprintf(fp, "%-60s %10s %15s %15s %15s %15s\n\n", "Scope", "Count", "Tot time", "Avg time", "Max time", "Min time");
|
||||
|
||||
asSMapNode<asCString, TimeCount> *cursor;
|
||||
map.MoveLast(&cursor);
|
||||
while( cursor )
|
||||
{
|
||||
asCString key = cursor->key;
|
||||
int count;
|
||||
int n = key.FindLast("|", &count);
|
||||
if( count )
|
||||
{
|
||||
key = asCString(" ", count) + key.SubString(n+1);
|
||||
}
|
||||
|
||||
fprintf(fp, "%-60s %10d %15.6f %15.6f %15.6f %15.6f\n", key.AddressOf(), cursor->value.count, cursor->value.time, cursor->value.time / cursor->value.count, cursor->value.max, cursor->value.min);
|
||||
|
||||
map.MovePrev(&cursor, cursor);
|
||||
}
|
||||
|
||||
fclose(fp);
|
||||
}
|
||||
|
||||
double timeOffset;
|
||||
double ticksPerSecond;
|
||||
bool usePerformance;
|
||||
|
||||
asCString key;
|
||||
asCMap<asCString, TimeCount> map;
|
||||
};
|
||||
|
||||
extern CProfiler g_profiler;
|
||||
|
||||
class CProfilerScope
|
||||
{
|
||||
public:
|
||||
CProfilerScope(const char *name)
|
||||
{
|
||||
this->name = name;
|
||||
beginTime = g_profiler.Begin(name);
|
||||
}
|
||||
|
||||
~CProfilerScope()
|
||||
{
|
||||
g_profiler.End(name, beginTime);
|
||||
}
|
||||
|
||||
protected:
|
||||
const char *name;
|
||||
double beginTime;
|
||||
};
|
||||
|
||||
#define TimeIt(x) CProfilerScope profilescope(x)
|
||||
|
||||
END_AS_NAMESPACE
|
||||
|
||||
#else // _MSC_VER && AS_PROFILE
|
||||
|
||||
// Define it so nothing is done
|
||||
#define TimeIt(x)
|
||||
|
||||
#endif // !(_MSC_VER && AS_PROFILE)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _WIN32_WCE
|
||||
#endif // AS_WII
|
||||
|
||||
#endif
|
||||
|
||||
|
946
lib/angelscript/source/as_gc.cpp
Normal file
946
lib/angelscript/source/as_gc.cpp
Normal file
@ -0,0 +1,946 @@
|
||||
/*
|
||||
AngelCode Scripting Library
|
||||
Copyright (c) 2003-2013 Andreas Jonsson
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any
|
||||
damages arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any
|
||||
purpose, including commercial applications, and to alter it and
|
||||
redistribute it freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you
|
||||
must not claim that you wrote the original software. If you use
|
||||
this software in a product, an acknowledgment in the product
|
||||
documentation would be appreciated but is not required.
|
||||
|
||||
2. Altered source versions must be plainly marked as such, and
|
||||
must not be misrepresented as being the original software.
|
||||
|
||||
3. This notice may not be removed or altered from any source
|
||||
distribution.
|
||||
|
||||
The original version of this library can be located at:
|
||||
http://www.angelcode.com/angelscript/
|
||||
|
||||
Andreas Jonsson
|
||||
andreas@angelcode.com
|
||||
*/
|
||||
|
||||
|
||||
//
|
||||
// as_gc.cpp
|
||||
//
|
||||
// The implementation of the garbage collector
|
||||
//
|
||||
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "as_gc.h"
|
||||
#include "as_scriptengine.h"
|
||||
#include "as_scriptobject.h"
|
||||
#include "as_texts.h"
|
||||
|
||||
BEGIN_AS_NAMESPACE
|
||||
|
||||
asCGarbageCollector::asCGarbageCollector()
|
||||
{
|
||||
engine = 0;
|
||||
detectState = clearCounters_init;
|
||||
destroyNewState = destroyGarbage_init;
|
||||
destroyOldState = destroyGarbage_init;
|
||||
numDestroyed = 0;
|
||||
numNewDestroyed = 0;
|
||||
numDetected = 0;
|
||||
numAdded = 0;
|
||||
isProcessing = false;
|
||||
|
||||
seqAtSweepStart[0] = 0;
|
||||
seqAtSweepStart[1] = 0;
|
||||
seqAtSweepStart[2] = 0;
|
||||
}
|
||||
|
||||
asCGarbageCollector::~asCGarbageCollector()
|
||||
{
|
||||
// This local typedef is done to workaround a compiler error on
|
||||
// MSVC6 when using the typedef declared in the class definition
|
||||
typedef asSMapNode_t node_t;
|
||||
for( asUINT n = 0; n < freeNodes.GetLength(); n++ )
|
||||
asDELETE(freeNodes[n], node_t);
|
||||
freeNodes.SetLength(0);
|
||||
}
|
||||
|
||||
int asCGarbageCollector::AddScriptObjectToGC(void *obj, asCObjectType *objType)
|
||||
{
|
||||
if( obj == 0 || objType == 0 )
|
||||
{
|
||||
engine->WriteMessage("", 0, 0, asMSGTYPE_ERROR, TXT_GC_RECEIVED_NULL_PTR);
|
||||
return asINVALID_ARG;
|
||||
}
|
||||
|
||||
engine->CallObjectMethod(obj, objType->beh.addref);
|
||||
asSObjTypePair ot = {obj, objType, 0};
|
||||
|
||||
// Invoke the garbage collector to destroy a little garbage as new comes in
|
||||
// This will maintain the number of objects in the GC at a maintainable level without
|
||||
// halting the application, and without burdening the application with manually invoking the
|
||||
// garbage collector.
|
||||
if( engine->ep.autoGarbageCollect && gcNewObjects.GetLength() )
|
||||
{
|
||||
// If the GC is already processing in another thread, then don't try this again
|
||||
if( TRYENTERCRITICALSECTION(gcCollecting) )
|
||||
{
|
||||
// Skip this if the GC is already running in this thread
|
||||
if( !isProcessing )
|
||||
{
|
||||
isProcessing = true;
|
||||
|
||||
// TODO: The number of iterations should be dynamic, and increase
|
||||
// if the number of objects in the garbage collector grows high
|
||||
|
||||
// Run one step of DetectGarbage
|
||||
if( gcOldObjects.GetLength() )
|
||||
{
|
||||
IdentifyGarbageWithCyclicRefs();
|
||||
DestroyOldGarbage();
|
||||
}
|
||||
|
||||
// Run a few steps of DestroyGarbage
|
||||
int iter = (int)gcNewObjects.GetLength();
|
||||
if( iter > 10 ) iter = 10;
|
||||
while( iter-- > 0 )
|
||||
DestroyNewGarbage();
|
||||
|
||||
isProcessing = false;
|
||||
}
|
||||
|
||||
LEAVECRITICALSECTION(gcCollecting);
|
||||
}
|
||||
}
|
||||
|
||||
// Add the data to the gcObjects array in a critical section as
|
||||
// another thread might be calling this method at the same time
|
||||
ENTERCRITICALSECTION(gcCritical);
|
||||
ot.seqNbr = numAdded++;
|
||||
gcNewObjects.PushLast(ot);
|
||||
LEAVECRITICALSECTION(gcCritical);
|
||||
|
||||
return ot.seqNbr;
|
||||
}
|
||||
|
||||
int asCGarbageCollector::GetObjectInGC(asUINT idx, asUINT *seqNbr, void **obj, asIObjectType **type)
|
||||
{
|
||||
if( seqNbr ) *seqNbr = 0;
|
||||
if( obj ) *obj = 0;
|
||||
if( type ) *type = 0;
|
||||
|
||||
ENTERCRITICALSECTION(gcCritical);
|
||||
asSObjTypePair *o = 0;
|
||||
asUINT newObjs = asUINT(gcNewObjects.GetLength());
|
||||
if( idx < newObjs )
|
||||
o = &gcNewObjects[idx];
|
||||
else if( idx < gcOldObjects.GetLength() + newObjs )
|
||||
o = &gcOldObjects[idx-newObjs];
|
||||
else
|
||||
{
|
||||
LEAVECRITICALSECTION(gcCritical);
|
||||
return asINVALID_ARG;
|
||||
}
|
||||
if( seqNbr ) *seqNbr = o->seqNbr;
|
||||
if( obj ) *obj = o->obj;
|
||||
if( type ) *type = o->type;
|
||||
LEAVECRITICALSECTION(gcCritical);
|
||||
|
||||
return asSUCCESS;
|
||||
}
|
||||
|
||||
int asCGarbageCollector::GarbageCollect(asDWORD flags)
|
||||
{
|
||||
// If the GC is already processing in another thread, then don't enter here again
|
||||
if( TRYENTERCRITICALSECTION(gcCollecting) )
|
||||
{
|
||||
// If the GC is already processing in this thread, then don't enter here again
|
||||
if( isProcessing )
|
||||
{
|
||||
LEAVECRITICALSECTION(gcCollecting);
|
||||
return 1;
|
||||
}
|
||||
|
||||
isProcessing = true;
|
||||
|
||||
bool doDetect = (flags & asGC_DETECT_GARBAGE) || !(flags & asGC_DESTROY_GARBAGE);
|
||||
bool doDestroy = (flags & asGC_DESTROY_GARBAGE) || !(flags & asGC_DETECT_GARBAGE);
|
||||
|
||||
if( flags & asGC_FULL_CYCLE )
|
||||
{
|
||||
// Reset the state
|
||||
if( doDetect )
|
||||
{
|
||||
// Move all objects to the old list, so we guarantee that all is detected
|
||||
for( asUINT n = (asUINT)gcNewObjects.GetLength(); n-- > 0; )
|
||||
MoveObjectToOldList(n);
|
||||
detectState = clearCounters_init;
|
||||
}
|
||||
if( doDestroy )
|
||||
{
|
||||
destroyNewState = destroyGarbage_init;
|
||||
destroyOldState = destroyGarbage_init;
|
||||
}
|
||||
|
||||
unsigned int count = (unsigned int)(gcNewObjects.GetLength() + gcOldObjects.GetLength());
|
||||
for(;;)
|
||||
{
|
||||
// Detect all garbage with cyclic references
|
||||
if( doDetect )
|
||||
while( IdentifyGarbageWithCyclicRefs() == 1 ) {}
|
||||
|
||||
// Now destroy all known garbage
|
||||
if( doDestroy )
|
||||
{
|
||||
while( DestroyNewGarbage() == 1 ) {}
|
||||
while( DestroyOldGarbage() == 1 ) {}
|
||||
}
|
||||
|
||||
// Run another iteration if any garbage was destroyed
|
||||
if( count != (unsigned int)(gcNewObjects.GetLength() + gcOldObjects.GetLength()) )
|
||||
count = (unsigned int)(gcNewObjects.GetLength() + gcOldObjects.GetLength());
|
||||
else
|
||||
{
|
||||
// Let the engine destroy the types that reached refCount 0
|
||||
// If none were destroyed, then leave the GC
|
||||
// TODO: The asCObjectType should destroy its content when refCount reaches 0
|
||||
// since no-one is using them. The registered types should have their
|
||||
// refcount increased by the config groups. Doing it like that will allow
|
||||
// me to remove this call to ClearUnusedTypes() that the GC really
|
||||
// shouldn't be calling.
|
||||
if( engine->ClearUnusedTypes() == 0 )
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
isProcessing = false;
|
||||
LEAVECRITICALSECTION(gcCollecting);
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Destroy the garbage that we know of
|
||||
if( doDestroy )
|
||||
{
|
||||
DestroyNewGarbage();
|
||||
DestroyOldGarbage();
|
||||
}
|
||||
|
||||
// Run another incremental step of the identification of cyclic references
|
||||
if( doDetect )
|
||||
IdentifyGarbageWithCyclicRefs();
|
||||
}
|
||||
|
||||
isProcessing = false;
|
||||
LEAVECRITICALSECTION(gcCollecting);
|
||||
}
|
||||
|
||||
// Return 1 to indicate that the cycle wasn't finished
|
||||
return 1;
|
||||
}
|
||||
|
||||
void asCGarbageCollector::GetStatistics(asUINT *currentSize, asUINT *totalDestroyed, asUINT *totalDetected, asUINT *newObjects, asUINT *totalNewDestroyed) const
|
||||
{
|
||||
// It's not necessary to protect this access, as
|
||||
// it doesn't matter if another thread is currently
|
||||
// appending a new object.
|
||||
if( currentSize )
|
||||
*currentSize = (asUINT)(gcNewObjects.GetLength() + gcOldObjects.GetLength());
|
||||
|
||||
if( totalDestroyed )
|
||||
*totalDestroyed = numDestroyed;
|
||||
|
||||
asASSERT( numAdded == gcNewObjects.GetLength() + gcOldObjects.GetLength() + numDestroyed );
|
||||
|
||||
if( totalDetected )
|
||||
*totalDetected = numDetected;
|
||||
|
||||
if( newObjects )
|
||||
*newObjects = (asUINT)gcNewObjects.GetLength();
|
||||
|
||||
if( totalNewDestroyed )
|
||||
*totalNewDestroyed = numNewDestroyed;
|
||||
}
|
||||
|
||||
asCGarbageCollector::asSObjTypePair asCGarbageCollector::GetNewObjectAtIdx(int idx)
|
||||
{
|
||||
// We need to protect this access with a critical section as
|
||||
// another thread might be appending an object at the same time
|
||||
ENTERCRITICALSECTION(gcCritical);
|
||||
asSObjTypePair gcObj = gcNewObjects[idx];
|
||||
LEAVECRITICALSECTION(gcCritical);
|
||||
|
||||
return gcObj;
|
||||
}
|
||||
|
||||
asCGarbageCollector::asSObjTypePair asCGarbageCollector::GetOldObjectAtIdx(int idx)
|
||||
{
|
||||
// We need to protect this access with a critical section as
|
||||
// another thread might be appending an object at the same time
|
||||
ENTERCRITICALSECTION(gcCritical);
|
||||
asSObjTypePair gcObj = gcOldObjects[idx];
|
||||
LEAVECRITICALSECTION(gcCritical);
|
||||
|
||||
return gcObj;
|
||||
}
|
||||
|
||||
void asCGarbageCollector::RemoveNewObjectAtIdx(int idx)
|
||||
{
|
||||
// We need to protect this update with a critical section as
|
||||
// another thread might be appending an object at the same time
|
||||
ENTERCRITICALSECTION(gcCritical);
|
||||
if( idx == (int)gcNewObjects.GetLength() - 1)
|
||||
gcNewObjects.PopLast();
|
||||
else
|
||||
gcNewObjects[idx] = gcNewObjects.PopLast();
|
||||
LEAVECRITICALSECTION(gcCritical);
|
||||
}
|
||||
|
||||
void asCGarbageCollector::RemoveOldObjectAtIdx(int idx)
|
||||
{
|
||||
// We need to protect this update with a critical section as
|
||||
// another thread might be appending an object at the same time
|
||||
ENTERCRITICALSECTION(gcCritical);
|
||||
if( idx == (int)gcOldObjects.GetLength() - 1)
|
||||
gcOldObjects.PopLast();
|
||||
else
|
||||
gcOldObjects[idx] = gcOldObjects.PopLast();
|
||||
LEAVECRITICALSECTION(gcCritical);
|
||||
}
|
||||
|
||||
void asCGarbageCollector::MoveObjectToOldList(int idx)
|
||||
{
|
||||
// We need to protect this update with a critical section as
|
||||
// another thread might be appending an object at the same time
|
||||
ENTERCRITICALSECTION(gcCritical);
|
||||
gcOldObjects.PushLast(gcNewObjects[idx]);
|
||||
if( idx == (int)gcNewObjects.GetLength() - 1)
|
||||
gcNewObjects.PopLast();
|
||||
else
|
||||
gcNewObjects[idx] = gcNewObjects.PopLast();
|
||||
LEAVECRITICALSECTION(gcCritical);
|
||||
}
|
||||
|
||||
int asCGarbageCollector::DestroyNewGarbage()
|
||||
{
|
||||
// This function will only be called within the critical section gcCollecting
|
||||
asASSERT(isProcessing);
|
||||
|
||||
for(;;)
|
||||
{
|
||||
switch( destroyNewState )
|
||||
{
|
||||
case destroyGarbage_init:
|
||||
{
|
||||
// If there are no objects to be freed then don't start
|
||||
if( gcNewObjects.GetLength() == 0 )
|
||||
return 0;
|
||||
|
||||
// Update the seqAtSweepStart which is used to determine when
|
||||
// to move an object from the new set to the old set
|
||||
seqAtSweepStart[0] = seqAtSweepStart[1];
|
||||
seqAtSweepStart[1] = seqAtSweepStart[2];
|
||||
seqAtSweepStart[2] = numAdded;
|
||||
|
||||
destroyNewIdx = (asUINT)-1;
|
||||
destroyNewState = destroyGarbage_loop;
|
||||
}
|
||||
break;
|
||||
|
||||
case destroyGarbage_loop:
|
||||
case destroyGarbage_haveMore:
|
||||
{
|
||||
// If the refCount has reached 1, then only the GC still holds a
|
||||
// reference to the object, thus we don't need to worry about the
|
||||
// application touching the objects during collection.
|
||||
|
||||
// Destroy all objects that have refCount == 1. If any objects are
|
||||
// destroyed, go over the list again, because it may have made more
|
||||
// objects reach refCount == 1.
|
||||
if( ++destroyNewIdx < gcNewObjects.GetLength() )
|
||||
{
|
||||
asSObjTypePair gcObj = GetNewObjectAtIdx(destroyNewIdx);
|
||||
if( engine->CallObjectMethodRetInt(gcObj.obj, gcObj.type->beh.gcGetRefCount) == 1 )
|
||||
{
|
||||
// Release the object immediately
|
||||
|
||||
// Make sure the refCount is really 0, because the
|
||||
// destructor may have increased the refCount again.
|
||||
bool addRef = false;
|
||||
if( gcObj.type->flags & asOBJ_SCRIPT_OBJECT )
|
||||
{
|
||||
// Script objects may actually be resurrected in the destructor
|
||||
int refCount = ((asCScriptObject*)gcObj.obj)->Release();
|
||||
if( refCount > 0 ) addRef = true;
|
||||
}
|
||||
else
|
||||
engine->CallObjectMethod(gcObj.obj, gcObj.type->beh.release);
|
||||
|
||||
// Was the object really destroyed?
|
||||
if( !addRef )
|
||||
{
|
||||
numDestroyed++;
|
||||
numNewDestroyed++;
|
||||
RemoveNewObjectAtIdx(destroyNewIdx);
|
||||
destroyNewIdx--;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Since the object was resurrected in the
|
||||
// destructor, we must add our reference again
|
||||
engine->CallObjectMethod(gcObj.obj, gcObj.type->beh.addref);
|
||||
}
|
||||
|
||||
destroyNewState = destroyGarbage_haveMore;
|
||||
}
|
||||
// Check if this object has been inspected 3 times already, and if so move it to the
|
||||
// set of old objects that are less likely to become garbage in a short time
|
||||
// TODO: Is 3 really a good value? Should the number of times be dynamic?
|
||||
else if( gcObj.seqNbr < seqAtSweepStart[0] )
|
||||
{
|
||||
// We've already verified this object multiple times. It is likely
|
||||
// to live for quite a long time so we'll move it to the list if old objects
|
||||
MoveObjectToOldList(destroyNewIdx);
|
||||
destroyNewIdx--;
|
||||
}
|
||||
|
||||
// Allow the application to work a little
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if( destroyNewState == destroyGarbage_haveMore )
|
||||
{
|
||||
// Restart the cycle
|
||||
destroyNewState = destroyGarbage_init;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Restart the cycle
|
||||
destroyNewState = destroyGarbage_init;
|
||||
|
||||
// Return 0 to tell the application that there
|
||||
// is no more garbage to destroy at the moment
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Shouldn't reach this point
|
||||
UNREACHABLE_RETURN;
|
||||
}
|
||||
|
||||
int asCGarbageCollector::ReportAndReleaseUndestroyedObjects()
|
||||
{
|
||||
// This function will only be called as the engine is shutting down
|
||||
|
||||
int items = 0;
|
||||
for( asUINT n = 0; n < gcOldObjects.GetLength(); n++ )
|
||||
{
|
||||
asSObjTypePair gcObj = GetOldObjectAtIdx(n);
|
||||
|
||||
int refCount = 0;
|
||||
if( gcObj.type->beh.gcGetRefCount && engine->scriptFunctions[gcObj.type->beh.gcGetRefCount] )
|
||||
refCount = engine->CallObjectMethodRetInt(gcObj.obj, gcObj.type->beh.gcGetRefCount);
|
||||
|
||||
// Report the object as not being properly destroyed
|
||||
asCString msg;
|
||||
msg.Format(TXT_d_GC_CANNOT_FREE_OBJ_OF_TYPE_s_REF_COUNT_d, gcObj.seqNbr, gcObj.type->name.AddressOf(), refCount - 1);
|
||||
engine->WriteMessage("", 0, 0, asMSGTYPE_ERROR, msg.AddressOf());
|
||||
|
||||
// Add additional info for builtin types
|
||||
if( gcObj.type->name == "_builtin_function_" )
|
||||
{
|
||||
// Unfortunately we can't show the function declaration here, because the engine may have released the parameter list already so the declaration would only be misleading
|
||||
// We need to show the function type too as for example delegates do not have a name
|
||||
msg.Format(TXT_PREV_FUNC_IS_NAMED_s_TYPE_IS_d, reinterpret_cast<asCScriptFunction*>(gcObj.obj)->GetName(), reinterpret_cast<asCScriptFunction*>(gcObj.obj)->GetFuncType());
|
||||
engine->WriteMessage("", 0, 0, asMSGTYPE_INFORMATION, msg.AddressOf());
|
||||
}
|
||||
else if( gcObj.type->name == "_builtin_objecttype_" )
|
||||
{
|
||||
msg.Format(TXT_PREV_TYPE_IS_NAMED_s, reinterpret_cast<asCObjectType*>(gcObj.obj)->GetName());
|
||||
engine->WriteMessage("", 0, 0, asMSGTYPE_INFORMATION, msg.AddressOf());
|
||||
}
|
||||
else if( gcObj.type->name == "_builtin_globalprop_" )
|
||||
{
|
||||
msg.Format(TXT_PREV_TYPE_IS_NAMED_s, reinterpret_cast<asCGlobalProperty*>(gcObj.obj)->name.AddressOf());
|
||||
engine->WriteMessage("", 0, 0, asMSGTYPE_INFORMATION, msg.AddressOf());
|
||||
}
|
||||
|
||||
// Release the reference that the GC holds if the release functions is still available
|
||||
if( gcObj.type->beh.release && engine->scriptFunctions[gcObj.type->beh.release] )
|
||||
engine->CallObjectMethod(gcObj.obj, gcObj.type->beh.release);
|
||||
|
||||
items++;
|
||||
}
|
||||
return items;
|
||||
}
|
||||
|
||||
int asCGarbageCollector::DestroyOldGarbage()
|
||||
{
|
||||
// This function will only be called within the critical section gcCollecting
|
||||
asASSERT(isProcessing);
|
||||
|
||||
for(;;)
|
||||
{
|
||||
switch( destroyOldState )
|
||||
{
|
||||
case destroyGarbage_init:
|
||||
{
|
||||
// If there are no objects to be freed then don't start
|
||||
if( gcOldObjects.GetLength() == 0 )
|
||||
return 0;
|
||||
|
||||
destroyOldIdx = (asUINT)-1;
|
||||
destroyOldState = destroyGarbage_loop;
|
||||
}
|
||||
break;
|
||||
|
||||
case destroyGarbage_loop:
|
||||
case destroyGarbage_haveMore:
|
||||
{
|
||||
// If the refCount has reached 1, then only the GC still holds a
|
||||
// reference to the object, thus we don't need to worry about the
|
||||
// application touching the objects during collection.
|
||||
|
||||
// Destroy all objects that have refCount == 1. If any objects are
|
||||
// destroyed, go over the list again, because it may have made more
|
||||
// objects reach refCount == 1.
|
||||
if( ++destroyOldIdx < gcOldObjects.GetLength() )
|
||||
{
|
||||
asSObjTypePair gcObj = GetOldObjectAtIdx(destroyOldIdx);
|
||||
|
||||
if( gcObj.type->beh.gcGetRefCount == 0 )
|
||||
{
|
||||
// If circular references are formed with registered types that hasn't
|
||||
// registered the GC behaviours, then the engine may be forced to free
|
||||
// the object type before the actual object instance. In this case we
|
||||
// will be forced to skip the destruction of the objects, so as not to
|
||||
// crash the application.
|
||||
asCString msg;
|
||||
msg.Format(TXT_d_GC_CANNOT_FREE_OBJ_OF_TYPE_s, gcObj.seqNbr, gcObj.type->name.AddressOf());
|
||||
engine->WriteMessage("", 0, 0, asMSGTYPE_ERROR, msg.AddressOf());
|
||||
|
||||
// Just remove the object, as we will not bother to destroy it
|
||||
numDestroyed++;
|
||||
RemoveOldObjectAtIdx(destroyOldIdx);
|
||||
destroyOldIdx--;
|
||||
}
|
||||
else if( engine->CallObjectMethodRetInt(gcObj.obj, gcObj.type->beh.gcGetRefCount) == 1 )
|
||||
{
|
||||
// Release the object immediately
|
||||
|
||||
// Make sure the refCount is really 0, because the
|
||||
// destructor may have increased the refCount again.
|
||||
bool addRef = false;
|
||||
if( gcObj.type->flags & asOBJ_SCRIPT_OBJECT )
|
||||
{
|
||||
// Script objects may actually be resurrected in the destructor
|
||||
int refCount = ((asCScriptObject*)gcObj.obj)->Release();
|
||||
if( refCount > 0 ) addRef = true;
|
||||
}
|
||||
else
|
||||
engine->CallObjectMethod(gcObj.obj, gcObj.type->beh.release);
|
||||
|
||||
// Was the object really destroyed?
|
||||
if( !addRef )
|
||||
{
|
||||
numDestroyed++;
|
||||
RemoveOldObjectAtIdx(destroyOldIdx);
|
||||
destroyOldIdx--;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Since the object was resurrected in the
|
||||
// destructor, we must add our reference again
|
||||
engine->CallObjectMethod(gcObj.obj, gcObj.type->beh.addref);
|
||||
}
|
||||
|
||||
destroyOldState = destroyGarbage_haveMore;
|
||||
}
|
||||
|
||||
// Allow the application to work a little
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if( destroyOldState == destroyGarbage_haveMore )
|
||||
{
|
||||
// Restart the cycle
|
||||
destroyOldState = destroyGarbage_init;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Restart the cycle
|
||||
destroyOldState = destroyGarbage_init;
|
||||
|
||||
// Return 0 to tell the application that there
|
||||
// is no more garbage to destroy at the moment
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Shouldn't reach this point
|
||||
UNREACHABLE_RETURN;
|
||||
}
|
||||
|
||||
int asCGarbageCollector::IdentifyGarbageWithCyclicRefs()
|
||||
{
|
||||
// This function will only be called within the critical section gcCollecting
|
||||
asASSERT(isProcessing);
|
||||
|
||||
for(;;)
|
||||
{
|
||||
switch( detectState )
|
||||
{
|
||||
case clearCounters_init:
|
||||
detectState = clearCounters_loop;
|
||||
break;
|
||||
|
||||
case clearCounters_loop:
|
||||
{
|
||||
// Decrease reference counter for all objects removed from the map
|
||||
asSMapNode<void*, asSIntTypePair> *cursor = 0;
|
||||
gcMap.MoveFirst(&cursor);
|
||||
if( cursor )
|
||||
{
|
||||
void *obj = gcMap.GetKey(cursor);
|
||||
asSIntTypePair it = gcMap.GetValue(cursor);
|
||||
|
||||
engine->CallObjectMethod(obj, it.type->beh.release);
|
||||
|
||||
ReturnNode(gcMap.Remove(cursor));
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
detectState = buildMap_init;
|
||||
}
|
||||
break;
|
||||
|
||||
case buildMap_init:
|
||||
detectIdx = 0;
|
||||
detectState = buildMap_loop;
|
||||
break;
|
||||
|
||||
case buildMap_loop:
|
||||
{
|
||||
// Build a map of objects that will be checked, the map will
|
||||
// hold the object pointer as key, and the gcCount and the
|
||||
// object's type as value. As objects are added to the map the
|
||||
// gcFlag must be set in the objects, so we can be verify if
|
||||
// the object is accessed during the GC cycle.
|
||||
|
||||
// If an object is removed from the gcObjects list during the
|
||||
// iteration of this step, it is possible that an object won't
|
||||
// be used during the analyzing for cyclic references. This
|
||||
// isn't a problem, as the next time the GC cycle starts the
|
||||
// object will be verified.
|
||||
if( detectIdx < gcOldObjects.GetLength() )
|
||||
{
|
||||
// Add the gc count for this object
|
||||
asSObjTypePair gcObj = GetOldObjectAtIdx(detectIdx);
|
||||
|
||||
int refCount = 0;
|
||||
if( gcObj.type->beh.gcGetRefCount )
|
||||
refCount = engine->CallObjectMethodRetInt(gcObj.obj, gcObj.type->beh.gcGetRefCount);
|
||||
|
||||
if( refCount > 1 )
|
||||
{
|
||||
asSIntTypePair it = {refCount-1, gcObj.type};
|
||||
|
||||
gcMap.Insert(GetNode(gcObj.obj, it));
|
||||
|
||||
// Increment the object's reference counter when putting it in the map
|
||||
engine->CallObjectMethod(gcObj.obj, gcObj.type->beh.addref);
|
||||
|
||||
// Mark the object so that we can
|
||||
// see if it has changed since read
|
||||
engine->CallObjectMethod(gcObj.obj, gcObj.type->beh.gcSetFlag);
|
||||
}
|
||||
|
||||
detectIdx++;
|
||||
|
||||
// Let the application work a little
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
detectState = countReferences_init;
|
||||
}
|
||||
break;
|
||||
|
||||
case countReferences_init:
|
||||
{
|
||||
gcMap.MoveFirst(&gcMapCursor);
|
||||
detectState = countReferences_loop;
|
||||
}
|
||||
break;
|
||||
|
||||
case countReferences_loop:
|
||||
{
|
||||
// Call EnumReferences on all objects in the map to count the number
|
||||
// of references reachable from between objects in the map. If all
|
||||
// references for an object in the map is reachable from other objects
|
||||
// in the map, then we know that no outside references are held for
|
||||
// this object, thus it is a potential dead object in a circular reference.
|
||||
|
||||
// If the gcFlag is cleared for an object we consider the object alive
|
||||
// and referenced from outside the GC, thus we don't enumerate its references.
|
||||
|
||||
// Any new objects created after this step in the GC cycle won't be
|
||||
// in the map, and is thus automatically considered alive.
|
||||
if( gcMapCursor )
|
||||
{
|
||||
void *obj = gcMap.GetKey(gcMapCursor);
|
||||
asCObjectType *type = gcMap.GetValue(gcMapCursor).type;
|
||||
gcMap.MoveNext(&gcMapCursor, gcMapCursor);
|
||||
|
||||
if( engine->CallObjectMethodRetBool(obj, type->beh.gcGetFlag) )
|
||||
{
|
||||
engine->CallObjectMethod(obj, engine, type->beh.gcEnumReferences);
|
||||
}
|
||||
|
||||
// Allow the application to work a little
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
detectState = detectGarbage_init;
|
||||
}
|
||||
break;
|
||||
|
||||
case detectGarbage_init:
|
||||
{
|
||||
gcMap.MoveFirst(&gcMapCursor);
|
||||
liveObjects.SetLength(0);
|
||||
detectState = detectGarbage_loop1;
|
||||
}
|
||||
break;
|
||||
|
||||
case detectGarbage_loop1:
|
||||
{
|
||||
// All objects that are known not to be dead must be removed from the map,
|
||||
// along with all objects they reference. What remains in the map after
|
||||
// this pass is sure to be dead objects in circular references.
|
||||
|
||||
// An object is considered alive if its gcFlag is cleared, or all the
|
||||
// references were not found in the map.
|
||||
|
||||
// Add all alive objects from the map to the liveObjects array
|
||||
if( gcMapCursor )
|
||||
{
|
||||
asSMapNode<void*, asSIntTypePair> *cursor = gcMapCursor;
|
||||
gcMap.MoveNext(&gcMapCursor, gcMapCursor);
|
||||
|
||||
void *obj = gcMap.GetKey(cursor);
|
||||
asSIntTypePair it = gcMap.GetValue(cursor);
|
||||
|
||||
bool gcFlag = engine->CallObjectMethodRetBool(obj, it.type->beh.gcGetFlag);
|
||||
if( !gcFlag || it.i > 0 )
|
||||
{
|
||||
liveObjects.PushLast(obj);
|
||||
}
|
||||
|
||||
// Allow the application to work a little
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
detectState = detectGarbage_loop2;
|
||||
}
|
||||
break;
|
||||
|
||||
case detectGarbage_loop2:
|
||||
{
|
||||
// In this step we are actually removing the alive objects from the map.
|
||||
// As the object is removed, all the objects it references are added to the
|
||||
// liveObjects list, by calling EnumReferences. Only objects still in the map
|
||||
// will be added to the liveObjects list.
|
||||
if( liveObjects.GetLength() )
|
||||
{
|
||||
void *gcObj = liveObjects.PopLast();
|
||||
asCObjectType *type = 0;
|
||||
|
||||
// Remove the object from the map to mark it as alive
|
||||
asSMapNode<void*, asSIntTypePair> *cursor = 0;
|
||||
if( gcMap.MoveTo(&cursor, gcObj) )
|
||||
{
|
||||
type = gcMap.GetValue(cursor).type;
|
||||
ReturnNode(gcMap.Remove(cursor));
|
||||
|
||||
// We need to decrease the reference count again as we remove the object from the map
|
||||
engine->CallObjectMethod(gcObj, type->beh.release);
|
||||
|
||||
// Enumerate all the object's references so that they too can be marked as alive
|
||||
engine->CallObjectMethod(gcObj, engine, type->beh.gcEnumReferences);
|
||||
}
|
||||
|
||||
// Allow the application to work a little
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
detectState = verifyUnmarked_init;
|
||||
}
|
||||
break;
|
||||
|
||||
case verifyUnmarked_init:
|
||||
gcMap.MoveFirst(&gcMapCursor);
|
||||
detectState = verifyUnmarked_loop;
|
||||
break;
|
||||
|
||||
case verifyUnmarked_loop:
|
||||
{
|
||||
// In this step we must make sure that none of the objects still in the map
|
||||
// has been touched by the application. If they have then we must run the
|
||||
// detectGarbage loop once more.
|
||||
if( gcMapCursor )
|
||||
{
|
||||
void *gcObj = gcMap.GetKey(gcMapCursor);
|
||||
asCObjectType *type = gcMap.GetValue(gcMapCursor).type;
|
||||
|
||||
bool gcFlag = engine->CallObjectMethodRetBool(gcObj, type->beh.gcGetFlag);
|
||||
if( !gcFlag )
|
||||
{
|
||||
// The unmarked object was touched, rerun the detectGarbage loop
|
||||
detectState = detectGarbage_init;
|
||||
}
|
||||
else
|
||||
gcMap.MoveNext(&gcMapCursor, gcMapCursor);
|
||||
|
||||
// Allow the application to work a little
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
// No unmarked object was touched, we can now be sure
|
||||
// that objects that have gcCount == 0 really is garbage
|
||||
detectState = breakCircles_init;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case breakCircles_init:
|
||||
{
|
||||
gcMap.MoveFirst(&gcMapCursor);
|
||||
detectState = breakCircles_loop;
|
||||
}
|
||||
break;
|
||||
|
||||
case breakCircles_loop:
|
||||
case breakCircles_haveGarbage:
|
||||
{
|
||||
// All objects in the map are now known to be dead objects
|
||||
// kept alive through circular references. To be able to free
|
||||
// these objects we need to force the breaking of the circle
|
||||
// by having the objects release their references.
|
||||
if( gcMapCursor )
|
||||
{
|
||||
numDetected++;
|
||||
void *gcObj = gcMap.GetKey(gcMapCursor);
|
||||
asCObjectType *type = gcMap.GetValue(gcMapCursor).type;
|
||||
if( type->flags & asOBJ_SCRIPT_OBJECT )
|
||||
{
|
||||
// For script objects we must call the class destructor before
|
||||
// releasing the references, otherwise the destructor may not
|
||||
// be able to perform the necessary clean-up as the handles will
|
||||
// be null.
|
||||
reinterpret_cast<asCScriptObject*>(gcObj)->CallDestructor();
|
||||
}
|
||||
engine->CallObjectMethod(gcObj, engine, type->beh.gcReleaseAllReferences);
|
||||
|
||||
gcMap.MoveNext(&gcMapCursor, gcMapCursor);
|
||||
|
||||
detectState = breakCircles_haveGarbage;
|
||||
|
||||
// Allow the application to work a little
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
// If no garbage was detected we can finish now
|
||||
if( detectState != breakCircles_haveGarbage )
|
||||
{
|
||||
// Restart the GC
|
||||
detectState = clearCounters_init;
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Restart the GC
|
||||
detectState = clearCounters_init;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
} // switch
|
||||
}
|
||||
|
||||
// Shouldn't reach this point
|
||||
UNREACHABLE_RETURN;
|
||||
}
|
||||
|
||||
asCGarbageCollector::asSMapNode_t *asCGarbageCollector::GetNode(void *obj, asSIntTypePair it)
|
||||
{
|
||||
// This function will only be called within the critical section gcCollecting
|
||||
asASSERT(isProcessing);
|
||||
|
||||
asSMapNode_t *node;
|
||||
if( freeNodes.GetLength() )
|
||||
node = freeNodes.PopLast();
|
||||
else
|
||||
node = asNEW(asSMapNode_t);
|
||||
|
||||
node->Init(obj, it);
|
||||
return node;
|
||||
}
|
||||
|
||||
void asCGarbageCollector::ReturnNode(asSMapNode_t *node)
|
||||
{
|
||||
// This function will only be called within the critical section gcCollecting
|
||||
asASSERT(isProcessing);
|
||||
|
||||
if( node )
|
||||
freeNodes.PushLast(node);
|
||||
}
|
||||
|
||||
void asCGarbageCollector::GCEnumCallback(void *reference)
|
||||
{
|
||||
// This function will only be called within the critical section gcCollecting
|
||||
asASSERT(isProcessing);
|
||||
|
||||
if( detectState == countReferences_loop )
|
||||
{
|
||||
// Find the reference in the map
|
||||
asSMapNode<void*, asSIntTypePair> *cursor = 0;
|
||||
if( gcMap.MoveTo(&cursor, reference) )
|
||||
{
|
||||
// Decrease the counter in the map for the reference
|
||||
gcMap.GetValue(cursor).i--;
|
||||
}
|
||||
}
|
||||
else if( detectState == detectGarbage_loop2 )
|
||||
{
|
||||
// Find the reference in the map
|
||||
asSMapNode<void*, asSIntTypePair> *cursor = 0;
|
||||
if( gcMap.MoveTo(&cursor, reference) )
|
||||
{
|
||||
// Add the object to the list of objects to mark as alive
|
||||
liveObjects.PushLast(reference);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
END_AS_NAMESPACE
|
||||
|
146
lib/angelscript/source/as_gc.h
Normal file
146
lib/angelscript/source/as_gc.h
Normal file
@ -0,0 +1,146 @@
|
||||
/*
|
||||
AngelCode Scripting Library
|
||||
Copyright (c) 2003-2013 Andreas Jonsson
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any
|
||||
damages arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any
|
||||
purpose, including commercial applications, and to alter it and
|
||||
redistribute it freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you
|
||||
must not claim that you wrote the original software. If you use
|
||||
this software in a product, an acknowledgment in the product
|
||||
documentation would be appreciated but is not required.
|
||||
|
||||
2. Altered source versions must be plainly marked as such, and
|
||||
must not be misrepresented as being the original software.
|
||||
|
||||
3. This notice may not be removed or altered from any source
|
||||
distribution.
|
||||
|
||||
The original version of this library can be located at:
|
||||
http://www.angelcode.com/angelscript/
|
||||
|
||||
Andreas Jonsson
|
||||
andreas@angelcode.com
|
||||
*/
|
||||
|
||||
|
||||
//
|
||||
// as_gc.h
|
||||
//
|
||||
// The garbage collector is used to resolve cyclic references
|
||||
//
|
||||
|
||||
|
||||
|
||||
#ifndef AS_GC_H
|
||||
#define AS_GC_H
|
||||
|
||||
#include "as_config.h"
|
||||
#include "as_array.h"
|
||||
#include "as_map.h"
|
||||
#include "as_thread.h"
|
||||
|
||||
BEGIN_AS_NAMESPACE
|
||||
|
||||
class asCScriptEngine;
|
||||
class asCObjectType;
|
||||
|
||||
class asCGarbageCollector
|
||||
{
|
||||
public:
|
||||
asCGarbageCollector();
|
||||
~asCGarbageCollector();
|
||||
|
||||
int GarbageCollect(asDWORD flags);
|
||||
void GetStatistics(asUINT *currentSize, asUINT *totalDestroyed, asUINT *totalDetected, asUINT *newObjects, asUINT *totalNewDestroyed) const;
|
||||
void GCEnumCallback(void *reference);
|
||||
int AddScriptObjectToGC(void *obj, asCObjectType *objType);
|
||||
int GetObjectInGC(asUINT idx, asUINT *seqNbr, void **obj, asIObjectType **type);
|
||||
|
||||
int ReportAndReleaseUndestroyedObjects();
|
||||
|
||||
asCScriptEngine *engine;
|
||||
|
||||
protected:
|
||||
struct asSObjTypePair {void *obj; asCObjectType *type; asUINT seqNbr;};
|
||||
struct asSIntTypePair {int i; asCObjectType *type;};
|
||||
typedef asSMapNode<void*, asSIntTypePair> asSMapNode_t;
|
||||
|
||||
enum egcDestroyState
|
||||
{
|
||||
destroyGarbage_init = 0,
|
||||
destroyGarbage_loop,
|
||||
destroyGarbage_haveMore
|
||||
};
|
||||
|
||||
enum egcDetectState
|
||||
{
|
||||
clearCounters_init = 0,
|
||||
clearCounters_loop,
|
||||
buildMap_init,
|
||||
buildMap_loop,
|
||||
countReferences_init,
|
||||
countReferences_loop,
|
||||
detectGarbage_init,
|
||||
detectGarbage_loop1,
|
||||
detectGarbage_loop2,
|
||||
verifyUnmarked_init,
|
||||
verifyUnmarked_loop,
|
||||
breakCircles_init,
|
||||
breakCircles_loop,
|
||||
breakCircles_haveGarbage
|
||||
};
|
||||
|
||||
int DestroyNewGarbage();
|
||||
int DestroyOldGarbage();
|
||||
int IdentifyGarbageWithCyclicRefs();
|
||||
asSObjTypePair GetNewObjectAtIdx(int idx);
|
||||
asSObjTypePair GetOldObjectAtIdx(int idx);
|
||||
void RemoveNewObjectAtIdx(int idx);
|
||||
void RemoveOldObjectAtIdx(int idx);
|
||||
void MoveObjectToOldList(int idx);
|
||||
|
||||
// Holds all the objects known by the garbage collector
|
||||
asCArray<asSObjTypePair> gcNewObjects;
|
||||
asCArray<asSObjTypePair> gcOldObjects;
|
||||
|
||||
// This array temporarily holds references to objects known to be live objects
|
||||
asCArray<void*> liveObjects;
|
||||
|
||||
// This map holds objects currently being searched for cyclic references, it also holds a
|
||||
// counter that gives the number of references to the object that the GC can't reach
|
||||
asCMap<void*, asSIntTypePair> gcMap;
|
||||
|
||||
// State variables
|
||||
egcDestroyState destroyNewState;
|
||||
egcDestroyState destroyOldState;
|
||||
asUINT destroyNewIdx;
|
||||
asUINT destroyOldIdx;
|
||||
asUINT numDestroyed;
|
||||
asUINT numNewDestroyed;
|
||||
egcDetectState detectState;
|
||||
asUINT detectIdx;
|
||||
asUINT numDetected;
|
||||
asUINT numAdded;
|
||||
asUINT seqAtSweepStart[3];
|
||||
asSMapNode_t *gcMapCursor;
|
||||
bool isProcessing;
|
||||
|
||||
// We'll keep a pool of nodes to avoid allocating memory all the time
|
||||
asSMapNode_t *GetNode(void *obj, asSIntTypePair it);
|
||||
void ReturnNode(asSMapNode_t *node);
|
||||
asCArray<asSMapNode_t*> freeNodes;
|
||||
|
||||
// Critical section for multithreaded access
|
||||
DECLARECRITICALSECTION(gcCritical) // Used for adding/removing objects
|
||||
DECLARECRITICALSECTION(gcCollecting) // Used for processing
|
||||
};
|
||||
|
||||
END_AS_NAMESPACE
|
||||
|
||||
#endif
|
520
lib/angelscript/source/as_generic.cpp
Normal file
520
lib/angelscript/source/as_generic.cpp
Normal file
@ -0,0 +1,520 @@
|
||||
/*
|
||||
AngelCode Scripting Library
|
||||
Copyright (c) 2003-2013 Andreas Jonsson
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any
|
||||
damages arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any
|
||||
purpose, including commercial applications, and to alter it and
|
||||
redistribute it freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you
|
||||
must not claim that you wrote the original software. If you use
|
||||
this software in a product, an acknowledgment in the product
|
||||
documentation would be appreciated but is not required.
|
||||
|
||||
2. Altered source versions must be plainly marked as such, and
|
||||
must not be misrepresented as being the original software.
|
||||
|
||||
3. This notice may not be removed or altered from any source
|
||||
distribution.
|
||||
|
||||
The original version of this library can be located at:
|
||||
http://www.angelcode.com/angelscript/
|
||||
|
||||
Andreas Jonsson
|
||||
andreas@angelcode.com
|
||||
*/
|
||||
|
||||
|
||||
//
|
||||
// as_generic.cpp
|
||||
//
|
||||
// This class handles the call to a function registered with asCALL_GENERIC
|
||||
//
|
||||
|
||||
#include "as_generic.h"
|
||||
#include "as_scriptfunction.h"
|
||||
#include "as_objecttype.h"
|
||||
#include "as_scriptengine.h"
|
||||
|
||||
BEGIN_AS_NAMESPACE
|
||||
|
||||
// TODO: runtime optimize: The access to the arguments should be optimized so that code
|
||||
// doesn't have to count the position of the argument with every call
|
||||
|
||||
// internal
|
||||
asCGeneric::asCGeneric(asCScriptEngine *engine, asCScriptFunction *sysFunction, void *currentObject, asDWORD *stackPointer)
|
||||
{
|
||||
this->engine = engine;
|
||||
this->sysFunction = sysFunction;
|
||||
this->currentObject = currentObject;
|
||||
this->stackPointer = stackPointer;
|
||||
|
||||
objectRegister = 0;
|
||||
returnVal = 0;
|
||||
}
|
||||
|
||||
// internal
|
||||
asCGeneric::~asCGeneric()
|
||||
{
|
||||
}
|
||||
|
||||
// interface
|
||||
asIScriptEngine *asCGeneric::GetEngine() const
|
||||
{
|
||||
return (asIScriptEngine*)engine;
|
||||
}
|
||||
|
||||
// interface
|
||||
asIScriptFunction *asCGeneric::GetFunction() const
|
||||
{
|
||||
return sysFunction;
|
||||
}
|
||||
|
||||
// interface
|
||||
void *asCGeneric::GetObject()
|
||||
{
|
||||
return currentObject;
|
||||
}
|
||||
|
||||
// interface
|
||||
int asCGeneric::GetObjectTypeId() const
|
||||
{
|
||||
asCDataType dt = asCDataType::CreateObject(sysFunction->objectType, false);
|
||||
return engine->GetTypeIdFromDataType(dt);
|
||||
}
|
||||
|
||||
// interface
|
||||
int asCGeneric::GetArgCount() const
|
||||
{
|
||||
return (int)sysFunction->parameterTypes.GetLength();
|
||||
}
|
||||
|
||||
// interface
|
||||
asBYTE asCGeneric::GetArgByte(asUINT arg)
|
||||
{
|
||||
if( arg >= (unsigned)sysFunction->parameterTypes.GetLength() )
|
||||
return 0;
|
||||
|
||||
// Verify that the type is correct
|
||||
asCDataType *dt = &sysFunction->parameterTypes[arg];
|
||||
if( dt->IsObject() || dt->IsReference() )
|
||||
return 0;
|
||||
|
||||
if( dt->GetSizeInMemoryBytes() != 1 )
|
||||
return 0;
|
||||
|
||||
// Determine the position of the argument
|
||||
int offset = 0;
|
||||
for( asUINT n = 0; n < arg; n++ )
|
||||
offset += sysFunction->parameterTypes[n].GetSizeOnStackDWords();
|
||||
|
||||
// Get the value
|
||||
return *(asBYTE*)&stackPointer[offset];
|
||||
}
|
||||
|
||||
// interface
|
||||
asWORD asCGeneric::GetArgWord(asUINT arg)
|
||||
{
|
||||
if( arg >= (unsigned)sysFunction->parameterTypes.GetLength() )
|
||||
return 0;
|
||||
|
||||
// Verify that the type is correct
|
||||
asCDataType *dt = &sysFunction->parameterTypes[arg];
|
||||
if( dt->IsObject() || dt->IsReference() )
|
||||
return 0;
|
||||
|
||||
if( dt->GetSizeInMemoryBytes() != 2 )
|
||||
return 0;
|
||||
|
||||
// Determine the position of the argument
|
||||
int offset = 0;
|
||||
for( asUINT n = 0; n < arg; n++ )
|
||||
offset += sysFunction->parameterTypes[n].GetSizeOnStackDWords();
|
||||
|
||||
// Get the value
|
||||
return *(asWORD*)&stackPointer[offset];
|
||||
}
|
||||
|
||||
// interface
|
||||
asDWORD asCGeneric::GetArgDWord(asUINT arg)
|
||||
{
|
||||
if( arg >= (unsigned)sysFunction->parameterTypes.GetLength() )
|
||||
return 0;
|
||||
|
||||
// Verify that the type is correct
|
||||
asCDataType *dt = &sysFunction->parameterTypes[arg];
|
||||
if( dt->IsObject() || dt->IsReference() )
|
||||
return 0;
|
||||
|
||||
if( dt->GetSizeInMemoryBytes() != 4 )
|
||||
return 0;
|
||||
|
||||
// Determine the position of the argument
|
||||
int offset = 0;
|
||||
for( asUINT n = 0; n < arg; n++ )
|
||||
offset += sysFunction->parameterTypes[n].GetSizeOnStackDWords();
|
||||
|
||||
// Get the value
|
||||
return *(asDWORD*)&stackPointer[offset];
|
||||
}
|
||||
|
||||
// interface
|
||||
asQWORD asCGeneric::GetArgQWord(asUINT arg)
|
||||
{
|
||||
if( arg >= (unsigned)sysFunction->parameterTypes.GetLength() )
|
||||
return 0;
|
||||
|
||||
// Verify that the type is correct
|
||||
asCDataType *dt = &sysFunction->parameterTypes[arg];
|
||||
if( dt->IsObject() || dt->IsReference() )
|
||||
return 0;
|
||||
|
||||
if( dt->GetSizeInMemoryBytes() != 8 )
|
||||
return 0;
|
||||
|
||||
// Determine the position of the argument
|
||||
int offset = 0;
|
||||
for( asUINT n = 0; n < arg; n++ )
|
||||
offset += sysFunction->parameterTypes[n].GetSizeOnStackDWords();
|
||||
|
||||
// Get the value
|
||||
return *(asQWORD*)(&stackPointer[offset]);
|
||||
}
|
||||
|
||||
// interface
|
||||
float asCGeneric::GetArgFloat(asUINT arg)
|
||||
{
|
||||
if( arg >= (unsigned)sysFunction->parameterTypes.GetLength() )
|
||||
return 0;
|
||||
|
||||
// Verify that the type is correct
|
||||
asCDataType *dt = &sysFunction->parameterTypes[arg];
|
||||
if( dt->IsObject() || dt->IsReference() )
|
||||
return 0;
|
||||
|
||||
if( dt->GetSizeInMemoryBytes() != 4 )
|
||||
return 0;
|
||||
|
||||
// Determine the position of the argument
|
||||
int offset = 0;
|
||||
for( asUINT n = 0; n < arg; n++ )
|
||||
offset += sysFunction->parameterTypes[n].GetSizeOnStackDWords();
|
||||
|
||||
// Get the value
|
||||
return *(float*)(&stackPointer[offset]);
|
||||
}
|
||||
|
||||
// interface
|
||||
double asCGeneric::GetArgDouble(asUINT arg)
|
||||
{
|
||||
if( arg >= (unsigned)sysFunction->parameterTypes.GetLength() )
|
||||
return 0;
|
||||
|
||||
// Verify that the type is correct
|
||||
asCDataType *dt = &sysFunction->parameterTypes[arg];
|
||||
if( dt->IsObject() || dt->IsReference() )
|
||||
return 0;
|
||||
|
||||
if( dt->GetSizeInMemoryBytes() != 8 )
|
||||
return 0;
|
||||
|
||||
// Determine the position of the argument
|
||||
int offset = 0;
|
||||
for( asUINT n = 0; n < arg; n++ )
|
||||
offset += sysFunction->parameterTypes[n].GetSizeOnStackDWords();
|
||||
|
||||
// Get the value
|
||||
return *(double*)(&stackPointer[offset]);
|
||||
}
|
||||
|
||||
// interface
|
||||
void *asCGeneric::GetArgAddress(asUINT arg)
|
||||
{
|
||||
if( arg >= (unsigned)sysFunction->parameterTypes.GetLength() )
|
||||
return 0;
|
||||
|
||||
// Verify that the type is correct
|
||||
asCDataType *dt = &sysFunction->parameterTypes[arg];
|
||||
if( !dt->IsReference() && !dt->IsObjectHandle() )
|
||||
return 0;
|
||||
|
||||
// Determine the position of the argument
|
||||
int offset = 0;
|
||||
for( asUINT n = 0; n < arg; n++ )
|
||||
offset += sysFunction->parameterTypes[n].GetSizeOnStackDWords();
|
||||
|
||||
// Get the value
|
||||
return (void*)*(asPWORD*)(&stackPointer[offset]);
|
||||
}
|
||||
|
||||
// interface
|
||||
void *asCGeneric::GetArgObject(asUINT arg)
|
||||
{
|
||||
if( arg >= (unsigned)sysFunction->parameterTypes.GetLength() )
|
||||
return 0;
|
||||
|
||||
// Verify that the type is correct
|
||||
asCDataType *dt = &sysFunction->parameterTypes[arg];
|
||||
if( !dt->IsObject() )
|
||||
return 0;
|
||||
|
||||
// Determine the position of the argument
|
||||
int offset = 0;
|
||||
for( asUINT n = 0; n < arg; n++ )
|
||||
offset += sysFunction->parameterTypes[n].GetSizeOnStackDWords();
|
||||
|
||||
// Get the value
|
||||
return *(void**)(&stackPointer[offset]);
|
||||
}
|
||||
|
||||
// interface
|
||||
void *asCGeneric::GetAddressOfArg(asUINT arg)
|
||||
{
|
||||
if( arg >= (unsigned)sysFunction->parameterTypes.GetLength() )
|
||||
return 0;
|
||||
|
||||
// Determine the position of the argument
|
||||
int offset = 0;
|
||||
for( asUINT n = 0; n < arg; n++ )
|
||||
offset += sysFunction->parameterTypes[n].GetSizeOnStackDWords();
|
||||
|
||||
// For object variables it's necessary to dereference the pointer to get the address of the value
|
||||
if( !sysFunction->parameterTypes[arg].IsReference() &&
|
||||
sysFunction->parameterTypes[arg].IsObject() &&
|
||||
!sysFunction->parameterTypes[arg].IsObjectHandle() )
|
||||
return *(void**)&stackPointer[offset];
|
||||
|
||||
// Get the address of the value
|
||||
return &stackPointer[offset];
|
||||
}
|
||||
|
||||
// interface
|
||||
int asCGeneric::GetArgTypeId(asUINT arg, asDWORD *flags) const
|
||||
{
|
||||
if( arg >= (unsigned)sysFunction->parameterTypes.GetLength() )
|
||||
return 0;
|
||||
|
||||
if( flags )
|
||||
{
|
||||
*flags = sysFunction->inOutFlags[arg];
|
||||
*flags |= sysFunction->parameterTypes[arg].IsReadOnly() ? asTM_CONST : 0;
|
||||
}
|
||||
|
||||
asCDataType *dt = &sysFunction->parameterTypes[arg];
|
||||
if( dt->GetTokenType() != ttQuestion )
|
||||
return engine->GetTypeIdFromDataType(*dt);
|
||||
else
|
||||
{
|
||||
int offset = 0;
|
||||
for( asUINT n = 0; n < arg; n++ )
|
||||
offset += sysFunction->parameterTypes[n].GetSizeOnStackDWords();
|
||||
|
||||
// Skip the actual value to get to the type id
|
||||
offset += AS_PTR_SIZE;
|
||||
|
||||
// Get the value
|
||||
return stackPointer[offset];
|
||||
}
|
||||
}
|
||||
|
||||
// interface
|
||||
int asCGeneric::SetReturnByte(asBYTE val)
|
||||
{
|
||||
// Verify the type of the return value
|
||||
if( sysFunction->returnType.IsObject() || sysFunction->returnType.IsReference() )
|
||||
return asINVALID_TYPE;
|
||||
|
||||
if( sysFunction->returnType.GetSizeInMemoryBytes() != 1 )
|
||||
return asINVALID_TYPE;
|
||||
|
||||
// Store the value
|
||||
*(asBYTE*)&returnVal = val;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// interface
|
||||
int asCGeneric::SetReturnWord(asWORD val)
|
||||
{
|
||||
// Verify the type of the return value
|
||||
if( sysFunction->returnType.IsObject() || sysFunction->returnType.IsReference() )
|
||||
return asINVALID_TYPE;
|
||||
|
||||
if( sysFunction->returnType.GetSizeInMemoryBytes() != 2 )
|
||||
return asINVALID_TYPE;
|
||||
|
||||
// Store the value
|
||||
*(asWORD*)&returnVal = val;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// interface
|
||||
int asCGeneric::SetReturnDWord(asDWORD val)
|
||||
{
|
||||
// Verify the type of the return value
|
||||
if( sysFunction->returnType.IsObject() || sysFunction->returnType.IsReference() )
|
||||
return asINVALID_TYPE;
|
||||
|
||||
if( sysFunction->returnType.GetSizeInMemoryBytes() != 4 )
|
||||
return asINVALID_TYPE;
|
||||
|
||||
// Store the value
|
||||
*(asDWORD*)&returnVal = val;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// interface
|
||||
int asCGeneric::SetReturnQWord(asQWORD val)
|
||||
{
|
||||
// Verify the type of the return value
|
||||
if( sysFunction->returnType.IsObject() || sysFunction->returnType.IsReference() )
|
||||
return asINVALID_TYPE;
|
||||
|
||||
if( sysFunction->returnType.GetSizeOnStackDWords() != 2 )
|
||||
return asINVALID_TYPE;
|
||||
|
||||
// Store the value
|
||||
returnVal = val;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// interface
|
||||
int asCGeneric::SetReturnFloat(float val)
|
||||
{
|
||||
// Verify the type of the return value
|
||||
if( sysFunction->returnType.IsObject() || sysFunction->returnType.IsReference() )
|
||||
return asINVALID_TYPE;
|
||||
|
||||
if( sysFunction->returnType.GetSizeOnStackDWords() != 1 )
|
||||
return asINVALID_TYPE;
|
||||
|
||||
// Store the value
|
||||
*(float*)&returnVal = val;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// interface
|
||||
int asCGeneric::SetReturnDouble(double val)
|
||||
{
|
||||
// Verify the type of the return value
|
||||
if( sysFunction->returnType.IsObject() || sysFunction->returnType.IsReference() )
|
||||
return asINVALID_TYPE;
|
||||
|
||||
if( sysFunction->returnType.GetSizeOnStackDWords() != 2 )
|
||||
return asINVALID_TYPE;
|
||||
|
||||
// Store the value
|
||||
*(double*)&returnVal = val;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// interface
|
||||
int asCGeneric::SetReturnAddress(void *val)
|
||||
{
|
||||
// Verify the type of the return value
|
||||
if( sysFunction->returnType.IsReference() )
|
||||
{
|
||||
// Store the value
|
||||
*(void**)&returnVal = val;
|
||||
return 0;
|
||||
}
|
||||
else if( sysFunction->returnType.IsObjectHandle() )
|
||||
{
|
||||
// Store the handle without increasing reference
|
||||
objectRegister = val;
|
||||
return 0;
|
||||
}
|
||||
|
||||
return asINVALID_TYPE;
|
||||
}
|
||||
|
||||
// interface
|
||||
int asCGeneric::SetReturnObject(void *obj)
|
||||
{
|
||||
asCDataType *dt = &sysFunction->returnType;
|
||||
if( !dt->IsObject() )
|
||||
return asINVALID_TYPE;
|
||||
|
||||
if( dt->IsReference() )
|
||||
{
|
||||
*(void**)&returnVal = obj;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if( dt->IsObjectHandle() )
|
||||
{
|
||||
// Increase the reference counter
|
||||
asSTypeBehaviour *beh = &dt->GetObjectType()->beh;
|
||||
if( obj && beh->addref )
|
||||
engine->CallObjectMethod(obj, beh->addref);
|
||||
}
|
||||
else
|
||||
{
|
||||
// If function returns object by value the memory is already allocated.
|
||||
// Here we should just initialize that memory by calling the copy constructor
|
||||
// or the default constructor followed by the assignment operator
|
||||
void *mem = (void*)*(asPWORD*)&stackPointer[-AS_PTR_SIZE];
|
||||
engine->ConstructScriptObjectCopy(mem, obj, dt->GetObjectType());
|
||||
return 0;
|
||||
}
|
||||
|
||||
objectRegister = obj;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// internal
|
||||
void *asCGeneric::GetReturnPointer()
|
||||
{
|
||||
asCDataType &dt = sysFunction->returnType;
|
||||
|
||||
if( dt.IsObject() && !dt.IsReference() )
|
||||
{
|
||||
// This function doesn't support returning on the stack but the use of
|
||||
// the function doesn't require it so we don't need to implement it here.
|
||||
asASSERT( !sysFunction->DoesReturnOnStack() );
|
||||
|
||||
return &objectRegister;
|
||||
}
|
||||
|
||||
return &returnVal;
|
||||
}
|
||||
|
||||
// interface
|
||||
void *asCGeneric::GetAddressOfReturnLocation()
|
||||
{
|
||||
asCDataType &dt = sysFunction->returnType;
|
||||
|
||||
if( dt.IsObject() && !dt.IsReference() )
|
||||
{
|
||||
if( sysFunction->DoesReturnOnStack() )
|
||||
{
|
||||
// The memory is already preallocated on the stack,
|
||||
// and the pointer to the location is found before the first arg
|
||||
return (void*)*(asPWORD*)&stackPointer[-AS_PTR_SIZE];
|
||||
}
|
||||
|
||||
// Reference types store the handle in the objectReference
|
||||
return &objectRegister;
|
||||
}
|
||||
|
||||
// Primitive types and references are stored in the returnVal property
|
||||
return &returnVal;
|
||||
}
|
||||
|
||||
// interface
|
||||
int asCGeneric::GetReturnTypeId(asDWORD *flags) const
|
||||
{
|
||||
return sysFunction->GetReturnTypeId(flags);
|
||||
}
|
||||
|
||||
END_AS_NAMESPACE
|
107
lib/angelscript/source/as_generic.h
Normal file
107
lib/angelscript/source/as_generic.h
Normal file
@ -0,0 +1,107 @@
|
||||
/*
|
||||
AngelCode Scripting Library
|
||||
Copyright (c) 2003-2013 Andreas Jonsson
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any
|
||||
damages arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any
|
||||
purpose, including commercial applications, and to alter it and
|
||||
redistribute it freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you
|
||||
must not claim that you wrote the original software. If you use
|
||||
this software in a product, an acknowledgment in the product
|
||||
documentation would be appreciated but is not required.
|
||||
|
||||
2. Altered source versions must be plainly marked as such, and
|
||||
must not be misrepresented as being the original software.
|
||||
|
||||
3. This notice may not be removed or altered from any source
|
||||
distribution.
|
||||
|
||||
The original version of this library can be located at:
|
||||
http://www.angelcode.com/angelscript/
|
||||
|
||||
Andreas Jonsson
|
||||
andreas@angelcode.com
|
||||
*/
|
||||
|
||||
|
||||
//
|
||||
// as_generic.h
|
||||
//
|
||||
// This class handles the call to a function registered with asCALL_GENERIC
|
||||
//
|
||||
|
||||
|
||||
#ifndef AS_GENERIC_H
|
||||
#define AS_GENERIC_H
|
||||
|
||||
#include "as_config.h"
|
||||
|
||||
BEGIN_AS_NAMESPACE
|
||||
|
||||
class asCScriptEngine;
|
||||
class asCScriptFunction;
|
||||
|
||||
class asCGeneric : public asIScriptGeneric
|
||||
{
|
||||
public:
|
||||
//------------------------------
|
||||
// asIScriptGeneric
|
||||
//------------------------------
|
||||
// Miscellaneous
|
||||
asIScriptEngine *GetEngine() const;
|
||||
asIScriptFunction *GetFunction() const;
|
||||
|
||||
// Object
|
||||
void *GetObject();
|
||||
int GetObjectTypeId() const;
|
||||
|
||||
// Arguments
|
||||
int GetArgCount() const;
|
||||
int GetArgTypeId(asUINT arg, asDWORD *flags = 0) const;
|
||||
asBYTE GetArgByte(asUINT arg);
|
||||
asWORD GetArgWord(asUINT arg);
|
||||
asDWORD GetArgDWord(asUINT arg);
|
||||
asQWORD GetArgQWord(asUINT arg);
|
||||
float GetArgFloat(asUINT arg);
|
||||
double GetArgDouble(asUINT arg);
|
||||
void *GetArgAddress(asUINT arg);
|
||||
void *GetArgObject(asUINT arg);
|
||||
void *GetAddressOfArg(asUINT arg);
|
||||
|
||||
// Return value
|
||||
int GetReturnTypeId(asDWORD *flags = 0) const;
|
||||
int SetReturnByte(asBYTE val);
|
||||
int SetReturnWord(asWORD val);
|
||||
int SetReturnDWord(asDWORD val);
|
||||
int SetReturnQWord(asQWORD val);
|
||||
int SetReturnFloat(float val);
|
||||
int SetReturnDouble(double val);
|
||||
int SetReturnAddress(void *addr);
|
||||
int SetReturnObject(void *obj);
|
||||
void *GetAddressOfReturnLocation();
|
||||
|
||||
//------------------------
|
||||
// internal
|
||||
//-------------------------
|
||||
asCGeneric(asCScriptEngine *engine, asCScriptFunction *sysFunction, void *currentObject, asDWORD *stackPointer);
|
||||
virtual ~asCGeneric();
|
||||
|
||||
void *GetReturnPointer();
|
||||
|
||||
asCScriptEngine *engine;
|
||||
asCScriptFunction *sysFunction;
|
||||
void *currentObject;
|
||||
asDWORD *stackPointer;
|
||||
void *objectRegister;
|
||||
|
||||
asQWORD returnVal;
|
||||
};
|
||||
|
||||
END_AS_NAMESPACE
|
||||
|
||||
#endif
|
255
lib/angelscript/source/as_globalproperty.cpp
Normal file
255
lib/angelscript/source/as_globalproperty.cpp
Normal file
@ -0,0 +1,255 @@
|
||||
/*
|
||||
AngelCode Scripting Library
|
||||
Copyright (c) 2003-2012 Andreas Jonsson
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any
|
||||
damages arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any
|
||||
purpose, including commercial applications, and to alter it and
|
||||
redistribute it freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you
|
||||
must not claim that you wrote the original software. If you use
|
||||
this software in a product, an acknowledgment in the product
|
||||
documentation would be appreciated but is not required.
|
||||
|
||||
2. Altered source versions must be plainly marked as such, and
|
||||
must not be misrepresented as being the original software.
|
||||
|
||||
3. This notice may not be removed or altered from any source
|
||||
distribution.
|
||||
|
||||
The original version of this library can be located at:
|
||||
http://www.angelcode.com/angelscript/
|
||||
|
||||
Andreas Jonsson
|
||||
andreas@angelcode.com
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
#include "as_config.h"
|
||||
#include "as_property.h"
|
||||
#include "as_scriptengine.h"
|
||||
|
||||
BEGIN_AS_NAMESPACE
|
||||
|
||||
asCGlobalProperty::asCGlobalProperty()
|
||||
{
|
||||
memory = &storage;
|
||||
memoryAllocated = false;
|
||||
realAddress = 0;
|
||||
initFunc = 0;
|
||||
accessMask = 0xFFFFFFFF;
|
||||
|
||||
refCount.set(1);
|
||||
}
|
||||
|
||||
asCGlobalProperty::~asCGlobalProperty()
|
||||
{
|
||||
if( memoryAllocated ) { asDELETEARRAY(memory); }
|
||||
if( initFunc )
|
||||
initFunc->Release();
|
||||
}
|
||||
|
||||
void asCGlobalProperty::AddRef()
|
||||
{
|
||||
gcFlag = false;
|
||||
refCount.atomicInc();
|
||||
}
|
||||
|
||||
void asCGlobalProperty::Release()
|
||||
{
|
||||
gcFlag = false;
|
||||
|
||||
// The property doesn't delete itself. The
|
||||
// engine will do that at a later time
|
||||
if( refCount.atomicDec() == 2 && initFunc )
|
||||
{
|
||||
// Since the initFunc holds references to the property,
|
||||
// we'll release it when we reach refCount 2. This will
|
||||
// break the circle and allow the engine to free the property
|
||||
// without the need for the GC to attempt finding circular
|
||||
// references.
|
||||
initFunc->Release();
|
||||
initFunc = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void *asCGlobalProperty::GetAddressOfValue()
|
||||
{
|
||||
return memory;
|
||||
}
|
||||
|
||||
// The global property structure is responsible for allocating the storage
|
||||
// method for script declared variables. Each allocation is independent of
|
||||
// other global properties, so that variables can be added and removed at
|
||||
// any time.
|
||||
void asCGlobalProperty::AllocateMemory()
|
||||
{
|
||||
if( type.GetSizeOnStackDWords() > 2 )
|
||||
{
|
||||
memory = asNEWARRAY(asDWORD, type.GetSizeOnStackDWords());
|
||||
memoryAllocated = true;
|
||||
}
|
||||
}
|
||||
|
||||
void asCGlobalProperty::SetRegisteredAddress(void *p)
|
||||
{
|
||||
realAddress = p;
|
||||
if( type.IsObject() && !type.IsReference() && !type.IsObjectHandle() )
|
||||
{
|
||||
// The global property is a pointer to a pointer
|
||||
memory = &realAddress;
|
||||
}
|
||||
else
|
||||
memory = p;
|
||||
}
|
||||
|
||||
void *asCGlobalProperty::GetRegisteredAddress() const
|
||||
{
|
||||
return realAddress;
|
||||
}
|
||||
|
||||
int asCGlobalProperty::GetRefCount()
|
||||
{
|
||||
return refCount.get();
|
||||
}
|
||||
|
||||
void asCGlobalProperty::SetGCFlag()
|
||||
{
|
||||
gcFlag = true;
|
||||
}
|
||||
|
||||
bool asCGlobalProperty::GetGCFlag()
|
||||
{
|
||||
return gcFlag;
|
||||
}
|
||||
|
||||
void asCGlobalProperty::EnumReferences(asIScriptEngine *engine)
|
||||
{
|
||||
engine->GCEnumCallback(initFunc);
|
||||
}
|
||||
|
||||
void asCGlobalProperty::ReleaseAllHandles(asIScriptEngine *)
|
||||
{
|
||||
if( initFunc )
|
||||
{
|
||||
initFunc->Release();
|
||||
initFunc = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void asCGlobalProperty::Orphan(asCModule *module)
|
||||
{
|
||||
if( initFunc && initFunc->module == module )
|
||||
{
|
||||
// The owning module is releasing the property, so we need to notify
|
||||
// the GC in order to resolve any circular references that may exists
|
||||
|
||||
// This will add the property
|
||||
initFunc->engine->gc.AddScriptObjectToGC(this, &initFunc->engine->globalPropertyBehaviours);
|
||||
|
||||
// This will add the function
|
||||
initFunc->AddRef();
|
||||
initFunc->Orphan(module);
|
||||
}
|
||||
|
||||
Release();
|
||||
}
|
||||
|
||||
void asCGlobalProperty::SetInitFunc(asCScriptFunction *initFunc)
|
||||
{
|
||||
// This should only be done once
|
||||
asASSERT( this->initFunc == 0 );
|
||||
|
||||
this->initFunc = initFunc;
|
||||
this->initFunc->AddRef();
|
||||
}
|
||||
|
||||
asCScriptFunction *asCGlobalProperty::GetInitFunc()
|
||||
{
|
||||
return initFunc;
|
||||
}
|
||||
|
||||
|
||||
#ifdef AS_MAX_PORTABILITY
|
||||
|
||||
static void GlobalProperty_AddRef_Generic(asIScriptGeneric *gen)
|
||||
{
|
||||
asCGlobalProperty *self = (asCGlobalProperty*)gen->GetObject();
|
||||
self->AddRef();
|
||||
}
|
||||
|
||||
static void GlobalProperty_Release_Generic(asIScriptGeneric *gen)
|
||||
{
|
||||
asCGlobalProperty *self = (asCGlobalProperty*)gen->GetObject();
|
||||
self->Release();
|
||||
}
|
||||
|
||||
static void GlobalProperty_GetRefCount_Generic(asIScriptGeneric *gen)
|
||||
{
|
||||
asCGlobalProperty *self = (asCGlobalProperty*)gen->GetObject();
|
||||
*(int*)gen->GetAddressOfReturnLocation() = self->GetRefCount();
|
||||
}
|
||||
|
||||
static void GlobalProperty_SetGCFlag_Generic(asIScriptGeneric *gen)
|
||||
{
|
||||
asCGlobalProperty *self = (asCGlobalProperty*)gen->GetObject();
|
||||
self->SetGCFlag();
|
||||
}
|
||||
|
||||
static void GlobalProperty_GetGCFlag_Generic(asIScriptGeneric *gen)
|
||||
{
|
||||
asCGlobalProperty *self = (asCGlobalProperty*)gen->GetObject();
|
||||
*(bool*)gen->GetAddressOfReturnLocation() = self->GetGCFlag();
|
||||
}
|
||||
|
||||
static void GlobalProperty_EnumReferences_Generic(asIScriptGeneric *gen)
|
||||
{
|
||||
asCGlobalProperty *self = (asCGlobalProperty*)gen->GetObject();
|
||||
asIScriptEngine *engine = *(asIScriptEngine**)gen->GetAddressOfArg(0);
|
||||
self->EnumReferences(engine);
|
||||
}
|
||||
|
||||
static void GlobalProperty_ReleaseAllHandles_Generic(asIScriptGeneric *gen)
|
||||
{
|
||||
asCGlobalProperty *self = (asCGlobalProperty*)gen->GetObject();
|
||||
asIScriptEngine *engine = *(asIScriptEngine**)gen->GetAddressOfArg(0);
|
||||
self->ReleaseAllHandles(engine);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
void asCGlobalProperty::RegisterGCBehaviours(asCScriptEngine *engine)
|
||||
{
|
||||
// Register the gc behaviours for the global properties
|
||||
int r = 0;
|
||||
UNUSED_VAR(r); // It is only used in debug mode
|
||||
engine->globalPropertyBehaviours.engine = engine;
|
||||
engine->globalPropertyBehaviours.flags = asOBJ_REF | asOBJ_GC;
|
||||
engine->globalPropertyBehaviours.name = "_builtin_globalprop_";
|
||||
#ifndef AS_MAX_PORTABILITY
|
||||
r = engine->RegisterBehaviourToObjectType(&engine->globalPropertyBehaviours, asBEHAVE_ADDREF, "void f()", asMETHOD(asCGlobalProperty,AddRef), asCALL_THISCALL, 0); asASSERT( r >= 0 );
|
||||
r = engine->RegisterBehaviourToObjectType(&engine->globalPropertyBehaviours, asBEHAVE_RELEASE, "void f()", asMETHOD(asCGlobalProperty,Release), asCALL_THISCALL, 0); asASSERT( r >= 0 );
|
||||
r = engine->RegisterBehaviourToObjectType(&engine->globalPropertyBehaviours, asBEHAVE_GETREFCOUNT, "int f()", asMETHOD(asCGlobalProperty,GetRefCount), asCALL_THISCALL, 0); asASSERT( r >= 0 );
|
||||
r = engine->RegisterBehaviourToObjectType(&engine->globalPropertyBehaviours, asBEHAVE_SETGCFLAG, "void f()", asMETHOD(asCGlobalProperty,SetGCFlag), asCALL_THISCALL, 0); asASSERT( r >= 0 );
|
||||
r = engine->RegisterBehaviourToObjectType(&engine->globalPropertyBehaviours, asBEHAVE_GETGCFLAG, "bool f()", asMETHOD(asCGlobalProperty,GetGCFlag), asCALL_THISCALL, 0); asASSERT( r >= 0 );
|
||||
r = engine->RegisterBehaviourToObjectType(&engine->globalPropertyBehaviours, asBEHAVE_ENUMREFS, "void f(int&in)", asMETHOD(asCGlobalProperty,EnumReferences), asCALL_THISCALL, 0); asASSERT( r >= 0 );
|
||||
r = engine->RegisterBehaviourToObjectType(&engine->globalPropertyBehaviours, asBEHAVE_RELEASEREFS, "void f(int&in)", asMETHOD(asCGlobalProperty,ReleaseAllHandles), asCALL_THISCALL, 0); asASSERT( r >= 0 );
|
||||
#else
|
||||
r = engine->RegisterBehaviourToObjectType(&engine->globalPropertyBehaviours, asBEHAVE_ADDREF, "void f()", asFUNCTION(GlobalProperty_AddRef_Generic), asCALL_GENERIC, 0); asASSERT( r >= 0 );
|
||||
r = engine->RegisterBehaviourToObjectType(&engine->globalPropertyBehaviours, asBEHAVE_RELEASE, "void f()", asFUNCTION(GlobalProperty_Release_Generic), asCALL_GENERIC, 0); asASSERT( r >= 0 );
|
||||
r = engine->RegisterBehaviourToObjectType(&engine->globalPropertyBehaviours, asBEHAVE_GETREFCOUNT, "int f()", asFUNCTION(GlobalProperty_GetRefCount_Generic), asCALL_GENERIC, 0); asASSERT( r >= 0 );
|
||||
r = engine->RegisterBehaviourToObjectType(&engine->globalPropertyBehaviours, asBEHAVE_SETGCFLAG, "void f()", asFUNCTION(GlobalProperty_SetGCFlag_Generic), asCALL_GENERIC, 0); asASSERT( r >= 0 );
|
||||
r = engine->RegisterBehaviourToObjectType(&engine->globalPropertyBehaviours, asBEHAVE_GETGCFLAG, "bool f()", asFUNCTION(GlobalProperty_GetGCFlag_Generic), asCALL_GENERIC, 0); asASSERT( r >= 0 );
|
||||
r = engine->RegisterBehaviourToObjectType(&engine->globalPropertyBehaviours, asBEHAVE_ENUMREFS, "void f(int&in)", asFUNCTION(GlobalProperty_EnumReferences_Generic), asCALL_GENERIC, 0); asASSERT( r >= 0 );
|
||||
r = engine->RegisterBehaviourToObjectType(&engine->globalPropertyBehaviours, asBEHAVE_RELEASEREFS, "void f(int&in)", asFUNCTION(GlobalProperty_ReleaseAllHandles_Generic), asCALL_GENERIC, 0); asASSERT( r >= 0 );
|
||||
#endif
|
||||
}
|
||||
|
||||
END_AS_NAMESPACE
|
786
lib/angelscript/source/as_map.h
Normal file
786
lib/angelscript/source/as_map.h
Normal file
@ -0,0 +1,786 @@
|
||||
/*
|
||||
AngelCode Scripting Library
|
||||
Copyright (c) 2003-2013 Andreas Jonsson
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any
|
||||
damages arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any
|
||||
purpose, including commercial applications, and to alter it and
|
||||
redistribute it freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you
|
||||
must not claim that you wrote the original software. If you use
|
||||
this software in a product, an acknowledgment in the product
|
||||
documentation would be appreciated but is not required.
|
||||
|
||||
2. Altered source versions must be plainly marked as such, and
|
||||
must not be misrepresented as being the original software.
|
||||
|
||||
3. This notice may not be removed or altered from any source
|
||||
distribution.
|
||||
|
||||
The original version of this library can be located at:
|
||||
http://www.angelcode.com/angelscript/
|
||||
|
||||
Andreas Jonsson
|
||||
andreas@angelcode.com
|
||||
*/
|
||||
|
||||
|
||||
//
|
||||
// as_map.h
|
||||
//
|
||||
// This class is used for mapping a value to another
|
||||
//
|
||||
|
||||
|
||||
#ifndef AS_MAP_H
|
||||
#define AS_MAP_H
|
||||
|
||||
template <class KEY, class VAL> struct asSMapNode;
|
||||
|
||||
template <class KEY, class VAL> class asCMap
|
||||
{
|
||||
public:
|
||||
asCMap();
|
||||
~asCMap();
|
||||
|
||||
int Insert(const KEY &key, const VAL &value);
|
||||
int Insert(asSMapNode<KEY,VAL> *node);
|
||||
int GetCount() const;
|
||||
|
||||
const KEY &GetKey(const asSMapNode<KEY,VAL> *cursor) const;
|
||||
const VAL &GetValue(const asSMapNode<KEY,VAL> *cursor) const;
|
||||
VAL &GetValue(asSMapNode<KEY,VAL> *cursor);
|
||||
|
||||
void Erase(asSMapNode<KEY,VAL> *cursor);
|
||||
asSMapNode<KEY,VAL> *Remove(asSMapNode<KEY,VAL> *cursor);
|
||||
void EraseAll();
|
||||
|
||||
void SwapWith(asCMap<KEY,VAL> &other);
|
||||
|
||||
// Returns true as long as cursor is valid
|
||||
|
||||
bool MoveTo(asSMapNode<KEY,VAL> **out, const KEY &key) const;
|
||||
bool MoveFirst(asSMapNode<KEY,VAL> **out) const;
|
||||
bool MoveLast(asSMapNode<KEY,VAL> **out) const;
|
||||
bool MoveNext(asSMapNode<KEY,VAL> **out, asSMapNode<KEY,VAL> *cursor) const;
|
||||
bool MovePrev(asSMapNode<KEY,VAL> **out, asSMapNode<KEY,VAL> *cursor) const;
|
||||
|
||||
// For debugging only
|
||||
|
||||
int CheckIntegrity(asSMapNode<KEY,VAL> *node) const;
|
||||
|
||||
protected:
|
||||
// Don't allow value assignment
|
||||
asCMap &operator=(const asCMap &) { return *this; }
|
||||
|
||||
void BalanceInsert(asSMapNode<KEY,VAL> *node);
|
||||
void BalanceErase(asSMapNode<KEY,VAL> *child, asSMapNode<KEY,VAL> *parent);
|
||||
|
||||
int EraseAll(asSMapNode<KEY,VAL> *node);
|
||||
int RotateLeft(asSMapNode<KEY,VAL> *node);
|
||||
int RotateRight(asSMapNode<KEY,VAL> *node);
|
||||
|
||||
asSMapNode<KEY,VAL> *root;
|
||||
asSMapNode<KEY,VAL> dummy;
|
||||
|
||||
int count;
|
||||
};
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Implementation
|
||||
|
||||
// Properties of a Red-Black Tree
|
||||
//
|
||||
// 1. The root is always black
|
||||
// 2. All single paths from the root to leafs
|
||||
// contain the same amount of black nodes
|
||||
// 3. No red node can have a red node as parent
|
||||
|
||||
#define ISRED(x) ((x != 0) && (x)->isRed)
|
||||
#define ISBLACK(x) (!ISRED(x))
|
||||
|
||||
template <class KEY, class VAL> struct asSMapNode
|
||||
{
|
||||
asSMapNode() {parent = 0; left = 0; right = 0; isRed = true;}
|
||||
void Init(KEY k, VAL v) {key = k; value = v; parent = 0; left = 0; right = 0; isRed = true;}
|
||||
|
||||
asSMapNode *parent;
|
||||
asSMapNode *left;
|
||||
asSMapNode *right;
|
||||
bool isRed;
|
||||
|
||||
KEY key;
|
||||
VAL value;
|
||||
};
|
||||
|
||||
template <class KEY, class VAL>
|
||||
asCMap<KEY, VAL>::asCMap()
|
||||
{
|
||||
root = 0;
|
||||
count = 0;
|
||||
}
|
||||
|
||||
template <class KEY, class VAL>
|
||||
asCMap<KEY, VAL>::~asCMap()
|
||||
{
|
||||
EraseAll();
|
||||
}
|
||||
|
||||
template <class KEY, class VAL>
|
||||
void asCMap<KEY,VAL>::SwapWith(asCMap<KEY,VAL> &other)
|
||||
{
|
||||
asSMapNode<KEY,VAL> *tmpRoot = root;
|
||||
int tmpCount = count;
|
||||
|
||||
root = other.root;
|
||||
count = other.count;
|
||||
|
||||
other.root = tmpRoot;
|
||||
other.count = tmpCount;
|
||||
}
|
||||
|
||||
template <class KEY, class VAL>
|
||||
void asCMap<KEY, VAL>::EraseAll()
|
||||
{
|
||||
EraseAll(root);
|
||||
root = 0;
|
||||
}
|
||||
|
||||
template <class KEY, class VAL>
|
||||
int asCMap<KEY, VAL>::EraseAll(asSMapNode<KEY, VAL> *p)
|
||||
{
|
||||
if( p == 0 ) return -1;
|
||||
|
||||
EraseAll( p->left );
|
||||
EraseAll( p->right );
|
||||
|
||||
typedef asSMapNode<KEY,VAL> node_t;
|
||||
asDELETE(p,node_t);
|
||||
|
||||
count--;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
template <class KEY, class VAL>
|
||||
int asCMap<KEY, VAL>::GetCount() const
|
||||
{
|
||||
return count;
|
||||
}
|
||||
|
||||
template <class KEY, class VAL>
|
||||
int asCMap<KEY, VAL>::Insert(const KEY &key, const VAL &value)
|
||||
{
|
||||
typedef asSMapNode<KEY,VAL> node_t;
|
||||
asSMapNode<KEY,VAL> *nnode = asNEW(node_t);
|
||||
if( nnode == 0 )
|
||||
{
|
||||
// Out of memory
|
||||
return -1;
|
||||
}
|
||||
|
||||
nnode->key = key;
|
||||
nnode->value = value;
|
||||
|
||||
return Insert(nnode);
|
||||
}
|
||||
|
||||
template <class KEY, class VAL>
|
||||
int asCMap<KEY, VAL>::Insert(asSMapNode<KEY,VAL> *nnode)
|
||||
{
|
||||
// Insert the node
|
||||
if( root == 0 )
|
||||
root = nnode;
|
||||
else
|
||||
{
|
||||
asSMapNode<KEY,VAL> *p = root;
|
||||
for(;;)
|
||||
{
|
||||
if( nnode->key < p->key )
|
||||
{
|
||||
if( p->left == 0 )
|
||||
{
|
||||
nnode->parent = p;
|
||||
p->left = nnode;
|
||||
break;
|
||||
}
|
||||
else
|
||||
p = p->left;
|
||||
}
|
||||
else
|
||||
{
|
||||
if( p->right == 0 )
|
||||
{
|
||||
nnode->parent = p;
|
||||
p->right = nnode;
|
||||
break;
|
||||
}
|
||||
else
|
||||
p = p->right;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
BalanceInsert(nnode);
|
||||
|
||||
count++;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
template <class KEY, class VAL>
|
||||
void asCMap<KEY, VAL>::BalanceInsert(asSMapNode<KEY, VAL> *node)
|
||||
{
|
||||
// The node, that is red, can't have a red parent
|
||||
while( node != root && node->parent->isRed )
|
||||
{
|
||||
// Check color of uncle
|
||||
if( node->parent == node->parent->parent->left )
|
||||
{
|
||||
asSMapNode<KEY,VAL> *uncle = node->parent->parent->right;
|
||||
if( ISRED(uncle) )
|
||||
{
|
||||
// B
|
||||
// R R
|
||||
// N
|
||||
|
||||
// Change color on parent, uncle, and grand parent
|
||||
node->parent->isRed = false;
|
||||
uncle->isRed = false;
|
||||
node->parent->parent->isRed = true;
|
||||
|
||||
// Continue balancing from grand parent
|
||||
node = node->parent->parent;
|
||||
}
|
||||
else
|
||||
{
|
||||
// B
|
||||
// R B
|
||||
// N
|
||||
|
||||
if( node == node->parent->right )
|
||||
{
|
||||
// Make the node a left child
|
||||
node = node->parent;
|
||||
RotateLeft(node);
|
||||
}
|
||||
|
||||
// Change color on parent and grand parent
|
||||
// Then rotate grand parent to the right
|
||||
node->parent->isRed = false;
|
||||
node->parent->parent->isRed = true;
|
||||
RotateRight(node->parent->parent);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
asSMapNode<KEY,VAL> *uncle = node->parent->parent->left;
|
||||
if( ISRED(uncle) )
|
||||
{
|
||||
// B
|
||||
// R R
|
||||
// N
|
||||
|
||||
// Change color on parent, uncle, and grand parent
|
||||
// Continue balancing from grand parent
|
||||
node->parent->isRed = false;
|
||||
uncle->isRed = false;
|
||||
node = node->parent->parent;
|
||||
node->isRed = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
// B
|
||||
// B R
|
||||
// N
|
||||
|
||||
if( node == node->parent->left )
|
||||
{
|
||||
// Make the node a right child
|
||||
node = node->parent;
|
||||
RotateRight(node);
|
||||
}
|
||||
|
||||
// Change color on parent and grand parent
|
||||
// Then rotate grand parent to the right
|
||||
node->parent->isRed = false;
|
||||
node->parent->parent->isRed = true;
|
||||
RotateLeft(node->parent->parent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
root->isRed = false;
|
||||
}
|
||||
|
||||
// For debugging purposes only
|
||||
template <class KEY, class VAL>
|
||||
int asCMap<KEY, VAL>::CheckIntegrity(asSMapNode<KEY, VAL> *node) const
|
||||
{
|
||||
if( node == 0 )
|
||||
{
|
||||
if( root == 0 )
|
||||
return 0;
|
||||
else if( ISRED(root) )
|
||||
return -1;
|
||||
else
|
||||
node = root;
|
||||
}
|
||||
|
||||
int left = 0, right = 0;
|
||||
if( node->left )
|
||||
left = CheckIntegrity(node->left);
|
||||
if( node->right )
|
||||
right = CheckIntegrity(node->right);
|
||||
|
||||
if( left != right || left == -1 )
|
||||
return -1;
|
||||
|
||||
if( ISBLACK(node) )
|
||||
return left+1;
|
||||
|
||||
return left;
|
||||
}
|
||||
|
||||
// Returns true if successful
|
||||
template <class KEY, class VAL>
|
||||
bool asCMap<KEY, VAL>::MoveTo(asSMapNode<KEY,VAL> **out, const KEY &key) const
|
||||
{
|
||||
asSMapNode<KEY,VAL> *p = root;
|
||||
while( p )
|
||||
{
|
||||
if( key < p->key )
|
||||
p = p->left;
|
||||
else if( key == p->key )
|
||||
{
|
||||
if( out ) *out = p;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
p = p->right;
|
||||
}
|
||||
|
||||
if( out ) *out = 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
template <class KEY, class VAL>
|
||||
void asCMap<KEY, VAL>::Erase(asSMapNode<KEY,VAL> *cursor)
|
||||
{
|
||||
asSMapNode<KEY,VAL> *node = Remove(cursor);
|
||||
asASSERT( node == cursor );
|
||||
|
||||
typedef asSMapNode<KEY,VAL> node_t;
|
||||
asDELETE(node,node_t);
|
||||
}
|
||||
|
||||
template <class KEY, class VAL>
|
||||
asSMapNode<KEY,VAL> *asCMap<KEY, VAL>::Remove(asSMapNode<KEY,VAL> *cursor)
|
||||
{
|
||||
if( cursor == 0 ) return 0;
|
||||
|
||||
asSMapNode<KEY,VAL> *node = cursor;
|
||||
|
||||
//---------------------------------------------------
|
||||
// Choose the node that will replace the erased one
|
||||
asSMapNode<KEY,VAL> *remove;
|
||||
if( node->left == 0 || node->right == 0 )
|
||||
remove = node;
|
||||
else
|
||||
{
|
||||
remove = node->right;
|
||||
while( remove->left ) remove = remove->left;
|
||||
}
|
||||
|
||||
//--------------------------------------------------
|
||||
// Remove the node
|
||||
asSMapNode<KEY,VAL> *child;
|
||||
if( remove->left )
|
||||
child = remove->left;
|
||||
else
|
||||
child = remove->right;
|
||||
|
||||
if( child ) child->parent = remove->parent;
|
||||
if( remove->parent )
|
||||
{
|
||||
if( remove == remove->parent->left )
|
||||
remove->parent->left = child;
|
||||
else
|
||||
remove->parent->right = child;
|
||||
}
|
||||
else
|
||||
root = child;
|
||||
|
||||
// If we remove a black node we must make sure the tree is balanced
|
||||
if( ISBLACK(remove) )
|
||||
BalanceErase(child, remove->parent);
|
||||
|
||||
//----------------------------------------
|
||||
// Replace the erased node with the removed one
|
||||
if( remove != node )
|
||||
{
|
||||
if( node->parent )
|
||||
{
|
||||
if( node->parent->left == node )
|
||||
node->parent->left = remove;
|
||||
else
|
||||
node->parent->right = remove;
|
||||
}
|
||||
else
|
||||
root = remove;
|
||||
|
||||
remove->isRed = node->isRed;
|
||||
remove->parent = node->parent;
|
||||
|
||||
remove->left = node->left;
|
||||
if( remove->left ) remove->left->parent = remove;
|
||||
remove->right = node->right;
|
||||
if( remove->right ) remove->right->parent = remove;
|
||||
}
|
||||
|
||||
count--;
|
||||
|
||||
return node;
|
||||
}
|
||||
|
||||
// Call method only if removed node was black
|
||||
// child is the child of the removed node
|
||||
template <class KEY, class VAL>
|
||||
void asCMap<KEY, VAL>::BalanceErase(asSMapNode<KEY, VAL> *child, asSMapNode<KEY, VAL> *parent)
|
||||
{
|
||||
// If child is red
|
||||
// Color child black
|
||||
// Terminate
|
||||
|
||||
// These tests assume brother is to the right.
|
||||
|
||||
// 1. Brother is red
|
||||
// Color parent red and brother black
|
||||
// Rotate parent left
|
||||
// Transforms to 2b
|
||||
// 2a. Parent and brother is black, brother's children are black
|
||||
// Color brother red
|
||||
// Continue test with parent as child
|
||||
// 2b. Parent is red, brother is black, brother's children are black
|
||||
// Color parent black and brother red
|
||||
// Terminate
|
||||
// 3. Brother is black, and brother's left is red and brother's right is black
|
||||
// Color brother red and brother's left black
|
||||
// Rotate brother to right
|
||||
// Transforms to 4.
|
||||
// 4. Brother is black, brother's right is red
|
||||
// Color brother's right black
|
||||
// Color brother to color of parent
|
||||
// Color parent black
|
||||
// Rotate parent left
|
||||
// Terminate
|
||||
|
||||
while( child != root && ISBLACK(child) )
|
||||
{
|
||||
if( child == parent->left )
|
||||
{
|
||||
asSMapNode<KEY,VAL> *brother = parent->right;
|
||||
|
||||
// Case 1
|
||||
if( ISRED(brother) )
|
||||
{
|
||||
brother->isRed = false;
|
||||
parent->isRed = true;
|
||||
RotateLeft(parent);
|
||||
brother = parent->right;
|
||||
}
|
||||
|
||||
// Case 2
|
||||
if( brother == 0 ) break;
|
||||
if( ISBLACK(brother->left) && ISBLACK(brother->right) )
|
||||
{
|
||||
// Case 2b
|
||||
if( ISRED(parent) )
|
||||
{
|
||||
parent->isRed = false;
|
||||
brother->isRed = true;
|
||||
break;
|
||||
}
|
||||
|
||||
brother->isRed = true;
|
||||
child = parent;
|
||||
parent = child->parent;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Case 3
|
||||
if( ISBLACK(brother->right) )
|
||||
{
|
||||
brother->left->isRed = false;
|
||||
brother->isRed = true;
|
||||
RotateRight(brother);
|
||||
brother = parent->right;
|
||||
}
|
||||
|
||||
// Case 4
|
||||
brother->isRed = parent->isRed;
|
||||
parent->isRed = false;
|
||||
brother->right->isRed = false;
|
||||
RotateLeft(parent);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
asSMapNode<KEY,VAL> *brother = parent->left;
|
||||
|
||||
// Case 1
|
||||
if( ISRED(brother) )
|
||||
{
|
||||
brother->isRed = false;
|
||||
parent->isRed = true;
|
||||
RotateRight(parent);
|
||||
brother = parent->left;
|
||||
}
|
||||
|
||||
// Case 2
|
||||
if( brother == 0 ) break;
|
||||
if( ISBLACK(brother->left) && ISBLACK(brother->right) )
|
||||
{
|
||||
// Case 2b
|
||||
if( ISRED(parent) )
|
||||
{
|
||||
parent->isRed = false;
|
||||
brother->isRed = true;
|
||||
break;
|
||||
}
|
||||
|
||||
brother->isRed = true;
|
||||
child = parent;
|
||||
parent = child->parent;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Case 3
|
||||
if( ISBLACK(brother->left) )
|
||||
{
|
||||
brother->right->isRed = false;
|
||||
brother->isRed = true;
|
||||
RotateLeft(brother);
|
||||
brother = parent->left;
|
||||
}
|
||||
|
||||
// Case 4
|
||||
brother->isRed = parent->isRed;
|
||||
parent->isRed = false;
|
||||
brother->left->isRed = false;
|
||||
RotateRight(parent);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if( child )
|
||||
child->isRed = false;
|
||||
}
|
||||
|
||||
template <class KEY, class VAL>
|
||||
int asCMap<KEY, VAL>::RotateRight(asSMapNode<KEY, VAL> *node)
|
||||
{
|
||||
// P L //
|
||||
// / \ / \ //
|
||||
// L R => Ll P //
|
||||
// / \ / \ //
|
||||
// Ll Lr Lr R //
|
||||
|
||||
if( node->left == 0 ) return -1;
|
||||
|
||||
asSMapNode<KEY,VAL> *left = node->left;
|
||||
|
||||
// Update parent
|
||||
if( node->parent )
|
||||
{
|
||||
asSMapNode<KEY,VAL> *parent = node->parent;
|
||||
if( parent->left == node )
|
||||
parent->left = left;
|
||||
else
|
||||
parent->right = left;
|
||||
|
||||
left->parent = parent;
|
||||
}
|
||||
else
|
||||
{
|
||||
root = left;
|
||||
left->parent = 0;
|
||||
}
|
||||
|
||||
// Move left's right child to node's left child
|
||||
node->left = left->right;
|
||||
if( node->left ) node->left->parent = node;
|
||||
|
||||
// Put node as left's right child
|
||||
left->right = node;
|
||||
node->parent = left;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
template <class KEY, class VAL>
|
||||
int asCMap<KEY, VAL>::RotateLeft(asSMapNode<KEY, VAL> *node)
|
||||
{
|
||||
// P R //
|
||||
// / \ / \ //
|
||||
// L R => P Rr //
|
||||
// / \ / \ //
|
||||
// Rl Rr L Rl //
|
||||
|
||||
if( node->right == 0 ) return -1;
|
||||
|
||||
asSMapNode<KEY,VAL> *right = node->right;
|
||||
|
||||
// Update parent
|
||||
if( node->parent )
|
||||
{
|
||||
asSMapNode<KEY,VAL> *parent = node->parent;
|
||||
if( parent->right == node )
|
||||
parent->right = right;
|
||||
else
|
||||
parent->left = right;
|
||||
|
||||
right->parent = parent;
|
||||
}
|
||||
else
|
||||
{
|
||||
root = right;
|
||||
right->parent = 0;
|
||||
}
|
||||
|
||||
// Move right's left child to node's right child
|
||||
node->right = right->left;
|
||||
if( node->right ) node->right->parent = node;
|
||||
|
||||
// Put node as right's left child
|
||||
right->left = node;
|
||||
node->parent = right;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
template <class KEY, class VAL>
|
||||
const VAL &asCMap<KEY, VAL>::GetValue(const asSMapNode<KEY,VAL> *cursor) const
|
||||
{
|
||||
if( cursor == 0 )
|
||||
return dummy.value;
|
||||
|
||||
return cursor->value;
|
||||
}
|
||||
|
||||
template <class KEY, class VAL>
|
||||
VAL &asCMap<KEY, VAL>::GetValue(asSMapNode<KEY,VAL> *cursor)
|
||||
{
|
||||
if( cursor == 0 )
|
||||
return dummy.value;
|
||||
|
||||
return cursor->value;
|
||||
}
|
||||
|
||||
template <class KEY, class VAL>
|
||||
const KEY &asCMap<KEY, VAL>::GetKey(const asSMapNode<KEY,VAL> *cursor) const
|
||||
{
|
||||
if( cursor == 0 )
|
||||
return dummy.key;
|
||||
|
||||
return cursor->key;
|
||||
}
|
||||
|
||||
template <class KEY, class VAL>
|
||||
bool asCMap<KEY, VAL>::MoveFirst(asSMapNode<KEY,VAL> **out) const
|
||||
{
|
||||
*out = root;
|
||||
if( root == 0 ) return false;
|
||||
|
||||
while( (*out)->left )
|
||||
*out = (*out)->left;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class KEY, class VAL>
|
||||
bool asCMap<KEY, VAL>::MoveLast(asSMapNode<KEY,VAL> **out) const
|
||||
{
|
||||
*out = root;
|
||||
if( root == 0 ) return false;
|
||||
|
||||
while( (*out)->right )
|
||||
*out = (*out)->right;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class KEY, class VAL>
|
||||
bool asCMap<KEY, VAL>::MoveNext(asSMapNode<KEY,VAL> **out, asSMapNode<KEY,VAL> *cursor) const
|
||||
{
|
||||
if( cursor == 0 )
|
||||
{
|
||||
*out = 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
if( cursor->right == 0 )
|
||||
{
|
||||
// Move upwards until we find a parent node to the right
|
||||
while( cursor->parent && cursor->parent->right == cursor )
|
||||
cursor = cursor->parent;
|
||||
|
||||
cursor = cursor->parent;
|
||||
*out = cursor;
|
||||
if( cursor == 0 )
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
cursor = cursor->right;
|
||||
while( cursor->left )
|
||||
cursor = cursor->left;
|
||||
|
||||
*out = cursor;
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class KEY, class VAL>
|
||||
bool asCMap<KEY, VAL>::MovePrev(asSMapNode<KEY,VAL> **out, asSMapNode<KEY,VAL> *cursor) const
|
||||
{
|
||||
if( cursor == 0 )
|
||||
{
|
||||
*out = 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
if( cursor->left == 0 )
|
||||
{
|
||||
// Move upwards until we find a parent node to the left
|
||||
while( cursor->parent && cursor->parent->left == cursor )
|
||||
cursor = cursor->parent;
|
||||
|
||||
cursor = cursor->parent;
|
||||
|
||||
*out = cursor;
|
||||
if( cursor == 0 )
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
cursor = cursor->left;
|
||||
while( cursor->right )
|
||||
cursor = cursor->right;
|
||||
|
||||
*out = cursor;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
185
lib/angelscript/source/as_memory.cpp
Normal file
185
lib/angelscript/source/as_memory.cpp
Normal file
@ -0,0 +1,185 @@
|
||||
/*
|
||||
AngelCode Scripting Library
|
||||
Copyright (c) 2003-2012 Andreas Jonsson
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any
|
||||
damages arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any
|
||||
purpose, including commercial applications, and to alter it and
|
||||
redistribute it freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you
|
||||
must not claim that you wrote the original software. If you use
|
||||
this software in a product, an acknowledgment in the product
|
||||
documentation would be appreciated but is not required.
|
||||
|
||||
2. Altered source versions must be plainly marked as such, and
|
||||
must not be misrepresented as being the original software.
|
||||
|
||||
3. This notice may not be removed or altered from any source
|
||||
distribution.
|
||||
|
||||
The original version of this library can be located at:
|
||||
http://www.angelcode.com/angelscript/
|
||||
|
||||
Andreas Jonsson
|
||||
andreas@angelcode.com
|
||||
*/
|
||||
|
||||
|
||||
//
|
||||
// as_memory.cpp
|
||||
//
|
||||
// Overload the default memory management functions so that we
|
||||
// can let the application decide how to do it.
|
||||
//
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#if !defined(__APPLE__) && !defined( __SNC__ ) && !defined( __ghs__ ) && !defined(__FreeBSD__)
|
||||
#include <malloc.h>
|
||||
#endif
|
||||
|
||||
#include "as_config.h"
|
||||
#include "as_memory.h"
|
||||
#include "as_scriptnode.h"
|
||||
#include "as_bytecode.h"
|
||||
|
||||
BEGIN_AS_NAMESPACE
|
||||
|
||||
// By default we'll use the standard memory management functions
|
||||
|
||||
// Make sure these globals are initialized first. Otherwise the
|
||||
// library may crash in case the application initializes the engine
|
||||
// as a global variable.
|
||||
|
||||
#ifdef _MSC_VER
|
||||
// MSVC let's us choose between a couple of different initialization orders.
|
||||
#pragma warning(disable: 4073)
|
||||
#pragma init_seg(lib)
|
||||
asALLOCFUNC_t userAlloc = malloc;
|
||||
asFREEFUNC_t userFree = free;
|
||||
#else
|
||||
// Other compilers will just have to rely on luck.
|
||||
asALLOCFUNC_t userAlloc = malloc;
|
||||
asFREEFUNC_t userFree = free;
|
||||
#endif
|
||||
|
||||
extern "C"
|
||||
{
|
||||
|
||||
int asSetGlobalMemoryFunctions(asALLOCFUNC_t allocFunc, asFREEFUNC_t freeFunc)
|
||||
{
|
||||
userAlloc = allocFunc;
|
||||
userFree = freeFunc;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int asResetGlobalMemoryFunctions()
|
||||
{
|
||||
asThreadCleanup();
|
||||
|
||||
userAlloc = malloc;
|
||||
userFree = free;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
} // extern "C"
|
||||
|
||||
asCMemoryMgr::asCMemoryMgr()
|
||||
{
|
||||
}
|
||||
|
||||
asCMemoryMgr::~asCMemoryMgr()
|
||||
{
|
||||
FreeUnusedMemory();
|
||||
}
|
||||
|
||||
void asCMemoryMgr::FreeUnusedMemory()
|
||||
{
|
||||
// It's necessary to protect the scriptNodePool from multiple
|
||||
// simultaneous accesses, as the parser is used by several methods
|
||||
// that can be executed simultaneously.
|
||||
ENTERCRITICALSECTION(cs);
|
||||
|
||||
int n;
|
||||
for( n = 0; n < (signed)scriptNodePool.GetLength(); n++ )
|
||||
userFree(scriptNodePool[n]);
|
||||
scriptNodePool.Allocate(0, false);
|
||||
|
||||
LEAVECRITICALSECTION(cs);
|
||||
|
||||
// The engine already protects against multiple threads
|
||||
// compiling scripts simultaneously so this pool doesn't have
|
||||
// to be protected again.
|
||||
for( n = 0; n < (signed)byteInstructionPool.GetLength(); n++ )
|
||||
userFree(byteInstructionPool[n]);
|
||||
byteInstructionPool.Allocate(0, false);
|
||||
}
|
||||
|
||||
void *asCMemoryMgr::AllocScriptNode()
|
||||
{
|
||||
ENTERCRITICALSECTION(cs);
|
||||
|
||||
if( scriptNodePool.GetLength() )
|
||||
{
|
||||
void *tRet = scriptNodePool.PopLast();
|
||||
LEAVECRITICALSECTION(cs);
|
||||
return tRet;
|
||||
}
|
||||
|
||||
LEAVECRITICALSECTION(cs);
|
||||
|
||||
#if defined(AS_DEBUG)
|
||||
return ((asALLOCFUNCDEBUG_t)(userAlloc))(sizeof(asCScriptNode), __FILE__, __LINE__);
|
||||
#else
|
||||
return userAlloc(sizeof(asCScriptNode));
|
||||
#endif
|
||||
}
|
||||
|
||||
void asCMemoryMgr::FreeScriptNode(void *ptr)
|
||||
{
|
||||
ENTERCRITICALSECTION(cs);
|
||||
|
||||
// Pre allocate memory for the array to avoid slow growth
|
||||
if( scriptNodePool.GetLength() == 0 )
|
||||
scriptNodePool.Allocate(100, 0);
|
||||
|
||||
scriptNodePool.PushLast(ptr);
|
||||
|
||||
LEAVECRITICALSECTION(cs);
|
||||
}
|
||||
|
||||
#ifndef AS_NO_COMPILER
|
||||
|
||||
void *asCMemoryMgr::AllocByteInstruction()
|
||||
{
|
||||
if( byteInstructionPool.GetLength() )
|
||||
return byteInstructionPool.PopLast();
|
||||
|
||||
#if defined(AS_DEBUG)
|
||||
return ((asALLOCFUNCDEBUG_t)(userAlloc))(sizeof(asCByteInstruction), __FILE__, __LINE__);
|
||||
#else
|
||||
return userAlloc(sizeof(asCByteInstruction));
|
||||
#endif
|
||||
}
|
||||
|
||||
void asCMemoryMgr::FreeByteInstruction(void *ptr)
|
||||
{
|
||||
// Pre allocate memory for the array to avoid slow growth
|
||||
if( byteInstructionPool.GetLength() == 0 )
|
||||
byteInstructionPool.Allocate(100, 0);
|
||||
|
||||
byteInstructionPool.PushLast(ptr);
|
||||
}
|
||||
|
||||
#endif // AS_NO_COMPILER
|
||||
|
||||
END_AS_NAMESPACE
|
||||
|
||||
|
||||
|
105
lib/angelscript/source/as_memory.h
Normal file
105
lib/angelscript/source/as_memory.h
Normal file
@ -0,0 +1,105 @@
|
||||
/*
|
||||
AngelCode Scripting Library
|
||||
Copyright (c) 2003-2012 Andreas Jonsson
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any
|
||||
damages arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any
|
||||
purpose, including commercial applications, and to alter it and
|
||||
redistribute it freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you
|
||||
must not claim that you wrote the original software. If you use
|
||||
this software in a product, an acknowledgment in the product
|
||||
documentation would be appreciated but is not required.
|
||||
|
||||
2. Altered source versions must be plainly marked as such, and
|
||||
must not be misrepresented as being the original software.
|
||||
|
||||
3. This notice may not be removed or altered from any source
|
||||
distribution.
|
||||
|
||||
The original version of this library can be located at:
|
||||
http://www.angelcode.com/angelscript/
|
||||
|
||||
Andreas Jonsson
|
||||
andreas@angelcode.com
|
||||
*/
|
||||
|
||||
|
||||
//
|
||||
// as_memory.h
|
||||
//
|
||||
// Overload the default memory management functions so that we
|
||||
// can let the application decide how to do it.
|
||||
//
|
||||
|
||||
|
||||
|
||||
#ifndef AS_MEMORY_H
|
||||
#define AS_MEMORY_H
|
||||
|
||||
#include "as_config.h"
|
||||
|
||||
BEGIN_AS_NAMESPACE
|
||||
|
||||
extern asALLOCFUNC_t userAlloc;
|
||||
extern asFREEFUNC_t userFree;
|
||||
|
||||
// We don't overload the new operator as that would affect the application as well
|
||||
|
||||
#ifndef AS_DEBUG
|
||||
|
||||
#define asNEW(x) new(userAlloc(sizeof(x))) x
|
||||
#define asDELETE(ptr,x) {void *tmp = ptr; (ptr)->~x(); userFree(tmp);}
|
||||
|
||||
#define asNEWARRAY(x,cnt) (x*)userAlloc(sizeof(x)*cnt)
|
||||
#define asDELETEARRAY(ptr) userFree(ptr)
|
||||
|
||||
#else
|
||||
|
||||
typedef void *(*asALLOCFUNCDEBUG_t)(size_t, const char *, unsigned int);
|
||||
|
||||
#define asNEW(x) new(((asALLOCFUNCDEBUG_t)(userAlloc))(sizeof(x), __FILE__, __LINE__)) x
|
||||
#define asDELETE(ptr,x) {void *tmp = ptr; (ptr)->~x(); userFree(tmp);}
|
||||
|
||||
#define asNEWARRAY(x,cnt) (x*)((asALLOCFUNCDEBUG_t)(userAlloc))(sizeof(x)*cnt, __FILE__, __LINE__)
|
||||
#define asDELETEARRAY(ptr) userFree(ptr)
|
||||
|
||||
#endif
|
||||
|
||||
END_AS_NAMESPACE
|
||||
|
||||
#include <new>
|
||||
#include "as_criticalsection.h"
|
||||
#include "as_array.h"
|
||||
|
||||
BEGIN_AS_NAMESPACE
|
||||
|
||||
class asCMemoryMgr
|
||||
{
|
||||
public:
|
||||
asCMemoryMgr();
|
||||
~asCMemoryMgr();
|
||||
|
||||
void FreeUnusedMemory();
|
||||
|
||||
void *AllocScriptNode();
|
||||
void FreeScriptNode(void *ptr);
|
||||
|
||||
#ifndef AS_NO_COMPILER
|
||||
void *AllocByteInstruction();
|
||||
void FreeByteInstruction(void *ptr);
|
||||
#endif
|
||||
|
||||
protected:
|
||||
DECLARECRITICALSECTION(cs)
|
||||
asCArray<void *> scriptNodePool;
|
||||
asCArray<void *> byteInstructionPool;
|
||||
};
|
||||
|
||||
END_AS_NAMESPACE
|
||||
|
||||
#endif
|
1366
lib/angelscript/source/as_module.cpp
Normal file
1366
lib/angelscript/source/as_module.cpp
Normal file
File diff suppressed because it is too large
Load Diff
229
lib/angelscript/source/as_module.h
Normal file
229
lib/angelscript/source/as_module.h
Normal file
@ -0,0 +1,229 @@
|
||||
/*
|
||||
AngelCode Scripting Library
|
||||
Copyright (c) 2003-2013 Andreas Jonsson
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any
|
||||
damages arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any
|
||||
purpose, including commercial applications, and to alter it and
|
||||
redistribute it freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you
|
||||
must not claim that you wrote the original software. If you use
|
||||
this software in a product, an acknowledgment in the product
|
||||
documentation would be appreciated but is not required.
|
||||
|
||||
2. Altered source versions must be plainly marked as such, and
|
||||
must not be misrepresented as being the original software.
|
||||
|
||||
3. This notice may not be removed or altered from any source
|
||||
distribution.
|
||||
|
||||
The original version of this library can be located at:
|
||||
http://www.angelcode.com/angelscript/
|
||||
|
||||
Andreas Jonsson
|
||||
andreas@angelcode.com
|
||||
*/
|
||||
|
||||
|
||||
|
||||
//
|
||||
// as_module.h
|
||||
//
|
||||
// A class that holds a script module
|
||||
//
|
||||
|
||||
#ifndef AS_MODULE_H
|
||||
#define AS_MODULE_H
|
||||
|
||||
#include "as_config.h"
|
||||
#include "as_symboltable.h"
|
||||
#include "as_atomic.h"
|
||||
#include "as_string.h"
|
||||
#include "as_array.h"
|
||||
#include "as_datatype.h"
|
||||
#include "as_scriptfunction.h"
|
||||
#include "as_property.h"
|
||||
|
||||
BEGIN_AS_NAMESPACE
|
||||
|
||||
// TODO: import: Remove this when the imported functions are removed
|
||||
const int FUNC_IMPORTED = 0x40000000;
|
||||
|
||||
class asCScriptEngine;
|
||||
class asCCompiler;
|
||||
class asCBuilder;
|
||||
class asCContext;
|
||||
class asCConfigGroup;
|
||||
struct asSNameSpace;
|
||||
|
||||
struct sBindInfo
|
||||
{
|
||||
asCScriptFunction *importedFunctionSignature;
|
||||
asCString importFromModule;
|
||||
int boundFunctionId;
|
||||
};
|
||||
|
||||
struct sObjectTypePair
|
||||
{
|
||||
asCObjectType *a;
|
||||
asCObjectType *b;
|
||||
};
|
||||
|
||||
|
||||
// TODO: import: Remove function imports. When I have implemented function
|
||||
// pointers the function imports should be deprecated.
|
||||
|
||||
// TODO: Need a separate interface for compiling scripts. The asIScriptCompiler
|
||||
// will have a target module, and will allow the compilation of an entire
|
||||
// script or just individual functions within the scope of the module
|
||||
//
|
||||
// With this separation it will be possible to compile the library without
|
||||
// the compiler, thus giving a much smaller binary executable.
|
||||
|
||||
// TODO: There should be an special compile option that will let the application
|
||||
// recompile an already compiled script. The compiler should check if no
|
||||
// destructive changes have been made (changing function signatures, etc)
|
||||
// then it should simply replace the bytecode within the functions without
|
||||
// changing the values of existing global properties, etc.
|
||||
|
||||
class asCModule : public asIScriptModule
|
||||
{
|
||||
//-------------------------------------------
|
||||
// Public interface
|
||||
//--------------------------------------------
|
||||
public:
|
||||
virtual asIScriptEngine *GetEngine() const;
|
||||
virtual void SetName(const char *name);
|
||||
virtual const char *GetName() const;
|
||||
virtual void Discard();
|
||||
|
||||
// Compilation
|
||||
virtual int AddScriptSection(const char *name, const char *code, size_t codeLength, int lineOffset);
|
||||
virtual int Build();
|
||||
virtual int CompileFunction(const char *sectionName, const char *code, int lineOffset, asDWORD reserved, asIScriptFunction **outFunc);
|
||||
virtual int CompileGlobalVar(const char *sectionName, const char *code, int lineOffset);
|
||||
virtual asDWORD SetAccessMask(asDWORD accessMask);
|
||||
virtual int SetDefaultNamespace(const char *nameSpace);
|
||||
virtual const char *GetDefaultNamespace() const;
|
||||
|
||||
// Script functions
|
||||
virtual asUINT GetFunctionCount() const;
|
||||
virtual asIScriptFunction *GetFunctionByIndex(asUINT index) const;
|
||||
virtual asIScriptFunction *GetFunctionByDecl(const char *decl) const;
|
||||
virtual asIScriptFunction *GetFunctionByName(const char *name) const;
|
||||
virtual int RemoveFunction(asIScriptFunction *func);
|
||||
|
||||
// Script global variables
|
||||
// TODO: interface: Should be called InitGlobalVars, and should have a bool to reset in case already initialized
|
||||
virtual int ResetGlobalVars(asIScriptContext *ctx);
|
||||
virtual asUINT GetGlobalVarCount() const;
|
||||
virtual int GetGlobalVarIndexByName(const char *name) const;
|
||||
virtual int GetGlobalVarIndexByDecl(const char *decl) const;
|
||||
virtual const char *GetGlobalVarDeclaration(asUINT index, bool includeNamespace) const;
|
||||
virtual int GetGlobalVar(asUINT index, const char **name, const char **nameSpace, int *typeId, bool *isConst) const;
|
||||
virtual void *GetAddressOfGlobalVar(asUINT index);
|
||||
virtual int RemoveGlobalVar(asUINT index);
|
||||
|
||||
// Type identification
|
||||
virtual asUINT GetObjectTypeCount() const;
|
||||
virtual asIObjectType *GetObjectTypeByIndex(asUINT index) const;
|
||||
virtual asIObjectType *GetObjectTypeByName(const char *name) const;
|
||||
virtual int GetTypeIdByDecl(const char *decl) const;
|
||||
|
||||
// Enums
|
||||
virtual asUINT GetEnumCount() const;
|
||||
virtual const char *GetEnumByIndex(asUINT index, int *enumTypeId, const char **nameSpace) const;
|
||||
virtual int GetEnumValueCount(int enumTypeId) const;
|
||||
virtual const char *GetEnumValueByIndex(int enumTypeId, asUINT index, int *outValue) const;
|
||||
|
||||
// Typedefs
|
||||
virtual asUINT GetTypedefCount() const;
|
||||
virtual const char *GetTypedefByIndex(asUINT index, int *typeId, const char **nameSpace) const;
|
||||
|
||||
// Dynamic binding between modules
|
||||
virtual asUINT GetImportedFunctionCount() const;
|
||||
virtual int GetImportedFunctionIndexByDecl(const char *decl) const;
|
||||
virtual const char *GetImportedFunctionDeclaration(asUINT importIndex) const;
|
||||
virtual const char *GetImportedFunctionSourceModule(asUINT importIndex) const;
|
||||
virtual int BindImportedFunction(asUINT index, asIScriptFunction *func);
|
||||
virtual int UnbindImportedFunction(asUINT importIndex);
|
||||
virtual int BindAllImportedFunctions();
|
||||
virtual int UnbindAllImportedFunctions();
|
||||
|
||||
// Bytecode Saving/Loading
|
||||
virtual int SaveByteCode(asIBinaryStream *out, bool stripDebugInfo) const;
|
||||
virtual int LoadByteCode(asIBinaryStream *in, bool *wasDebugInfoStripped);
|
||||
|
||||
// User data
|
||||
virtual void *SetUserData(void *data);
|
||||
virtual void *GetUserData() const;
|
||||
|
||||
//-----------------------------------------------
|
||||
// Internal
|
||||
//-----------------------------------------------
|
||||
asCModule(const char *name, asCScriptEngine *engine);
|
||||
~asCModule();
|
||||
|
||||
//protected:
|
||||
friend class asCScriptEngine;
|
||||
friend class asCBuilder;
|
||||
friend class asCCompiler;
|
||||
friend class asCContext;
|
||||
friend class asCRestore;
|
||||
|
||||
void InternalReset();
|
||||
bool IsEmpty() const;
|
||||
|
||||
int CallInit(asIScriptContext *ctx);
|
||||
void CallExit();
|
||||
|
||||
void JITCompile();
|
||||
|
||||
#ifndef AS_NO_COMPILER
|
||||
int AddScriptFunction(int sectionIdx, int declaredAt, int id, const asCString &name, const asCDataType &returnType, const asCArray<asCDataType> ¶ms, const asCArray<asETypeModifiers> &inOutFlags, const asCArray<asCString *> &defaultArgs, bool isInterface, asCObjectType *objType = 0, bool isConstMethod = false, bool isGlobalFunction = false, bool isPrivate = false, bool isFinal = false, bool isOverride = false, bool isShared = false, asSNameSpace *ns = 0);
|
||||
int AddScriptFunction(asCScriptFunction *func);
|
||||
int AddImportedFunction(int id, const asCString &name, const asCDataType &returnType, const asCArray<asCDataType> ¶ms, const asCArray<asETypeModifiers> &inOutFlags, const asCArray<asCString *> &defaultArgs, asSNameSpace *ns, const asCString &moduleName);
|
||||
int AddFuncDef(const asCString &name, asSNameSpace *ns);
|
||||
#endif
|
||||
|
||||
int GetNextImportedFunctionId();
|
||||
asCScriptFunction *GetImportedFunction(int funcId) const;
|
||||
asCObjectType *GetObjectType(const char *type, asSNameSpace *ns);
|
||||
asCGlobalProperty *AllocateGlobalProperty(const char *name, const asCDataType &dt, asSNameSpace *ns);
|
||||
|
||||
asCString name;
|
||||
|
||||
asCScriptEngine *engine;
|
||||
asCBuilder *builder;
|
||||
void *userData;
|
||||
asDWORD accessMask;
|
||||
asSNameSpace *defaultNamespace;
|
||||
|
||||
// This array holds all functions, class members, factories, etc that were compiled with the module
|
||||
asCArray<asCScriptFunction *> scriptFunctions;
|
||||
// This array holds global functions declared in the module
|
||||
asCSymbolTable<asCScriptFunction> globalFunctions;
|
||||
// This array holds imported functions in the module
|
||||
asCArray<sBindInfo *> bindInformations;
|
||||
|
||||
// This array holds the global variables declared in the script
|
||||
asCSymbolTable<asCGlobalProperty> scriptGlobals;
|
||||
bool isGlobalVarInitialized;
|
||||
|
||||
// This array holds class and interface types
|
||||
asCArray<asCObjectType*> classTypes;
|
||||
// This array holds enum types
|
||||
asCArray<asCObjectType*> enumTypes;
|
||||
// This array holds typedefs
|
||||
asCArray<asCObjectType*> typeDefs;
|
||||
// This array holds the funcdefs declared in the module
|
||||
asCArray<asCScriptFunction*> funcDefs;
|
||||
};
|
||||
|
||||
END_AS_NAMESPACE
|
||||
|
||||
#endif
|
76
lib/angelscript/source/as_namespace.h
Normal file
76
lib/angelscript/source/as_namespace.h
Normal file
@ -0,0 +1,76 @@
|
||||
/*
|
||||
AngelCode Scripting Library
|
||||
Copyright (c) 2013 Andreas Jonsson
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any
|
||||
damages arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any
|
||||
purpose, including commercial applications, and to alter it and
|
||||
redistribute it freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you
|
||||
must not claim that you wrote the original software. If you use
|
||||
this software in a product, an acknowledgment in the product
|
||||
documentation would be appreciated but is not required.
|
||||
|
||||
2. Altered source versions must be plainly marked as such, and
|
||||
must not be misrepresented as being the original software.
|
||||
|
||||
3. This notice may not be removed or altered from any source
|
||||
distribution.
|
||||
|
||||
The original version of this library can be located at:
|
||||
http://www.angelcode.com/angelscript/
|
||||
|
||||
Andreas Jonsson
|
||||
andreas@angelcode.com
|
||||
*/
|
||||
|
||||
|
||||
#ifndef AS_NAMESPACE_H
|
||||
#define AS_NAMESPACE_H
|
||||
|
||||
#include "as_string.h"
|
||||
|
||||
BEGIN_AS_NAMESPACE
|
||||
|
||||
struct asSNameSpace
|
||||
{
|
||||
asCString name;
|
||||
|
||||
// TODO: namespace: A namespace should have access masks. The application should be
|
||||
// able to restrict specific namespaces from access to specific modules
|
||||
};
|
||||
|
||||
|
||||
struct asSNameSpaceNamePair
|
||||
{
|
||||
const asSNameSpace *ns;
|
||||
asCString name;
|
||||
|
||||
asSNameSpaceNamePair() : ns(0) {}
|
||||
asSNameSpaceNamePair(const asSNameSpace *_ns, const asCString &_name) : ns(_ns), name(_name) {}
|
||||
|
||||
asSNameSpaceNamePair &operator=(const asSNameSpaceNamePair &other)
|
||||
{
|
||||
ns = other.ns;
|
||||
name = other.name;
|
||||
return *this;
|
||||
}
|
||||
|
||||
bool operator==(const asSNameSpaceNamePair &other) const
|
||||
{
|
||||
return (ns == other.ns && name == other.name);
|
||||
}
|
||||
|
||||
bool operator<(const asSNameSpaceNamePair &other) const
|
||||
{
|
||||
return (ns < other.ns || (ns == other.ns && name < other.name));
|
||||
}
|
||||
};
|
||||
|
||||
END_AS_NAMESPACE
|
||||
|
||||
#endif
|
980
lib/angelscript/source/as_objecttype.cpp
Normal file
980
lib/angelscript/source/as_objecttype.cpp
Normal file
@ -0,0 +1,980 @@
|
||||
/*
|
||||
AngelCode Scripting Library
|
||||
Copyright (c) 2003-2013 Andreas Jonsson
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any
|
||||
damages arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any
|
||||
purpose, including commercial applications, and to alter it and
|
||||
redistribute it freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you
|
||||
must not claim that you wrote the original software. If you use
|
||||
this software in a product, an acknowledgment in the product
|
||||
documentation would be appreciated but is not required.
|
||||
|
||||
2. Altered source versions must be plainly marked as such, and
|
||||
must not be misrepresented as being the original software.
|
||||
|
||||
3. This notice may not be removed or altered from any source
|
||||
distribution.
|
||||
|
||||
The original version of this library can be located at:
|
||||
http://www.angelcode.com/angelscript/
|
||||
|
||||
Andreas Jonsson
|
||||
andreas@angelcode.com
|
||||
*/
|
||||
|
||||
|
||||
//
|
||||
// as_objecttype.cpp
|
||||
//
|
||||
// A class for storing object type information
|
||||
//
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "as_config.h"
|
||||
#include "as_objecttype.h"
|
||||
#include "as_configgroup.h"
|
||||
#include "as_scriptengine.h"
|
||||
|
||||
BEGIN_AS_NAMESPACE
|
||||
|
||||
#ifdef AS_MAX_PORTABILITY
|
||||
|
||||
static void ObjectType_AddRef_Generic(asIScriptGeneric *gen)
|
||||
{
|
||||
asCObjectType *self = (asCObjectType*)gen->GetObject();
|
||||
self->AddRef();
|
||||
}
|
||||
|
||||
static void ObjectType_Release_Generic(asIScriptGeneric *gen)
|
||||
{
|
||||
asCObjectType *self = (asCObjectType*)gen->GetObject();
|
||||
self->Release();
|
||||
}
|
||||
|
||||
static void ObjectType_GetRefCount_Generic(asIScriptGeneric *gen)
|
||||
{
|
||||
asCObjectType *self = (asCObjectType*)gen->GetObject();
|
||||
*(int*)gen->GetAddressOfReturnLocation() = self->GetRefCount();
|
||||
}
|
||||
|
||||
static void ObjectType_SetGCFlag_Generic(asIScriptGeneric *gen)
|
||||
{
|
||||
asCObjectType *self = (asCObjectType*)gen->GetObject();
|
||||
self->SetGCFlag();
|
||||
}
|
||||
|
||||
static void ObjectType_GetGCFlag_Generic(asIScriptGeneric *gen)
|
||||
{
|
||||
asCObjectType *self = (asCObjectType*)gen->GetObject();
|
||||
*(bool*)gen->GetAddressOfReturnLocation() = self->GetGCFlag();
|
||||
}
|
||||
|
||||
static void ObjectType_EnumReferences_Generic(asIScriptGeneric *gen)
|
||||
{
|
||||
asCObjectType *self = (asCObjectType*)gen->GetObject();
|
||||
asIScriptEngine *engine = *(asIScriptEngine**)gen->GetAddressOfArg(0);
|
||||
self->EnumReferences(engine);
|
||||
}
|
||||
|
||||
static void ObjectType_ReleaseAllHandles_Generic(asIScriptGeneric *gen)
|
||||
{
|
||||
asCObjectType *self = (asCObjectType*)gen->GetObject();
|
||||
asIScriptEngine *engine = *(asIScriptEngine**)gen->GetAddressOfArg(0);
|
||||
self->ReleaseAllHandles(engine);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
void RegisterObjectTypeGCBehaviours(asCScriptEngine *engine)
|
||||
{
|
||||
// Register the gc behaviours for the object types
|
||||
int r = 0;
|
||||
UNUSED_VAR(r); // It is only used in debug mode
|
||||
engine->objectTypeBehaviours.engine = engine;
|
||||
engine->objectTypeBehaviours.flags = asOBJ_REF | asOBJ_GC;
|
||||
engine->objectTypeBehaviours.name = "_builtin_objecttype_";
|
||||
#ifndef AS_MAX_PORTABILITY
|
||||
r = engine->RegisterBehaviourToObjectType(&engine->objectTypeBehaviours, asBEHAVE_ADDREF, "void f()", asMETHOD(asCObjectType,AddRef), asCALL_THISCALL, 0); asASSERT( r >= 0 );
|
||||
r = engine->RegisterBehaviourToObjectType(&engine->objectTypeBehaviours, asBEHAVE_RELEASE, "void f()", asMETHOD(asCObjectType,Release), asCALL_THISCALL, 0); asASSERT( r >= 0 );
|
||||
r = engine->RegisterBehaviourToObjectType(&engine->objectTypeBehaviours, asBEHAVE_GETREFCOUNT, "int f()", asMETHOD(asCObjectType,GetRefCount), asCALL_THISCALL, 0); asASSERT( r >= 0 );
|
||||
r = engine->RegisterBehaviourToObjectType(&engine->objectTypeBehaviours, asBEHAVE_SETGCFLAG, "void f()", asMETHOD(asCObjectType,SetGCFlag), asCALL_THISCALL, 0); asASSERT( r >= 0 );
|
||||
r = engine->RegisterBehaviourToObjectType(&engine->objectTypeBehaviours, asBEHAVE_GETGCFLAG, "bool f()", asMETHOD(asCObjectType,GetGCFlag), asCALL_THISCALL, 0); asASSERT( r >= 0 );
|
||||
r = engine->RegisterBehaviourToObjectType(&engine->objectTypeBehaviours, asBEHAVE_ENUMREFS, "void f(int&in)", asMETHOD(asCObjectType,EnumReferences), asCALL_THISCALL, 0); asASSERT( r >= 0 );
|
||||
r = engine->RegisterBehaviourToObjectType(&engine->objectTypeBehaviours, asBEHAVE_RELEASEREFS, "void f(int&in)", asMETHOD(asCObjectType,ReleaseAllHandles), asCALL_THISCALL, 0); asASSERT( r >= 0 );
|
||||
#else
|
||||
r = engine->RegisterBehaviourToObjectType(&engine->objectTypeBehaviours, asBEHAVE_ADDREF, "void f()", asFUNCTION(ObjectType_AddRef_Generic), asCALL_GENERIC, 0); asASSERT( r >= 0 );
|
||||
r = engine->RegisterBehaviourToObjectType(&engine->objectTypeBehaviours, asBEHAVE_RELEASE, "void f()", asFUNCTION(ObjectType_Release_Generic), asCALL_GENERIC, 0); asASSERT( r >= 0 );
|
||||
r = engine->RegisterBehaviourToObjectType(&engine->objectTypeBehaviours, asBEHAVE_GETREFCOUNT, "int f()", asFUNCTION(ObjectType_GetRefCount_Generic), asCALL_GENERIC, 0); asASSERT( r >= 0 );
|
||||
r = engine->RegisterBehaviourToObjectType(&engine->objectTypeBehaviours, asBEHAVE_SETGCFLAG, "void f()", asFUNCTION(ObjectType_SetGCFlag_Generic), asCALL_GENERIC, 0); asASSERT( r >= 0 );
|
||||
r = engine->RegisterBehaviourToObjectType(&engine->objectTypeBehaviours, asBEHAVE_GETGCFLAG, "bool f()", asFUNCTION(ObjectType_GetGCFlag_Generic), asCALL_GENERIC, 0); asASSERT( r >= 0 );
|
||||
r = engine->RegisterBehaviourToObjectType(&engine->objectTypeBehaviours, asBEHAVE_ENUMREFS, "void f(int&in)", asFUNCTION(ObjectType_EnumReferences_Generic), asCALL_GENERIC, 0); asASSERT( r >= 0 );
|
||||
r = engine->RegisterBehaviourToObjectType(&engine->objectTypeBehaviours, asBEHAVE_RELEASEREFS, "void f(int&in)", asFUNCTION(ObjectType_ReleaseAllHandles_Generic), asCALL_GENERIC, 0); asASSERT( r >= 0 );
|
||||
#endif
|
||||
}
|
||||
|
||||
asCObjectType::asCObjectType()
|
||||
{
|
||||
engine = 0;
|
||||
module = 0;
|
||||
refCount.set(0);
|
||||
derivedFrom = 0;
|
||||
|
||||
acceptValueSubType = true;
|
||||
acceptRefSubType = true;
|
||||
|
||||
accessMask = 0xFFFFFFFF;
|
||||
nameSpace = 0;
|
||||
}
|
||||
|
||||
asCObjectType::asCObjectType(asCScriptEngine *engine)
|
||||
{
|
||||
this->engine = engine;
|
||||
module = 0;
|
||||
refCount.set(0);
|
||||
derivedFrom = 0;
|
||||
|
||||
acceptValueSubType = true;
|
||||
acceptRefSubType = true;
|
||||
|
||||
accessMask = 0xFFFFFFFF;
|
||||
nameSpace = engine->nameSpaces[0];
|
||||
}
|
||||
|
||||
int asCObjectType::AddRef() const
|
||||
{
|
||||
gcFlag = false;
|
||||
return refCount.atomicInc();
|
||||
}
|
||||
|
||||
int asCObjectType::Release() const
|
||||
{
|
||||
gcFlag = false;
|
||||
return refCount.atomicDec();
|
||||
}
|
||||
|
||||
void asCObjectType::Orphan(asCModule *mod)
|
||||
{
|
||||
if( mod && mod == module )
|
||||
{
|
||||
module = 0;
|
||||
if( flags & asOBJ_SCRIPT_OBJECT )
|
||||
{
|
||||
// Tell the GC that this type exists so it can resolve potential circular references
|
||||
engine->gc.AddScriptObjectToGC(this, &engine->objectTypeBehaviours);
|
||||
|
||||
// It's necessary to orphan the template instance types that refer to this object type,
|
||||
// otherwise the garbage collector cannot identify the circular references that involve
|
||||
// the type and the template type
|
||||
engine->OrphanTemplateInstances(this);
|
||||
}
|
||||
}
|
||||
|
||||
Release();
|
||||
}
|
||||
|
||||
// interface
|
||||
asIScriptModule *asCObjectType::GetModule() const
|
||||
{
|
||||
return module;
|
||||
}
|
||||
|
||||
void *asCObjectType::SetUserData(void *data, asPWORD type)
|
||||
{
|
||||
// As a thread might add a new new user data at the same time as another
|
||||
// it is necessary to protect both read and write access to the userData member
|
||||
ACQUIREEXCLUSIVE(engine->engineRWLock);
|
||||
|
||||
// It is not intended to store a lot of different types of userdata,
|
||||
// so a more complex structure like a associative map would just have
|
||||
// more overhead than a simple array.
|
||||
for( asUINT n = 0; n < userData.GetLength(); n += 2 )
|
||||
{
|
||||
if( userData[n] == type )
|
||||
{
|
||||
void *oldData = reinterpret_cast<void*>(userData[n+1]);
|
||||
userData[n+1] = reinterpret_cast<asPWORD>(data);
|
||||
|
||||
RELEASEEXCLUSIVE(engine->engineRWLock);
|
||||
|
||||
return oldData;
|
||||
}
|
||||
}
|
||||
|
||||
userData.PushLast(type);
|
||||
userData.PushLast(reinterpret_cast<asPWORD>(data));
|
||||
|
||||
RELEASEEXCLUSIVE(engine->engineRWLock);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void *asCObjectType::GetUserData(asPWORD type) const
|
||||
{
|
||||
// There may be multiple threads reading, but when
|
||||
// setting the user data nobody must be reading.
|
||||
ACQUIRESHARED(engine->engineRWLock);
|
||||
|
||||
for( asUINT n = 0; n < userData.GetLength(); n += 2 )
|
||||
{
|
||||
if( userData[n] == type )
|
||||
{
|
||||
RELEASESHARED(engine->engineRWLock);
|
||||
return reinterpret_cast<void*>(userData[n+1]);
|
||||
}
|
||||
}
|
||||
|
||||
RELEASESHARED(engine->engineRWLock);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int asCObjectType::GetRefCount()
|
||||
{
|
||||
return refCount.get();
|
||||
}
|
||||
|
||||
bool asCObjectType::GetGCFlag()
|
||||
{
|
||||
return gcFlag;
|
||||
}
|
||||
|
||||
void asCObjectType::SetGCFlag()
|
||||
{
|
||||
gcFlag = true;
|
||||
}
|
||||
|
||||
asCObjectType::~asCObjectType()
|
||||
{
|
||||
// Skip this for list patterns as they do not increase the references
|
||||
if( flags & asOBJ_LIST_PATTERN )
|
||||
return;
|
||||
|
||||
// Release the object types held by the templateSubTypes
|
||||
for( asUINT subtypeIndex = 0; subtypeIndex < templateSubTypes.GetLength(); subtypeIndex++ )
|
||||
{
|
||||
if( templateSubTypes[subtypeIndex].GetObjectType() )
|
||||
templateSubTypes[subtypeIndex].GetObjectType()->Release();
|
||||
}
|
||||
|
||||
if( derivedFrom )
|
||||
derivedFrom->Release();
|
||||
|
||||
ReleaseAllProperties();
|
||||
|
||||
ReleaseAllFunctions();
|
||||
|
||||
asUINT n;
|
||||
for( n = 0; n < enumValues.GetLength(); n++ )
|
||||
{
|
||||
if( enumValues[n] )
|
||||
asDELETE(enumValues[n],asSEnumValue);
|
||||
}
|
||||
enumValues.SetLength(0);
|
||||
|
||||
// Clean the user data
|
||||
for( n = 0; n < userData.GetLength(); n += 2 )
|
||||
{
|
||||
if( userData[n+1] )
|
||||
{
|
||||
for( asUINT c = 0; c < engine->cleanObjectTypeFuncs.GetLength(); c++ )
|
||||
if( engine->cleanObjectTypeFuncs[c].type == userData[n] )
|
||||
engine->cleanObjectTypeFuncs[c].cleanFunc(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// interface
|
||||
bool asCObjectType::Implements(const asIObjectType *objType) const
|
||||
{
|
||||
if( this == objType )
|
||||
return true;
|
||||
|
||||
for( asUINT n = 0; n < interfaces.GetLength(); n++ )
|
||||
if( interfaces[n] == objType ) return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// interface
|
||||
bool asCObjectType::DerivesFrom(const asIObjectType *objType) const
|
||||
{
|
||||
if( this == objType )
|
||||
return true;
|
||||
|
||||
asCObjectType *base = derivedFrom;
|
||||
while( base )
|
||||
{
|
||||
if( base == objType )
|
||||
return true;
|
||||
|
||||
base = base->derivedFrom;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool asCObjectType::IsShared() const
|
||||
{
|
||||
// Objects that can be declared by scripts need to have the explicit flag asOBJ_SHARED
|
||||
if( flags & (asOBJ_SCRIPT_OBJECT|asOBJ_ENUM) ) return flags & asOBJ_SHARED ? true : false;
|
||||
|
||||
// Otherwise we assume the object to be shared
|
||||
return true;
|
||||
}
|
||||
|
||||
// interface
|
||||
const char *asCObjectType::GetName() const
|
||||
{
|
||||
return name.AddressOf();
|
||||
}
|
||||
|
||||
// interface
|
||||
const char *asCObjectType::GetNamespace() const
|
||||
{
|
||||
return nameSpace->name.AddressOf();
|
||||
}
|
||||
|
||||
// interface
|
||||
asDWORD asCObjectType::GetFlags() const
|
||||
{
|
||||
return flags;
|
||||
}
|
||||
|
||||
// interface
|
||||
asUINT asCObjectType::GetSize() const
|
||||
{
|
||||
return size;
|
||||
}
|
||||
|
||||
// interface
|
||||
int asCObjectType::GetTypeId() const
|
||||
{
|
||||
// We need a non const pointer to create the asCDataType object.
|
||||
// We're not breaking anything here because this function is not
|
||||
// modifying the object, so this const cast is safe.
|
||||
asCObjectType *ot = const_cast<asCObjectType*>(this);
|
||||
|
||||
return engine->GetTypeIdFromDataType(asCDataType::CreateObject(ot, false));
|
||||
}
|
||||
|
||||
// interface
|
||||
int asCObjectType::GetSubTypeId(asUINT subtypeIndex) const
|
||||
{
|
||||
if( flags & asOBJ_TEMPLATE )
|
||||
{
|
||||
if( subtypeIndex >= templateSubTypes.GetLength() )
|
||||
return asINVALID_ARG;
|
||||
|
||||
return engine->GetTypeIdFromDataType(templateSubTypes[subtypeIndex]);
|
||||
}
|
||||
|
||||
// Only template types have sub types
|
||||
return asERROR;
|
||||
}
|
||||
|
||||
// interface
|
||||
asIObjectType *asCObjectType::GetSubType(asUINT subtypeIndex) const
|
||||
{
|
||||
if( flags & asOBJ_TEMPLATE )
|
||||
{
|
||||
if( subtypeIndex >= templateSubTypes.GetLength() )
|
||||
return 0;
|
||||
|
||||
return templateSubTypes[subtypeIndex].GetObjectType();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
asUINT asCObjectType::GetSubTypeCount() const
|
||||
{
|
||||
return asUINT(templateSubTypes.GetLength());
|
||||
}
|
||||
|
||||
asUINT asCObjectType::GetInterfaceCount() const
|
||||
{
|
||||
return asUINT(interfaces.GetLength());
|
||||
}
|
||||
|
||||
asIObjectType *asCObjectType::GetInterface(asUINT index) const
|
||||
{
|
||||
return interfaces[index];
|
||||
}
|
||||
|
||||
// internal
|
||||
bool asCObjectType::IsInterface() const
|
||||
{
|
||||
if( (flags & asOBJ_SCRIPT_OBJECT) && size == 0 )
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
asIScriptEngine *asCObjectType::GetEngine() const
|
||||
{
|
||||
return engine;
|
||||
}
|
||||
|
||||
// interface
|
||||
asUINT asCObjectType::GetFactoryCount() const
|
||||
{
|
||||
return (asUINT)beh.factories.GetLength();
|
||||
}
|
||||
|
||||
// interface
|
||||
asIScriptFunction *asCObjectType::GetFactoryByIndex(asUINT index) const
|
||||
{
|
||||
if( index >= beh.factories.GetLength() )
|
||||
return 0;
|
||||
|
||||
return engine->GetFunctionById(beh.factories[index]);
|
||||
}
|
||||
|
||||
// interface
|
||||
asIScriptFunction *asCObjectType::GetFactoryByDecl(const char *decl) const
|
||||
{
|
||||
if( beh.factories.GetLength() == 0 )
|
||||
return 0;
|
||||
|
||||
// Let the engine parse the string and find the appropriate factory function
|
||||
return engine->GetFunctionById(engine->GetFactoryIdByDecl(this, decl));
|
||||
}
|
||||
|
||||
// interface
|
||||
asUINT asCObjectType::GetMethodCount() const
|
||||
{
|
||||
return (asUINT)methods.GetLength();
|
||||
}
|
||||
|
||||
// interface
|
||||
asIScriptFunction *asCObjectType::GetMethodByIndex(asUINT index, bool getVirtual) const
|
||||
{
|
||||
if( index >= methods.GetLength() )
|
||||
return 0;
|
||||
|
||||
asCScriptFunction *func = engine->scriptFunctions[methods[index]];
|
||||
if( !getVirtual )
|
||||
{
|
||||
if( func && func->funcType == asFUNC_VIRTUAL )
|
||||
return virtualFunctionTable[func->vfTableIdx];
|
||||
}
|
||||
|
||||
return func;
|
||||
}
|
||||
|
||||
// interface
|
||||
asIScriptFunction *asCObjectType::GetMethodByName(const char *name, bool getVirtual) const
|
||||
{
|
||||
int id = -1;
|
||||
for( size_t n = 0; n < methods.GetLength(); n++ )
|
||||
{
|
||||
if( engine->scriptFunctions[methods[n]]->name == name )
|
||||
{
|
||||
if( id == -1 )
|
||||
id = methods[n];
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
if( id == -1 ) return 0;
|
||||
|
||||
asCScriptFunction *func = engine->scriptFunctions[id];
|
||||
if( !getVirtual )
|
||||
{
|
||||
if( func && func->funcType == asFUNC_VIRTUAL )
|
||||
return virtualFunctionTable[func->vfTableIdx];
|
||||
}
|
||||
|
||||
return func;
|
||||
}
|
||||
|
||||
// interface
|
||||
asIScriptFunction *asCObjectType::GetMethodByDecl(const char *decl, bool getVirtual) const
|
||||
{
|
||||
if( methods.GetLength() == 0 )
|
||||
return 0;
|
||||
|
||||
// Get the module from one of the methods, but it will only be
|
||||
// used to allow the parsing of types not already known by the object.
|
||||
// It is possible for object types to be orphaned, e.g. by discarding
|
||||
// the module that created it. In this case it is still possible to
|
||||
// find the methods, but any type not known by the object will result in
|
||||
// an invalid declaration.
|
||||
asCModule *mod = engine->scriptFunctions[methods[0]]->module;
|
||||
int id = engine->GetMethodIdByDecl(this, decl, mod);
|
||||
if( id <= 0 )
|
||||
return 0;
|
||||
|
||||
if( !getVirtual )
|
||||
{
|
||||
asCScriptFunction *func = engine->scriptFunctions[id];
|
||||
if( func && func->funcType == asFUNC_VIRTUAL )
|
||||
return virtualFunctionTable[func->vfTableIdx];
|
||||
}
|
||||
|
||||
return engine->scriptFunctions[id];
|
||||
}
|
||||
|
||||
// interface
|
||||
asUINT asCObjectType::GetPropertyCount() const
|
||||
{
|
||||
return (asUINT)properties.GetLength();
|
||||
}
|
||||
|
||||
// interface
|
||||
int asCObjectType::GetProperty(asUINT index, const char **name, int *typeId, bool *isPrivate, int *offset, bool *isReference, asDWORD *accessMask) const
|
||||
{
|
||||
if( index >= properties.GetLength() )
|
||||
return asINVALID_ARG;
|
||||
|
||||
if( name )
|
||||
*name = properties[index]->name.AddressOf();
|
||||
if( typeId )
|
||||
*typeId = engine->GetTypeIdFromDataType(properties[index]->type);
|
||||
if( isPrivate )
|
||||
*isPrivate = properties[index]->isPrivate;
|
||||
if( offset )
|
||||
*offset = properties[index]->byteOffset;
|
||||
if( isReference )
|
||||
*isReference = properties[index]->type.IsReference();
|
||||
if( accessMask )
|
||||
*accessMask = properties[index]->accessMask;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// interface
|
||||
const char *asCObjectType::GetPropertyDeclaration(asUINT index, bool includeNamespace) const
|
||||
{
|
||||
if( index >= properties.GetLength() )
|
||||
return 0;
|
||||
|
||||
asCString *tempString = &asCThreadManager::GetLocalData()->string;
|
||||
if( properties[index]->isPrivate )
|
||||
*tempString = "private ";
|
||||
else
|
||||
*tempString = "";
|
||||
*tempString += properties[index]->type.Format(includeNamespace);
|
||||
*tempString += " ";
|
||||
*tempString += properties[index]->name;
|
||||
|
||||
return tempString->AddressOf();
|
||||
}
|
||||
|
||||
asIObjectType *asCObjectType::GetBaseType() const
|
||||
{
|
||||
return derivedFrom;
|
||||
}
|
||||
|
||||
asUINT asCObjectType::GetBehaviourCount() const
|
||||
{
|
||||
// Count the number of behaviours (except factory functions)
|
||||
asUINT count = 0;
|
||||
|
||||
if( beh.destruct ) count++;
|
||||
if( beh.addref ) count++;
|
||||
if( beh.release ) count++;
|
||||
if( beh.gcGetRefCount ) count++;
|
||||
if( beh.gcSetFlag ) count++;
|
||||
if( beh.gcGetFlag ) count++;
|
||||
if( beh.gcEnumReferences ) count++;
|
||||
if( beh.gcReleaseAllReferences ) count++;
|
||||
if( beh.templateCallback ) count++;
|
||||
if( beh.listFactory ) count++;
|
||||
if( beh.getWeakRefFlag ) count++;
|
||||
|
||||
// For reference types, the factories are also stored in the constructor
|
||||
// list, so it is sufficient to enumerate only those
|
||||
count += (asUINT)beh.constructors.GetLength();
|
||||
count += (asUINT)beh.operators.GetLength() / 2;
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
asIScriptFunction *asCObjectType::GetBehaviourByIndex(asUINT index, asEBehaviours *outBehaviour) const
|
||||
{
|
||||
// Find the correct behaviour
|
||||
asUINT count = 0;
|
||||
|
||||
if( beh.destruct && count++ == index ) // only increase count if the behaviour is registered
|
||||
{
|
||||
if( outBehaviour ) *outBehaviour = asBEHAVE_DESTRUCT;
|
||||
return engine->scriptFunctions[beh.destruct];
|
||||
}
|
||||
|
||||
if( beh.addref && count++ == index )
|
||||
{
|
||||
if( outBehaviour ) *outBehaviour = asBEHAVE_ADDREF;
|
||||
return engine->scriptFunctions[beh.addref];
|
||||
}
|
||||
|
||||
if( beh.release && count++ == index )
|
||||
{
|
||||
if( outBehaviour ) *outBehaviour = asBEHAVE_RELEASE;
|
||||
return engine->scriptFunctions[beh.release];
|
||||
}
|
||||
|
||||
if( beh.gcGetRefCount && count++ == index )
|
||||
{
|
||||
if( outBehaviour ) *outBehaviour = asBEHAVE_GETREFCOUNT;
|
||||
return engine->scriptFunctions[beh.gcGetRefCount];
|
||||
}
|
||||
|
||||
if( beh.gcSetFlag && count++ == index )
|
||||
{
|
||||
if( outBehaviour ) *outBehaviour = asBEHAVE_SETGCFLAG;
|
||||
return engine->scriptFunctions[beh.gcSetFlag];
|
||||
}
|
||||
|
||||
if( beh.gcGetFlag && count++ == index )
|
||||
{
|
||||
if( outBehaviour ) *outBehaviour = asBEHAVE_GETGCFLAG;
|
||||
return engine->scriptFunctions[beh.gcGetFlag];
|
||||
}
|
||||
|
||||
if( beh.gcEnumReferences && count++ == index )
|
||||
{
|
||||
if( outBehaviour ) *outBehaviour = asBEHAVE_ENUMREFS;
|
||||
return engine->scriptFunctions[beh.gcEnumReferences];
|
||||
}
|
||||
|
||||
if( beh.gcReleaseAllReferences && count++ == index )
|
||||
{
|
||||
if( outBehaviour ) *outBehaviour = asBEHAVE_RELEASEREFS;
|
||||
return engine->scriptFunctions[beh.gcReleaseAllReferences];
|
||||
}
|
||||
|
||||
if( beh.templateCallback && count++ == index )
|
||||
{
|
||||
if( outBehaviour ) *outBehaviour = asBEHAVE_TEMPLATE_CALLBACK;
|
||||
return engine->scriptFunctions[beh.templateCallback];
|
||||
}
|
||||
|
||||
if( beh.listFactory && count++ == index )
|
||||
{
|
||||
if( outBehaviour )
|
||||
{
|
||||
if( flags & asOBJ_VALUE )
|
||||
*outBehaviour = asBEHAVE_LIST_CONSTRUCT;
|
||||
else
|
||||
*outBehaviour = asBEHAVE_LIST_FACTORY;
|
||||
}
|
||||
|
||||
return engine->scriptFunctions[beh.listFactory];
|
||||
}
|
||||
|
||||
if( beh.getWeakRefFlag && count++ == index )
|
||||
{
|
||||
if( outBehaviour ) *outBehaviour = asBEHAVE_GET_WEAKREF_FLAG;
|
||||
return engine->scriptFunctions[beh.getWeakRefFlag];
|
||||
}
|
||||
|
||||
// For reference types, the factories are also stored in the constructor
|
||||
// list, so it is sufficient to enumerate only those
|
||||
if( index - count < beh.constructors.GetLength() )
|
||||
{
|
||||
if( outBehaviour ) *outBehaviour = asBEHAVE_CONSTRUCT;
|
||||
return engine->scriptFunctions[beh.constructors[index - count]];
|
||||
}
|
||||
else
|
||||
count += (asUINT)beh.constructors.GetLength();
|
||||
|
||||
if( index - count < beh.operators.GetLength() / 2 )
|
||||
{
|
||||
index = 2*(index - count);
|
||||
|
||||
if( outBehaviour ) *outBehaviour = static_cast<asEBehaviours>(beh.operators[index]);
|
||||
return engine->scriptFunctions[beh.operators[index + 1]];
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// interface
|
||||
const char *asCObjectType::GetConfigGroup() const
|
||||
{
|
||||
asCConfigGroup *group = engine->FindConfigGroupForObjectType(this);
|
||||
if( group == 0 )
|
||||
return 0;
|
||||
|
||||
return group->groupName.AddressOf();
|
||||
}
|
||||
|
||||
// interface
|
||||
asDWORD asCObjectType::GetAccessMask() const
|
||||
{
|
||||
return accessMask;
|
||||
}
|
||||
|
||||
// internal
|
||||
asCObjectProperty *asCObjectType::AddPropertyToClass(const asCString &name, const asCDataType &dt, bool isPrivate)
|
||||
{
|
||||
asASSERT( flags & asOBJ_SCRIPT_OBJECT );
|
||||
asASSERT( dt.CanBeInstanciated() );
|
||||
asASSERT( !IsInterface() );
|
||||
|
||||
// Store the properties in the object type descriptor
|
||||
asCObjectProperty *prop = asNEW(asCObjectProperty);
|
||||
if( prop == 0 )
|
||||
{
|
||||
// Out of memory
|
||||
return 0;
|
||||
}
|
||||
|
||||
prop->name = name;
|
||||
prop->type = dt;
|
||||
prop->isPrivate = isPrivate;
|
||||
|
||||
int propSize;
|
||||
if( dt.IsObject() )
|
||||
{
|
||||
// Non-POD value types can't be allocated inline,
|
||||
// because there is a risk that the script might
|
||||
// try to access the content without knowing that
|
||||
// it hasn't been initialized yet.
|
||||
if( dt.GetObjectType()->flags & asOBJ_POD )
|
||||
propSize = dt.GetSizeInMemoryBytes();
|
||||
else
|
||||
{
|
||||
propSize = dt.GetSizeOnStackDWords()*4;
|
||||
if( !dt.IsObjectHandle() )
|
||||
prop->type.MakeReference(true);
|
||||
}
|
||||
}
|
||||
else
|
||||
propSize = dt.GetSizeInMemoryBytes();
|
||||
|
||||
// Add extra bytes so that the property will be properly aligned
|
||||
if( propSize == 2 && (size & 1) ) size += 1;
|
||||
if( propSize > 2 && (size & 3) ) size += 4 - (size & 3);
|
||||
|
||||
prop->byteOffset = size;
|
||||
size += propSize;
|
||||
|
||||
properties.PushLast(prop);
|
||||
|
||||
// Make sure the struct holds a reference to the config group where the object is registered
|
||||
asCConfigGroup *group = engine->FindConfigGroupForObjectType(prop->type.GetObjectType());
|
||||
if( group != 0 ) group->AddRef();
|
||||
|
||||
// Add reference to object types
|
||||
asCObjectType *type = prop->type.GetObjectType();
|
||||
if( type )
|
||||
type->AddRef();
|
||||
|
||||
return prop;
|
||||
}
|
||||
|
||||
// internal
|
||||
void asCObjectType::ReleaseAllProperties()
|
||||
{
|
||||
for( asUINT n = 0; n < properties.GetLength(); n++ )
|
||||
{
|
||||
if( properties[n] )
|
||||
{
|
||||
if( flags & asOBJ_SCRIPT_OBJECT )
|
||||
{
|
||||
// Release the config group for script classes that are being destroyed
|
||||
asCConfigGroup *group = engine->FindConfigGroupForObjectType(properties[n]->type.GetObjectType());
|
||||
if( group != 0 ) group->Release();
|
||||
|
||||
// Release references to objects types
|
||||
asCObjectType *type = properties[n]->type.GetObjectType();
|
||||
if( type )
|
||||
type->Release();
|
||||
}
|
||||
|
||||
asDELETE(properties[n],asCObjectProperty);
|
||||
}
|
||||
}
|
||||
|
||||
properties.SetLength(0);
|
||||
}
|
||||
|
||||
// internal
|
||||
void asCObjectType::ReleaseAllHandles(asIScriptEngine *)
|
||||
{
|
||||
ReleaseAllFunctions();
|
||||
ReleaseAllProperties();
|
||||
}
|
||||
|
||||
// internal
|
||||
void asCObjectType::ReleaseAllFunctions()
|
||||
{
|
||||
beh.factory = 0;
|
||||
beh.copyfactory = 0;
|
||||
for( asUINT a = 0; a < beh.factories.GetLength(); a++ )
|
||||
{
|
||||
if( engine->scriptFunctions[beh.factories[a]] )
|
||||
engine->scriptFunctions[beh.factories[a]]->Release();
|
||||
}
|
||||
beh.factories.SetLength(0);
|
||||
|
||||
beh.construct = 0;
|
||||
beh.copyconstruct = 0;
|
||||
for( asUINT b = 0; b < beh.constructors.GetLength(); b++ )
|
||||
{
|
||||
if( engine->scriptFunctions[beh.constructors[b]] )
|
||||
engine->scriptFunctions[beh.constructors[b]]->Release();
|
||||
}
|
||||
beh.constructors.SetLength(0);
|
||||
|
||||
if( beh.templateCallback )
|
||||
engine->scriptFunctions[beh.templateCallback]->Release();
|
||||
beh.templateCallback = 0;
|
||||
|
||||
if( beh.listFactory )
|
||||
engine->scriptFunctions[beh.listFactory]->Release();
|
||||
beh.listFactory = 0;
|
||||
|
||||
if( beh.destruct )
|
||||
engine->scriptFunctions[beh.destruct]->Release();
|
||||
beh.destruct = 0;
|
||||
|
||||
if( beh.copy )
|
||||
engine->scriptFunctions[beh.copy]->Release();
|
||||
beh.copy = 0;
|
||||
|
||||
for( asUINT e = 1; e < beh.operators.GetLength(); e += 2 )
|
||||
{
|
||||
if( engine->scriptFunctions[beh.operators[e]] )
|
||||
engine->scriptFunctions[beh.operators[e]]->Release();
|
||||
}
|
||||
beh.operators.SetLength(0);
|
||||
|
||||
for( asUINT c = 0; c < methods.GetLength(); c++ )
|
||||
{
|
||||
if( engine->scriptFunctions[methods[c]] )
|
||||
engine->scriptFunctions[methods[c]]->Release();
|
||||
}
|
||||
methods.SetLength(0);
|
||||
|
||||
for( asUINT d = 0; d < virtualFunctionTable.GetLength(); d++ )
|
||||
{
|
||||
if( virtualFunctionTable[d] )
|
||||
virtualFunctionTable[d]->Release();
|
||||
}
|
||||
virtualFunctionTable.SetLength(0);
|
||||
|
||||
// GC behaviours
|
||||
if( beh.addref )
|
||||
engine->scriptFunctions[beh.addref]->Release();
|
||||
beh.addref = 0;
|
||||
|
||||
if( beh.release )
|
||||
engine->scriptFunctions[beh.release]->Release();
|
||||
beh.release = 0;
|
||||
|
||||
if( beh.gcEnumReferences )
|
||||
engine->scriptFunctions[beh.gcEnumReferences]->Release();
|
||||
beh.gcEnumReferences = 0;
|
||||
|
||||
if( beh.gcGetFlag )
|
||||
engine->scriptFunctions[beh.gcGetFlag]->Release();
|
||||
beh.gcGetFlag = 0;
|
||||
|
||||
if( beh.gcGetRefCount )
|
||||
engine->scriptFunctions[beh.gcGetRefCount]->Release();
|
||||
beh.gcGetRefCount = 0;
|
||||
|
||||
if( beh.gcReleaseAllReferences )
|
||||
engine->scriptFunctions[beh.gcReleaseAllReferences]->Release();
|
||||
beh.gcReleaseAllReferences = 0;
|
||||
|
||||
if( beh.gcSetFlag )
|
||||
engine->scriptFunctions[beh.gcSetFlag]->Release();
|
||||
beh.gcSetFlag = 0;
|
||||
|
||||
if ( beh.getWeakRefFlag )
|
||||
engine->scriptFunctions[beh.getWeakRefFlag]->Release();
|
||||
beh.getWeakRefFlag = 0;
|
||||
}
|
||||
|
||||
// internal
|
||||
void asCObjectType::EnumReferences(asIScriptEngine *)
|
||||
{
|
||||
for( asUINT a = 0; a < beh.factories.GetLength(); a++ )
|
||||
if( engine->scriptFunctions[beh.factories[a]] )
|
||||
engine->GCEnumCallback(engine->scriptFunctions[beh.factories[a]]);
|
||||
|
||||
for( asUINT b = 0; b < beh.constructors.GetLength(); b++ )
|
||||
if( engine->scriptFunctions[beh.constructors[b]] )
|
||||
engine->GCEnumCallback(engine->scriptFunctions[beh.constructors[b]]);
|
||||
|
||||
if( beh.templateCallback )
|
||||
engine->GCEnumCallback(engine->scriptFunctions[beh.templateCallback]);
|
||||
|
||||
if( beh.listFactory )
|
||||
engine->GCEnumCallback(engine->scriptFunctions[beh.listFactory]);
|
||||
|
||||
if( beh.destruct )
|
||||
engine->GCEnumCallback(engine->scriptFunctions[beh.destruct]);
|
||||
|
||||
if( beh.addref )
|
||||
engine->GCEnumCallback(engine->scriptFunctions[beh.addref]);
|
||||
|
||||
if( beh.release )
|
||||
engine->GCEnumCallback(engine->scriptFunctions[beh.release]);
|
||||
|
||||
if( beh.copy )
|
||||
engine->GCEnumCallback(engine->scriptFunctions[beh.copy]);
|
||||
|
||||
if( beh.gcEnumReferences )
|
||||
engine->GCEnumCallback(engine->scriptFunctions[beh.gcEnumReferences]);
|
||||
|
||||
if( beh.gcGetFlag )
|
||||
engine->GCEnumCallback(engine->scriptFunctions[beh.gcGetFlag]);
|
||||
|
||||
if( beh.gcGetRefCount )
|
||||
engine->GCEnumCallback(engine->scriptFunctions[beh.gcGetRefCount]);
|
||||
|
||||
if( beh.gcReleaseAllReferences )
|
||||
engine->GCEnumCallback(engine->scriptFunctions[beh.gcReleaseAllReferences]);
|
||||
|
||||
if( beh.gcSetFlag )
|
||||
engine->GCEnumCallback(engine->scriptFunctions[beh.gcSetFlag]);
|
||||
|
||||
for( asUINT e = 1; e < beh.operators.GetLength(); e += 2 )
|
||||
if( engine->scriptFunctions[beh.operators[e]] )
|
||||
engine->GCEnumCallback(engine->scriptFunctions[beh.operators[e]]);
|
||||
|
||||
for( asUINT c = 0; c < methods.GetLength(); c++ )
|
||||
if( engine->scriptFunctions[methods[c]] )
|
||||
engine->GCEnumCallback(engine->scriptFunctions[methods[c]]);
|
||||
|
||||
for( asUINT d = 0; d < virtualFunctionTable.GetLength(); d++ )
|
||||
if( virtualFunctionTable[d] )
|
||||
engine->GCEnumCallback(virtualFunctionTable[d]);
|
||||
|
||||
for( asUINT p = 0; p < properties.GetLength(); p++ )
|
||||
{
|
||||
asCObjectType *type = properties[p]->type.GetObjectType();
|
||||
if( type )
|
||||
engine->GCEnumCallback(type);
|
||||
}
|
||||
|
||||
for( asUINT t = 0; t < templateSubTypes.GetLength(); t++ )
|
||||
if( templateSubTypes[t].GetObjectType() )
|
||||
engine->GCEnumCallback(templateSubTypes[t].GetObjectType());
|
||||
|
||||
if( beh.getWeakRefFlag )
|
||||
engine->GCEnumCallback(engine->scriptFunctions[beh.getWeakRefFlag]);
|
||||
|
||||
if( derivedFrom )
|
||||
engine->GCEnumCallback(derivedFrom);
|
||||
}
|
||||
|
||||
END_AS_NAMESPACE
|
||||
|
||||
|
||||
|
249
lib/angelscript/source/as_objecttype.h
Normal file
249
lib/angelscript/source/as_objecttype.h
Normal file
@ -0,0 +1,249 @@
|
||||
/*
|
||||
AngelCode Scripting Library
|
||||
Copyright (c) 2003-2013 Andreas Jonsson
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any
|
||||
damages arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any
|
||||
purpose, including commercial applications, and to alter it and
|
||||
redistribute it freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you
|
||||
must not claim that you wrote the original software. If you use
|
||||
this software in a product, an acknowledgment in the product
|
||||
documentation would be appreciated but is not required.
|
||||
|
||||
2. Altered source versions must be plainly marked as such, and
|
||||
must not be misrepresented as being the original software.
|
||||
|
||||
3. This notice may not be removed or altered from any source
|
||||
distribution.
|
||||
|
||||
The original version of this library can be located at:
|
||||
http://www.angelcode.com/angelscript/
|
||||
|
||||
Andreas Jonsson
|
||||
andreas@angelcode.com
|
||||
*/
|
||||
|
||||
|
||||
|
||||
//
|
||||
// as_objecttype.h
|
||||
//
|
||||
// A class for storing object type information
|
||||
//
|
||||
|
||||
|
||||
|
||||
#ifndef AS_OBJECTTYPE_H
|
||||
#define AS_OBJECTTYPE_H
|
||||
|
||||
#include "as_atomic.h"
|
||||
#include "as_string.h"
|
||||
#include "as_property.h"
|
||||
#include "as_array.h"
|
||||
#include "as_scriptfunction.h"
|
||||
|
||||
BEGIN_AS_NAMESPACE
|
||||
|
||||
// TODO: memory: Need to minimize used memory here, because not all types use all properties of the class
|
||||
|
||||
// TODO: The type id should have flags for differenciating between value types and reference types. It should also have a flag for differenciating interface types.
|
||||
|
||||
// Additional flag to the class object type
|
||||
const asDWORD asOBJ_IMPLICIT_HANDLE = 0x00400000;
|
||||
const asDWORD asOBJ_LIST_PATTERN = 0x08000000;
|
||||
const asDWORD asOBJ_ENUM = 0x10000000;
|
||||
const asDWORD asOBJ_TEMPLATE_SUBTYPE = 0x20000000;
|
||||
const asDWORD asOBJ_TYPEDEF = 0x40000000;
|
||||
|
||||
|
||||
|
||||
// asOBJ_GC is used to indicate that the type can potentially
|
||||
// form circular references, thus is garbage collected.
|
||||
|
||||
// The fact that an object is garbage collected doesn't imply that an other object
|
||||
// that can reference it also must be garbage collected, only if the garbage collected
|
||||
// object can reference the other object as well.
|
||||
|
||||
// For registered types however, we set the flag asOBJ_GC if the GC
|
||||
// behaviours are registered. For script types that contain any such type we
|
||||
// automatically make garbage collected as well, because we cannot know what type
|
||||
// of references that object can contain, and must assume the worst.
|
||||
|
||||
struct asSTypeBehaviour
|
||||
{
|
||||
asSTypeBehaviour()
|
||||
{
|
||||
factory = 0;
|
||||
listFactory = 0;
|
||||
copyfactory = 0;
|
||||
construct = 0;
|
||||
copyconstruct = 0;
|
||||
destruct = 0;
|
||||
copy = 0;
|
||||
addref = 0;
|
||||
release = 0;
|
||||
gcGetRefCount = 0;
|
||||
gcSetFlag = 0;
|
||||
gcGetFlag = 0;
|
||||
gcEnumReferences = 0;
|
||||
gcReleaseAllReferences = 0;
|
||||
templateCallback = 0;
|
||||
getWeakRefFlag = 0;
|
||||
}
|
||||
|
||||
int factory;
|
||||
int listFactory; // Used for initialization lists only
|
||||
int copyfactory;
|
||||
int construct;
|
||||
int copyconstruct;
|
||||
int destruct;
|
||||
int copy;
|
||||
int addref;
|
||||
int release;
|
||||
int templateCallback;
|
||||
|
||||
// GC behaviours
|
||||
int gcGetRefCount;
|
||||
int gcSetFlag;
|
||||
int gcGetFlag;
|
||||
int gcEnumReferences;
|
||||
int gcReleaseAllReferences;
|
||||
|
||||
// Weakref behaviours
|
||||
int getWeakRefFlag;
|
||||
|
||||
asCArray<int> factories;
|
||||
asCArray<int> constructors;
|
||||
asCArray<int> operators;
|
||||
};
|
||||
|
||||
struct asSEnumValue
|
||||
{
|
||||
asCString name;
|
||||
int value;
|
||||
};
|
||||
|
||||
class asCScriptEngine;
|
||||
struct asSNameSpace;
|
||||
|
||||
void RegisterObjectTypeGCBehaviours(asCScriptEngine *engine);
|
||||
|
||||
class asCObjectType : public asIObjectType
|
||||
{
|
||||
public:
|
||||
//=====================================
|
||||
// From asIObjectType
|
||||
//=====================================
|
||||
asIScriptEngine *GetEngine() const;
|
||||
const char *GetConfigGroup() const;
|
||||
asDWORD GetAccessMask() const;
|
||||
asIScriptModule *GetModule() const;
|
||||
|
||||
// Memory management
|
||||
int AddRef() const;
|
||||
int Release() const;
|
||||
|
||||
// Type info
|
||||
const char *GetName() const;
|
||||
const char *GetNamespace() const;
|
||||
asIObjectType *GetBaseType() const;
|
||||
bool DerivesFrom(const asIObjectType *objType) const;
|
||||
asDWORD GetFlags() const;
|
||||
asUINT GetSize() const;
|
||||
int GetTypeId() const;
|
||||
int GetSubTypeId(asUINT subtypeIndex = 0) const;
|
||||
asIObjectType *GetSubType(asUINT subtypeIndex = 0) const;
|
||||
asUINT GetSubTypeCount() const;
|
||||
|
||||
// Interfaces
|
||||
asUINT GetInterfaceCount() const;
|
||||
asIObjectType *GetInterface(asUINT index) const;
|
||||
bool Implements(const asIObjectType *objType) const;
|
||||
|
||||
// Factories
|
||||
asUINT GetFactoryCount() const;
|
||||
asIScriptFunction *GetFactoryByIndex(asUINT index) const;
|
||||
asIScriptFunction *GetFactoryByDecl(const char *decl) const;
|
||||
|
||||
// Methods
|
||||
asUINT GetMethodCount() const;
|
||||
asIScriptFunction *GetMethodByIndex(asUINT index, bool getVirtual) const;
|
||||
asIScriptFunction *GetMethodByName(const char *name, bool getVirtual) const;
|
||||
asIScriptFunction *GetMethodByDecl(const char *decl, bool getVirtual) const;
|
||||
|
||||
// Properties
|
||||
asUINT GetPropertyCount() const;
|
||||
int GetProperty(asUINT index, const char **name, int *typeId, bool *isPrivate, int *offset, bool *isReference, asDWORD *accessMask) const;
|
||||
const char *GetPropertyDeclaration(asUINT index, bool includeNamespace = false) const;
|
||||
|
||||
// Behaviours
|
||||
asUINT GetBehaviourCount() const;
|
||||
asIScriptFunction *GetBehaviourByIndex(asUINT index, asEBehaviours *outBehaviour) const;
|
||||
|
||||
// User data
|
||||
void *SetUserData(void *data, asPWORD type);
|
||||
void *GetUserData(asPWORD type) const;
|
||||
|
||||
//===========================================
|
||||
// Internal
|
||||
//===========================================
|
||||
public:
|
||||
asCObjectType(asCScriptEngine *engine);
|
||||
~asCObjectType();
|
||||
|
||||
void Orphan(asCModule *module);
|
||||
int GetRefCount();
|
||||
void SetGCFlag();
|
||||
bool GetGCFlag();
|
||||
void EnumReferences(asIScriptEngine *);
|
||||
void ReleaseAllHandles(asIScriptEngine *);
|
||||
|
||||
void ReleaseAllFunctions();
|
||||
|
||||
bool IsInterface() const;
|
||||
bool IsShared() const;
|
||||
|
||||
asCObjectProperty *AddPropertyToClass(const asCString &name, const asCDataType &dt, bool isPrivate);
|
||||
void ReleaseAllProperties();
|
||||
|
||||
asCString name;
|
||||
asSNameSpace *nameSpace;
|
||||
int size;
|
||||
asCArray<asCObjectProperty*> properties;
|
||||
asCArray<int> methods;
|
||||
asCArray<asCObjectType*> interfaces;
|
||||
asCArray<asUINT> interfaceVFTOffsets;
|
||||
asCArray<asSEnumValue*> enumValues;
|
||||
asCObjectType * derivedFrom;
|
||||
asCArray<asCScriptFunction*> virtualFunctionTable;
|
||||
|
||||
asDWORD flags;
|
||||
asDWORD accessMask;
|
||||
|
||||
asSTypeBehaviour beh;
|
||||
|
||||
// Used for template types
|
||||
asCArray<asCDataType> templateSubTypes;
|
||||
bool acceptValueSubType;
|
||||
bool acceptRefSubType;
|
||||
|
||||
asCScriptEngine *engine;
|
||||
asCModule *module;
|
||||
asCArray<asPWORD> userData;
|
||||
|
||||
protected:
|
||||
friend class asCScriptEngine;
|
||||
asCObjectType();
|
||||
|
||||
mutable asCAtomic refCount;
|
||||
mutable bool gcFlag;
|
||||
};
|
||||
|
||||
END_AS_NAMESPACE
|
||||
|
||||
#endif
|
109
lib/angelscript/source/as_outputbuffer.cpp
Normal file
109
lib/angelscript/source/as_outputbuffer.cpp
Normal file
@ -0,0 +1,109 @@
|
||||
/*
|
||||
AngelCode Scripting Library
|
||||
Copyright (c) 2003-2012 Andreas Jonsson
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any
|
||||
damages arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any
|
||||
purpose, including commercial applications, and to alter it and
|
||||
redistribute it freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you
|
||||
must not claim that you wrote the original software. If you use
|
||||
this software in a product, an acknowledgment in the product
|
||||
documentation would be appreciated but is not required.
|
||||
|
||||
2. Altered source versions must be plainly marked as such, and
|
||||
must not be misrepresented as being the original software.
|
||||
|
||||
3. This notice may not be removed or altered from any source
|
||||
distribution.
|
||||
|
||||
The original version of this library can be located at:
|
||||
http://www.angelcode.com/angelscript/
|
||||
|
||||
Andreas Jonsson
|
||||
andreas@angelcode.com
|
||||
*/
|
||||
|
||||
|
||||
//
|
||||
// as_outputbuffer.cpp
|
||||
//
|
||||
// This class appends strings to one large buffer that can later
|
||||
// be sent to the real output stream
|
||||
//
|
||||
|
||||
#include "as_config.h"
|
||||
|
||||
#ifndef AS_NO_COMPILER
|
||||
|
||||
#include "as_outputbuffer.h"
|
||||
#include "as_scriptengine.h"
|
||||
|
||||
BEGIN_AS_NAMESPACE
|
||||
|
||||
asCOutputBuffer::~asCOutputBuffer()
|
||||
{
|
||||
Clear();
|
||||
}
|
||||
|
||||
void asCOutputBuffer::Clear()
|
||||
{
|
||||
for( asUINT n = 0; n < messages.GetLength(); n++ )
|
||||
{
|
||||
if( messages[n] )
|
||||
{
|
||||
asDELETE(messages[n],message_t);
|
||||
}
|
||||
}
|
||||
messages.SetLength(0);
|
||||
}
|
||||
|
||||
void asCOutputBuffer::Callback(asSMessageInfo *msg)
|
||||
{
|
||||
message_t *msgInfo = asNEW(message_t);
|
||||
if( msgInfo == 0 )
|
||||
return;
|
||||
|
||||
msgInfo->section = msg->section;
|
||||
msgInfo->row = msg->row;
|
||||
msgInfo->col = msg->col;
|
||||
msgInfo->type = msg->type;
|
||||
msgInfo->msg = msg->message;
|
||||
|
||||
messages.PushLast(msgInfo);
|
||||
}
|
||||
|
||||
void asCOutputBuffer::Append(asCOutputBuffer &in)
|
||||
{
|
||||
for( asUINT n = 0; n < in.messages.GetLength(); n++ )
|
||||
messages.PushLast(in.messages[n]);
|
||||
in.messages.SetLength(0);
|
||||
}
|
||||
|
||||
void asCOutputBuffer::SendToCallback(asCScriptEngine *engine, asSSystemFunctionInterface *func, void *obj)
|
||||
{
|
||||
for( asUINT n = 0; n < messages.GetLength(); n++ )
|
||||
{
|
||||
asSMessageInfo msg;
|
||||
msg.section = messages[n]->section.AddressOf();
|
||||
msg.row = messages[n]->row;
|
||||
msg.col = messages[n]->col;
|
||||
msg.type = messages[n]->type;
|
||||
msg.message = messages[n]->msg.AddressOf();
|
||||
|
||||
if( func->callConv < ICC_THISCALL )
|
||||
engine->CallGlobalFunction(&msg, obj, func, 0);
|
||||
else
|
||||
engine->CallObjectMethod(obj, &msg, func, 0);
|
||||
}
|
||||
Clear();
|
||||
}
|
||||
|
||||
END_AS_NAMESPACE
|
||||
|
||||
#endif // AS_NO_COMPILER
|
||||
|
80
lib/angelscript/source/as_outputbuffer.h
Normal file
80
lib/angelscript/source/as_outputbuffer.h
Normal file
@ -0,0 +1,80 @@
|
||||
/*
|
||||
AngelCode Scripting Library
|
||||
Copyright (c) 2003-2012 Andreas Jonsson
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any
|
||||
damages arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any
|
||||
purpose, including commercial applications, and to alter it and
|
||||
redistribute it freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you
|
||||
must not claim that you wrote the original software. If you use
|
||||
this software in a product, an acknowledgment in the product
|
||||
documentation would be appreciated but is not required.
|
||||
|
||||
2. Altered source versions must be plainly marked as such, and
|
||||
must not be misrepresented as being the original software.
|
||||
|
||||
3. This notice may not be removed or altered from any source
|
||||
distribution.
|
||||
|
||||
The original version of this library can be located at:
|
||||
http://www.angelcode.com/angelscript/
|
||||
|
||||
Andreas Jonsson
|
||||
andreas@angelcode.com
|
||||
*/
|
||||
|
||||
|
||||
//
|
||||
// as_outputbuffer.h
|
||||
//
|
||||
// This class appends strings to one large buffer that can later
|
||||
// be sent to the real output stream
|
||||
//
|
||||
|
||||
|
||||
#ifndef AS_OUTPUTBUFFER_H
|
||||
#define AS_OUTPUTBUFFER_H
|
||||
|
||||
#include "as_config.h"
|
||||
|
||||
#ifndef AS_NO_COMPILER
|
||||
|
||||
#include "as_string.h"
|
||||
#include "as_array.h"
|
||||
|
||||
BEGIN_AS_NAMESPACE
|
||||
|
||||
struct asSSystemFunctionInterface;
|
||||
class asCScriptEngine;
|
||||
|
||||
class asCOutputBuffer
|
||||
{
|
||||
public:
|
||||
~asCOutputBuffer ();
|
||||
void Clear();
|
||||
void Callback(asSMessageInfo *msg);
|
||||
void Append(asCOutputBuffer &in);
|
||||
void SendToCallback(asCScriptEngine *engine, asSSystemFunctionInterface *func, void *obj);
|
||||
|
||||
struct message_t
|
||||
{
|
||||
asCString section;
|
||||
int row;
|
||||
int col;
|
||||
asEMsgType type;
|
||||
asCString msg;
|
||||
};
|
||||
|
||||
asCArray<message_t*> messages;
|
||||
};
|
||||
|
||||
END_AS_NAMESPACE
|
||||
|
||||
#endif // AS_NO_COMPILER
|
||||
|
||||
#endif
|
3886
lib/angelscript/source/as_parser.cpp
Normal file
3886
lib/angelscript/source/as_parser.cpp
Normal file
File diff suppressed because it is too large
Load Diff
190
lib/angelscript/source/as_parser.h
Normal file
190
lib/angelscript/source/as_parser.h
Normal file
@ -0,0 +1,190 @@
|
||||
/*
|
||||
AngelCode Scripting Library
|
||||
Copyright (c) 2003-2013 Andreas Jonsson
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any
|
||||
damages arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any
|
||||
purpose, including commercial applications, and to alter it and
|
||||
redistribute it freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you
|
||||
must not claim that you wrote the original software. If you use
|
||||
this software in a product, an acknowledgment in the product
|
||||
documentation would be appreciated but is not required.
|
||||
|
||||
2. Altered source versions must be plainly marked as such, and
|
||||
must not be misrepresented as being the original software.
|
||||
|
||||
3. This notice may not be removed or altered from any source
|
||||
distribution.
|
||||
|
||||
The original version of this library can be located at:
|
||||
http://www.angelcode.com/angelscript/
|
||||
|
||||
Andreas Jonsson
|
||||
andreas@angelcode.com
|
||||
*/
|
||||
|
||||
|
||||
//
|
||||
// as_parser.h
|
||||
//
|
||||
// This class parses the script code and builds a tree for compilation
|
||||
//
|
||||
|
||||
|
||||
|
||||
#ifndef AS_PARSER_H
|
||||
#define AS_PARSER_H
|
||||
|
||||
#include "as_scriptnode.h"
|
||||
#include "as_scriptcode.h"
|
||||
#include "as_builder.h"
|
||||
#include "as_tokenizer.h"
|
||||
|
||||
BEGIN_AS_NAMESPACE
|
||||
|
||||
class asCParser
|
||||
{
|
||||
public:
|
||||
asCParser(asCBuilder *builder);
|
||||
~asCParser();
|
||||
|
||||
int ParseFunctionDefinition(asCScriptCode *script, bool expectListPattern);
|
||||
int ParsePropertyDeclaration(asCScriptCode *script);
|
||||
int ParseDataType(asCScriptCode *script, bool isReturnType);
|
||||
int ParseTemplateDecl(asCScriptCode *script);
|
||||
|
||||
#ifndef AS_NO_COMPILER
|
||||
int ParseScript(asCScriptCode *script);
|
||||
|
||||
// Called from compiler
|
||||
int ParseStatementBlock(asCScriptCode *script, asCScriptNode *block);
|
||||
int ParseVarInit(asCScriptCode *script, asCScriptNode *init);
|
||||
int ParseExpression(asCScriptCode *script);
|
||||
#endif
|
||||
|
||||
asCScriptNode *GetScriptNode();
|
||||
|
||||
protected:
|
||||
void Reset();
|
||||
|
||||
void GetToken(sToken *token);
|
||||
void RewindTo(const sToken *token);
|
||||
void SetPos(size_t pos);
|
||||
void Error(const asCString &text, sToken *token);
|
||||
void Info(const asCString &text, sToken *token);
|
||||
|
||||
asCScriptNode *CreateNode(eScriptNode type);
|
||||
|
||||
asCScriptNode *ParseFunctionDefinition();
|
||||
asCScriptNode *ParseParameterList();
|
||||
asCScriptNode *SuperficiallyParseExpression();
|
||||
asCScriptNode *ParseType(bool allowConst, bool allowVariableType = false);
|
||||
asCScriptNode *ParseTypeMod(bool isParam);
|
||||
void ParseOptionalScope(asCScriptNode *node);
|
||||
asCScriptNode *ParseRealType();
|
||||
asCScriptNode *ParseDataType(bool allowVariableType = false);
|
||||
asCScriptNode *ParseIdentifier();
|
||||
|
||||
asCScriptNode *ParseListPattern();
|
||||
|
||||
bool IsRealType(int tokenType);
|
||||
bool IsDataType(const sToken &token);
|
||||
bool IdentifierIs(const sToken &t, const char *str);
|
||||
|
||||
#ifndef AS_NO_COMPILER
|
||||
// Statements
|
||||
asCScriptNode *SuperficiallyParseStatementBlock();
|
||||
asCScriptNode *SuperficiallyParseVarInit();
|
||||
asCScriptNode *ParseStatementBlock();
|
||||
asCScriptNode *ParseStatement();
|
||||
asCScriptNode *ParseExpressionStatement();
|
||||
asCScriptNode *ParseSwitch();
|
||||
asCScriptNode *ParseCase();
|
||||
asCScriptNode *ParseIf();
|
||||
asCScriptNode *ParseFor();
|
||||
asCScriptNode *ParseWhile();
|
||||
asCScriptNode *ParseDoWhile();
|
||||
asCScriptNode *ParseReturn();
|
||||
asCScriptNode *ParseBreak();
|
||||
asCScriptNode *ParseContinue();
|
||||
|
||||
// Declarations
|
||||
asCScriptNode *ParseDeclaration(bool isClassProp = false, bool isGlobalVar = false);
|
||||
asCScriptNode *ParseImport();
|
||||
asCScriptNode *ParseScript(bool inBlock);
|
||||
asCScriptNode *ParseNamespace();
|
||||
asCScriptNode *ParseFunction(bool isMethod = false);
|
||||
asCScriptNode *ParseFuncDef();
|
||||
asCScriptNode *ParseClass();
|
||||
asCScriptNode *ParseMixin();
|
||||
asCScriptNode *ParseInitList();
|
||||
asCScriptNode *ParseInterface();
|
||||
asCScriptNode *ParseInterfaceMethod();
|
||||
asCScriptNode *ParseVirtualPropertyDecl(bool isMethod, bool isInterface);
|
||||
asCScriptNode *ParseEnumeration();
|
||||
asCScriptNode *ParseTypedef();
|
||||
void ParseMethodOverrideBehaviors(asCScriptNode *funcNode);
|
||||
bool IsVarDecl();
|
||||
bool IsVirtualPropertyDecl();
|
||||
bool IsFuncDecl(bool isMethod);
|
||||
|
||||
// Expressions
|
||||
asCScriptNode *ParseAssignment();
|
||||
asCScriptNode *ParseAssignOperator();
|
||||
asCScriptNode *ParseCondition();
|
||||
asCScriptNode *ParseExpression();
|
||||
asCScriptNode *ParseExprTerm();
|
||||
asCScriptNode *ParseExprOperator();
|
||||
asCScriptNode *ParseExprPreOp();
|
||||
asCScriptNode *ParseExprPostOp();
|
||||
asCScriptNode *ParseExprValue();
|
||||
asCScriptNode *ParseArgList();
|
||||
asCScriptNode *ParseFunctionCall();
|
||||
asCScriptNode *ParseVariableAccess();
|
||||
asCScriptNode *ParseConstructCall();
|
||||
asCScriptNode *ParseCast();
|
||||
asCScriptNode *ParseConstant();
|
||||
asCScriptNode *ParseStringConstant();
|
||||
|
||||
bool IsConstant(int tokenType);
|
||||
bool IsOperator(int tokenType);
|
||||
bool IsPreOperator(int tokenType);
|
||||
bool IsPostOperator(int tokenType);
|
||||
bool IsAssignOperator(int tokenType);
|
||||
bool IsFunctionCall();
|
||||
|
||||
bool CheckTemplateType(sToken &t);
|
||||
#endif
|
||||
|
||||
asCScriptNode *ParseToken(int token);
|
||||
asCScriptNode *ParseOneOf(int *tokens, int num);
|
||||
|
||||
asCString ExpectedToken(const char *token);
|
||||
asCString ExpectedTokens(const char *token1, const char *token2);
|
||||
asCString ExpectedOneOf(int *tokens, int count);
|
||||
asCString ExpectedOneOf(const char **tokens, int count);
|
||||
|
||||
bool errorWhileParsing;
|
||||
bool isSyntaxError;
|
||||
bool checkValidTypes;
|
||||
bool isParsingAppInterface;
|
||||
|
||||
asCScriptEngine *engine;
|
||||
asCBuilder *builder;
|
||||
asCScriptCode *script;
|
||||
asCScriptNode *scriptNode;
|
||||
|
||||
asCString tempString; // Used for reduzing amount of dynamic allocations
|
||||
|
||||
sToken lastToken;
|
||||
size_t sourcePos;
|
||||
};
|
||||
|
||||
END_AS_NAMESPACE
|
||||
|
||||
#endif
|
134
lib/angelscript/source/as_property.h
Normal file
134
lib/angelscript/source/as_property.h
Normal file
@ -0,0 +1,134 @@
|
||||
/*
|
||||
AngelCode Scripting Library
|
||||
Copyright (c) 2003-2012 Andreas Jonsson
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any
|
||||
damages arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any
|
||||
purpose, including commercial applications, and to alter it and
|
||||
redistribute it freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you
|
||||
must not claim that you wrote the original software. If you use
|
||||
this software in a product, an acknowledgment in the product
|
||||
documentation would be appreciated but is not required.
|
||||
|
||||
2. Altered source versions must be plainly marked as such, and
|
||||
must not be misrepresented as being the original software.
|
||||
|
||||
3. This notice may not be removed or altered from any source
|
||||
distribution.
|
||||
|
||||
The original version of this library can be located at:
|
||||
http://www.angelcode.com/angelscript/
|
||||
|
||||
Andreas Jonsson
|
||||
andreas@angelcode.com
|
||||
*/
|
||||
|
||||
|
||||
//
|
||||
// as_property.h
|
||||
//
|
||||
// A class for storing object property information
|
||||
//
|
||||
|
||||
|
||||
|
||||
#ifndef AS_PROPERTY_H
|
||||
#define AS_PROPERTY_H
|
||||
|
||||
#include "as_string.h"
|
||||
#include "as_datatype.h"
|
||||
#include "as_atomic.h"
|
||||
#include "as_scriptfunction.h"
|
||||
#include "as_symboltable.h"
|
||||
|
||||
BEGIN_AS_NAMESPACE
|
||||
|
||||
struct asSNameSpace;
|
||||
|
||||
class asCObjectProperty
|
||||
{
|
||||
public:
|
||||
asCObjectProperty() {accessMask = 0xFFFFFFFF;}
|
||||
asCString name;
|
||||
asCDataType type;
|
||||
int byteOffset;
|
||||
bool isPrivate;
|
||||
asDWORD accessMask;
|
||||
};
|
||||
|
||||
class asCGlobalProperty
|
||||
{
|
||||
public:
|
||||
asCGlobalProperty();
|
||||
~asCGlobalProperty();
|
||||
|
||||
void AddRef();
|
||||
void Release();
|
||||
int GetRefCount();
|
||||
|
||||
void *GetAddressOfValue();
|
||||
void AllocateMemory();
|
||||
void SetRegisteredAddress(void *p);
|
||||
void *GetRegisteredAddress() const;
|
||||
|
||||
asCString name;
|
||||
asCDataType type;
|
||||
asUINT id;
|
||||
asSNameSpace *nameSpace;
|
||||
|
||||
void SetInitFunc(asCScriptFunction *initFunc);
|
||||
asCScriptFunction *GetInitFunc();
|
||||
|
||||
static void RegisterGCBehaviours(asCScriptEngine *engine);
|
||||
|
||||
//protected:
|
||||
void SetGCFlag();
|
||||
bool GetGCFlag();
|
||||
void EnumReferences(asIScriptEngine *);
|
||||
void ReleaseAllHandles(asIScriptEngine *);
|
||||
|
||||
void Orphan(asCModule *module);
|
||||
|
||||
// This is only stored for registered properties, and keeps the pointer given by the application
|
||||
void *realAddress;
|
||||
|
||||
bool memoryAllocated;
|
||||
void *memory;
|
||||
asQWORD storage;
|
||||
|
||||
asCScriptFunction *initFunc;
|
||||
|
||||
asDWORD accessMask;
|
||||
|
||||
// The global property structure is reference counted, so that the
|
||||
// engine can keep track of how many references to the property there are.
|
||||
asCAtomic refCount;
|
||||
bool gcFlag;
|
||||
};
|
||||
|
||||
class asCCompGlobPropType : public asIFilter
|
||||
{
|
||||
public:
|
||||
const asCDataType &m_type;
|
||||
|
||||
asCCompGlobPropType(const asCDataType &type) : m_type(type) {}
|
||||
|
||||
bool operator()(const void *p) const
|
||||
{
|
||||
const asCGlobalProperty* prop = reinterpret_cast<const asCGlobalProperty*>(p);
|
||||
return prop->type == m_type;
|
||||
}
|
||||
|
||||
private:
|
||||
// The assignment operator is required for MSVC9, otherwise it will complain that it is not possible to auto generate the operator
|
||||
asCCompGlobPropType &operator=(const asCCompGlobPropType &) {return *this;}
|
||||
};
|
||||
|
||||
END_AS_NAMESPACE
|
||||
|
||||
#endif
|
4743
lib/angelscript/source/as_restore.cpp
Normal file
4743
lib/angelscript/source/as_restore.cpp
Normal file
File diff suppressed because it is too large
Load Diff
252
lib/angelscript/source/as_restore.h
Normal file
252
lib/angelscript/source/as_restore.h
Normal file
@ -0,0 +1,252 @@
|
||||
/*
|
||||
AngelCode Scripting Library
|
||||
Copyright (c) 2003-2014 Andreas Jonsson
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any
|
||||
damages arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any
|
||||
purpose, including commercial applications, and to alter it and
|
||||
redistribute it freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you
|
||||
must not claim that you wrote the original software. If you use
|
||||
this software in a product, an acknowledgment in the product
|
||||
documentation would be appreciated but is not required.
|
||||
|
||||
2. Altered source versions must be plainly marked as such, and
|
||||
must not be misrepresented as being the original software.
|
||||
|
||||
3. This notice may not be removed or altered from any source
|
||||
distribution.
|
||||
|
||||
The original version of this library can be located at:
|
||||
http://www.angelcode.com/angelscript/
|
||||
|
||||
Andreas Jonsson
|
||||
andreas@angelcode.com
|
||||
*/
|
||||
|
||||
|
||||
//
|
||||
// as_restore.h
|
||||
//
|
||||
// Functions for saving and restoring module bytecode
|
||||
// asCRestore was originally written by Dennis Bollyn, dennis@gyrbo.be
|
||||
// It was later split in two classes asCReader and asCWriter by me
|
||||
|
||||
#ifndef AS_RESTORE_H
|
||||
#define AS_RESTORE_H
|
||||
|
||||
#include "as_scriptengine.h"
|
||||
#include "as_context.h"
|
||||
#include "as_map.h"
|
||||
|
||||
BEGIN_AS_NAMESPACE
|
||||
|
||||
class asCReader
|
||||
{
|
||||
public:
|
||||
asCReader(asCModule *module, asIBinaryStream *stream, asCScriptEngine *engine);
|
||||
|
||||
int Read(bool *wasDebugInfoStripped);
|
||||
|
||||
protected:
|
||||
asCModule *module;
|
||||
asIBinaryStream *stream;
|
||||
asCScriptEngine *engine;
|
||||
bool noDebugInfo;
|
||||
bool error;
|
||||
asUINT bytesRead;
|
||||
|
||||
int Error(const char *msg);
|
||||
|
||||
int ReadInner();
|
||||
|
||||
void ReadData(void *data, asUINT size);
|
||||
void ReadString(asCString *str);
|
||||
asCScriptFunction *ReadFunction(bool &isNew, bool addToModule = true, bool addToEngine = true, bool addToGC = true);
|
||||
void ReadFunctionSignature(asCScriptFunction *func);
|
||||
void ReadGlobalProperty();
|
||||
void ReadObjectProperty(asCObjectType *ot);
|
||||
void ReadDataType(asCDataType *dt);
|
||||
asCObjectType * ReadObjectType();
|
||||
void ReadObjectTypeDeclaration(asCObjectType *ot, int phase);
|
||||
void ReadByteCode(asCScriptFunction *func);
|
||||
asWORD ReadEncodedUInt16();
|
||||
asUINT ReadEncodedUInt();
|
||||
asQWORD ReadEncodedUInt64();
|
||||
|
||||
void ReadUsedTypeIds();
|
||||
void ReadUsedFunctions();
|
||||
void ReadUsedGlobalProps();
|
||||
void ReadUsedStringConstants();
|
||||
void ReadUsedObjectProps();
|
||||
|
||||
asCObjectType * FindObjectType(int idx);
|
||||
int FindTypeId(int idx);
|
||||
short FindObjectPropOffset(asWORD index);
|
||||
asCScriptFunction *FindFunction(int idx);
|
||||
|
||||
// After loading, each function needs to be translated to update pointers, function ids, etc
|
||||
void TranslateFunction(asCScriptFunction *func);
|
||||
void CalculateAdjustmentByPos(asCScriptFunction *func);
|
||||
int AdjustStackPosition(int pos);
|
||||
int AdjustGetOffset(int offset, asCScriptFunction *func, asDWORD programPos);
|
||||
void CalculateStackNeeded(asCScriptFunction *func);
|
||||
asCScriptFunction *GetCalledFunction(asCScriptFunction *func, asDWORD programPos);
|
||||
|
||||
// Temporary storage for persisting variable data
|
||||
asCArray<int> usedTypeIds;
|
||||
asCArray<asCObjectType*> usedTypes;
|
||||
asCArray<asCScriptFunction*> usedFunctions;
|
||||
asCArray<void*> usedGlobalProperties;
|
||||
asCArray<int> usedStringConstants;
|
||||
|
||||
asCArray<asCScriptFunction*> savedFunctions;
|
||||
asCArray<asCDataType> savedDataTypes;
|
||||
asCArray<asCString> savedStrings;
|
||||
|
||||
asCArray<int> adjustByPos;
|
||||
asCArray<int> adjustNegativeStackByPos;
|
||||
|
||||
struct SObjProp
|
||||
{
|
||||
asCObjectType *objType;
|
||||
int offset;
|
||||
};
|
||||
asCArray<SObjProp> usedObjectProperties;
|
||||
|
||||
asCMap<void*,bool> existingShared;
|
||||
asCMap<asCScriptFunction*,bool> dontTranslate;
|
||||
|
||||
// Helper class for adjusting offsets within initialization list buffers
|
||||
struct SListAdjuster
|
||||
{
|
||||
SListAdjuster(asDWORD *bc, asCObjectType *ot);
|
||||
void AdjustAllocMem();
|
||||
int AdjustOffset(int offset, asCObjectType *listPatternType);
|
||||
void SetRepeatCount(asUINT rc);
|
||||
void SetNextType(int typeId);
|
||||
|
||||
struct SInfo
|
||||
{
|
||||
asUINT repeatCount;
|
||||
asSListPatternNode *startNode;
|
||||
};
|
||||
asCArray<SInfo> stack;
|
||||
|
||||
asDWORD *allocMemBC;
|
||||
asUINT maxOffset;
|
||||
asCObjectType *patternType;
|
||||
asUINT repeatCount;
|
||||
int lastOffset;
|
||||
asUINT lastAdjustedOffset;
|
||||
asSListPatternNode *patternNode;
|
||||
int nextTypeId;
|
||||
};
|
||||
asCArray<SListAdjuster*> listAdjusters;
|
||||
};
|
||||
|
||||
#ifndef AS_NO_COMPILER
|
||||
|
||||
class asCWriter
|
||||
{
|
||||
public:
|
||||
asCWriter(asCModule *module, asIBinaryStream *stream, asCScriptEngine *engine, bool stripDebugInfo);
|
||||
|
||||
int Write();
|
||||
|
||||
protected:
|
||||
asCModule *module;
|
||||
asIBinaryStream *stream;
|
||||
asCScriptEngine *engine;
|
||||
bool stripDebugInfo;
|
||||
|
||||
void WriteData(const void *data, asUINT size);
|
||||
|
||||
void WriteString(asCString *str);
|
||||
void WriteFunction(asCScriptFunction *func);
|
||||
void WriteFunctionSignature(asCScriptFunction *func);
|
||||
void WriteGlobalProperty(asCGlobalProperty *prop);
|
||||
void WriteObjectProperty(asCObjectProperty *prop);
|
||||
void WriteDataType(const asCDataType *dt);
|
||||
void WriteObjectType(asCObjectType *ot);
|
||||
void WriteObjectTypeDeclaration(asCObjectType *ot, int phase);
|
||||
void WriteByteCode(asCScriptFunction *func);
|
||||
void WriteEncodedInt64(asINT64 i);
|
||||
|
||||
// Helper functions for storing variable data
|
||||
int FindObjectTypeIdx(asCObjectType*);
|
||||
int FindTypeIdIdx(int typeId);
|
||||
int FindFunctionIndex(asCScriptFunction *func);
|
||||
int FindGlobalPropPtrIndex(void *);
|
||||
int FindStringConstantIndex(int id);
|
||||
int FindObjectPropIndex(short offset, int typeId);
|
||||
|
||||
void CalculateAdjustmentByPos(asCScriptFunction *func);
|
||||
int AdjustStackPosition(int pos);
|
||||
int AdjustProgramPosition(int pos);
|
||||
int AdjustGetOffset(int offset, asCScriptFunction *func, asDWORD programPos);
|
||||
|
||||
// Intermediate data used for storing that which isn't constant, function id's, pointers, etc
|
||||
void WriteUsedTypeIds();
|
||||
void WriteUsedFunctions();
|
||||
void WriteUsedGlobalProps();
|
||||
void WriteUsedStringConstants();
|
||||
void WriteUsedObjectProps();
|
||||
|
||||
// Temporary storage for persisting variable data
|
||||
asCArray<int> usedTypeIds;
|
||||
asCArray<asCObjectType*> usedTypes;
|
||||
asCArray<asCScriptFunction*> usedFunctions;
|
||||
asCArray<void*> usedGlobalProperties;
|
||||
asCArray<int> usedStringConstants;
|
||||
asCMap<int, int> stringIdToIndexMap;
|
||||
|
||||
asCArray<asCScriptFunction*> savedFunctions;
|
||||
asCArray<asCDataType> savedDataTypes;
|
||||
asCArray<asCString> savedStrings;
|
||||
asCMap<asCStringPointer, int> stringToIdMap;
|
||||
asCArray<int> adjustStackByPos;
|
||||
asCArray<int> adjustNegativeStackByPos;
|
||||
asCArray<int> bytecodeNbrByPos;
|
||||
|
||||
struct SObjProp
|
||||
{
|
||||
asCObjectType *objType;
|
||||
int offset;
|
||||
};
|
||||
asCArray<SObjProp> usedObjectProperties;
|
||||
|
||||
// Helper class for adjusting offsets within initialization list buffers
|
||||
struct SListAdjuster
|
||||
{
|
||||
SListAdjuster(asCObjectType *ot);
|
||||
int AdjustOffset(int offset, asCObjectType *listPatternType);
|
||||
void SetRepeatCount(asUINT rc);
|
||||
void SetNextType(int typeId);
|
||||
|
||||
struct SInfo
|
||||
{
|
||||
asUINT repeatCount;
|
||||
asSListPatternNode *startNode;
|
||||
};
|
||||
asCArray<SInfo> stack;
|
||||
|
||||
asCObjectType *patternType;
|
||||
asUINT repeatCount;
|
||||
asSListPatternNode *patternNode;
|
||||
asUINT entries;
|
||||
int lastOffset;
|
||||
int nextTypeId;
|
||||
};
|
||||
asCArray<SListAdjuster*> listAdjusters;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
END_AS_NAMESPACE
|
||||
|
||||
#endif // AS_RESTORE_H
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user